}
-/**
- * Called whenever a client is disconnected. Frees our
- * resources associated with that client.
- *
- * @param cls closure
- * @param client identification of the client
- * @param message the stop message
- */
-static void handle_stop (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
-{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_REMOVE");
- struct DisconnectMessage * msg = (struct DisconnectMessage *) message;
- struct GNUNET_NAMESTORE_ZoneIteration * no;
- struct GNUNET_NAMESTORE_Client * nc;
- int drop;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected \n", client);
-
- nc = client_lookup (client);
- if (nc == NULL)
- {
- GNUNET_break (0);
- return;
- }
-
- for (no = nc->op_head; no != NULL; no = no->next)
- {
- GNUNET_CONTAINER_DLL_remove (nc->op_head, nc->op_tail, no);
- GNUNET_free (no);
- }
-
- drop = ntohl(msg->drop);
- if (GNUNET_YES == drop)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Dropping namestore content\n");
- int stop = GNUNET_NO;
- int offset = 0;
- while (stop == GNUNET_NO)
- {
- GSN_database->iterate_records (GSN_database->cls, NULL, NULL, offset, &drop_iterator, &stop);
- offset ++;
- }
- }
-
- GNUNET_SERVER_client_drop(nc->client);
- GNUNET_CONTAINER_DLL_remove (client_head, client_tail, nc);
- GNUNET_free (nc);
-}
-
static void
handle_lookup_name_it (void *cls,
const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
char *rd_tmp;
char *name_tmp;
size_t rd_ser_len;
- struct GNUNET_CRYPTO_RsaSignature *signature_tmp;
-
size_t r_size = 0;
-
size_t name_len = 0;
- if (NULL != name)
- name_len = strlen(name) + 1;
int copied_elements = 0;
int contains_signature = 0;
int c;
+ if (NULL != name)
+ name_len = strlen(name) + 1;
+
/* count records to copy */
if (rd_count != 0)
{
char rd_ser[rd_ser_len];
GNUNET_NAMESTORE_records_serialize(copied_elements, rd_selected, rd_ser_len, rd_ser);
+ if (rd_selected != rd)
+ GNUNET_free (rd_selected);
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records for name `%s' in zone `%s'\n",
copied_elements, lnc->name, GNUNET_h2s(lnc->zone));
if ((copied_elements == rd_count) && (signature != NULL))
- contains_signature = GNUNET_YES;
-
- if (rd_selected != rd)
- GNUNET_free (rd_selected);
+ contains_signature = GNUNET_YES;
+ else
+ contains_signature = GNUNET_NO;
r_size = sizeof (struct LookupNameResponseMessage) +
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) +
name_len +
- rd_ser_len +
- contains_signature * sizeof (struct GNUNET_CRYPTO_RsaSignature);
+ rd_ser_len;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "NAMESTORE_LOOKUP_NAME_RESPONSE");
-
lnr_msg = GNUNET_malloc (r_size);
-
lnr_msg->gns_header.header.type = ntohs (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE);
lnr_msg->gns_header.header.size = ntohs (r_size);
lnr_msg->gns_header.r_id = htonl (lnc->request_id);
lnr_msg->name_len = htons (name_len);
lnr_msg->expire = GNUNET_TIME_absolute_hton(expire);
lnr_msg->contains_sig = htons (contains_signature);
+ if (GNUNET_YES == contains_signature)
+ lnr_msg->signature = *signature;
+ else
+ memset (&lnr_msg->signature, '\0', sizeof (lnr_msg->signature));
zone_key_tmp = (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *) &lnr_msg[1];
name_tmp = (char *) &zone_key_tmp[1];
rd_tmp = &name_tmp[name_len];
- signature_tmp = (struct GNUNET_CRYPTO_RsaSignature *) &rd_tmp[rd_ser_len];
- if (zone_key != NULL)
- memcpy (zone_key_tmp, zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
- else
- {
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded dummy;
- memset (&dummy, '0', sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
- memcpy (zone_key_tmp, &dummy, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
- }
+ memcpy (zone_key_tmp, zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
memcpy (name_tmp, name, name_len);
memcpy (rd_tmp, rd_ser, rd_ser_len);
- if (GNUNET_YES == contains_signature)
- memcpy (signature_tmp, signature, sizeof (struct GNUNET_CRYPTO_RsaSignature));
GNUNET_SERVER_notification_context_unicast (snc, lnc->nc->client, (const struct GNUNET_MessageHeader *) lnr_msg, GNUNET_NO);
GNUNET_free (lnr_msg);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up all records for name `%s' in zone `%s'\n", name, GNUNET_h2s(&ln_msg->zone));
else
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up records with type %u for name `%s' in zone `%s'\n", type, name, GNUNET_h2s(&ln_msg->zone));
+
/* do the actual lookup */
lnc.request_id = rid;
lnc.nc = nc;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_PUT");
struct GNUNET_NAMESTORE_Client *nc;
struct GNUNET_TIME_Absolute expire;
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key;
struct GNUNET_CRYPTO_RsaSignature *signature;
struct RecordPutResponseMessage rpr_msg;
size_t name_len;
size_t msg_size;
size_t msg_size_exp;
- size_t key_len;
char * name;
char * rd_ser;
uint32_t rid = 0;
rid = ntohl (rp_msg->gns_header.r_id);
msg_size = ntohs (rp_msg->gns_header.header.size);
- key_len = ntohs (rp_msg->key_len);
name_len = ntohs (rp_msg->name_len);
rd_count = ntohs (rp_msg->rd_count);
rd_ser_len = ntohs(rp_msg->rd_len);
return;
}
- msg_size_exp = sizeof (struct RecordPutMessage) + key_len + name_len + rd_ser_len;
+ msg_size_exp = sizeof (struct RecordPutMessage) + name_len + rd_ser_len;
if (msg_size != msg_size_exp)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Expected message %u size but message size is %u \n", msg_size_exp, msg_size);
return;
}
- zone_key = (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *) &rp_msg[1];
- name = &((char *)zone_key)[key_len];
+ name = (char *) &rp_msg[1];
if (name[name_len -1] != '\0')
{
GNUNET_HashCode zone_hash;
- GNUNET_CRYPTO_hash (zone_key, key_len, &zone_hash);
+ GNUNET_CRYPTO_hash (&rp_msg->public_key, sizeof (rp_msg->public_key), &zone_hash);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting %u record for name `%s' in zone `%s'\n", rd_count, name, GNUNET_h2s(&zone_hash));
/* Database operation */
res = GSN_database->put_records(GSN_database->cls,
- zone_key,
+ &rp_msg->public_key,
expire,
name,
rd_count, rd,
/* Send response */
send:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_PUT_RESPONSE");
- rpr_msg.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE);
- rpr_msg.op_id = rp_msg->gns_header.r_id;
- rpr_msg.header.size = htons (sizeof (struct RecordPutResponseMessage));
+ rpr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE);
+ rpr_msg.gns_header.header.size = htons (sizeof (struct RecordPutResponseMessage));
+ rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id;
+
if (GNUNET_OK == res)
rpr_msg.op_result = htons (GNUNET_OK);
else
name_len = ntohs (rr_msg->name_len);
rd_ser_len = ntohs (rr_msg->rd_len);
rd_count = ntohs (rr_msg->rd_count);
- key_len = ntohs (rr_msg->key_len);
+ key_len = ntohs (rr_msg->pkey_len);
msg_size = ntohs (message->size);
if (msg_size > GNUNET_SERVER_MAX_MESSAGE_SIZE)
ztnr_msg->rd_len = htons (rd_ser_len);
ztnr_msg->rd_count = htons (rd_count);
ztnr_msg->name_len = htons (name_len);
- ztnr_msg->contains_sig = htons (contains_sig);
ztnr_msg->expire = GNUNET_TIME_absolute_hton(expire);
if (zone_key != NULL)
ztnr_msg->zone_key = *zone_key;
static const struct GNUNET_SERVER_MessageHandler handlers[] = {
{&handle_start, NULL,
GNUNET_MESSAGE_TYPE_NAMESTORE_START, sizeof (struct StartMessage)},
- {&handle_stop, NULL,
- GNUNET_MESSAGE_TYPE_NAMESTORE_DISCONNECT, sizeof (struct DisconnectMessage)},
{&handle_lookup_name, NULL,
GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME, 0},
{&handle_record_put, NULL,
GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME, 0},
{&handle_iteration_start, NULL,
GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START, sizeof (struct ZoneIterationStartMessage)},
- {&handle_iteration_stop, NULL,
- GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP, sizeof (struct ZoneIterationStopMessage)},
{&handle_iteration_next, NULL,
GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT, 0},
+ {&handle_iteration_stop, NULL,
+ GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP, 0},
{NULL, NULL, 0, 0}
};
#define GNUNET_MESSAGE_TYPE_NAMESTORE_DISCONNECT 449
/**
- * Sign name and records
+ * Create a signature based on name and records
*
* @param key the private key
* @param name the name
* @return the signature
*/
struct GNUNET_CRYPTO_RsaSignature *
-GNUNET_NAMESTORE_create_signature (const struct GNUNET_CRYPTO_RsaPrivateKey *key, const char *name, struct GNUNET_NAMESTORE_RecordData *rd, unsigned int rd_count);
+GNUNET_NAMESTORE_create_signature (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
+ const char *name,
+ const struct GNUNET_NAMESTORE_RecordData *rd,
+ unsigned int rd_count);
/**
* Compares if two records are equal
*
- * @param a record
- * @param b record
+ * @param a Record a
+ * @param b Record b
*
* @return GNUNET_YES or GNUNET_NO
*/
GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
const struct GNUNET_NAMESTORE_RecordData *b);
+
GNUNET_NETWORK_STRUCT_BEGIN
/**
* A GNS record serialized for network transmission.
- * layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
+ *
+ * Layout is [struct GNUNET_NAMESTORE_NetworkRecord][char[data_size] data]
*/
struct GNUNET_NAMESTORE_NetworkRecord
{
};
-/**
- * Connect to namestore service. FIXME: UNNECESSARY.
- */
-struct DisconnectMessage
-{
-
- /**
- * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_DISCONNECT
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * Drop namestore?
- * GNUNET_YES or _NO in NBO
- */
- uint32_t drop;
-};
-
/**
* Generic namestore message with op id
/**
- * Connect to namestore service
+ * Lookup a name in the namestore
*/
struct LookupNameMessage
{
/**
* Lookup response
- * Memory layout:
- * [struct LookupNameResponseMessage][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
*/
struct LookupNameResponseMessage
{
*/
struct GNUNET_NAMESTORE_Header gns_header;
+ /**
+ * Expiration time
+ */
struct GNUNET_TIME_AbsoluteNBO expire;
+
+ /**
+ * Name length
+ */
uint16_t name_len;
+ /**
+ * Bytes of serialized record data
+ */
uint16_t rd_len;
+ /**
+ * Number of records contained
+ */
uint16_t rd_count;
+ /**
+ * Is the signature valid
+ * GNUNET_YES or GNUNET_NO
+ */
int16_t contains_sig;
/**
struct GNUNET_CRYPTO_RsaSignature signature;
/**
- *
+ * The public key for the name
*/
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key;
/* 0-terminated name and serialized record data */
+ /* rd_len bytes serialized record data */
};
/**
* Put a record to the namestore
- * Memory layout:
- * [struct RecordPutMessage][char *name][rc_count * struct GNUNET_NAMESTORE_RecordData]
*/
struct RecordPutMessage
{
struct GNUNET_NAMESTORE_Header gns_header;
/**
- *
+ * Expiration time
*/
struct GNUNET_TIME_AbsoluteNBO expire;
/**
- * name length
+ * Name length
*/
uint16_t name_len;
/**
- * Length of serialized rd data
+ * Length of serialized record data
*/
uint16_t rd_len;
uint16_t reserved;
/**
- *
+ * The signature
*/
struct GNUNET_CRYPTO_RsaSignature signature;
/**
- *
+ * The public key
*/
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key;
struct GNUNET_TIME_AbsoluteNBO expire;
/**
- * name length
+ * Name length
*/
uint16_t name_len;
/**
- * Record data length
+ * Length of serialized record data
*/
uint16_t rd_len;
*/
uint16_t pkey_len;
- /* followed by: name and serialized record data --- PK??? */
+ /* followed by:
+ * GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded private key with length pkey_len
+ * name with length name_len
+ * serialized record data with length rd_len
+ * */
};
/**
* Create a record to the namestore response
- * Memory layout:
*/
struct RecordCreateResponseMessage
{
* name length: GNUNET_NO already exists, GNUNET_YES on success, GNUNET_SYSERR error
*/
int32_t op_result;
-
};
/**
* Remove a record from the namestore
* Memory layout:
- * [struct RecordRemoveMessage][char *name][struct GNUNET_NAMESTORE_RecordData]
*/
struct RecordRemoveMessage
{
uint16_t rd_count;
/**
- * Length of pubkey
+ * Length of private key
*/
- uint16_t key_len;
+ uint16_t pkey_len;
+
+ /* followed by:
+ * GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded private key with length pkey_len
+ * name with length name_len
+ * serialized record data with length rd_len
+ * */
};
/**
- * Connect to namestore service
+ * Lookup a name for a zone hash
*/
struct ZoneToNameMessage
{
+ /**
+ * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME
+ */
struct GNUNET_NAMESTORE_Header gns_header;
/**
};
/**
- * Connect to namestore service
+ * Respone for zone to name lookup
*/
struct ZoneToNameResponseMessage
{
+ /**
+ * Type will be GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE
+ */
struct GNUNET_NAMESTORE_Header gns_header;
+ /**
+ * Record block expiration
+ */
struct GNUNET_TIME_AbsoluteNBO expire;
+ /**
+ * Length of the name
+ */
uint16_t name_len;
+ /**
+ * Length of serialized record data
+ */
uint16_t rd_len;
+ /**
+ * Number of records contained
+ */
uint16_t rd_count;
/* result in NBO: GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error */
int16_t res;
/**
- *
+ * Signature
*/
struct GNUNET_CRYPTO_RsaSignature signature;
+ /**
+ * Publik key
+ */
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded zone_key;
};
*/
struct GNUNET_NAMESTORE_Header gns_header;
+ /**
+ * Zone hash
+ */
GNUNET_HashCode zone;
+ /**
+ * Which flags must be included
+ */
uint16_t must_have_flags;
+ /**
+ * Which flags must not be included
+ */
uint16_t must_not_have_flags;
-
};
struct GNUNET_CRYPTO_RsaSignature signature;
/**
- *
+ * The public key
*/
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key;
"LOOKUP_NAME_RESPONSE");
struct GNUNET_NAMESTORE_Handle *h = qe->nsh;
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key;
char *name;
char * rd_tmp;
struct GNUNET_CRYPTO_RsaSignature *signature = NULL;
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded dummy;
struct GNUNET_TIME_Absolute expire;
size_t exp_msg_len;
size_t msg_len = 0;
exp_msg_len = sizeof (struct LookupNameResponseMessage) +
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) +
- name_len +
- rd_len +
- contains_sig * sizeof (struct GNUNET_CRYPTO_RsaSignature);
+ name_len + rd_len;
if (msg_len != exp_msg_len)
{
GNUNET_break_op (0);
return;
}
+ if (name_len == 0)
+ {
+ GNUNET_break_op (0);
+ return;
+ }
- zone_key = (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *) &msg[1];
- name = (char *) &zone_key[1];
+ name = (char *) &msg[1];
rd_tmp = &name[name_len];
+ /* deserialize records */
struct GNUNET_NAMESTORE_RecordData rd[rd_count];
GNUNET_NAMESTORE_records_deserialize(rd_len, rd_tmp, rd_count, rd);
if (contains_sig == GNUNET_NO)
signature = NULL;
else
- signature = (struct GNUNET_CRYPTO_RsaSignature *) &rd_tmp[rd_len];
- if (name_len == 0)
- name = NULL;
-
- memset (&dummy, '0', sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
- if (0 == memcmp (zone_key, &dummy, sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)))
- zone_key = NULL;
+ signature = &msg->signature;
if (qe->proc != NULL)
{
- qe->proc (qe->proc_cls, zone_key, expire, name, rd_count, (rd_count > 0) ? rd : NULL, signature);
+ qe->proc (qe->proc_cls, &msg->public_key, expire, name, rd_count, (rd_count > 0) ? rd : NULL, signature);
}
/* Operation done, remove */
size_t name_len;
size_t rd_ser_len;
unsigned int rd_count;
- int have_signature;
char * name_tmp;
char * rd_tmp;
- struct GNUNET_CRYPTO_RsaSignature* sig_tmp;
if (res == GNUNET_SYSERR)
{
name_len = ntohs (msg->name_len);
rd_count = ntohs (msg->rd_count);
rd_ser_len = ntohs (msg->rd_len);
- have_signature = ntohl (msg->contains_sig);
expire = GNUNET_TIME_absolute_ntoh(msg->expire);
name_tmp = (char *) &msg[1];
rd_tmp = &name_tmp[name_len];
- if (have_signature == GNUNET_YES)
- sig_tmp = (struct GNUNET_CRYPTO_RsaSignature *) &rd_tmp[rd_ser_len];
- else
- sig_tmp = NULL;
struct GNUNET_NAMESTORE_RecordData rd[rd_count];
GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_tmp, rd_count, rd);
if (qe->proc != NULL)
- qe->proc (qe->proc_cls, &msg->zone_key, expire, name_tmp, rd_count, rd, sig_tmp);
-
+ qe->proc (qe->proc_cls, &msg->zone_key, expire, name_tmp, rd_count, rd, &msg->signature);
}
else
GNUNET_break_op (0);
return h;
}
-struct DisconnectContext
-{
- struct GNUNET_NAMESTORE_Handle *h;
- int drop;
-};
-
static void
clean_up_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
h = NULL;
};
-static size_t
-transmit_disconnect_to_namestore (void *cls, size_t size, void *buf)
-{
- struct DisconnectContext * d_ctx = cls;
- struct DisconnectMessage d_msg;
- struct GNUNET_NAMESTORE_Handle *h = d_ctx->h;
- int res;
-
- d_msg.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_DISCONNECT);
- d_msg.header.size = htons (sizeof (struct DisconnectMessage));
- d_msg.drop = htonl (d_ctx->drop);
-
- h->th = NULL;
- if ((size == 0) || (buf == NULL) || (size < sizeof (struct DisconnectMessage)))
- {
- GNUNET_break (0);
- res = 0;
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to service \n", "NAMESTORE_DISCONNECT");
- memcpy (buf, &d_msg, sizeof (struct DisconnectMessage));
- res = sizeof (struct DisconnectMessage);
- }
-
- GNUNET_SCHEDULER_add_now (&clean_up_task, h);
- GNUNET_free (d_ctx);
- return res;
-}
-
/**
* Disconnect from the namestore service (and free associated
* resources).
void
GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop)
{
- if (h->th != NULL)
- {
- GNUNET_CLIENT_notify_transmit_ready_cancel(h->th);
- h->th = NULL;
- }
- if (h->client != NULL)
- {
- struct DisconnectContext *d_ctx = GNUNET_malloc (sizeof (struct DisconnectContext));
- d_ctx->h = h;
- d_ctx->drop = drop;
-
- h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, sizeof (struct DisconnectMessage),
- GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_NO, &transmit_disconnect_to_namestore,
- d_ctx);
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Could not send disconnect notification to namestore service, we are not connected!\n");
- if (GNUNET_YES == drop)
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "NAMESTORE will not drop content\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Disconnecting from namestore service\n");
GNUNET_SCHEDULER_add_now (&clean_up_task, h);
- }
}
struct PendingMessage *pe;
/* pointer to elements */
- char * zone_key_tmp;
char * rd_tmp;
char * name_tmp;
pe->size = msg_size;
pe->is_init = GNUNET_NO;
msg = (struct RecordPutMessage *) &pe[1];
- zone_key_tmp = (char *) &msg[1];
- name_tmp = (char *) &zone_key_tmp[pubkey_len];
+ name_tmp = (char *) &msg[1];
rd_tmp = &name_tmp[name_len];
msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT);
msg->gns_header.header.size = htons (msg_size);
msg->gns_header.r_id = htonl (rid);
- msg->key_len = htons (pubkey_len);
- memcpy (zone_key_tmp, zone_key, pubkey_len);
msg->signature = *signature;
msg->name_len = htons (name_len);
- memcpy (name_tmp, name, name_len);
msg->expire = GNUNET_TIME_absolute_hton (expire);
msg->rd_len = htons (rd_ser_len);
msg->rd_count = htons (rd_count);
+ msg->public_key = *zone_key;
+ memcpy (name_tmp, name, name_len);
memcpy (rd_tmp, rd_ser, rd_ser_len);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for name `%s' with size %u\n", "NAMESTORE_RECORD_PUT", name, msg_size);
msg->name_len = htons (name_len);
msg->rd_len = htons (rd_ser_len);
msg->rd_count = htons (1);
- msg->key_len = htons (key_len);
+ msg->pkey_len = htons (key_len);
memcpy (pkey_tmp, pkey_enc, key_len);
memcpy (name_tmp, name, name_len);
memcpy (rd_tmp, rd_ser, rd_ser_len);
struct GNUNET_CRYPTO_RsaSignature *
GNUNET_NAMESTORE_create_signature (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
const char *name,
- struct GNUNET_NAMESTORE_RecordData *rd,
+ const struct GNUNET_NAMESTORE_RecordData *rd,
unsigned int rd_count)
{
struct GNUNET_CRYPTO_RsaSignature *sig = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_RsaSignature));
GNUNET_CRYPTO_hash (name, name_len, &nh);
memset (&zone_delegation, 0, sizeof (zone_delegation));
for (i=0;i<rd_count;i++)
- if (rd[i].record_type == GNUNET_GNS_TYPE_PKEY)
+ if (rd[i].record_type == GNUNET_NAMESTORE_TYPE_PKEY)
{
GNUNET_assert (sizeof (GNUNET_HashCode) == rd[i].data_size);
memcpy (&zone_delegation,