diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/conversation/conversation.h | 350 | ||||
-rw-r--r-- | src/conversation/conversation_api.c | 36 | ||||
-rw-r--r-- | src/include/gnunet_conversation_service.h | 28 | ||||
-rw-r--r-- | src/include/gnunet_namestore_service.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_regex_service.h | 20 | ||||
-rw-r--r-- | src/namestore/namestore_api_common.c | 47 | ||||
-rw-r--r-- | src/util/common_logging.c | 1 |
7 files changed, 91 insertions, 393 deletions
diff --git a/src/conversation/conversation.h b/src/conversation/conversation.h index dceb9b9e47..685d98d16d 100644 --- a/src/conversation/conversation.h +++ b/src/conversation/conversation.h @@ -39,356 +39,6 @@ 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 - */ -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 (between client and helpers). */ diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c index 6ce198e64e..1303586134 100644 --- a/src/conversation/conversation_api.c +++ b/src/conversation/conversation_api.c @@ -32,34 +32,6 @@ /** - * A phone record specifies which peer is hosting a given user and - * may also specify the phone line that is used (typically zero). - * The version is also right now always zero. - */ -struct PhoneRecord -{ - - /** - * Version of the phone record, for now always zero. We may - * use other versions for anonymously hosted phone lines in - * the future. - */ - uint32_t version GNUNET_PACKED; - - /** - * Phone line to use at the peer. - */ - uint32_t line GNUNET_PACKED; - - /** - * Identity of the peer hosting the phone service. - */ - struct GNUNET_PeerIdentity peer; - -}; - - -/** * Possible states of the phone. */ enum PhoneState @@ -147,7 +119,7 @@ struct GNUNET_CONVERSATION_Phone /** * This phone's record. */ - struct PhoneRecord my_record; + struct GNUNET_CONVERSATION_PhoneRecord my_record; /** * My GNS zone. @@ -473,7 +445,7 @@ GNUNET_CONVERSATION_phone_get_record (struct GNUNET_CONVERSATION_Phone *phone, { rd->data = &phone->my_record; rd->expiration_time = 0; - rd->data_size = sizeof (struct PhoneRecord); + rd->data_size = sizeof (struct GNUNET_CONVERSATION_PhoneRecord); rd->record_type = GNUNET_NAMESTORE_TYPE_PHONE; rd->flags = GNUNET_NAMESTORE_RF_NONE; } @@ -702,7 +674,7 @@ struct GNUNET_CONVERSATION_Call /** * Target phone record, only valid after the lookup is done. */ - struct PhoneRecord phone_record; + struct GNUNET_CONVERSATION_PhoneRecord phone_record; /** * State machine for the call. @@ -932,7 +904,7 @@ handle_gns_response (void *cls, { if (GNUNET_NAMESTORE_TYPE_PHONE == rd[i].record_type) { - if (rd[i].data_size != sizeof (struct PhoneRecord)) + if (rd[i].data_size != sizeof (struct GNUNET_CONVERSATION_PhoneRecord)) { GNUNET_break_op (0); continue; diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h index 3c31127454..848643f954 100644 --- a/src/include/gnunet_conversation_service.h +++ b/src/include/gnunet_conversation_service.h @@ -74,6 +74,34 @@ extern "C" /** + * A phone record specifies which peer is hosting a given user and + * may also specify the phone line that is used (typically zero). + * The version is also right now always zero. + */ +struct GNUNET_CONVERSATION_PhoneRecord +{ + + /** + * Version of the phone record, for now always zero. We may + * use other versions for anonymously hosted phone lines in + * the future. + */ + uint32_t version GNUNET_PACKED; + + /** + * Phone line to use at the peer. + */ + uint32_t line GNUNET_PACKED; + + /** + * Identity of the peer hosting the phone service. + */ + struct GNUNET_PeerIdentity peer; + +}; + + +/** * Information about the current status of a call. Each call * progresses from ring over ready to terminated. Steps may * be skipped. diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 6763c05fc9..c296d5eecf 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h @@ -260,6 +260,8 @@ struct GNUNET_NAMESTORE_Block /* followed by encrypted data */ }; + + GNUNET_NETWORK_STRUCT_END /** diff --git a/src/include/gnunet_regex_service.h b/src/include/gnunet_regex_service.h index d1d7c03f6a..a3652be50c 100644 --- a/src/include/gnunet_regex_service.h +++ b/src/include/gnunet_regex_service.h @@ -57,7 +57,7 @@ struct GNUNET_REGEX_Search; /** * Announce this peer under the given regular expression. Does - * not free resources, must call GNUNET_REGEX_announce_cancel for + * not free resources, must call #GNUNET_REGEX_announce_cancel for * that. * * @param cfg configuration to use @@ -65,7 +65,7 @@ struct GNUNET_REGEX_Search; * @param refresh_delay after what delay should the announcement be repeated? * @param compression How many characters per edge can we squeeze? * @return Handle to reuse o free cached resources. - * Must be freed by calling GNUNET_REGEX_announce_cancel. + * Must be freed by calling #GNUNET_REGEX_announce_cancel. */ struct GNUNET_REGEX_Announcement * GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg, @@ -77,7 +77,7 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Stop announcing the regex specified by the given handle. * - * @param a handle returned by a previous GNUNET_REGEX_announce call. + * @param a handle returned by a previous #GNUNET_REGEX_announce call. */ void GNUNET_REGEX_announce_cancel (struct GNUNET_REGEX_Announcement *a); @@ -86,12 +86,12 @@ GNUNET_REGEX_announce_cancel (struct GNUNET_REGEX_Announcement *a); /** * Search callback function, invoked for every result that was found. * - * @param cls Closure provided in GNUNET_REGEX_search. + * @param cls Closure provided in #GNUNET_REGEX_search. * @param id Peer providing a regex that matches the string. * @param get_path Path of the get request. - * @param get_path_length Lenght of get_path. + * @param get_path_length Lenght of @a get_path. * @param put_path Path of the put request. - * @param put_path_length Length of the put_path. + * @param put_path_length Length of the @a put_path. */ typedef void (*GNUNET_REGEX_Found)(void *cls, const struct GNUNET_PeerIdentity *id, @@ -103,7 +103,7 @@ typedef void (*GNUNET_REGEX_Found)(void *cls, /** * Search for a peer offering a regex matching certain string in the DHT. - * The search runs until GNUNET_REGEX_search_cancel is called, even if results + * The search runs until #GNUNET_REGEX_search_cancel is called, even if results * are returned. * * @param cfg configuration to use @@ -111,7 +111,7 @@ typedef void (*GNUNET_REGEX_Found)(void *cls, * @param callback Callback for found peers. * @param callback_cls Closure for @c callback. * @return Handle to stop search and free resources. - * Must be freed by calling GNUNET_REGEX_search_cancel. + * Must be freed by calling #GNUNET_REGEX_search_cancel. */ struct GNUNET_REGEX_Search * GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg, @@ -121,9 +121,9 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg, /** - * Stop search and free all data used by a GNUNET_REGEX_search call. + * Stop search and free all data used by a #GNUNET_REGEX_search call. * - * @param s Handle returned by a previous GNUNET_REGEX_search call. + * @param s Handle returned by a previous #GNUNET_REGEX_search call. */ void GNUNET_REGEX_search_cancel (struct GNUNET_REGEX_Search *s); diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c index 5ba8e6f378..c965b528ea 100644 --- a/src/namestore/namestore_api_common.c +++ b/src/namestore/namestore_api_common.c @@ -652,6 +652,25 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, if (data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) return NULL; return GNUNET_CRYPTO_ecc_public_sign_key_to_string (data); + case GNUNET_NAMESTORE_TYPE_PKEY: + { + const struct GNUNET_CONVERSATION_PhoneRecord *pr; + char *ret; + char *pkey; + + if (data_size != sizeof (struct GNUNET_CONVERSATION_PhoneRecord)) + return NULL; + pr = data; + if (0 != ntohl (pr->version)) + return NULL; + pkey = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pr->peer.public_key); + GNUNET_asprintf (&ret, + "%u-%s", + ntohl (pr->line), + pkey); + GNUNET_free (pkey); + return ret; + } case GNUNET_NAMESTORE_TYPE_PSEU: return GNUNET_strndup (data, data_size); case GNUNET_NAMESTORE_TYPE_LEHO: @@ -974,6 +993,33 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, memcpy (*data, &pkey, sizeof (pkey)); *data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); return GNUNET_OK; + case GNUNET_NAMESTORE_TYPE_PHONE: + { + struct GNUNET_CONVERSATION_PhoneRecord *pr; + unsigned int line; + const char *dash; + struct GNUNET_PeerIdentity peer; + + if ( (NULL == (dash = strchr (s, "-"))) || + (1 != sscanf (s, "%u-", &line)) || + (GNUNET_OK != + GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1, + strlen (dash + 1), + &peer.public_key)) ) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + _("Unable to parse PHONE record `%s'\n"), + s); + return GNUNET_SYSERR; + } + pr = GNUNET_new (struct GNUNET_CONVERSATION_PhoneRecord); + pr->version = htonl (0); + pr->line = htonl ((uint32_t) line); + pr->peer = peer; + *data = pr; + *data_size = sizeof (struct GNUNET_CONVERSATION_PhoneRecord); + return GNUNET_OK; + } case GNUNET_NAMESTORE_TYPE_PSEU: *data = GNUNET_strdup (s); *data_size = strlen (s); @@ -1073,6 +1119,7 @@ static struct { { "LEHO", GNUNET_NAMESTORE_TYPE_LEHO }, { "VPN", GNUNET_NAMESTORE_TYPE_VPN }, { "GNS2DNS", GNUNET_NAMESTORE_TYPE_GNS2DNS }, + { "PHONE", GNUNET_NAMESTORE_TYPE_PHONE }, { "TLSA", GNUNET_DNSPARSER_TYPE_TLSA }, { NULL, UINT32_MAX } }; diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 80819276e9..59a2eeb294 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c @@ -21,7 +21,6 @@ /** * @file util/common_logging.c * @brief error handling API - * * @author Christian Grothoff */ #include "platform.h" |