/*
This file is part of GNUnet.
- (C) 2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2013-2016 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
#define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
-/************************************************************************************************************************
-* Messages for the Client <-> Server communication
-*/
+/**
+ * Highest bit in a 32-bit unsigned integer,
+ * bit set if we are making an outgoing call,
+ * bit unset for local lines.
+ */
+#define HIGH_BIT ((uint32_t) (1LL << 31))
+
+GNUNET_NETWORK_STRUCT_BEGIN
/**
- * VoipClient.
+ * Message to transmit the audio (between client and helpers).
*/
-struct VoipClient
+struct AudioMessage
{
/**
- * Handle for a conversation client.
+ * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO
*/
- struct GNUNET_SERVER_Client *client;
-};
-
-/**
-* The connection status of the service
-*/
-struct ConnectionStatus
-{
- /**
- * The client which is in interaction
- */
- struct GNUNET_SERVER_Client *client;
-
- /**
- * The PeerIdentity of the peer
- */
- struct GNUNET_PeerIdentity peer;
-
- /**
- * The status (see enum)
- */
- int status;
-};
-
-/**
-* Information about a missed call
-*/
-struct MissedCall
-{
- /**
- * The PeerIdentity of the peer
- */
- struct GNUNET_PeerIdentity peer;
+ struct GNUNET_MessageHeader header;
- /**
- * The time the call was
- */
- struct GNUNET_TIME_Absolute time;
+ /* followed by audio data */
};
-
-
/**
- * Client <-> Server message to initiate a new call
+ * Client -> Service message to register a phone.
*/
-struct ClientServerSessionInitiateMessage
+struct ClientPhoneRegisterMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER
*/
struct GNUNET_MessageHeader header;
- struct GNUNET_PeerIdentity peer;
-};
+ /**
+ * Always zero.
+ */
+ uint32_t reserved GNUNET_PACKED;
-/**
- * Client <-> Server meessage to accept an incoming call
- */
-struct ClientServerSessionAcceptMessage
-{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT
+ * Phone line / CADET port to register.
*/
- struct GNUNET_MessageHeader header;
+ struct GNUNET_HashCode line_port;
};
/**
- * Client <-> Server message to reject an incoming call
+ * Service -> Client message for phone is ringing.
*/
-struct ClientServerSessionRejectMessage
+struct ClientPhoneRingMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING
*/
struct GNUNET_MessageHeader header;
- int reason;
-};
+ /**
+ * CID, internal caller ID number used in the future to identify
+ * which active call we are talking about.
+ */
+ uint32_t cid GNUNET_PACKED;
-/**
- * Client <-> Server message to terminat a call
- */
-struct ClientServerSessionTerminateMessage
-{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE
+ * Who is calling us?
*/
- struct GNUNET_MessageHeader header;
+ struct GNUNET_CRYPTO_EcdsaPublicKey caller_id;
+
};
/**
- * Client <-> Server message to initiate a new call
+ * Service <-> Client message for phone was suspended.
*/
-struct ClientServerTestMessage
+struct ClientPhoneSuspendMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND
*/
struct GNUNET_MessageHeader header;
- struct GNUNET_PeerIdentity peer;
+
+ /**
+ * CID, internal caller ID to identify which active call we are
+ * talking about.
+ */
+ uint32_t cid GNUNET_PACKED;
+
};
-/************************************************************************************************************************
-* Messages for the Server <-> Client communication
-*/
/**
- * Server <-> Client message to initiate a new call
+ * Service <-> Client message for phone was resumed.
*/
-struct ServerClientSessionInitiateMessage
+struct ClientPhoneResumeMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME
*/
struct GNUNET_MessageHeader header;
- struct GNUNET_PeerIdentity peer;
+
+ /**
+ * CID, internal caller ID to identify which active call we are
+ * talking about.
+ */
+ uint32_t cid GNUNET_PACKED;
+
};
/**
- * Server <-> Client meessage to accept an incoming call
+ * Client -> Service pick up phone that is ringing.
*/
-struct ServerClientSessionAcceptMessage
+struct ClientPhonePickupMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP
*/
struct GNUNET_MessageHeader header;
+
+ /**
+ * CID, internal caller ID to identify which active call we are
+ * talking about.
+ */
+ uint32_t cid GNUNET_PACKED;
+
};
/**
- * Server <-> Client message to reject an incoming call
+ * Client <-> Service hang up phone that may or may not be ringing.
+ * Also sent in response to a (failed) `struct ClientCallMessage`.
*/
-struct ServerClientSessionRejectMessage
+struct ClientPhoneHangupMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP
*/
struct GNUNET_MessageHeader header;
- int reason;
- int notify;
+
+ /**
+ * CID, internal caller ID to identify which active call we are
+ * talking about.
+ */
+ uint32_t cid GNUNET_PACKED;
+
};
/**
- * Server <-> Client message to terminat a call
+ * Message Client <-> Service to transmit the audio.
*/
-struct ServerClientSessionTerminateMessage
+struct ClientAudioMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE
+ * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO
*/
struct GNUNET_MessageHeader header;
+
+ /**
+ * CID, internal caller ID to identify which active call we are
+ * sending data to.
+ */
+ uint32_t cid GNUNET_PACKED;
+
+ /* followed by audio data */
+
};
/**
- * Server <-> Client message to signalize the client that the service is already in use
+ * Client -> Service message to call a phone.
*/
-struct ServerClientServiceBlockedMessage
+struct ClientCallMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
*/
struct GNUNET_MessageHeader header;
-};
-/**
- * Server <-> Client message to signalize the client that the called peer is not connected
- */
-struct ServerClientPeerNotConnectedMessage
-{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED
+ * Always zero.
*/
- struct GNUNET_MessageHeader header;
-};
+ uint32_t reserved GNUNET_PACKED;
+ /**
+ * Which peer is hosting the line?
+ */
+ struct GNUNET_PeerIdentity target;
-/**
- * Server <-> Client message to signalize the client that called peer does not answer
- */
-struct ServerClientNoAnswerMessage
-{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER
+ * Which phone line to call at the peer?
*/
- struct GNUNET_MessageHeader header;
-};
+ struct GNUNET_HashCode line_port;
-/**
- * Server <-> Client message to notify client of missed call
- */
-struct ServerClientMissedCallMessage
-{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL
+ * Identity of the caller.
*/
- struct GNUNET_MessageHeader header;
- int number;
- struct MissedCall *missed_call;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey caller_id;
};
/**
- * Server <-> Client message to signalize the client that there occured an error
+ * Service -> Client: other peer has picked up the phone, we are
+ * now talking.
*/
-struct ServerClientErrorMessage
+struct ClientPhonePickedupMessage
{
/**
- * Type is: #define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP
*/
struct GNUNET_MessageHeader header;
+
+ /**
+ * Call ID of the corresponding
+ * #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_CALL
+ */
+ uint32_t cid GNUNET_PACKED;
+
};
/**
- * Server <-> Client message to notify client of peer being available
+ * Information signed in a `struct CadetPhoneRingMessage`
+ * whereby the caller self-identifies to the receiver.
*/
-struct ServerClientPeerAvailableMessage
+struct CadetPhoneRingInfoPS
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE
+ * Purpose for the signature, must be
+ * #GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING.
*/
- struct GNUNET_MessageHeader header;
- struct GNUNET_PeerIdentity peer;
- struct GNUNET_TIME_Absolute time;
-};
+ struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-/************************************************************************************************************************
-* Messages for the Mesh communication
-*/
+ /**
+ * Which port did the call go to?
+ */
+ struct GNUNET_HashCode line_port;
-struct VoIPMeshMessageHeader
-{
/**
- * Type is:
+ * Which peer is the call for?
*/
- struct GNUNET_MessageHeader header;
- int SequenceNumber;
- struct GNUNET_TIME_Absolute time;
+ struct GNUNET_PeerIdentity target_peer;
+
+ /**
+ * When does the signature expire?
+ */
+ struct GNUNET_TIME_AbsoluteNBO expiration_time;
};
/**
- * Mesh message to sinal the remote peer the wish to initiate a new call
+ * Cadet message to make a phone ring. Sent to the port
+ * of the respective phone.
*/
-struct MeshSessionInitiateMessage
+struct CadetPhoneRingMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING
*/
struct GNUNET_MessageHeader header;
- int SequenceNumber;
- struct GNUNET_TIME_Absolute time;
- struct GNUNET_PeerIdentity peer;
-};
-/**
- * Mesh message to signal the remote peer the acceptance of an initiated call
- */
-struct MeshSessionAcceptMessage
-{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT
+ * Always zero.
*/
- struct GNUNET_MessageHeader header;
- int SequenceNumber;
- struct GNUNET_TIME_Absolute time;
+ uint32_t reserved GNUNET_PACKED;
+
+ /**
+ * Who is calling us? (also who is signing).
+ */
+ struct GNUNET_CRYPTO_EcdsaPublicKey caller_id;
+
+ /**
+ * When does the signature expire?
+ */
+ struct GNUNET_TIME_AbsoluteNBO expiration_time;
+
+ /**
+ * Signature over a `struct CadetPhoneRingInfoPS`
+ */
+ struct GNUNET_CRYPTO_EcdsaSignature signature;
+
};
/**
- * Mesh message to reject an a wish to initiate a new call
+ * Cadet message for hanging up.
*/
-struct MeshSessionRejectMessage
+struct CadetPhoneHangupMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP
*/
struct GNUNET_MessageHeader header;
- int SequenceNumber;
- struct GNUNET_TIME_Absolute time;
- int reason;
- int notify;
+
};
/**
- * Mesh message to signal a remote peer the terminatation of a call
+ * Cadet message for picking up.
*/
-struct MeshSessionTerminateMessage
+struct CadetPhonePickupMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP
*/
struct GNUNET_MessageHeader header;
- int SequenceNumber;
- struct GNUNET_TIME_Absolute time;
+
};
/**
- * Server <-> Client message to notify client of peer being available
+ * Cadet message for phone suspended.
*/
-struct MeshPeerAvailableMessage
+struct CadetPhoneSuspendMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND
*/
struct GNUNET_MessageHeader header;
- int SequenceNumber;
- struct GNUNET_TIME_Absolute time;
- struct GNUNET_PeerIdentity peer;
- struct GNUNET_TIME_Absolute call;
+
};
/**
- * Messages for the audio communication
+ * Cadet message for phone resumed.
*/
-struct TestMessage
+struct CadetPhoneResumeMessage
{
/**
- * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_TEST
+ * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME
*/
struct GNUNET_MessageHeader header;
+
};
/**
- * Message to transmit the audio
+ * Cadet message to transmit the audio.
*/
-struct AudioMessage
+struct CadetAudioMessage
{
/**
- * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO
+ * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO
*/
struct GNUNET_MessageHeader header;
- int SequenceNumber;
- struct GNUNET_TIME_Absolute time;
- int length;
- int encrypted;
- uint8_t audio[200];
+
+ /* followed by audio data */
};
+GNUNET_NETWORK_STRUCT_END
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif