/**
* Namestore client which intiated this zone iteration
*/
- struct GNUNET_NAMESTORE_Client * client;
+ struct GNUNET_NAMESTORE_Client *client;
/**
* GNUNET_YES if we iterate over a specific zone
/**
* The client
*/
- struct GNUNET_SERVER_Client * client;
+ struct GNUNET_SERVER_Client *client;
/**
* Head of the DLL of
/**
* Filename where to store the container
*/
- char * filename;
+ char *filename;
/**
* Short hash of the zone's public key
* @return GNUNET_OK on success, GNUNET_SYSERR on fail
*/
-int
+static int
write_key_to_file (const char *filename, struct GNUNET_NAMESTORE_CryptoContainer *c)
{
struct GNUNET_CRYPTO_RsaPrivateKey *ret = c->privkey;
{
struct GNUNET_CRYPTO_ShortHashCode zone;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
- struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
+ struct GNUNET_CRYPTO_RsaPrivateKey *privkey;
privkey = GNUNET_CRYPTO_rsa_key_create_from_file(filename);
if (privkey == NULL)
return GNUNET_OK;
}
-int zone_to_disk_it (void *cls,
- const struct GNUNET_HashCode *key,
- void *value)
+static int
+zone_to_disk_it (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
- struct GNUNET_NAMESTORE_CryptoContainer * c = value;
+ struct GNUNET_NAMESTORE_CryptoContainer *c = value;
if (c->filename != NULL)
write_key_to_file(c->filename, c);
else
cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping namestore service\n");
- struct GNUNET_NAMESTORE_ZoneIteration * no;
- struct GNUNET_NAMESTORE_ZoneIteration * tmp;
- struct GNUNET_NAMESTORE_Client * nc;
- struct GNUNET_NAMESTORE_Client * next;
+ struct GNUNET_NAMESTORE_ZoneIteration *no;
+ struct GNUNET_NAMESTORE_ZoneIteration *tmp;
+ struct GNUNET_NAMESTORE_Client *nc;
+ struct GNUNET_NAMESTORE_Client *next;
if (NULL != snc)
{
static struct GNUNET_NAMESTORE_Client *
client_lookup (struct GNUNET_SERVER_Client *client)
{
- struct GNUNET_NAMESTORE_Client * nc;
+ struct GNUNET_NAMESTORE_Client *nc;
GNUNET_assert (NULL != client);
}
/**
- * Called whenever a client is disconnected. Frees our
+* Called whenever a client is disconnected. Frees our
* resources associated with that client.
*
* @param cls closure
static void
client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client)
{
- struct GNUNET_NAMESTORE_ZoneIteration * no;
- struct GNUNET_NAMESTORE_Client * nc;
+ struct GNUNET_NAMESTORE_ZoneIteration *no;
+ struct GNUNET_NAMESTORE_Client *nc;
if (NULL == client)
return;
-static void handle_start (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
+static void
+handle_start (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
- struct GNUNET_NAMESTORE_Client * nc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Client));
+ struct GNUNET_NAMESTORE_Client *nc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Client));
nc->client = client;
GNUNET_SERVER_notification_context_add (snc, client);
GNUNET_CONTAINER_DLL_insert(client_head, client_tail, nc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
+
struct LookupNameContext
{
+
struct GNUNET_NAMESTORE_Client *nc;
uint32_t request_id;
uint32_t record_type;
struct GNUNET_CRYPTO_ShortHashCode *zone;
- char * name;
+ char *name;
};
-void drop_iterator (void *cls,
- const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
- struct GNUNET_TIME_Absolute expire,
- const char *name,
- unsigned int rd_len,
- const struct GNUNET_NAMESTORE_RecordData *rd,
- const struct GNUNET_CRYPTO_RsaSignature *signature)
+static void
+drop_iterator (void *cls,
+ const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
+ struct GNUNET_TIME_Absolute expire,
+ const char *name,
+ unsigned int rd_len,
+ const struct GNUNET_NAMESTORE_RecordData *rd,
+ const struct GNUNET_CRYPTO_RsaSignature *signature)
{
struct GNUNET_CRYPTO_ShortHashCode zone_hash;
- int * stop = cls;
+ int *stop = cls;
if (NULL != zone_key)
{
GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash);
GNUNET_free (lnr_msg);
}
-static void handle_lookup_name (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
+static void
+handle_lookup_name (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_LOOKUP_NAME");
struct LookupNameContext lnc;
struct GNUNET_NAMESTORE_Client *nc;
size_t name_len;
- char * name;
+ char *name;
uint32_t rid = 0;
uint32_t type = 0;
return;
}
- struct LookupNameMessage * ln_msg = (struct LookupNameMessage *) message;
+ struct LookupNameMessage *ln_msg = (struct LookupNameMessage *) message;
rid = ntohl (ln_msg->gns_header.r_id);
name_len = ntohl (ln_msg->name_len);
type = ntohl (ln_msg->record_type);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
-static void handle_record_put (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
+static void
+handle_record_put (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_PUT");
struct GNUNET_NAMESTORE_Client *nc;
size_t name_len;
size_t msg_size;
size_t msg_size_exp;
- char * name;
- char * rd_ser;
+ char *name;
+ char *rd_ser;
uint32_t rid = 0;
uint32_t rd_ser_len;
uint32_t rd_count;
return;
}
- struct RecordPutMessage * rp_msg = (struct RecordPutMessage *) message;
+ struct RecordPutMessage *rp_msg = (struct RecordPutMessage *) message;
rid = ntohl (rp_msg->gns_header.r_id);
msg_size = ntohs (rp_msg->gns_header.header.size);
const struct GNUNET_NAMESTORE_RecordData *rd,
const struct GNUNET_CRYPTO_RsaSignature *signature)
{
- struct CreateRecordContext * crc = cls;
+ struct CreateRecordContext *crc = cls;
struct GNUNET_NAMESTORE_RecordData *rd_new = NULL;
struct GNUNET_CRYPTO_RsaSignature dummy_signature;
struct GNUNET_TIME_Absolute block_expiration;
}
-static void handle_record_create (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
+static void
+handle_record_create (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "NAMESTORE_RECORD_CREATE");
struct GNUNET_NAMESTORE_Client *nc;
return;
}
- struct RecordCreateMessage * rp_msg = (struct RecordCreateMessage *) message;
+ struct RecordCreateMessage *rp_msg = (struct RecordCreateMessage *) message;
rid = ntohl (rp_msg->gns_header.r_id);
name_len = ntohs (rp_msg->name_len);
msg_size = ntohs (message->size);
static void
handle_record_remove (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_NAMESTORE_Client *nc;
- const struct RecordRemoveMessage * rr_msg;
+ const struct RecordRemoveMessage *rr_msg;
struct RecordRemoveResponseMessage rrr_msg;
struct GNUNET_CRYPTO_RsaPrivateKey *pkey;
struct GNUNET_NAMESTORE_CryptoContainer *cc;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
struct GNUNET_CRYPTO_ShortHashCode pubkey_hash;
struct GNUNET_HashCode long_hash;
- const char * pkey_tmp;
- const char * name_tmp;
- const char * rd_ser;
+ const char *pkey_tmp;
+ const char *name_tmp;
+ const char *rd_ser;
size_t key_len;
size_t name_len;
size_t rd_ser_len;
const struct GNUNET_NAMESTORE_RecordData *rd,
const struct GNUNET_CRYPTO_RsaSignature *signature)
{
- struct ZoneToNameCtx * ztn_ctx = cls;
+ struct ZoneToNameCtx *ztn_ctx = cls;
struct ZoneToNameResponseMessage *ztnr_msg;
int16_t res = GNUNET_SYSERR;
uint16_t name_len = 0;
}
-static void handle_zone_to_name (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
+static void
+handle_zone_to_name (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_TO_NAME");
struct GNUNET_NAMESTORE_Client *nc;
/**
* Copy record, data has to be free separetely
*/
-void
+static void
copy_record (const struct GNUNET_NAMESTORE_RecordData *src, struct GNUNET_NAMESTORE_RecordData *dest)
{
};
-void zone_iteraterate_proc (void *cls,
- const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
- struct GNUNET_TIME_Absolute expire,
- const char *name,
- unsigned int rd_count,
- const struct GNUNET_NAMESTORE_RecordData *rd,
- const struct GNUNET_CRYPTO_RsaSignature *signature)
+static void
+zone_iteraterate_proc (void *cls,
+ const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key,
+ struct GNUNET_TIME_Absolute expire,
+ const char *name,
+ unsigned int rd_count,
+ const struct GNUNET_NAMESTORE_RecordData *rd,
+ const struct GNUNET_CRYPTO_RsaSignature *signature)
{
struct ZoneIterationProcResult *proc = cls;
struct GNUNET_NAMESTORE_RecordData *rd_filtered;
- struct GNUNET_CRYPTO_RsaSignature * new_signature;
+ struct GNUNET_CRYPTO_RsaSignature *new_signature;
struct GNUNET_NAMESTORE_CryptoContainer *cc;
struct GNUNET_CRYPTO_ShortHashCode hash;
struct GNUNET_HashCode long_hash;
}
-void find_next_zone_iteration_result (struct ZoneIterationProcResult *proc)
+static void
+find_next_zone_iteration_result (struct ZoneIterationProcResult *proc)
{
struct GNUNET_CRYPTO_ShortHashCode *zone;
}
-void send_zone_iteration_result (struct ZoneIterationProcResult *proc)
+static void
+send_zone_iteration_result (struct ZoneIterationProcResult *proc)
{
struct GNUNET_NAMESTORE_ZoneIteration *zi = proc->zi;
}
}
-void clean_up_zone_iteration_result (struct ZoneIterationProcResult *proc)
+static void
+clean_up_zone_iteration_result (struct ZoneIterationProcResult *proc)
{
int c;
GNUNET_free_non_null (proc->name);
proc->rd = NULL;
}
-static void handle_iteration_start (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
+static void
+handle_iteration_start (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_ITERATION_START");
- struct ZoneIterationStartMessage * zis_msg = (struct ZoneIterationStartMessage *) message;
+ struct ZoneIterationStartMessage *zis_msg = (struct ZoneIterationStartMessage *) message;
struct GNUNET_NAMESTORE_Client *nc;
struct GNUNET_NAMESTORE_ZoneIteration *zi;
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
-static void handle_iteration_stop (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
+static void
+handle_iteration_stop (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_ITERATION_STOP");
struct GNUNET_NAMESTORE_Client *nc;
struct GNUNET_NAMESTORE_ZoneIteration *zi;
- struct ZoneIterationStopMessage * zis_msg = (struct ZoneIterationStopMessage *) message;
+ struct ZoneIterationStopMessage *zis_msg = (struct ZoneIterationStopMessage *) message;
uint32_t rid;
nc = client_lookup(client);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
-static void handle_iteration_next (void *cls,
- struct GNUNET_SERVER_Client * client,
- const struct GNUNET_MessageHeader * message)
+static void
+handle_iteration_next (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "ZONE_ITERATION_NEXT");
struct GNUNET_NAMESTORE_Client *nc;
struct GNUNET_NAMESTORE_ZoneIteration *zi;
- struct ZoneIterationStopMessage * zis_msg = (struct ZoneIterationStopMessage *) message;
+ struct ZoneIterationStopMessage *zis_msg = (struct ZoneIterationStopMessage *) message;
uint32_t rid;
nc = client_lookup(client);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
-int zonekey_file_it (void *cls, const char *filename)
+static int
+zonekey_file_it (void *cls, const char *filename)
{
struct GNUNET_HashCode long_hash;
int *counter = cls;
if ((filename != NULL) && (NULL != strstr(filename, ".zkey")))
{
- struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
+ struct GNUNET_CRYPTO_RsaPrivateKey *privkey;
struct GNUNET_NAMESTORE_CryptoContainer *c;
privkey = GNUNET_CRYPTO_rsa_key_create_from_file(filename);
if (privkey == NULL)
run (void *cls, struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- char * database;
+ char *database;
int counter = 0;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting namestore service\n");