* Return the name of the directory in which we store
* our local namespaces (or rather, their public keys).
*
- * @param h global fs handle
+ * @param h global fs handle
* @return NULL on error, otherwise the name of the directory
*/
static char *
char *dn;
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_filename (h->cfg,
- "FS", "IDENTITY_DIR", &dn))
+ GNUNET_CONFIGURATION_get_value_filename (h->cfg, "FS", "IDENTITY_DIR",
+ &dn))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Configuration fails to specify `%s' in section `%s'\n"),
* Return the name of the directory in which we store
* the update information graph for the given local namespace.
*
- * @param ns namespace handle
+ * @param ns namespace handle
* @return NULL on error, otherwise the name of the directory
*/
static char *
char *ret;
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_filename (ns->h->cfg,
- "FS", "UPDATE_DIR", &dn))
+ GNUNET_CONFIGURATION_get_value_filename (ns->h->cfg, "FS", "UPDATE_DIR",
+ &dn))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Configuration fails to specify `%s' in section `%s'\n"),
/**
* Write the namespace update node graph to a file.
- *
+ *
* @param ns namespace to dump
*/
static void
{
n = ns->update_nodes[i];
uris = GNUNET_FS_uri_to_string (n->uri);
- if ((GNUNET_OK !=
- GNUNET_BIO_write_string (wh, n->id)) ||
- (GNUNET_OK !=
- GNUNET_BIO_write_meta_data (wh, n->md)) ||
- (GNUNET_OK !=
- GNUNET_BIO_write_string (wh, n->update)) ||
+ if ((GNUNET_OK != GNUNET_BIO_write_string (wh, n->id)) ||
+ (GNUNET_OK != GNUNET_BIO_write_meta_data (wh, n->md)) ||
+ (GNUNET_OK != GNUNET_BIO_write_string (wh, n->update)) ||
(GNUNET_OK != GNUNET_BIO_write_string (wh, uris)))
{
GNUNET_free (uris);
}
END:
if (GNUNET_OK != GNUNET_BIO_write_close (wh))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to write `%s': %s\n"), STRERROR (errno));
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to write `%s': %s\n"),
+ STRERROR (errno));
GNUNET_free (fn);
}
/**
* Read the namespace update node graph from a file.
- *
+ *
* @param ns namespace to read
*/
static void
for (i = 0; i < count; i++)
{
n = GNUNET_malloc (sizeof (struct NamespaceUpdateNode));
- if ((GNUNET_OK !=
- GNUNET_BIO_read_string (rh, "identifier", &n->id, 1024)) ||
- (GNUNET_OK !=
- GNUNET_BIO_read_meta_data (rh, "meta", &n->md)) ||
+ if ((GNUNET_OK != GNUNET_BIO_read_string (rh, "identifier", &n->id, 1024))
+ || (GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "meta", &n->md)) ||
(GNUNET_OK !=
GNUNET_BIO_read_string (rh, "update-id", &n->update, 1024)) ||
(GNUNET_OK != GNUNET_BIO_read_string (rh, "uri", &uris, 1024 * 2)))
/**
* Disconnect from the datastore.
- *
+ *
* @param cls datastore handle
* @param tc scheduler context
*/
if (GNUNET_OK != success)
{
/* error! */
- GNUNET_SCHEDULER_add_continuation (&do_disconnect,
- ac->dsh,
+ GNUNET_SCHEDULER_add_continuation (&do_disconnect, ac->dsh,
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
if (msg == NULL)
{
if (ac->pos == ac->ksk_uri->data.ksk.keywordCount)
{
/* done! */
- GNUNET_SCHEDULER_add_continuation (&do_disconnect,
- ac->dsh,
+ GNUNET_SCHEDULER_add_continuation (&do_disconnect, ac->dsh,
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
if (ac->cont != NULL)
ac->cont (ac->cont_cls, ac->ksk_uri, NULL);
GNUNET_CRYPTO_hash_to_aes_key (&key, &skey, &iv);
GNUNET_CRYPTO_aes_encrypt (ac->pt, ac->pt_size, &skey, &iv, &ac->nb[1]);
GNUNET_break (GNUNET_OK ==
- GNUNET_CRYPTO_rsa_sign (ac->ns->key,
- &ac->nb->ns_purpose,
+ GNUNET_CRYPTO_rsa_sign (ac->ns->key, &ac->nb->ns_purpose,
&ac->nb->ns_signature));
pk = GNUNET_CRYPTO_rsa_key_create_from_hash (&key);
GNUNET_assert (pk != NULL);
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&query);
GNUNET_break (GNUNET_OK ==
- GNUNET_CRYPTO_rsa_sign (pk,
- &ac->nb->ksk_purpose,
+ GNUNET_CRYPTO_rsa_sign (pk, &ac->nb->ksk_purpose,
&ac->nb->ksk_signature));
GNUNET_CRYPTO_rsa_key_free (pk);
GNUNET_DATASTORE_put (ac->dsh, 0 /* no reservation */ ,
- &query,
- ac->pt_size + sizeof (struct NBlock),
- ac->nb,
- GNUNET_BLOCK_TYPE_FS_NBLOCK,
- ac->bo.content_priority,
- ac->bo.anonymity_level,
- ac->bo.replication_level,
- ac->bo.expiration_time,
- -2, 1,
- GNUNET_CONSTANTS_SERVICE_TIMEOUT,
- &advertisement_cont, ac);
+ &query, ac->pt_size + sizeof (struct NBlock), ac->nb,
+ GNUNET_BLOCK_TYPE_FS_NBLOCK, ac->bo.content_priority,
+ ac->bo.anonymity_level, ac->bo.replication_level,
+ ac->bo.expiration_time, -2, 1,
+ GNUNET_CONSTANTS_SERVICE_TIMEOUT, &advertisement_cont,
+ ac);
}
/**
- * Publish an advertismement for a namespace.
+ * Publish an advertismement for a namespace.
*
* @param h handle to the file sharing subsystem
* @param ksk_uri keywords to use for advertisment
pt = GNUNET_malloc (mdsize + reslen);
memcpy (pt, rootEntry, reslen);
mdst = &pt[reslen];
- mdsize = GNUNET_CONTAINER_meta_data_serialize (meta,
- &mdst,
- mdsize,
- GNUNET_CONTAINER_META_DATA_SERIALIZE_PART);
+ mdsize =
+ GNUNET_CONTAINER_meta_data_serialize (meta, &mdst, mdsize,
+ GNUNET_CONTAINER_META_DATA_SERIALIZE_PART);
if (mdsize == -1)
{
GNUNET_break (0);
size = mdsize + sizeof (struct NBlock) + reslen;
nb = GNUNET_malloc (size);
GNUNET_CRYPTO_rsa_key_get_public (namespace->key, &nb->subspace);
- nb->ns_purpose.size = htonl (mdsize + reslen +
- sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose)
- +
- sizeof (struct
- GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
+ nb->ns_purpose.size =
+ htonl (mdsize + reslen +
+ sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) +
+ sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
nb->ns_purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK);
nb->ksk_purpose.size =
htonl (size - sizeof (struct GNUNET_CRYPTO_RsaSignature));
if (freeze)
{
if (0 != UNLINK (namespace->filename))
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
- "unlink", namespace->filename);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "unlink",
+ namespace->filename);
}
if (0 == namespace->rc)
{
GNUNET_free (nsn->update);
GNUNET_free (nsn);
}
- GNUNET_array_grow (namespace->update_nodes,
- namespace->update_node_count, 0);
+ GNUNET_array_grow (namespace->update_nodes, namespace->update_node_count,
+ 0);
if (namespace->update_map != NULL)
GNUNET_CONTAINER_multihashmap_destroy (namespace->update_map);
GNUNET_free (namespace);
if (psc->namespace->update_map != NULL)
{
GNUNET_CRYPTO_hash (psc->nsn->id, strlen (psc->nsn->id), &hc);
- GNUNET_CONTAINER_multihashmap_put (psc->namespace->update_map,
- &hc,
+ GNUNET_CONTAINER_multihashmap_put (psc->namespace->update_map, &hc,
psc->nsn,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
}
void
GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
struct GNUNET_FS_Namespace *namespace,
- const char *identifier,
- const char *update,
+ const char *identifier, const char *update,
const struct GNUNET_CONTAINER_MetaData *meta,
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_FS_BlockOptions *bo,
memcpy (dest, uris, slen);
GNUNET_free (uris);
dest += slen;
- mdsize = GNUNET_CONTAINER_meta_data_serialize (mmeta,
- &dest,
- mdsize,
- GNUNET_CONTAINER_META_DATA_SERIALIZE_PART);
+ mdsize =
+ GNUNET_CONTAINER_meta_data_serialize (mmeta, &dest, mdsize,
+ GNUNET_CONTAINER_META_DATA_SERIALIZE_PART);
GNUNET_CONTAINER_meta_data_destroy (mmeta);
if (mdsize == -1)
{
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&sks_uri->data.sks.namespace);
sks_uri->data.sks.identifier = GNUNET_strdup (identifier);
- GNUNET_CRYPTO_hash_xor (&id,
- &sks_uri->data.sks.namespace, &sb_enc->identifier);
+ GNUNET_CRYPTO_hash_xor (&id, &sks_uri->data.sks.namespace,
+ &sb_enc->identifier);
GNUNET_CRYPTO_hash_to_aes_key (&key, &sk, &iv);
- GNUNET_CRYPTO_aes_encrypt (&sb[1],
- size - sizeof (struct SBlock),
- &sk, &iv, &sb_enc[1]);
+ GNUNET_CRYPTO_aes_encrypt (&sb[1], size - sizeof (struct SBlock), &sk, &iv,
+ &sb_enc[1]);
sb_enc->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK);
- sb_enc->purpose.size = htonl (slen + mdsize + nidlen
- + sizeof (struct SBlock)
- - sizeof (struct GNUNET_CRYPTO_RsaSignature));
+ sb_enc->purpose.size =
+ htonl (slen + mdsize + nidlen + sizeof (struct SBlock) -
+ sizeof (struct GNUNET_CRYPTO_RsaSignature));
GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_rsa_sign (namespace->key,
- &sb_enc->purpose, &sb_enc->signature));
+ GNUNET_CRYPTO_rsa_sign (namespace->key, &sb_enc->purpose,
+ &sb_enc->signature));
psc = GNUNET_malloc (sizeof (struct PublishSksContext));
psc->uri = sks_uri;
psc->cont = cont;
psc->nsn->md = GNUNET_CONTAINER_meta_data_duplicate (meta);
psc->nsn->uri = GNUNET_FS_uri_dup (uri);
}
- GNUNET_DATASTORE_put (psc->dsh,
- 0,
- &sb_enc->identifier,
- size,
- sb_enc,
- GNUNET_BLOCK_TYPE_FS_SBLOCK,
- bo->content_priority,
- bo->anonymity_level,
- bo->replication_level,
- bo->expiration_time,
- -2, 1,
+ GNUNET_DATASTORE_put (psc->dsh, 0, &sb_enc->identifier, size, sb_enc,
+ GNUNET_BLOCK_TYPE_FS_SBLOCK, bo->content_priority,
+ bo->anonymity_level, bo->replication_level,
+ bo->expiration_time, -2, 1,
GNUNET_CONSTANTS_SERVICE_TIMEOUT, &sb_put_cont, psc);
GNUNET_free (sb);
GNUNET_free (sb_enc);
* head of an tree if it is in the 'tree_array' under its respective
* 'tree_id'.
*
- * In short, we're trying to find the smallest number of tree to
+ * In short, we're trying to find the smallest number of tree to
* cover a directed graph.
*
* @param cls closure (of type 'struct FindTreeClosure')
return GNUNET_YES; /* circular */
GNUNET_assert (nsn->tree_id < fc->tree_array_size);
if (fc->tree_array[nsn->tree_id] != nsn)
- return GNUNET_YES; /* part of "another" (directed) TREE,
+ return GNUNET_YES; /* part of "another" (directed) TREE,
* and not root of it, end trace */
if (nsn->tree_id == fc->id)
return GNUNET_YES; /* that's our own root (can this be?) */
nsn->tree_id = UINT_MAX; /* mark as undef */
/* trace */
GNUNET_CRYPTO_hash (nsn->update, strlen (nsn->update), &hc);
- GNUNET_CONTAINER_multihashmap_get_multiple (fc->namespace->update_map,
- &hc, &find_trees, fc);
+ GNUNET_CONTAINER_multihashmap_get_multiple (fc->namespace->update_map, &hc,
+ &find_trees, fc);
}
return GNUNET_YES;
}
* produce an update. Namespace updates form a graph where each node
* has a name. Each node can have any number of URI/meta-data entries
* which can each be linked to other nodes. Cycles are possible.
- *
+ *
* Calling this function with "next_id" NULL will cause the library to
* call "ip" with a root for each strongly connected component of the
* graph (a root being a node from which all other nodes in the Tree
* are reachable).
- *
+ *
* Calling this function with "next_id" being the name of a node will
* cause the library to call "ip" with all children of the node. Note
* that cycles within the final tree are possible (including self-loops).
{
nsn = namespace->update_nodes[i];
GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc);
- GNUNET_CONTAINER_multihashmap_put (namespace->update_map,
- &hc,
- nsn,
+ GNUNET_CONTAINER_multihashmap_put (namespace->update_map, &hc, nsn,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
}
}
GNUNET_CRYPTO_hash (next_id, strlen (next_id), &hc);
pc.ip = ip;
pc.ip_cls = ip_cls;
- GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map,
- &hc, &process_update_node, &pc);
+ GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, &hc,
+ &process_update_node, &pc);
return;
}
#if DEBUG_NAMESPACE
if (nsn->nug == nug)
{
#if DEBUG_NAMESPACE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "TREE of node `%s' is %u\n", nsn->id, nsn->nug);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TREE of node `%s' is %u\n", nsn->id,
+ nsn->nug);
#endif
continue; /* already placed in TREE */
}
fc.id = UINT_MAX;
fc.nug = nug;
fc.namespace = namespace;
- GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map,
- &hc, &find_trees, &fc);
+ GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, &hc,
+ &find_trees, &fc);
if (fc.id == UINT_MAX)
{
/* start new TREE */
}
#if DEBUG_NAMESPACE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Starting new TREE %u with node `%s'\n",
- nsn->tree_id, nsn->id);
+ "Starting new TREE %u with node `%s'\n", nsn->tree_id,
+ nsn->id);
#endif
/* put all nodes with same identifier into this TREE */
GNUNET_CRYPTO_hash (nsn->id, strlen (nsn->id), &hc);
fc.id = nsn->tree_id;
fc.nug = nug;
fc.namespace = namespace;
- GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map,
- &hc, &find_trees, &fc);
+ GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, &hc,
+ &find_trees, &fc);
}
else
{
nsn->tree_id = fc.id;
}
#if DEBUG_NAMESPACE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "TREE of node `%s' is %u\n", nsn->id, fc.id);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TREE of node `%s' is %u\n", nsn->id,
+ fc.id);
#endif
}
for (i = 0; i < fc.tree_array_size; i++)
if (NULL != nsn)
{
#if DEBUG_NAMESPACE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Root of TREE %u is node `%s'\n", i, nsn->id);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Root of TREE %u is node `%s'\n", i,
+ nsn->id);
#endif
ip (ip_cls, nsn->id, nsn->uri, nsn->md, nsn->update);