void
GNUNET_NAMESTORE_records_free (unsigned int rd_count, struct GNUNET_NAMESTORE_RecordData *rd);
+
+GNUNET_NETWORK_STRUCT_BEGIN
/**
* A GNS record serialized for network transmission.
* layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
-GNUNET_NETWORK_STRUCT_BEGIN
/**
- * Connect to namestore service
+ * Connect to namestore service. FIXME: UNNECESSARY.
*/
struct StartMessage
{
struct GNUNET_MessageHeader header;
};
-GNUNET_NETWORK_STRUCT_END
-
-GNUNET_NETWORK_STRUCT_BEGIN
/**
* Generic namestore message with op id
*/
struct GNUNET_MessageHeader header;
/**
- * Operation ID in NBO
+ * Operation ID in NBO // BETTER: request ID
*/
uint32_t op_id;
};
-GNUNET_NETWORK_STRUCT_END
/**
* Connect to namestore service
*/
-GNUNET_NETWORK_STRUCT_BEGIN
struct LookupNameMessage
{
/**
*/
struct GNUNET_MessageHeader header;
+ // FIXME: use 'struct GenericMessage'
/**
* Operation ID in NBO
*/
/* Requested record type */
uint32_t name_len;
};
-GNUNET_NETWORK_STRUCT_END
/**
* Memory layout:
* [struct LookupNameResponseMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData][struct GNUNET_CRYPTO_RsaSignature]
*/
-GNUNET_NETWORK_STRUCT_BEGIN
struct LookupNameResponseMessage
{
/**
uint16_t name_len;
- uint16_t contains_sig;
+ uint16_t rd_len;
+
+ int32_t contains_sig;
/* Requested record type */
- uint16_t rd_len;
};
-GNUNET_NETWORK_STRUCT_END
/**
* Memory layout:
* [struct RecordPutMessage][struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
*/
-GNUNET_NETWORK_STRUCT_BEGIN
struct RecordPutMessage
{
/**
struct GNUNET_CRYPTO_RsaSignature signature;
};
-GNUNET_NETWORK_STRUCT_END
+
/**
* Put a record to the namestore response
*/
-GNUNET_NETWORK_STRUCT_BEGIN
struct RecordPutResponseMessage
{
/**
*/
uint16_t op_result;
};
-GNUNET_NETWORK_STRUCT_END
/**
* Memory layout:
* [struct RecordCreateMessage][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
*/
-GNUNET_NETWORK_STRUCT_BEGIN
struct RecordCreateMessage
{
/**
/* private key length */
uint16_t pkey_len;
};
-GNUNET_NETWORK_STRUCT_END
/**
* Create a record to the namestore response
* Memory layout:
*/
-GNUNET_NETWORK_STRUCT_BEGIN
struct RecordCreateResponseMessage
{
/**
};
-GNUNET_NETWORK_STRUCT_END
/**
* Remove a record from the namestore
* Memory layout:
* [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
*/
-GNUNET_NETWORK_STRUCT_BEGIN
struct RecordRemoveMessage
{
/**
const struct GNUNET_NAMESTORE_RecordData *rd)
{
//size_t len = 0;
- struct GNUNET_NAMESTORE_NetworkRecord * nr;
+ struct GNUNET_NAMESTORE_NetworkRecord nr;
char * d = (*dest);
int c = 0;
int offset;
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Serialized record [%i]: data_size %i\n", c,rd[c].data_size);
- nr = (struct GNUNET_NAMESTORE_NetworkRecord *) &d[offset];
- nr->data_size = htonl (rd[c].data_size);
- nr->flags = htonl (rd[c].flags);
- nr->record_type = htonl (rd[c].record_type);
- nr->expiration = GNUNET_TIME_absolute_hton(rd[c].expiration);
+ // nr = (struct GNUNET_NAMESTORE_NetworkRecord *) &d[offset];
+ nr.data_size = htonl (rd[c].data_size);
+ nr.flags = htonl (rd[c].flags);
+ nr.record_type = htonl (rd[c].record_type);
+ nr.expiration = GNUNET_TIME_absolute_hton(rd[c].expiration);
+ memcpy (&d[offset], &nr, sizeof (nr));
+ offset += sizeof (struct GNUNET_NAMESTORE_NetworkRecord);
/*put data here */
- offset += sizeof (struct GNUNET_NAMESTORE_NetworkRecord);
memcpy (&d[offset], rd[c].data, rd[c].data_size);
offset += rd[c].data_size;
}