[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34960 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34960 - gnunet/src/ats |
Date: |
Thu, 22 Jan 2015 22:08:43 +0100 |
Author: grothoff
Date: 2015-01-22 22:08:43 +0100 (Thu, 22 Jan 2015)
New Revision: 34960
Modified:
gnunet/src/ats/ats.h
gnunet/src/ats/ats_api_scheduling.c
gnunet/src/ats/gnunet-service-ats_scheduling.c
Log:
split structs for address adding and updating
Modified: gnunet/src/ats/ats.h
===================================================================
--- gnunet/src/ats/ats.h 2015-01-22 20:59:08 UTC (rev 34959)
+++ gnunet/src/ats/ats.h 2015-01-22 21:08:43 UTC (rev 34960)
@@ -75,6 +75,57 @@
};
+/**
+ * ATS client to ATS service: here is another address you can use.
+ */
+struct AddressAddMessage
+{
+ /**
+ * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD.
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Size of the `struct GNUNET_ATS_Information` array that follows this
struct.
+ */
+ uint32_t ats_count GNUNET_PACKED;
+
+ /**
+ * Identity of the peer that this address is for.
+ */
+ struct GNUNET_PeerIdentity peer;
+
+ /**
+ * Number of bytes in the address that follows this struct.
+ */
+ uint16_t address_length GNUNET_PACKED;
+
+ /**
+ * Number of bytes in the plugin name that follows this struct.
+ */
+ uint16_t plugin_name_length GNUNET_PACKED;
+
+ /**
+ * Internal number this client will henceforth use to
+ * refer to this address.
+ */
+ uint32_t session_id GNUNET_PACKED;
+
+ /**
+ * Local-only information of the address, see
+ * `enum GNUNET_HELLO_AddressInfo`.
+ */
+ uint32_t address_local_info GNUNET_PACKED;
+
+ /* followed by:
+ * - struct GNUNET_ATS_Information [ats_count];
+ * - char address[address_length]
+ * - char plugin_name[plugin_name_length] (including '\0'-termination).
+ */
+
+};
+
+
struct AddressUpdateMessage
{
struct GNUNET_MessageHeader header;
Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2015-01-22 20:59:08 UTC (rev 34959)
+++ gnunet/src/ats/ats_api_scheduling.c 2015-01-22 21:08:43 UTC (rev 34960)
@@ -556,8 +556,8 @@
/**
- * Generate the "AddressUpdateMessage" for the given
- * session record.
+ * Generate and transmit the `struct AddressAddMessage` for the given
+ * address record.
*
* @param sh the scheduling handle to use for transmission
* @param ar the address to inform the ATS service about
@@ -567,7 +567,7 @@
const struct GNUNET_ATS_AddressRecord *ar)
{
struct GNUNET_MQ_Envelope *ev;
- struct AddressUpdateMessage *m;
+ struct AddressAddMessage *m;
struct GNUNET_ATS_Information *am;
char *pm;
size_t namelen;
Modified: gnunet/src/ats/gnunet-service-ats_scheduling.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_scheduling.c 2015-01-22 20:59:08 UTC
(rev 34959)
+++ gnunet/src/ats/gnunet-service-ats_scheduling.c 2015-01-22 21:08:43 UTC
(rev 34960)
@@ -241,7 +241,7 @@
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- const struct AddressUpdateMessage *m;
+ const struct AddressAddMessage *m;
const struct GNUNET_ATS_Information *atsi;
const char *address;
const char *plugin_name;
@@ -254,13 +254,13 @@
"Received `%s' message\n",
"ADDRESS_ADD");
size = ntohs (message->size);
- if (size < sizeof (struct AddressUpdateMessage))
+ if (size < sizeof (struct AddressAddMessage))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- m = (const struct AddressUpdateMessage *) message;
+ m = (const struct AddressAddMessage *) message;
ats_count = ntohl (m->ats_count);
address_length = ntohs (m->address_length);
plugin_name_length = ntohs (m->plugin_name_length);
@@ -273,7 +273,7 @@
if ((address_length + plugin_name_length +
ats_count * sizeof (struct GNUNET_ATS_Information) +
- sizeof (struct AddressUpdateMessage) != ntohs (message->size)) ||
+ sizeof (struct AddressAddMessage) != ntohs (message->size)) ||
(ats_count >
GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct
GNUNET_ATS_Information)) ||
((plugin_name_length > 0) && (plugin_name[plugin_name_length - 1] !=
'\0')))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34960 - gnunet/src/ats,
gnunet <=