X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fconversation%2Fconversation.h;h=da7bb53c8500af416ae40225aaf7fee68c478aef;hb=392baa82fc240d76b31a353c2d729a6f83f10b2c;hp=dceb9b9e4726e13ab119cd32ca8879d50bb1438b;hpb=84fafd05402d39d86ee385b4410b06afcfbd6671;p=oweals%2Fgnunet.git diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h index dceb9b9e4..da7bb53c8 100644 --- a/src/conversation/conversation.h +++ b/src/conversation/conversation.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2013 Christian Grothoff (and other contributing authors) + Copyright (C) 2013 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -14,8 +14,8 @@ 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. */ /** @@ -39,420 +39,96 @@ extern "C" #define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) -/************************************************************************************************************************ -* Messages for the Client <-> Server communication -*/ - - -/** - * VoipClient. - */ -struct VoipClient -{ - /** - * Handle for a conversation client. - */ - 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; - - /** - * The time the call was - */ - struct GNUNET_TIME_Absolute time; - -}; - - - - -/** - * Client <-> Server message to initiate a new call - */ -struct ClientServerSessionInitiateMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE - */ - struct GNUNET_MessageHeader header; - struct GNUNET_PeerIdentity peer; -}; - - -/** - * Client <-> Server meessage to accept an incoming call - */ -struct ClientServerSessionAcceptMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT - */ - struct GNUNET_MessageHeader header; -}; - - -/** - * Client <-> Server message to reject an incoming call - */ -struct ClientServerSessionRejectMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT - */ - struct GNUNET_MessageHeader header; - int reason; -}; - - -/** - * Client <-> Server message to terminat a call - */ -struct ClientServerSessionTerminateMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE - */ - struct GNUNET_MessageHeader header; -}; - - -/** - * Client <-> Server message to initiate a new call - */ -struct ClientServerTestMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST - */ - struct GNUNET_MessageHeader header; - struct GNUNET_PeerIdentity peer; -}; - -/************************************************************************************************************************ -* Messages for the Server <-> Client communication -*/ - -/** - * Server <-> Client message to initiate a new call - */ -struct ServerClientSessionInitiateMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE - */ - struct GNUNET_MessageHeader header; - struct GNUNET_PeerIdentity peer; -}; - - -/** - * Server <-> Client meessage to accept an incoming call - */ -struct ServerClientSessionAcceptMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT - */ - struct GNUNET_MessageHeader header; -}; - - -/** - * Server <-> Client message to reject an incoming call - */ -struct ServerClientSessionRejectMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT - */ - struct GNUNET_MessageHeader header; - int reason; - int notify; -}; - - -/** - * Server <-> Client message to terminat a call - */ -struct ServerClientSessionTerminateMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE - */ - struct GNUNET_MessageHeader header; -}; - - -/** - * Server <-> Client message to signalize the client that the service is already in use - */ -struct ServerClientServiceBlockedMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED - */ - 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 - */ - struct GNUNET_MessageHeader header; -}; - - -/** - * Server <-> Client message to signalize the client that called peer does not answer - */ -struct ServerClientNoAnswerMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER - */ - struct GNUNET_MessageHeader header; -}; - -/** - * Server <-> Client message to notify client of missed call - */ -struct ServerClientMissedCallMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL - */ - struct GNUNET_MessageHeader header; - int number; - struct MissedCall *missed_call; -}; - - -/** - * Server <-> Client message to signalize the client that there occured an error - */ -struct ServerClientErrorMessage -{ - /** - * Type is: #define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR - */ - struct GNUNET_MessageHeader header; -}; - - /** - * Server <-> Client message to notify client of peer being available + * Message to transmit the audio (between client and helpers). */ -struct ServerClientPeerAvailableMessage +struct AudioMessage { /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE + * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO */ struct GNUNET_MessageHeader header; - struct GNUNET_PeerIdentity peer; - struct GNUNET_TIME_Absolute time; -}; -/************************************************************************************************************************ -* Messages for the Mesh communication -*/ + /* followed by audio data */ -struct VoIPMeshMessageHeader -{ - /** - * Type is: - */ - struct GNUNET_MessageHeader header; - int SequenceNumber; - struct GNUNET_TIME_Absolute time; }; /** - * Mesh message to sinal the remote peer the wish to initiate a new call + * Client -> Service message to register a phone. */ -struct MeshSessionInitiateMessage +struct ClientPhoneRegisterMessage { /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER */ 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 + * Phone line to register. */ - struct GNUNET_MessageHeader header; - int SequenceNumber; - struct GNUNET_TIME_Absolute time; + uint32_t line GNUNET_PACKED; }; /** - * Mesh message to reject an a wish to initiate a new call + * Service -> Client message for phone is ringing. */ -struct MeshSessionRejectMessage +struct ClientPhoneRingMessage { /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING */ 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 - */ -struct MeshSessionTerminateMessage -{ /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE + * CID, internal caller ID to identify which active call we are + * talking about. */ - struct GNUNET_MessageHeader header; - int SequenceNumber; - struct GNUNET_TIME_Absolute time; -}; - + uint32_t cid GNUNET_PACKED; -/** - * Server <-> Client message to notify client of peer being available - */ -struct MeshPeerAvailableMessage -{ /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE + * Who is calling us? */ - struct GNUNET_MessageHeader header; - int SequenceNumber; - struct GNUNET_TIME_Absolute time; - struct GNUNET_PeerIdentity peer; - struct GNUNET_TIME_Absolute call; -}; + struct GNUNET_CRYPTO_EcdsaPublicKey caller_id; - -/** - * Messages for the audio communication - */ -struct TestMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_TEST - */ - struct GNUNET_MessageHeader header; }; -//////////////////////////////////////////////////////////// /** - * Message to transmit the audio (between client and helpers). + * Service <-> Client message for phone was suspended. */ -struct AudioMessage +struct ClientPhoneSuspendMessage { /** - * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND */ struct GNUNET_MessageHeader header; - /* followed by audio data */ - -}; - - -/** - * Client -> Service message to register a phone. - */ -struct ClientPhoneRegisterMessage -{ /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_REGISTER + * CID, internal caller ID to identify which active call we are + * talking about. */ - struct GNUNET_MessageHeader header; + uint32_t cid GNUNET_PACKED; - /** - * Phone line to register. - */ - uint32_t line GNUNET_PACKED; }; /** - * Service -> Client message for phone is ringing. + * Service <-> Client message for phone was resumed. */ -struct ClientPhoneRingMessage +struct ClientPhoneResumeMessage { /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RING + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME */ struct GNUNET_MessageHeader header; /** - * Always zero. - */ - uint32_t reserved GNUNET_PACKED; - - /** - * Who is calling us? - */ - struct GNUNET_CRYPTO_EccPublicSignKey caller_id; - -}; - - -/** - * Service -> Client message for phone is busy. - */ -struct ClientPhoneBusyMessage -{ - /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_BUSY + * CID, internal caller ID to identify which active call we are + * talking about. */ - struct GNUNET_MessageHeader header; + uint32_t cid GNUNET_PACKED; }; @@ -466,8 +142,12 @@ struct ClientPhonePickupMessage * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICK_UP */ struct GNUNET_MessageHeader header; - - /* followed by variable length 0-terminated string with meta data */ + + /** + * CID, internal caller ID to identify which active call we are + * talking about. + */ + uint32_t cid GNUNET_PACKED; }; @@ -482,8 +162,12 @@ struct ClientPhoneHangupMessage * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP */ struct GNUNET_MessageHeader header; - - /* followed by variable length 0-terminated string with meta data */ + + /** + * CID, internal caller ID to identify which active call we are + * talking about. + */ + uint32_t cid GNUNET_PACKED; }; @@ -498,6 +182,12 @@ struct ClientAudioMessage */ 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 */ }; @@ -526,7 +216,7 @@ struct ClientCallMessage /** * Identity of the caller. */ - struct GNUNET_CRYPTO_EccPrivateKey caller_id; + struct GNUNET_CRYPTO_EcdsaPrivateKey caller_id; }; @@ -540,19 +230,17 @@ struct ClientPhonePickedupMessage * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP */ struct GNUNET_MessageHeader header; - - /* followed by variable length 0-terminated string with meta data */ }; /** - * Mesh message for phone is ringing. + * Cadet message for phone is ringing. */ -struct MeshPhoneRingMessage +struct CadetPhoneRingMessage { /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING */ struct GNUNET_MessageHeader header; @@ -569,7 +257,7 @@ struct MeshPhoneRingMessage /** * Who is calling us? (also who is signing). */ - struct GNUNET_CRYPTO_EccPublicSignKey caller_id; + struct GNUNET_CRYPTO_EcdsaPublicKey caller_id; /** * Who are we calling? @@ -583,13 +271,13 @@ struct MeshPhoneRingMessage /** * When does the signature expire? - */ + */ struct GNUNET_TIME_AbsoluteNBO expiration_time; /** * Signature on the above. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EcdsaSignature signature; /** * Source line for audio data in the other direction. @@ -600,40 +288,51 @@ struct MeshPhoneRingMessage /** - * Mesh message for hanging up. + * Cadet message for hanging up. + */ +struct CadetPhoneHangupMessage +{ + /** + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_HANG_UP + */ + struct GNUNET_MessageHeader header; + +}; + + +/** + * Cadet message for picking up. */ -struct MeshPhoneHangupMessage +struct CadetPhonePickupMessage { /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_HANG_UP + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_PICK_UP */ struct GNUNET_MessageHeader header; - /* followed by variable-size 0-terminated reason string */ }; /** - * Mesh message for picking up. + * Cadet message for phone suspended. */ -struct MeshPhonePickupMessage +struct CadetPhoneSuspendMessage { /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_PICK_UP + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_SUSPEND */ struct GNUNET_MessageHeader header; - /* followed by variable-size 0-terminated metadata string */ }; /** - * Mesh message for phone busy. + * Cadet message for phone resumed. */ -struct MeshPhoneBusyMessage +struct CadetPhoneResumeMessage { /** - * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_BUSY + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RESUME */ struct GNUNET_MessageHeader header; @@ -641,19 +340,24 @@ struct MeshPhoneBusyMessage /** - * Mesh message to transmit the audio. + * Cadet message to transmit the audio. */ -struct MeshAudioMessage +struct CadetAudioMessage { /** - * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_AUDIO + * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_AUDIO */ struct GNUNET_MessageHeader header; /** * Target line on the receiving end. */ - uint32_t remote_line; + uint32_t remote_line GNUNET_PACKED; + + /** + * The source line sending this data + */ + uint32_t source_line GNUNET_PACKED; /* followed by audio data */