gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit 437a8ac3b0f835c2035575331c1c9272ed93ae43
parent 5b82f1062147ef5da89971d515d93fd4df8cd40d
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed,  2 Oct 2013 14:48:56 +0000

-towards canonical header structure for conversation

Diffstat:
Asrc/conversation/conversation.h | 417+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/conversation/conversation_api.c | 3++-
Msrc/conversation/gnunet-service-conversation.c | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
Dsrc/conversation/gnunet_conversation.h | 163-------------------------------------------------------------------------------
Dsrc/conversation/gnunet_protocols_conversation.h | 300-------------------------------------------------------------------------------
Msrc/include/gnunet_conversation_service.h | 10++++++++--
Msrc/include/gnunet_protocols.h | 117+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
7 files changed, 608 insertions(+), 474 deletions(-)

diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h @@ -0,0 +1,417 @@ +/* + This file is part of GNUnet. + (C) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + 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. +*/ + +/** + * @file conversation/conversation.h + * @brief constants for network protocols + * @author Siomon Dieterle + * @author Andreas Fuchs + */ +#ifndef CONVERSATION_H +#define CONVERSATION_H + +#ifdef __cplusplus +extern "C" +{ +#if 0 /* keep Emacsens' auto-indent happy */ +} +#endif +#endif + + +#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 + */ +struct ServerClientPeerAvailableMessage +{ + /** + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE + */ + struct GNUNET_MessageHeader header; + struct GNUNET_PeerIdentity peer; + struct GNUNET_TIME_Absolute time; +}; + +/************************************************************************************************************************ +* Messages for the Mesh communication +*/ + +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 + */ +struct MeshSessionInitiateMessage +{ + /** + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE + */ + 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 + */ + struct GNUNET_MessageHeader header; + int SequenceNumber; + struct GNUNET_TIME_Absolute time; +}; + + +/** + * Mesh message to reject an a wish to initiate a new call + */ +struct MeshSessionRejectMessage +{ + /** + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT + */ + 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 + */ + struct GNUNET_MessageHeader header; + int SequenceNumber; + struct GNUNET_TIME_Absolute time; +}; + + +/** + * Server <-> Client message to notify client of peer being available + */ +struct MeshPeerAvailableMessage +{ + /** + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE + */ + 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 + */ +struct TestMessage +{ + /** + * Type is: #GNUNET_MESSAGE_TYPE_CONVERSATION_TEST + */ + struct GNUNET_MessageHeader header; +}; + + +/** + * Message to transmit the audio + */ +struct AudioMessage +{ + /** + * Type is #GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO + */ + struct GNUNET_MessageHeader header; + int SequenceNumber; + struct GNUNET_TIME_Absolute time; + int length; + int encrypted; + uint8_t audio[200]; + +}; + + +#if 0 /* keep Emacsens' auto-indent happy */ +{ +#endif +#ifdef __cplusplus +} +#endif + +/* ifndef GNUNET_PROTOCOLS_CONVERSATION_H */ +#endif +/* end of gnunet_protocols_conversation.h */ diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c @@ -37,7 +37,8 @@ #include "gnunet_util_lib.h" #include "gnunet_dnsparser_lib.h" #include "gnunet_gns_service.h" -#include "gnunet_protocols_conversation.h" +#include "gnunet_protocols.h" +#include "conversation.h" #include "gnunet_conversation_service.h" #define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c @@ -34,12 +34,27 @@ * - TUNNEL HANDLING * - CLIENT HANDLING */ -#include <gnunet/platform.h> -#include <gnunet/gnunet_util_lib.h> -#include <gnunet/gnunet_constants.h> -#include <gnunet/gnunet_mesh_service.h> -#include "gnunet_conversation.h" -#include "gnunet_protocols_conversation.h" +#include "platform.h" +#include "gnunet_util_lib.h" +#include "gnunet_protocols.h" +#include "gnunet_constants.h" +#include "gnunet_mesh_service.h" +#include "gnunet_conversation_service.h" +#include "conversation.h" + + + +/* +* The possible connection status +*/ +enum connection_status +{ + LISTEN, + CALLER, + CALLEE, + CONNECTED +}; + /******************************************************** * Ugly hack because of not working MESH API @@ -158,6 +173,51 @@ static int data_sent_size; static int data_received; static int data_received_size; + +/** +* Transmit a mesh message + * @param cls closure, NULL + * @param size number of bytes available in buf + * @param buf where the callee should write the error message + * @return number of bytes written to buf + */ +static size_t transmit_mesh_message (void *cls, size_t size, void *buf); + +/** + * Function called to send a peer no answer message to the client. + * "buf" will be NULL and "size" zero if the socket was closed for writing in + * the meantime. + * + * @param cls closure, NULL + * @param size number of bytes available in buf + * @param buf where the callee should write the peer no answer message + * @return number of bytes written to buf + */ +static size_t +transmit_server_no_answer_message (void *cls, size_t size, void *buf); + +/** + * Task to schedule a audio transmission. + * + * @param cls Closure. + * @param tc Task Context. + */ +static void +transmit_audio_task (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc); + +/** +* Start the audio helpers +*/ +int start_helpers (void); + +/** +* Stop the audio helpers +*/ +void stop_helpers (void); + + + /******************************************************************************/ /*********************** AUXILIARY FUNCTIONS *************************/ /******************************************************************************/ diff --git a/src/conversation/gnunet_conversation.h b/src/conversation/gnunet_conversation.h @@ -1,163 +0,0 @@ -/* - This file is part of GNUnet - (C) - - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2, or (at your - option) any later version. - - GNUnet is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - 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. - */ - -/** - * @file include/gnunet_conversation.h - * @brief Header to the conversation service - * @author Simon Dieterle - * @author Andreas Fuchs - */ -#ifndef GNUNET_CONVERSATION_H -#define GNUNET_CONVERSATION_H - -#ifdef __cplusplus -extern "C" -{ -#if 0 /* keep Emacsens' auto-indent happy */ -} -#endif -#endif - -#define MAX_TRANSMIT_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) - -/** -* Reasons for rejecting an incoming call -*/ -enum reject_reason -{ - REJECT_REASON_GENERIC = 0, - REJECT_REASON_NOT_AVAILABLE, - REJECT_REASON_NO_CLIENT, - REJECT_REASON_ACTIVE_CALL, - REJECT_REASON_NO_ANSWER -}; - -/* -* The possible connection status -*/ -enum connection_status -{ - LISTEN, - CALLER, - CALLEE, - CONNECTED -}; - -/** - * 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; -}; - -/** -* Iformation 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; - -}; - -/** -* Transmit a mesh message - * @param cls closure, NULL - * @param size number of bytes available in buf - * @param buf where the callee should write the error message - * @return number of bytes written to buf - */ -static size_t transmit_mesh_message (void *cls, size_t size, void *buf); - -/** - * Function called to send a peer no answer message to the client. - * "buf" will be NULL and "size" zero if the socket was closed for writing in - * the meantime. - * - * @param cls closure, NULL - * @param size number of bytes available in buf - * @param buf where the callee should write the peer no answer message - * @return number of bytes written to buf - */ -static size_t -transmit_server_no_answer_message (void *cls, size_t size, void *buf); - -/** - * Task to schedule a audio transmission. - * - * @param cls Closure. - * @param tc Task Context. - */ -static void -transmit_audio_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); - -/** -* Start the audio helpers -*/ -int start_helpers (void); - -/** -* Stop the audio helpers -*/ -void stop_helpers (void); - - - -#if 0 /* keep Emacsens' auto-indent happy */ -{ -#endif -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/conversation/gnunet_protocols_conversation.h b/src/conversation/gnunet_protocols_conversation.h @@ -1,300 +0,0 @@ -/* - This file is part of GNUnet. - (C) - - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2, or (at your - option) any later version. - - GNUnet is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - 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. -*/ - -/** - * @file include/gnunet_protocols_conversation.h - * @brief constants for network protocols - * @author Siomon Dieterle - * @author Andreas Fuchs - */ - -#ifndef GNUNET_PROTOCOLS_CONVERSATION_H -#define GNUNET_PROTOCOLS_CONVERSATION_H - -#ifdef __cplusplus -extern "C" -{ -#if 0 /* keep Emacsens' auto-indent happy */ -} -#endif -#endif - - -/************************************************************************************************************************ -* Messages for the Client <-> Server communication -*/ - -/** -* Client <-> Server message to initiate a new call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE 30002 -struct ClientServerSessionInitiateMessage -{ - struct GNUNET_MessageHeader header; - struct GNUNET_PeerIdentity peer; -}; - -/** -* Client <-> Server meessage to accept an incoming call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT 30003 -struct ClientServerSessionAcceptMessage -{ - struct GNUNET_MessageHeader header; -}; - -/** -* Client <-> Server message to reject an incoming call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT 30004 -struct ClientServerSessionRejectMessage -{ - struct GNUNET_MessageHeader header; - int reason; -}; - -/** -* Client <-> Server message to terminat a call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE 30005 -struct ClientServerSessionTerminateMessage -{ - struct GNUNET_MessageHeader header; -}; - -/** -* Client <-> Server message to initiate a new call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST 30099 -struct ClientServerTestMessage -{ - struct GNUNET_MessageHeader header; - struct GNUNET_PeerIdentity peer; -}; - -/************************************************************************************************************************ -* Messages for the Server <-> Client communication -*/ - -/** -* Server <-> Client message to initiate a new call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE 30006 -struct ServerClientSessionInitiateMessage -{ - struct GNUNET_MessageHeader header; - struct GNUNET_PeerIdentity peer; -}; - -/** -* Server <-> Client meessage to accept an incoming call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT 30007 -struct ServerClientSessionAcceptMessage -{ - struct GNUNET_MessageHeader header; -}; - -/** -* Server <-> Client message to reject an incoming call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT 30008 -struct ServerClientSessionRejectMessage -{ - struct GNUNET_MessageHeader header; - int reason; - int notify; -}; - -/** -* Server <-> Client message to terminat a call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE 30009 -struct ServerClientSessionTerminateMessage -{ - struct GNUNET_MessageHeader header; -}; - -/** -* Server <-> Client message to signalize the client that the service is already in use -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED 30010 -struct ServerClientServiceBlockedMessage -{ - struct GNUNET_MessageHeader header; -}; - -/** -* Server <-> Client message to signalize the client that the called peer is not connected -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED 30011 -struct ServerClientPeerNotConnectedMessage -{ - struct GNUNET_MessageHeader header; -}; - -/** -* Server <-> Client message to signalize the client that called peer does not answer -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER 30012 -struct ServerClientNoAnswerMessage -{ - struct GNUNET_MessageHeader header; -}; - -/** -* Server <-> Client message to notify client of missed call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL 30013 -struct ServerClientMissedCallMessage -{ - struct GNUNET_MessageHeader header; - int number; - struct MissedCall *missed_call; -}; - -/** -* Server <-> Client message to signalize the client that there occured an error -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR 30014 -struct ServerClientErrorMessage -{ - struct GNUNET_MessageHeader header; -}; - -/** -* Server <-> Client message to notify client of peer being available -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE 30015 -struct ServerClientPeerAvailableMessage -{ - struct GNUNET_MessageHeader header; - struct GNUNET_PeerIdentity peer; - struct GNUNET_TIME_Absolute time; -}; - -/************************************************************************************************************************ -* Messages for the Mesh communication -*/ - -struct VoIPMeshMessageHeader -{ - 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 -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE 40000 -struct MeshSessionInitiateMessage -{ - 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 -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT 40001 -struct MeshSessionAcceptMessage -{ - struct GNUNET_MessageHeader header; - int SequenceNumber; - struct GNUNET_TIME_Absolute time; -}; - -/** -* Mesh message to reject an a wish to initiate a new call -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT 40002 -struct MeshSessionRejectMessage -{ - 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 -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE 40003 -struct MeshSessionTerminateMessage -{ - struct GNUNET_MessageHeader header; - int SequenceNumber; - struct GNUNET_TIME_Absolute time; -}; - -/** -* Server <-> Client message to notify client of peer being available -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE 40004 -struct MeshPeerAvailableMessage -{ - 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 -*/ - - -#define GNUNET_MESSAGE_TYPE_CONVERSATION_TEST 50001 -struct TestMessage -{ - struct GNUNET_MessageHeader header; -}; - -/** -* Message to transmit the audio -*/ -#define GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO 50000 -struct AudioMessage -{ - struct GNUNET_MessageHeader header; - int SequenceNumber; - struct GNUNET_TIME_Absolute time; - int length; - int encrypted; - uint8_t audio[200]; - -}; - - -#if 0 /* keep Emacsens' auto-indent happy */ -{ -#endif -#ifdef __cplusplus -} -#endif - -/* ifndef GNUNET_PROTOCOLS_CONVERSATION_H */ -#endif -/* end of gnunet_protocols_conversation.h */ diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h @@ -42,9 +42,13 @@ extern "C" enum GNUNET_CONVERSATION_RejectReason { - REJECT_REASON_NO_CLIENT = 0, + REJECT_REASON_GENERIC = 0, + REJECT_REASON_NOT_AVAILABLE, + REJECT_REASON_NO_CLIENT, REJECT_REASON_ACTIVE_CALL, - REJECT_REASON_NOT_WANTED + REJECT_REASON_NOT_WANTED, + REJECT_REASON_NO_ANSWER + }; enum GNUNET_CONVERSATION_NotificationType @@ -57,6 +61,8 @@ enum GNUNET_CONVERSATION_NotificationType NotificationType_CALL_TERMINATED }; + + /** * */ diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h @@ -2118,6 +2118,119 @@ extern "C" /******************************************************************************* + * CONVERSATION message types + ******************************************************************************/ + +/** + * Client <-> Server message to initiate a new call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_INITIATE 730 + +/** + * Client <-> Server meessage to accept an incoming call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_ACCEPT 731 + +/** + * Client <-> Server message to reject an incoming call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_REJECT 732 + +/** + * Client <-> Server message to terminate a call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_SESSION_TERMINATE 733 + +/** + * Client <-> Server message to initiate a new call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_CS_TEST 734 + +/** + * Server <-> Client message to initiate a new call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_INITIATE 735 + +/** + * Server <-> Client meessage to accept an incoming call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_ACCEPT 736 + +/** + * Server <-> Client message to reject an incoming call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_REJECT 737 + +/** + * Server <-> Client message to terminat a call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SESSION_TERMINATE 738 + +/** + * Server <-> Client message to signalize the client that the service is already in use + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_SERVICE_BLOCKED 739 + +/** + * Server <-> Client message to signalize the client that the called peer is not connected + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_NOT_CONNECTED 740 + +/** + * Server <-> Client message to signalize the client that called peer does not answer + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_NO_ANSWER 741 + +/** + * Server <-> Client message to notify client of missed call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_MISSED_CALL 742 + +/** + * Server <-> Client message to signalize the client that there occured an error + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_ERROR 743 + +/** + * Server <-> Client message to notify client of peer being available + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_SC_PEER_AVAILABLE 744 + +/** + * Mesh message to sinal the remote peer the wish to initiate a new call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_INITIATE 745 + +/** + * Mesh message to signal the remote peer the acceptance of an initiated call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_ACCEPT 746 + +/** + * Mesh message to reject an a wish to initiate a new call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_REJECT 747 + +/** + * Mesh message to signal a remote peer the terminatation of a call + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_SESSION_TERMINATE 748 + +/** + * Server <-> Client message to notify client of peer being available + */ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PEER_AVAILABLE 749 + + +#define GNUNET_MESSAGE_TYPE_CONVERSATION_TEST 750 + +/** +* Message to transmit the audio +*/ +#define GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO 751 + + +/******************************************************************************* * MULTICAST message types ******************************************************************************/ @@ -2127,7 +2240,7 @@ extern "C" /** * Multicast message from the origin to all members. */ -#define GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE 730 +#define GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE 760 /** * A unicast message from a group member to the origin. @@ -2177,7 +2290,7 @@ extern "C" /** - * Next available: 750 + * Next available: 780 */