[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29864 - in gnunet/src: conversation include namestore util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29864 - in gnunet/src: conversation include namestore util |
Date: |
Sat, 5 Oct 2013 17:40:55 +0200 |
Author: grothoff
Date: 2013-10-05 17:40:55 +0200 (Sat, 05 Oct 2013)
New Revision: 29864
Modified:
gnunet/src/conversation/conversation.h
gnunet/src/conversation/conversation_api.c
gnunet/src/include/gnunet_conversation_service.h
gnunet/src/include/gnunet_namestore_service.h
gnunet/src/include/gnunet_regex_service.h
gnunet/src/namestore/namestore_api_common.c
gnunet/src/util/common_logging.c
Log:
-enable printing and parsing of conversation's PHONE records
Modified: gnunet/src/conversation/conversation.h
===================================================================
--- gnunet/src/conversation/conversation.h 2013-10-05 13:20:56 UTC (rev
29863)
+++ gnunet/src/conversation/conversation.h 2013-10-05 15:40:55 UTC (rev
29864)
@@ -39,357 +39,7 @@
#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).
*/
struct AudioMessage
Modified: gnunet/src/conversation/conversation_api.c
===================================================================
--- gnunet/src/conversation/conversation_api.c 2013-10-05 13:20:56 UTC (rev
29863)
+++ gnunet/src/conversation/conversation_api.c 2013-10-05 15:40:55 UTC (rev
29864)
@@ -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 @@
/**
* This phone's record.
*/
- struct PhoneRecord my_record;
+ struct GNUNET_CONVERSATION_PhoneRecord my_record;
/**
* My GNS zone.
@@ -473,7 +445,7 @@
{
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 @@
/**
* 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 @@
{
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;
Modified: gnunet/src/include/gnunet_conversation_service.h
===================================================================
--- gnunet/src/include/gnunet_conversation_service.h 2013-10-05 13:20:56 UTC
(rev 29863)
+++ gnunet/src/include/gnunet_conversation_service.h 2013-10-05 15:40:55 UTC
(rev 29864)
@@ -74,6 +74,34 @@
/**
+ * 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.
Modified: gnunet/src/include/gnunet_namestore_service.h
===================================================================
--- gnunet/src/include/gnunet_namestore_service.h 2013-10-05 13:20:56 UTC
(rev 29863)
+++ gnunet/src/include/gnunet_namestore_service.h 2013-10-05 15:40:55 UTC
(rev 29864)
@@ -260,6 +260,8 @@
/* followed by encrypted data */
};
+
+
GNUNET_NETWORK_STRUCT_END
/**
Modified: gnunet/src/include/gnunet_regex_service.h
===================================================================
--- gnunet/src/include/gnunet_regex_service.h 2013-10-05 13:20:56 UTC (rev
29863)
+++ gnunet/src/include/gnunet_regex_service.h 2013-10-05 15:40:55 UTC (rev
29864)
@@ -57,7 +57,7 @@
/**
* 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 @@
* @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 @@
/**
* 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 @@
/**
* 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 @@
/**
* 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 @@
* @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 @@
/**
- * 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);
Modified: gnunet/src/namestore/namestore_api_common.c
===================================================================
--- gnunet/src/namestore/namestore_api_common.c 2013-10-05 13:20:56 UTC (rev
29863)
+++ gnunet/src/namestore/namestore_api_common.c 2013-10-05 15:40:55 UTC (rev
29864)
@@ -652,6 +652,25 @@
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 @@
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 @@
{ "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 }
};
Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c 2013-10-05 13:20:56 UTC (rev 29863)
+++ gnunet/src/util/common_logging.c 2013-10-05 15:40:55 UTC (rev 29864)
@@ -21,7 +21,6 @@
/**
* @file util/common_logging.c
* @brief error handling API
- *
* @author Christian Grothoff
*/
#include "platform.h"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29864 - in gnunet/src: conversation include namestore util,
gnunet <=