/**
* The task handle
*/
- struct GNUNET_SCHEDULER_Task * task;
+ struct GNUNET_SCHEDULER_Task *task;
/**
* The id of the operation which is resposible for this context
struct RemotePeer2Context
{
/**
- * Controller of peer 2; If OCC_TYPE_REMOTE_LATERAL is the type of overlay
+ * Controller of peer 2; If #OCC_TYPE_REMOTE_LATERAL is the type of overlay
* connection then this can be NULL until the connection to the controller is
* established
*/
/**
* Notification handle acquire to connect to a remote controller. Only used
- * if the type of overlay connection is OCC_TYPE_REMOTE_LATERAL.
+ * if the type of overlay connection is #OCC_TYPE_REMOTE_LATERAL.
*/
struct NeighbourConnectNotification *ncn;
* The id of the task for sending HELLO of peer 2 to peer 1 and ask peer 1 to
* connect to peer 2
*/
- struct GNUNET_SCHEDULER_Task * send_hello_task;
+ struct GNUNET_SCHEDULER_Task *send_hello_task;
/**
* The id of the overlay connect timeout task
*/
- struct GNUNET_SCHEDULER_Task * timeout_task;
+ struct GNUNET_SCHEDULER_Task *timeout_task;
/**
* The id of the cleanup task
*/
- struct GNUNET_SCHEDULER_Task * cleanup_task;
+ struct GNUNET_SCHEDULER_Task *cleanup_task;
/**
* The type of this context information
/**
* Task for offering HELLO of A to B and doing try_connect
*/
- struct GNUNET_SCHEDULER_Task * attempt_connect_task_id;
+ struct GNUNET_SCHEDULER_Task *attempt_connect_task_id;
/**
* Task to timeout RequestOverlayConnect
*/
- struct GNUNET_SCHEDULER_Task * timeout_rocc_task_id;
+ struct GNUNET_SCHEDULER_Task *timeout_rocc_task_id;
/**
* The id of the operation responsible for creating this context
* @param tc the TaskContext from scheduler
*/
static void
-send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_hello (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct OverlayConnectContext *occ = cls;
struct LocalPeer2Context *lp2c;
* @param ignore_ peer identity which is ignored in this callback
*/
static void
-p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch,
+p2_transport_connect_cache_callback (void *cls,
+ struct GNUNET_CORE_Handle *ch,
struct GNUNET_TRANSPORT_Handle *th,
const struct GNUNET_PeerIdentity *ignore_)
{
GNUNET_assert (OCC_TYPE_LOCAL == occ->type);
if (NULL == th)
{
- GNUNET_asprintf (&occ->emsg, "0x%llx: Cannot connect to TRANSPORT of %s",
+ GNUNET_asprintf (&occ->emsg,
+ "0x%llx: Cannot connect to TRANSPORT of %s",
occ->op_id, GNUNET_i2s (&occ->other_peer_identity));
GNUNET_SCHEDULER_cancel (occ->timeout_task);
occ->timeout_task =
return;
}
occ->p2ctx.local.tcc.th_ = th;
- GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while offering HELLO to %s",
- occ->op_id, GNUNET_i2s (&occ->other_peer_identity));
+ GNUNET_asprintf (&occ->emsg,
+ "0x%llx: Timeout while offering HELLO to %s",
+ occ->op_id,
+ GNUNET_i2s (&occ->other_peer_identity));
occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ);
}
occ, NULL, NULL, NULL);
return;
}
- GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while offering HELLO to %s",
- occ->op_id, GNUNET_i2s (&occ->other_peer_identity));
+ GNUNET_asprintf (&occ->emsg,
+ "0x%llx: Timeout while offering HELLO to %s",
+ occ->op_id,
+ GNUNET_i2s (&occ->other_peer_identity));
occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ);
}
* @return
*/
static int
-test_address (void *cls, const struct GNUNET_HELLO_Address *address,
+test_address (void *cls,
+ const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
int *empty = cls;
* @param hello our updated HELLO
*/
static void
-hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello)
+hello_update_cb (void *cls,
+ const struct GNUNET_MessageHeader *hello)
{
struct OverlayConnectContext *occ = cls;
int empty;
msize = ntohs (hello->size);
empty = GNUNET_YES;
(void) GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message *)
- hello, GNUNET_NO, &test_address,
+ hello, GNUNET_NO,
+ &test_address,
&empty);
if (GNUNET_YES == empty)
{
- LOG_DEBUG ("0x%llx: HELLO of %s is empty\n", occ->op_id,
+ LOG_DEBUG ("0x%llx: HELLO of %s is empty\n",
+ occ->op_id,
GNUNET_i2s (&occ->peer_identity));
return;
}
- LOG_DEBUG ("0x%llx: Received HELLO of %s\n", occ->op_id,
+ LOG_DEBUG ("0x%llx: Received HELLO of %s\n",
+ occ->op_id,
GNUNET_i2s (&occ->peer_identity));
occ->hello = GNUNET_malloc (msize);
GST_cache_add_hello (occ->peer->id, hello);
occ->emsg = NULL;
if (NULL == th)
{
- GNUNET_asprintf (&occ->emsg, "0x%llx: Cannot connect to TRANSPORT of %s",
- occ->op_id, GNUNET_i2s (&occ->peer_identity));
+ GNUNET_asprintf (&occ->emsg,
+ "0x%llx: Cannot connect to TRANSPORT of %s",
+ occ->op_id,
+ GNUNET_i2s (&occ->peer_identity));
GNUNET_SCHEDULER_cancel (occ->timeout_task);
occ->timeout_task =
GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
GNUNET_assert (NULL != occ->cgh_p1th);
occ->p1th_ = th;
GNUNET_asprintf (&occ->emsg,
- "0x%llx: Timeout while acquiring HELLO of peer %4s",
- occ->op_id, GNUNET_i2s (&occ->peer_identity));
- occ->ghh = GNUNET_TRANSPORT_get_hello (occ->p1th_, &hello_update_cb, occ);
+ "0x%llx: Timeout while acquiring HELLO of peer %s",
+ occ->op_id,
+ GNUNET_i2s (&occ->peer_identity));
+ occ->ghh = GNUNET_TRANSPORT_get_hello (occ->p1th_,
+ &hello_update_cb,
+ occ);
}
* @param my_identity the identity of our peer
*/
static void
-occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch,
+occ_cache_get_handle_core_cb (void *cls,
+ struct GNUNET_CORE_Handle *ch,
struct GNUNET_TRANSPORT_Handle *th,
const struct GNUNET_PeerIdentity *my_identity)
{
{
GNUNET_asprintf (&occ->emsg,
"0x%llx: Failed to connect to CORE of peer with "
- "id: %u", occ->op_id, occ->peer->id);
+ "id: %u",
+ occ->op_id,
+ occ->peer->id);
GNUNET_SCHEDULER_cancel (occ->timeout_task);
occ->timeout_task =
GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
}
memcpy (&occ->peer_identity, my_identity,
sizeof (struct GNUNET_PeerIdentity));
- LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n", occ->op_id,
+ LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n",
+ occ->op_id,
GNUNET_i2s (&occ->peer_identity));
/* Lookup for HELLO in hello cache */
if (NULL != (hello = GST_cache_lookup_hello (occ->peer->id)))
* @param msg the peer create success message
*/
static void
-overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg)
+overlay_connect_get_config (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
struct OverlayConnectContext *occ = cls;
struct RemotePeer2Context *rp2c;
}
cmsg =
(const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg;
- memcpy (&occ->other_peer_identity, &cmsg->peer_identity,
- sizeof (struct GNUNET_PeerIdentity));
+ occ->other_peer_identity = cmsg->peer_identity;
GNUNET_free_non_null (occ->emsg);
GNUNET_asprintf (&occ->emsg,
"0x%llx: Timeout while connecting to CORE of peer with "
- "id: %u", occ->op_id, occ->peer->id);
+ "id: %u",
+ occ->op_id,
+ occ->peer->id);
occ->cgh_ch =
GST_connection_pool_get_handle (occ->peer->id,
occ->peer->details.local.cfg,
GST_CONNECTIONPOOL_SERVICE_CORE,
- occ_cache_get_handle_core_cb, occ,
+ occ_cache_get_handle_core_cb,
+ occ,
&occ->other_peer_identity,
- &overlay_connect_notify, occ);
+ &overlay_connect_notify,
+ occ);
return;
}
* @param cls pointer 2 pointer of RegisteredHostContext
* @param key current key code
* @param value value in the hash map
- * @return GNUNET_YES if we should continue to
+ * @return #GNUNET_YES if we should continue to
* iterate,
- * GNUNET_NO if not.
+ * #GNUNET_NO if not.
*/
static int
-reghost_match_iterator (void *cls, const struct GNUNET_HashCode *key,
+reghost_match_iterator (void *cls,
+ const struct GNUNET_HashCode *key,
void *value)
{
struct RegisteredHostContext **rh = cls;
* @param c handle to the controller connection
*/
static void
-p2_controller_connect_cb (void *cls, struct GNUNET_TESTBED_Controller *c)
+p2_controller_connect_cb (void *cls,
+ struct GNUNET_TESTBED_Controller *c)
{
struct OverlayConnectContext *occ = cls;
struct RemotePeer2Context *rp2c;
GNUNET_free_non_null (occ->emsg);
GNUNET_asprintf (&occ->emsg,
"0x%llx: Timeout while getting peer identity of peer "
- "with id: %u", occ->op_id, occ->other_peer_id);
+ "with id: %u",
+ occ->op_id,
+ occ->other_peer_id);
}
/**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT messages
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT messages
*
* @param cls NULL
* @param client identification of the client
* @param message the actual message
*/
void
-GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
+GST_handle_overlay_connect (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_OverlayConnectMessage *msg;
peer = GST_peer_list[p1];
operation_id = GNUNET_ntohll (msg->operation_id);
LOG_DEBUG
- ("Received overlay connect for peers %u and %u with op id: 0x%llx\n", p1,
- p2, operation_id);
+ ("Received overlay connect for peers %u and %u with op id: 0x%llx\n",
+ p1,
+ p2,
+ operation_id);
peer2_host_id = ntohl (msg->peer2_host_id);
if (GNUNET_YES == peer->is_remote)
{
- if (!VALID_HOST_ID (peer2_host_id))
+ if (! VALID_HOST_ID (peer2_host_id))
{
GNUNET_break (0);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
return;
}
forward_overlay_connect (msg, client);
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_OK);
return;
}
p2n = NULL;
LOG (GNUNET_ERROR_TYPE_WARNING,
"0x%llx: Peer %u's host not in our neighbours list\n",
operation_id, p2);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
GNUNET_free (occ);
return;
}
occ->type = OCC_TYPE_REMOTE_SLAVE;
occ->p2ctx.remote.p2c = GST_peer_list[p2]->details.remote.slave->controller;
}
- GNUNET_CONTAINER_DLL_insert_tail (occq_head, occq_tail, occ);
+ GNUNET_CONTAINER_DLL_insert_tail (occq_head,
+ occq_tail,
+ occ);
GNUNET_SERVER_client_keep (client);
occ->client = client;
occ->other_peer_id = p2;
occ->op_id = operation_id;
GNUNET_assert (NULL == occ->timeout_task);
occ->timeout_task =
- GNUNET_SCHEDULER_add_delayed (GST_timeout, &timeout_overlay_connect, occ);
+ GNUNET_SCHEDULER_add_delayed (GST_timeout,
+ &timeout_overlay_connect,
+ occ);
switch (occ->type)
{
case OCC_TYPE_REMOTE_LATERAL:
GNUNET_asprintf (&occ->emsg,
"0x%llx: Timeout while acquiring connection to peer %u's "
- "host: %u\n", occ->op_id, occ->other_peer_id, peer2_host_id);
+ "host: %u\n",
+ occ->op_id,
+ occ->other_peer_id,
+ peer2_host_id);
occ->p2ctx.remote.ncn =
GST_neighbour_get_connection (p2n, &p2_controller_connect_cb, occ);
break;
&occ->other_peer_identity);
GNUNET_asprintf (&occ->emsg,
"0x%llx: Timeout while connecting to CORE of peer with "
- "id: %u", occ->op_id, occ->peer->id);
+ "id: %u",
+ occ->op_id,
+ occ->peer->id);
occ->cgh_ch =
GST_connection_pool_get_handle (occ->peer->id,
occ->peer->details.local.cfg,
* @param tc the TaskContext from scheduler
*/
static void
-timeout_rocc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_rocc_task (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct RemoteOverlayConnectCtx *rocc = cls;
GNUNET_assert (rocc->timeout_rocc_task_id != NULL);
rocc->timeout_rocc_task_id = NULL;
- LOG_DEBUG ("0x%llx: rocc timed out\n", rocc->op_id);
+ LOG_DEBUG ("0x%llx: rocc timed out\n",
+ rocc->op_id);
cleanup_rocc (rocc);
}
{
struct RemoteOverlayConnectCtx *rocc = cls;
- LOG_DEBUG ("0x%llx: Request Overlay connect notify\n", rocc->op_id);
+ LOG_DEBUG ("0x%llx: Request Overlay connect notify\n",
+ rocc->op_id);
GNUNET_assert (0 ==
memcmp (new_peer, &rocc->a_id,
sizeof (struct GNUNET_PeerIdentity)));
- LOG_DEBUG ("0x%llx: Peer %4s connected\n", rocc->op_id,
+ LOG_DEBUG ("0x%llx: Peer %4s connected\n",
+ rocc->op_id,
GNUNET_i2s (&rocc->a_id));
cleanup_rocc (rocc);
}
* @param tc the TaskContext from scheduler
*/
static void
-attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+attempt_connect_task (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc);
/**
*
* @param cls the overlay connect context
* @param tc the scheduler task context; if tc->reason =
- * GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
- * GNUNET_SCHEDULER_REASON_READ_READY is succeeded
+ * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
+ * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
*/
static void
rocc_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_, rocc->tcc.pid))
{
LOG_DEBUG ("0x%llx: Target peer %4s already connected to local peer: %u\n",
- rocc->op_id, GNUNET_i2s (&rocc->a_id), rocc->peer->id);
+ rocc->op_id,
+ GNUNET_i2s (&rocc->a_id),
+ rocc->peer->id);
cleanup_rocc (rocc);
return;
}
/**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT messages
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_REQUEST_CONNECT messages
*
* @param cls NULL
* @param client identification of the client
GNUNET_TESTING_peer_get_identity (peer->details.local.peer, &pid);
(void) strncpy (pid_str, GNUNET_i2s (&pid), 15);
LOG_DEBUG ("0x%llx: Remote overlay connect %4s to peer %4s with hello size: %u\n",
- rocc->op_id, pid_str, GNUNET_i2s (&rocc->a_id), hsize);
+ rocc->op_id,
+ pid_str,
+ GNUNET_i2s (&rocc->a_id),
+ hsize);
rocc->peer = peer;
rocc->peer->reference_cnt++;
rocc->hello = GNUNET_malloc (hsize);
&cache_transport_peer_connect_notify,
rocc);
rocc->timeout_rocc_task_id =
- GNUNET_SCHEDULER_add_delayed (GST_timeout, &timeout_rocc_task, rocc);
+ GNUNET_SCHEDULER_add_delayed (GST_timeout,
+ &timeout_rocc_task,
+ rocc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
/**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS message from
* controller (testbed service)
*
* @param c the controller handle
* @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
* not
*/
static int
/**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT message from
* controller (testbed service)
*
* @param c the controller handler
* @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
* not
*/
static int
/**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT message from
* controller (testbed service)
*
* @param c the controller handler
* @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
* not
*/
static int
/**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG message from
* controller (testbed service)
*
* @param c the controller handler
/**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT message from
* controller (testbed service)
*
* @param c the controller handler
* @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
* not
*/
static int
/**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
* (testbed service)
*
* @param c the controller handler
* @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
* not
*/
static int
/**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
* (testbed service)
*
* @param c the controller handler
* @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
* not
*/
static int
* @param c handle to controller to stop
*/
void
-GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller
- *c)
+GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller *c)
{
struct MessageQueue *mq_entry;
/**
* Generates configuration by uncompressing configuration in given message. The
* given message should be of the following types:
- * GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION,
- * GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION,
- * GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST,
- * GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS,
- * GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT,
*
* @param msg the message containing compressed configuration
* @return handle to the parsed configuration; NULL upon error while parsing the message
* The type of this context
*/
enum {
-
+
/**
* Type for underlay topology
*/
TOPOLOGYCONTEXT_TYPE_UNDERLAY = 0,
-
+
/**
* Type for overlay topology
*/
{
struct TopologyContextOverlay *overlay;
struct OverlayLink *olink;
-
+
overlay = &tc->u.overlay;
GNUNET_assert (offset < tc->link_array_size);
olink = &overlay->link_array[offset];
{
struct TopologyContextUnderlay *underlay;
struct UnderlayLink *ulink;
-
+
underlay = &tc->u.underlay;
GNUNET_assert (offset < tc->link_array_size);
ulink = &underlay->link_array[offset];
case TOPOLOGYCONTEXT_TYPE_OVERLAY:
{
struct TopologyContextOverlay *overlay;
-
+
overlay = &tc->u.overlay;
overlay->link_array =
GNUNET_malloc (sizeof (struct OverlayLink) * tc->link_array_size);
case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
{
struct TopologyContextUnderlay *underlay;
-
+
underlay = &tc->u.underlay;
underlay->link_array =
GNUNET_malloc (sizeof (struct UnderlayLink) * tc->link_array_size);
case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
{
struct TopologyContextUnderlay *underlay;
-
+
underlay = &tc->u.underlay;
underlay->link_array =
GNUNET_realloc (underlay->link_array, sizeof (struct UnderlayLink) *
case TOPOLOGYCONTEXT_TYPE_OVERLAY:
{
struct TopologyContextOverlay *overlay;
-
+
overlay = &tc->u.overlay;
overlay->link_array =
GNUNET_malloc (sizeof (struct OverlayLink) * tc->link_array_size);
*
* @param tc the topology context
* @param links the number of random links to establish
- * @param append GNUNET_YES to add links to existing link array; GNUNET_NO to
+ * @param append #GNUNET_YES to add links to existing link array; #GNUNET_NO to
* create a new link array
*/
static void
-gen_topo_random (struct TopologyContext *tc, unsigned int links, int append)
+gen_topo_random (struct TopologyContext *tc,
+ unsigned int links,
+ int append)
{
unsigned int cnt;
unsigned int index;
* network
*/
static void
-gen_topo_scale_free (struct TopologyContext *tc, uint16_t cap, uint8_t m)
+gen_topo_scale_free (struct TopologyContext *tc,
+ uint16_t cap,
+ uint8_t m)
{
unsigned int *deg;
unsigned int *etab;
case TOPOLOGYCONTEXT_TYPE_OVERLAY:
{
struct TopologyContextOverlay *overlay;
-
+
overlay = &tc->u.overlay;
- overlay->link_array =
+ overlay->link_array =
GNUNET_realloc (overlay->link_array, sizeof (struct OverlayLink) * tc->link_array_size);
}
break;
* @param filename the filename of the file containing topology data
*/
static void
-gen_topo_from_file (struct TopologyContext *tc, const char *filename)
+gen_topo_from_file (struct TopologyContext *tc,
+ const char *filename)
{
char *data;
char *end;
status = GNUNET_SYSERR;
if (GNUNET_YES != GNUNET_DISK_file_test (filename))
{
- LOG (GNUNET_ERROR_TYPE_ERROR, _("Topology file %s not found\n"), filename);
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Topology file %s not found\n"),
+ filename);
return;
}
if (GNUNET_OK !=
GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
{
- LOG (GNUNET_ERROR_TYPE_ERROR, _("Topology file %s has no data\n"),
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Topology file %s has no data\n"),
filename);
return;
}
data = GNUNET_malloc (fs);
if (fs != GNUNET_DISK_fn_read (filename, data, fs))
{
- LOG (GNUNET_ERROR_TYPE_ERROR, _("Topology file %s cannot be read\n"),
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Topology file %s cannot be read\n"),
filename);
goto _exit;
}
case TOPOLOGYCONTEXT_TYPE_OVERLAY:
{
struct TopologyContextOverlay *overlay;
-
+
overlay = &tc->u.overlay;
- overlay->link_array =
+ overlay->link_array =
GNUNET_realloc (overlay->link_array,
sizeof (struct OverlayLink) * tc->link_array_size);
}
case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
{
struct TopologyContextUnderlay *underlay;
-
+
underlay = &tc->u.underlay;
underlay->link_array =
GNUNET_realloc (underlay->link_array,
}
else
LOG (GNUNET_ERROR_TYPE_WARNING,
- _("Ignoring to connect peer %u to peer %u\n"), peer_id,
+ _("Ignoring to connect peer %u to peer %u\n"),
+ peer_id,
other_peer_id);
while (('\n' != data[offset]) && ('|' != data[offset]) && (offset < fs))
offset++;
GNUNET_free (data);
if (GNUNET_OK != status)
{
- LOG (GNUNET_ERROR_TYPE_WARNING, "Removing link data read from the file\n");
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Removing link data read from the file\n");
tc->link_array_size = 0;
switch (tc->type)
{
case TOPOLOGYCONTEXT_TYPE_OVERLAY:
{
struct TopologyContextOverlay *overlay;
-
+
overlay = &tc->u.overlay;
GNUNET_free_non_null (overlay->link_array);
overlay->link_array = NULL;
case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
{
struct TopologyContextUnderlay *underlay;
-
+
underlay = &tc->u.underlay;
GNUNET_free_non_null (underlay->link_array);
underlay->link_array = NULL;
unsigned int cnt;
unsigned int offset;
unsigned int neighbour;
-
+
tc->link_array_size = tc->num_peers * (tc->num_peers - 1);
switch (tc->type)
{
struct TopologyContextOverlay *overlay;
overlay = &tc->u.overlay;
- overlay->link_array = GNUNET_malloc (sizeof (struct OverlayLink) *
- tc->link_array_size);
+ overlay->link_array = GNUNET_new_array (tc->link_array_size,
+ struct OverlayLink);
}
break;
case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
struct TopologyContextUnderlay *underlay;
underlay = &tc->u.underlay;
- underlay->link_array = GNUNET_malloc (sizeof (struct UnderlayLink) *
- tc->link_array_size);
+ underlay->link_array = GNUNET_new_array (tc->link_array_size,
+ struct UnderlayLink);
}
}
offset = 0;
* Configure overall network topology to have a particular shape.
*
* @param op_cls closure argument to give with the operation event
- * @param num_peers number of peers in 'peers'
- * @param peers array of 'num_peers' with the peers to configure
+ * @param num_peers number of peers in @a peers
+ * @param peers array of @a num_peers with the peers to configure
* @param topo desired underlay topology to use
* @param ap topology-specific options
* @return handle to the operation, NULL if configuring the topology
* Configure overall network topology to have a particular shape.
*
* @param op_cls closure argument to give with the operation event
- * @param num_peers number of peers in 'peers'
- * @param peers array of 'num_peers' with the peers to configure
+ * @param num_peers number of peers in @a peers
+ * @param peers array of @a num_peers with the peers to configure
* @param topo desired underlay topology to use
* @param ... topology-specific options
* @return handle to the operation, NULL if configuring the topology
*
* @param op_cls closure argument to give with the peer connect operation events
* generated through this function
- * @param num_peers number of peers in 'peers'
- * @param peers array of 'num_peers' with the peers to configure
+ * @param num_peers number of peers in @a peers
+ * @param peers array of @a num_peers with the peers to configure
* @param max_connections the maximums number of overlay connections that will
* be made to achieve the given topology
* @param comp_cb the completion callback to call when the topology generation
GNUNET_TESTBED_operation_queue_insert_
(c->opq_parallel_topology_config_operations, op);
GNUNET_TESTBED_operation_begin_wait_ (op);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Generated %u connections\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Generated %u connections\n",
tc->link_array_size);
if (NULL != max_connections)
*max_connections = tc->link_array_size;
* @param topology where to write the retrieved topology
* @param topology_string The string to attempt to
* get a configuration value from
- * @return GNUNET_YES if topology string matched a
- * known topology, GNUNET_NO if not
+ * @return #GNUNET_YES if topology string matched a
+ * known topology, #GNUNET_NO if not
*/
int
GNUNET_TESTBED_topology_get_ (enum GNUNET_TESTBED_TopologyOption *topology,
* generated
* @param proc the underlay link processor callback. Will be called for each
* underlay link generated unless a previous call to this callback
- * returned GNUNET_SYSERR. Cannot be NULL.
- * @param cls closure for proc
+ * returned #GNUNET_SYSERR. Cannot be NULL.
+ * @param cls closure for @a proc
* @param ... variable arguments denoting the topology and its parameters. They
* should start with the type of topology to generate followed by their
* options.
- * @return GNUNET_OK if underlay link generation is successful; GNUNET_SYSERR
+ * @return #GNUNET_OK if underlay link generation is successful; #GNUNET_SYSERR
* upon error in generating the underlay or if any calls to the
- * underlay link processor returned GNUNET_SYSERR
+ * underlay link processor returned #GNUNET_SYSERR
*/
int
GNUNET_TESTBED_underlay_construct_ (int num_peers,
enum GNUNET_TESTBED_TopologyOption topology;
unsigned int cnt;
int ret;
-
+
GNUNET_assert (NULL != proc);
ret = GNUNET_OK;
memset (&tc, 0, sizeof (tc));