From 9aaa554470dbff968c6cab7a2850a15318c1f15b Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Wed, 14 May 2014 16:50:28 +0000 Subject: - change GM (Gnunet Mesh) function prefixes for GC (Gnunet Cadet) --- src/cadet/cadet.h | 14 +- src/cadet/cadet_api.c | 14 +- src/cadet/cadet_common.c | 22 +- src/cadet/cadet_path.c | 4 +- src/cadet/gnunet-cadet.c | 2 +- src/cadet/gnunet-service-cadet.c | 20 +- src/cadet/gnunet-service-cadet_channel.c | 210 +++++++------- src/cadet/gnunet-service-cadet_channel.h | 46 +-- src/cadet/gnunet-service-cadet_connection.c | 422 ++++++++++++++-------------- src/cadet/gnunet-service-cadet_connection.h | 80 +++--- src/cadet/gnunet-service-cadet_dht.c | 38 +-- src/cadet/gnunet-service-cadet_dht.h | 16 +- src/cadet/gnunet-service-cadet_hello.c | 20 +- src/cadet/gnunet-service-cadet_hello.h | 6 +- src/cadet/gnunet-service-cadet_local.c | 46 +-- src/cadet/gnunet-service-cadet_peer.c | 262 ++++++++--------- src/cadet/gnunet-service-cadet_peer.h | 66 ++--- src/cadet/gnunet-service-cadet_tunnel.c | 360 ++++++++++++------------ src/cadet/gnunet-service-cadet_tunnel.h | 84 +++--- 19 files changed, 866 insertions(+), 866 deletions(-) diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index 757f8c501..3667647eb 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h @@ -271,7 +271,7 @@ GNUNET_NETWORK_STRUCT_END * @return String representing FWD or BCK. */ char * -GM_f2s (int fwd); +GC_f2s (int fwd); /** @@ -283,7 +283,7 @@ GM_f2s (int fwd); * @return True if bigger (arg1) has a higher value than smaller (arg 2). */ int -GM_is_pid_bigger (uint32_t bigger, uint32_t smaller); +GC_is_pid_bigger (uint32_t bigger, uint32_t smaller); /** @@ -295,7 +295,7 @@ GM_is_pid_bigger (uint32_t bigger, uint32_t smaller); * @return Highest ACK value from the two. */ uint32_t -GM_max_pid (uint32_t a, uint32_t b); +GC_max_pid (uint32_t a, uint32_t b); /** @@ -307,7 +307,7 @@ GM_max_pid (uint32_t a, uint32_t b); * @return Lowest ACK value from the two. */ uint32_t -GM_min_pid (uint32_t a, uint32_t b); +GC_min_pid (uint32_t a, uint32_t b); /** @@ -319,14 +319,14 @@ GM_min_pid (uint32_t a, uint32_t b); * @return A HashCode containing the original 256 bit hash right-padded with 0. */ const struct GNUNET_HashCode * -GM_h2hc (const struct GNUNET_CADET_Hash *id); +GC_h2hc (const struct GNUNET_CADET_Hash *id); /** * Get a string from a Cadet Hash (256 bits). * WARNING: Not reentrant (based on GNUNET_h2s). */ const char * -GM_h2s (const struct GNUNET_CADET_Hash *id); +GC_h2s (const struct GNUNET_CADET_Hash *id); /** * Convert a message type into a string to help debug @@ -339,7 +339,7 @@ GM_h2s (const struct GNUNET_CADET_Hash *id); * @return Human readable string description. */ const char * -GM_m2s (uint16_t m); +GC_m2s (uint16_t m); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index aa5c67329..bcbc33ce3 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -865,7 +865,7 @@ process_incoming_data (struct GNUNET_CADET_Handle *h, payload = (struct GNUNET_MessageHeader *) &dmsg[1]; LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on channel %s [%X]\n", - GM_f2s (ch->chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV), + GC_f2s (ch->chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV), GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)), ntohl (dmsg->id)); size = ntohs (message->size); @@ -879,7 +879,7 @@ process_incoming_data (struct GNUNET_CADET_Handle *h, } type = ntohs (payload->type); size = ntohs (payload->size); - LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %s\n", GM_m2s (type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, " payload type %s\n", GC_m2s (type)); for (i = 0; i < h->n_handlers; i++) { handler = &h->message_handlers[i]; @@ -1253,7 +1253,7 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) type = ntohs (msg->type); LOG (GNUNET_ERROR_TYPE_DEBUG, "\n"); LOG (GNUNET_ERROR_TYPE_DEBUG, "Received a message: %s\n", - GM_m2s (type)); + GC_m2s (type)); switch (type) { /* Notify of a new incoming channel */ @@ -1296,7 +1296,7 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) /* We shouldn't get any other packages, log and ignore */ LOG (GNUNET_ERROR_TYPE_WARNING, "unsolicited message form service (type %s)\n", - GM_m2s (ntohs (msg->type))); + GC_m2s (ntohs (msg->type))); } LOG (GNUNET_ERROR_TYPE_DEBUG, "message processed\n"); if (GNUNET_YES == h->in_receive) @@ -1380,7 +1380,7 @@ send_callback (void *cls, size_t size, void *buf) dmsg->id = htonl (ch->chid); dmsg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); LOG (GNUNET_ERROR_TYPE_DEBUG, "# payload type %s\n", - GM_m2s (ntohs (mh->type))); + GC_m2s (ntohs (mh->type))); ch->allow_send = GNUNET_NO; } else @@ -1395,7 +1395,7 @@ send_callback (void *cls, size_t size, void *buf) struct GNUNET_MessageHeader *mh = (struct GNUNET_MessageHeader *) &th[1]; LOG (GNUNET_ERROR_TYPE_DEBUG, "# cadet internal traffic, type %s\n", - GM_m2s (ntohs (mh->type))); + GC_m2s (ntohs (mh->type))); memcpy (cbuf, &th[1], th->size); psize = th->size; } @@ -1457,7 +1457,7 @@ send_packet (struct GNUNET_CADET_Handle *h, size_t msize; LOG (GNUNET_ERROR_TYPE_DEBUG, " Sending message to service: %s\n", - GM_m2s(ntohs(msg->type))); + GC_m2s(ntohs(msg->type))); msize = ntohs (msg->size); th = GNUNET_malloc (sizeof (struct GNUNET_CADET_TransmitHandle) + msize); th->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; diff --git a/src/cadet/cadet_common.c b/src/cadet/cadet_common.c index 855e9e20c..42ccf189c 100644 --- a/src/cadet/cadet_common.c +++ b/src/cadet/cadet_common.c @@ -34,7 +34,7 @@ * @return String representing FWD or BCK. */ char * -GM_f2s (int fwd) +GC_f2s (int fwd) { if (GNUNET_YES == fwd) { @@ -52,7 +52,7 @@ GM_f2s (int fwd) } int -GM_is_pid_bigger (uint32_t bigger, uint32_t smaller) +GC_is_pid_bigger (uint32_t bigger, uint32_t smaller) { return (GNUNET_YES == PID_OVERFLOW (smaller, bigger) || (bigger > smaller && GNUNET_NO == PID_OVERFLOW (bigger, smaller))); @@ -60,25 +60,25 @@ GM_is_pid_bigger (uint32_t bigger, uint32_t smaller) uint32_t -GM_max_pid (uint32_t a, uint32_t b) +GC_max_pid (uint32_t a, uint32_t b) { - if (GM_is_pid_bigger(a, b)) + if (GC_is_pid_bigger(a, b)) return a; return b; } uint32_t -GM_min_pid (uint32_t a, uint32_t b) +GC_min_pid (uint32_t a, uint32_t b) { - if (GM_is_pid_bigger(a, b)) + if (GC_is_pid_bigger(a, b)) return b; return a; } const struct GNUNET_HashCode * -GM_h2hc (const struct GNUNET_CADET_Hash *id) +GC_h2hc (const struct GNUNET_CADET_Hash *id) { static struct GNUNET_HashCode hc; memcpy (&hc, id, sizeof (*id)); @@ -88,11 +88,11 @@ GM_h2hc (const struct GNUNET_CADET_Hash *id) const char * -GM_h2s (const struct GNUNET_CADET_Hash *id) +GC_h2s (const struct GNUNET_CADET_Hash *id) { static char s[53]; - memcpy (s, GNUNET_h2s_full (GM_h2hc (id)), 52); + memcpy (s, GNUNET_h2s_full (GC_h2hc (id)), 52); s[52] = '\0'; return s; @@ -101,7 +101,7 @@ GM_h2s (const struct GNUNET_CADET_Hash *id) #if !defined(GNUNET_CULL_LOGGING) const char * -GM_m2s (uint16_t m) +GC_m2s (uint16_t m) { static char buf[32]; const char *t; @@ -341,7 +341,7 @@ GM_m2s (uint16_t m) } #else const char * -GM_m2s (uint16_t m) +GC_m2s (uint16_t m) { return ""; } diff --git a/src/cadet/cadet_path.c b/src/cadet/cadet_path.c index 0a97e73ef..21c8ed158 100644 --- a/src/cadet/cadet_path.c +++ b/src/cadet/cadet_path.c @@ -43,8 +43,8 @@ path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct CadetPeer *peer; path->path_delete = GNUNET_SCHEDULER_NO_TASK; - peer = GMP_get_short (path->peers[path->length - 1]); - GMP_remove_path (peer, path); + peer = GCP_get_short (path->peers[path->length - 1]); + GCP_remove_path (peer, path); } diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index 840c6d0ac..2a43f570d 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c @@ -556,7 +556,7 @@ tunnel_callback (void *cls, FPRINTF (stdout, " %u\n", channels[i]); FPRINTF (stdout, "- %u connections\n", n_connections); for (i = 0; i < n_connections; i++) - FPRINTF (stdout, " %s\n", GM_h2s (&connections[i])); + FPRINTF (stdout, " %s\n", GC_h2s (&connections[i])); FPRINTF (stdout, "- enc state: %u\n", estate); FPRINTF (stdout, "- con state: %u\n", cstate); } diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index de9aaf7a5..7ac4c6370 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c @@ -108,11 +108,11 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) shutting_down = GNUNET_YES; GML_shutdown (); - GMH_shutdown (); - GMC_shutdown (); - GMT_shutdown (); - GMD_shutdown (); - GMP_shutdown (); + GCH_shutdown (); + GCC_shutdown (); + GCT_shutdown (); + GCD_shutdown (); + GCP_shutdown (); GNUNET_STATISTICS_destroy (stats, GNUNET_NO); stats = NULL; @@ -148,11 +148,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_i2s (&my_full_id)); GML_init (server); /* Local clients */ - GMH_init (c); /* Hellos */ - GMC_init (c); /* Connections */ - GMP_init (c); /* Peers */ - GMD_init (c); /* DHT */ - GMT_init (c, my_private_key); /* Tunnels */ + GCH_init (c); /* Hellos */ + GCC_init (c); /* Connections */ + GCP_init (c); /* Peers */ + GCD_init (c); /* DHT */ + GCT_init (c, my_private_key); /* Tunnels */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cadet service running\n"); } diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 91338d5c0..c85900456 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c @@ -350,7 +350,7 @@ static int is_loopback (const struct CadetChannel *ch) { if (NULL != ch->t) - return GMT_is_loopback (ch->t); + return GCT_is_loopback (ch->t); return (NULL != ch->root && NULL != ch->dest); } @@ -412,7 +412,7 @@ add_buffered_data (const struct GNUNET_CADET_Data *msg, LOG (GNUNET_ERROR_TYPE_DEBUG, " already there!\n"); return; } - else if (GM_is_pid_bigger (prev->mid, mid)) + else if (GC_is_pid_bigger (prev->mid, mid)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " bingo!\n"); copy = copy_message (msg, mid, rel); @@ -521,12 +521,12 @@ send_destroy (struct CadetChannel *ch, int local_only) if (NULL != ch->root) GML_send_channel_destroy (ch->root, ch->lid_root); else if (0 == ch->lid_root && GNUNET_NO == local_only) - GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); + GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); if (NULL != ch->dest) GML_send_channel_destroy (ch->dest, ch->lid_dest); else if (0 == ch->lid_dest && GNUNET_NO == local_only) - GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES, NULL); + GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES, NULL); } @@ -547,7 +547,7 @@ send_client_create (struct CadetChannel *ch) opt |= GNUNET_YES == ch->reliable ? GNUNET_CADET_OPTION_RELIABLE : 0; opt |= GNUNET_YES == ch->nobuffer ? GNUNET_CADET_OPTION_NOBUFFER : 0; GML_send_channel_create (ch->dest, ch->lid_dest, ch->port, opt, - GMT_get_destination (ch->t)); + GCT_get_destination (ch->t)); } @@ -640,7 +640,7 @@ send_client_buffered_data (struct CadetChannel *ch, * deliver missing messages */ send_destroy (ch, GNUNET_YES); - GMCH_destroy (ch); + GCCH_destroy (ch); } } } @@ -669,7 +669,7 @@ send_client_ack (struct CadetChannel *ch, int fwd) } LOG (GNUNET_ERROR_TYPE_DEBUG, " sending %s ack to client on channel %s\n", - GM_f2s (fwd), GMCH_2s (ch)); + GC_f2s (fwd), GCCH_2s (ch)); if (NULL == rel) { @@ -739,7 +739,7 @@ channel_retransmit_message (void *cls, /* Message not found in the queue that we are going to use. */ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! RETRANSMIT %u\n", copy->mid); - GMCH_send_prebuilt_message (&payload->header, ch, fwd, copy); + GCCH_send_prebuilt_message (&payload->header, ch, fwd, copy); GNUNET_STATISTICS_update (stats, "# data retransmitted", 1, GNUNET_NO); } @@ -798,7 +798,7 @@ ch_message_sent (void *cls, struct CadetChannelReliability *rel; LOG (GNUNET_ERROR_TYPE_DEBUG, "channel message sent callback %s\n", - GM_m2s (chq->type)); + GC_m2s (chq->type)); switch (chq->type) { @@ -842,7 +842,7 @@ ch_message_sent (void *cls, case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: - LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GM_m2s (chq->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SENT %s\n", GC_m2s (chq->type)); rel = chq->rel; GNUNET_assert (rel->uniq == chq); rel->uniq = NULL; @@ -885,7 +885,7 @@ send_create (struct CadetChannel *ch) msgcc.port = htonl (ch->port); msgcc.opt = htonl (channel_get_options (ch)); - GMCH_send_prebuilt_message (&msgcc.header, ch, GNUNET_YES, NULL); + GCCH_send_prebuilt_message (&msgcc.header, ch, GNUNET_YES, NULL); } @@ -904,10 +904,10 @@ send_ack (struct CadetChannel *ch, int fwd, int reaction) msg.header.size = htons (sizeof (msg)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK); LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel %s ack for channel %s\n", - GM_f2s (fwd), GMCH_2s (ch)); + GC_f2s (fwd), GCCH_2s (ch)); msg.chid = htonl (ch->gid); - GMCH_send_prebuilt_message (&msg.header, ch, !fwd, reaction ? &msg : NULL); + GCCH_send_prebuilt_message (&msg.header, ch, !fwd, reaction ? &msg : NULL); } @@ -924,7 +924,7 @@ fire_and_forget (const struct GNUNET_MessageHeader *msg, struct CadetChannel *ch, int force) { - GNUNET_break (NULL == GMT_send_prebuilt_message (msg, ch->t, NULL, + GNUNET_break (NULL == GCT_send_prebuilt_message (msg, ch->t, NULL, force, NULL, NULL)); } @@ -943,10 +943,10 @@ send_nack (struct CadetChannel *ch) msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK); LOG (GNUNET_ERROR_TYPE_DEBUG, " sending channel NACK for channel %s\n", - GMCH_2s (ch)); + GCCH_2s (ch)); msg.chid = htonl (ch->gid); - GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); + GCCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO, NULL); } @@ -983,7 +983,7 @@ channel_rel_free_all (struct CadetChannelReliability *rel) { if (NULL != copy->chq->tq) { - GMT_cancel (copy->chq->tq); + GCT_cancel (copy->chq->tq); /* ch_message_sent will free copy->q */ } else @@ -996,7 +996,7 @@ channel_rel_free_all (struct CadetChannelReliability *rel) } if (NULL != rel->uniq && NULL != rel->uniq->tq) { - GMT_cancel (rel->uniq->tq); + GCT_cancel (rel->uniq->tq); /* ch_message_sent is called freeing uniq */ } if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) @@ -1053,7 +1053,7 @@ channel_rel_free_sent (struct CadetChannelReliability *rel, /* Skip copies with mid < target */ target = mid + i + 1; LOG (GNUNET_ERROR_TYPE_DEBUG, " target %u\n", target); - while (NULL != copy && GM_is_pid_bigger (target, copy->mid)) + while (NULL != copy && GC_is_pid_bigger (target, copy->mid)) copy = copy->next; /* Did we run out of copies? (previously freed, it's ok) */ @@ -1064,7 +1064,7 @@ channel_rel_free_sent (struct CadetChannelReliability *rel, } /* Did we overshoot the target? (previously freed, it's ok) */ - if (GM_is_pid_bigger (copy->mid, target)) + if (GC_is_pid_bigger (copy->mid, target)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " next copy %u\n", copy->mid); continue; @@ -1125,7 +1125,7 @@ rel_message_free (struct CadetReliableMessage *copy, int update_time) rel->ch->pending_messages--; if (NULL != copy->chq) { - GMT_cancel (copy->chq->tq); + GCT_cancel (copy->chq->tq); /* copy->q is set to NULL by ch_message_sent */ } GNUNET_CONTAINER_DLL_remove (rel->head_sent, rel->tail_sent, copy); @@ -1134,7 +1134,7 @@ rel_message_free (struct CadetReliableMessage *copy, int update_time) if (GNUNET_NO != rel->ch->destroy && 0 == rel->ch->pending_messages) { - GMCH_destroy (rel->ch); + GCCH_destroy (rel->ch); return GNUNET_YES; } return GNUNET_NO; @@ -1160,7 +1160,7 @@ channel_confirm (struct CadetChannel *ch, int fwd) return; } LOG (GNUNET_ERROR_TYPE_DEBUG, " channel confirm %s %s\n", - GM_f2s (fwd), GMCH_2s (ch)); + GC_f2s (fwd), GCCH_2s (ch)); oldstate = ch->state; ch->state = CADET_CHANNEL_READY; @@ -1170,7 +1170,7 @@ channel_confirm (struct CadetChannel *ch, int fwd) rel->expected_delay = rel->retry_timer; LOG (GNUNET_ERROR_TYPE_DEBUG, " !! retry timer confirm %s\n", GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, GNUNET_NO)); - if (GMT_get_connections_buffer (ch->t) > 0 || GMT_is_loopback (ch->t)) + if (GCT_get_connections_buffer (ch->t) > 0 || GCT_is_loopback (ch->t)) send_client_ack (ch, fwd); if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task) @@ -1180,7 +1180,7 @@ channel_confirm (struct CadetChannel *ch, int fwd) } else if (NULL != rel->uniq) { - GMT_cancel (rel->uniq->tq); + GCT_cancel (rel->uniq->tq); /* ch_message_sent will free and NULL uniq */ } else @@ -1224,7 +1224,7 @@ channel_save_copy (struct CadetChannel *ch, type = ntohs (msg->type); size = ntohs (msg->size); - LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u %s\n", mid, GM_m2s (type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SAVE %u %s\n", mid, GC_m2s (type)); copy = GNUNET_malloc (sizeof (struct CadetReliableMessage) + size); LOG (GNUNET_ERROR_TYPE_DEBUG, " at %p\n", copy); copy->mid = mid; @@ -1263,10 +1263,10 @@ channel_new (struct CadetTunnel3 *t, if (NULL != owner) { - ch->gid = GMT_get_next_chid (t); + ch->gid = GCT_get_next_chid (t); GML_channel_add (owner, lid_root, ch); } - GMT_add_channel (t, ch); + GCT_add_channel (t, ch); return ch; } @@ -1289,7 +1289,7 @@ handle_loopback (struct CadetChannel *ch, type = ntohs (msgh->type); LOG (GNUNET_ERROR_TYPE_DEBUG, "Loopback %s %s message!\n", - GM_f2s (fwd), GM_m2s (type)); + GC_f2s (fwd), GC_m2s (type)); switch (type) { @@ -1297,30 +1297,30 @@ handle_loopback (struct CadetChannel *ch, /* Don't send hop ACK, wait for client to ACK */ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SEND loopback %u (%u)\n", ntohl (((struct GNUNET_CADET_Data *) msgh)->mid), ntohs (msgh->size)); - GMCH_handle_data (ch, (struct GNUNET_CADET_Data *) msgh, fwd); + GCCH_handle_data (ch, (struct GNUNET_CADET_Data *) msgh, fwd); break; case GNUNET_MESSAGE_TYPE_CADET_DATA_ACK: - GMCH_handle_data_ack (ch, (struct GNUNET_CADET_DataACK *) msgh, fwd); + GCCH_handle_data_ack (ch, (struct GNUNET_CADET_DataACK *) msgh, fwd); break; case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: - GMCH_handle_create (ch->t, + GCCH_handle_create (ch->t, (struct GNUNET_CADET_ChannelCreate *) msgh); break; case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: - GMCH_handle_ack (ch, + GCCH_handle_ack (ch, (struct GNUNET_CADET_ChannelManage *) msgh, fwd); break; case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: - GMCH_handle_nack (ch); + GCCH_handle_nack (ch); break; case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: - GMCH_handle_destroy (ch, + GCCH_handle_destroy (ch, (struct GNUNET_CADET_ChannelManage *) msgh, fwd); break; @@ -1345,7 +1345,7 @@ handle_loopback (struct CadetChannel *ch, * @param ch Channel to destroy. */ void -GMCH_destroy (struct CadetChannel *ch) +GCCH_destroy (struct CadetChannel *ch) { struct CadetClient *c; struct CadetTunnel3 *t; @@ -1357,8 +1357,8 @@ GMCH_destroy (struct CadetChannel *ch) ch->destroy = 2; LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying channel %s:%u\n", - GMT_2s (ch->t), ch->gid); - GMCH_debug (ch); + GCT_2s (ch->t), ch->gid); + GCCH_debug (ch); c = ch->root; if (NULL != c) @@ -1376,11 +1376,11 @@ GMCH_destroy (struct CadetChannel *ch) channel_rel_free_all (ch->dest_rel); t = ch->t; - GMT_remove_channel (t, ch); + GCT_remove_channel (t, ch); GNUNET_STATISTICS_update (stats, "# channels", -1, GNUNET_NO); GNUNET_free (ch); - GMT_destroy_if_empty (t); + GCT_destroy_if_empty (t); } @@ -1392,7 +1392,7 @@ GMCH_destroy (struct CadetChannel *ch) * @return ID used to identify the channel with the remote peer. */ CADET_ChannelNumber -GMCH_get_id (const struct CadetChannel *ch) +GCCH_get_id (const struct CadetChannel *ch) { return ch->gid; } @@ -1406,7 +1406,7 @@ GMCH_get_id (const struct CadetChannel *ch) * @return tunnel of the channel. */ struct CadetTunnel3 * -GMCH_get_tunnel (const struct CadetChannel *ch) +GCCH_get_tunnel (const struct CadetChannel *ch) { return ch->t; } @@ -1421,7 +1421,7 @@ GMCH_get_tunnel (const struct CadetChannel *ch) * @return Free buffer space [0 - 64] */ unsigned int -GMCH_get_buffer (struct CadetChannel *ch, int fwd) +GCCH_get_buffer (struct CadetChannel *ch, int fwd) { struct CadetChannelReliability *rel; @@ -1447,7 +1447,7 @@ GMCH_get_buffer (struct CadetChannel *ch, int fwd) * @return #GNUNET_YES if client is allowed to send us data. */ int -GMCH_get_allowed (struct CadetChannel *ch, int fwd) +GCCH_get_allowed (struct CadetChannel *ch, int fwd) { struct CadetChannelReliability *rel; @@ -1473,7 +1473,7 @@ GMCH_get_allowed (struct CadetChannel *ch, int fwd) * @return #GNUNET_YES in case it is. */ int -GMCH_is_origin (struct CadetChannel *ch, int fwd) +GCCH_is_origin (struct CadetChannel *ch, int fwd) { struct CadetClient *c; @@ -1491,7 +1491,7 @@ GMCH_is_origin (struct CadetChannel *ch, int fwd) * @return #GNUNET_YES in case it is. */ int -GMCH_is_terminal (struct CadetChannel *ch, int fwd) +GCCH_is_terminal (struct CadetChannel *ch, int fwd) { struct CadetClient *c; @@ -1509,7 +1509,7 @@ GMCH_is_terminal (struct CadetChannel *ch, int fwd) * @param fwd Is for FWD traffic? (ACK dest->owner) */ void -GMCH_send_data_ack (struct CadetChannel *ch, int fwd) +GCCH_send_data_ack (struct CadetChannel *ch, int fwd) { struct GNUNET_CADET_DataACK msg; struct CadetChannelReliability *rel; @@ -1536,7 +1536,7 @@ GMCH_send_data_ack (struct CadetChannel *ch, int fwd) { LOG (GNUNET_ERROR_TYPE_DEBUG, "!! Type %s, expected DATA\n", - GM_m2s (copy->type)); + GC_m2s (copy->type)); continue; } if (copy->mid == ack + 1) @@ -1558,7 +1558,7 @@ GMCH_send_data_ack (struct CadetChannel *ch, int fwd) "!!! ACK for %u, futures %llX\n", ack, msg.futures); - GMCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL); + GCCH_send_prebuilt_message (&msg.header, ch, !fwd, NULL); LOG (GNUNET_ERROR_TYPE_DEBUG, "send_data_ack END\n"); } @@ -1570,7 +1570,7 @@ GMCH_send_data_ack (struct CadetChannel *ch, int fwd) * @param fwd Is this about FWD traffic? (Root client). */ void -GMCH_allow_client (struct CadetChannel *ch, int fwd) +GCCH_allow_client (struct CadetChannel *ch, int fwd) { struct CadetChannelReliability *rel; unsigned int buffer; @@ -1609,9 +1609,9 @@ GMCH_allow_client (struct CadetChannel *ch, int fwd) } if (is_loopback (ch)) - buffer = GMCH_get_buffer (ch, fwd); + buffer = GCCH_get_buffer (ch, fwd); else - buffer = GMT_get_connections_buffer (ch->t); + buffer = GCT_get_connections_buffer (ch->t); if (0 == buffer) { @@ -1630,7 +1630,7 @@ GMCH_allow_client (struct CadetChannel *ch, int fwd) * @param ch Channel. */ void -GMCH_debug (struct CadetChannel *ch) +GCCH_debug (struct CadetChannel *ch) { if (NULL == ch) { @@ -1638,7 +1638,7 @@ GMCH_debug (struct CadetChannel *ch) return; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %s:%X (%p)\n", - GMT_2s (ch->t), ch->gid, ch); + GCT_2s (ch->t), ch->gid, ch); LOG (GNUNET_ERROR_TYPE_DEBUG, " root %p/%p\n", ch->root, ch->root_rel); if (NULL != ch->root) @@ -1669,7 +1669,7 @@ GMCH_debug (struct CadetChannel *ch) * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by dest and go BCK) */ void -GMCH_handle_local_ack (struct CadetChannel *ch, int fwd) +GCCH_handle_local_ack (struct CadetChannel *ch, int fwd) { struct CadetChannelReliability *rel; struct CadetClient *c; @@ -1683,7 +1683,7 @@ GMCH_handle_local_ack (struct CadetChannel *ch, int fwd) if (GNUNET_YES == ch->destroy && 0 == rel->n_recv) { send_destroy (ch, GNUNET_YES); - GMCH_destroy (ch); + GCCH_destroy (ch); } /* if loopback is marked for destruction, no need to ACK to the other peer, * it requested the destruction and is already gone, therefore, else if. @@ -1692,13 +1692,13 @@ GMCH_handle_local_ack (struct CadetChannel *ch, int fwd) { unsigned int buffer; - buffer = GMCH_get_buffer (ch, fwd); + buffer = GCCH_get_buffer (ch, fwd); if (0 < buffer) - GMCH_allow_client (ch, fwd); + GCCH_allow_client (ch, fwd); return; } - GMT_send_connection_acks (ch->t); + GCT_send_connection_acks (ch->t); } @@ -1717,7 +1717,7 @@ GMCH_handle_local_ack (struct CadetChannel *ch, int fwd) * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. */ int -GMCH_handle_local_data (struct CadetChannel *ch, +GCCH_handle_local_data (struct CadetChannel *ch, struct CadetClient *c, struct GNUNET_MessageHeader *message, int fwd) @@ -1758,19 +1758,19 @@ GMCH_handle_local_data (struct CadetChannel *ch, payload->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_DATA); payload->chid = htonl (ch->gid); LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channel...\n"); - GMCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); + GCCH_send_prebuilt_message (&payload->header, ch, fwd, NULL); if (is_loopback (ch)) { - if (GMCH_get_buffer (ch, fwd) > 0) - GMCH_allow_client (ch, fwd); + if (GCCH_get_buffer (ch, fwd) > 0) + GCCH_allow_client (ch, fwd); return GNUNET_OK; } - if (GMT_get_connections_buffer (ch->t) > 0) + if (GCT_get_connections_buffer (ch->t) > 0) { - GMCH_allow_client (ch, fwd); + GCCH_allow_client (ch, fwd); } return GNUNET_OK; @@ -1787,7 +1787,7 @@ GMCH_handle_local_data (struct CadetChannel *ch, * @param is_root Is the request coming from root? */ void -GMCH_handle_local_destroy (struct CadetChannel *ch, +GCCH_handle_local_destroy (struct CadetChannel *ch, struct CadetClient *c, int is_root) { @@ -1808,7 +1808,7 @@ GMCH_handle_local_destroy (struct CadetChannel *ch, send_destroy (ch, GNUNET_NO); if (0 == ch->pending_messages) - GMCH_destroy (ch); + GCCH_destroy (ch); } @@ -1823,7 +1823,7 @@ GMCH_handle_local_destroy (struct CadetChannel *ch, * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise. */ int -GMCH_handle_local_create (struct CadetClient *c, +GCCH_handle_local_create (struct CadetClient *c, struct GNUNET_CADET_ChannelMessage *msg) { struct CadetChannel *ch; @@ -1842,18 +1842,18 @@ GMCH_handle_local_create (struct CadetClient *c, return GNUNET_SYSERR; } - peer = GMP_get (&msg->peer); - GMP_add_tunnel (peer); - t = GMP_get_tunnel (peer); + peer = GCP_get (&msg->peer); + GCP_add_tunnel (peer); + t = GCP_get_tunnel (peer); - if (GMP_get_short_id (peer) == myid) + if (GCP_get_short_id (peer) == myid) { - GMT_change_cstate (t, CADET_TUNNEL3_READY); + GCT_change_cstate (t, CADET_TUNNEL3_READY); } else { /* FIXME change to a tunnel API, eliminate ch <-> peer connection */ - GMP_connect (peer); + GCP_connect (peer); } /* Create channel */ @@ -1872,7 +1872,7 @@ GMCH_handle_local_create (struct CadetClient *c, ch->root_rel->retry_timer = CADET_RETRANSMIT_TIME; ch->root_rel->expected_delay.rel_value_us = 0; - LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s\n", GMCH_2s (ch)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "CREATED CHANNEL %s\n", GCCH_2s (ch)); send_create (ch); @@ -1891,7 +1891,7 @@ GMCH_handle_local_create (struct CadetClient *c, * #GNUNET_SYSERR if message on a one-ended channel (remote) */ void -GMCH_handle_data (struct CadetChannel *ch, +GCCH_handle_data (struct CadetChannel *ch, const struct GNUNET_CADET_Data *msg, int fwd) { @@ -1942,11 +1942,11 @@ GMCH_handle_data (struct CadetChannel *ch, mid = ntohl (msg->mid); LOG (GNUNET_ERROR_TYPE_INFO, "<=== DATA %u %s on channel %s\n", - mid, GM_f2s (fwd), GMCH_2s (ch)); + mid, GC_f2s (fwd), GCCH_2s (ch)); if (GNUNET_NO == ch->reliable || - ( !GM_is_pid_bigger (rel->mid_recv, mid) && - GM_is_pid_bigger (rel->mid_recv + 64, mid) ) ) + ( !GC_is_pid_bigger (rel->mid_recv, mid) && + GC_is_pid_bigger (rel->mid_recv + 64, mid) ) ) { LOG (GNUNET_ERROR_TYPE_DEBUG, "RECV %u (%u)\n", mid, ntohs (msg->header.size)); @@ -1975,13 +1975,13 @@ GMCH_handle_data (struct CadetChannel *ch, } else { - GNUNET_break_op (GM_is_pid_bigger (rel->mid_recv, mid)); + GNUNET_break_op (GC_is_pid_bigger (rel->mid_recv, mid)); LOG (GNUNET_ERROR_TYPE_WARNING, "MID %u not expected (%u - %u), dropping!\n", mid, rel->mid_recv, rel->mid_recv + 63); } - GMCH_send_data_ack (ch, fwd); + GCCH_send_data_ack (ch, fwd); } @@ -1996,7 +1996,7 @@ GMCH_handle_data (struct CadetChannel *ch, * #GNUNET_SYSERR if message on a one-ended channel (remote) */ void -GMCH_handle_data_ack (struct CadetChannel *ch, +GCCH_handle_data_ack (struct CadetChannel *ch, const struct GNUNET_CADET_DataACK *msg, int fwd) { @@ -2020,7 +2020,7 @@ GMCH_handle_data_ack (struct CadetChannel *ch, } ack = ntohl (msg->mid); - LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s ACK %u\n", GM_f2s (fwd), ack); + LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s ACK %u\n", GC_f2s (fwd), ack); if (GNUNET_YES == fwd) { @@ -2039,7 +2039,7 @@ GMCH_handle_data_ack (struct CadetChannel *ch, /* Free ACK'd copies: no need to retransmit those anymore FIXME refactor */ for (work = GNUNET_NO, copy = rel->head_sent; copy != NULL; copy = next) { - if (GM_is_pid_bigger (copy->mid, ack)) + if (GC_is_pid_bigger (copy->mid, ack)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " head %u, out!\n", copy->mid); channel_rel_free_sent (rel, msg); @@ -2053,7 +2053,7 @@ GMCH_handle_data_ack (struct CadetChannel *ch, } /* ACK client if needed and possible */ - GMCH_allow_client (ch, fwd); + GCCH_allow_client (ch, fwd); /* If some message was free'd, update the retransmission delay */ if (GNUNET_YES == work) @@ -2096,7 +2096,7 @@ GMCH_handle_data_ack (struct CadetChannel *ch, * @param msg Channel crate message. */ struct CadetChannel * -GMCH_handle_create (struct CadetTunnel3 *t, +GCCH_handle_create (struct CadetTunnel3 *t, const struct GNUNET_CADET_ChannelCreate *msg) { CADET_ChannelNumber chid; @@ -2107,7 +2107,7 @@ GMCH_handle_create (struct CadetTunnel3 *t, reaction = GNUNET_NO; chid = ntohl (msg->chid); - ch = GMT_get_channel (t, chid); + ch = GCT_get_channel (t, chid); if (NULL == ch) { /* Create channel */ @@ -2121,7 +2121,7 @@ GMCH_handle_create (struct CadetTunnel3 *t, new_channel = GNUNET_NO; } - if (GNUNET_YES == new_channel || GMT_is_loopback (t)) + if (GNUNET_YES == new_channel || GCT_is_loopback (t)) { /* Find a destination client */ ch->port = ntohl (msg->port); @@ -2139,7 +2139,7 @@ GMCH_handle_create (struct CadetTunnel3 *t, { LOG (GNUNET_ERROR_TYPE_DEBUG, " not loopback: destroy now\n"); send_nack (ch); - GMCH_destroy (ch); + GCCH_destroy (ch); } return NULL; } @@ -2183,10 +2183,10 @@ GMCH_handle_create (struct CadetTunnel3 *t, * @param ch Channel. */ void -GMCH_handle_nack (struct CadetChannel *ch) +GCCH_handle_nack (struct CadetChannel *ch) { send_client_nack (ch); - GMCH_destroy (ch); + GCCH_destroy (ch); } @@ -2201,7 +2201,7 @@ GMCH_handle_nack (struct CadetChannel *ch) * #GNUNET_SYSERR if message on a one-ended channel (remote) */ void -GMCH_handle_ack (struct CadetChannel *ch, +GCCH_handle_ack (struct CadetChannel *ch, const struct GNUNET_CADET_ChannelManage *msg, int fwd) { @@ -2232,7 +2232,7 @@ GMCH_handle_ack (struct CadetChannel *ch, * #GNUNET_SYSERR if message on a one-ended channel (remote) */ void -GMCH_handle_destroy (struct CadetChannel *ch, +GCCH_handle_destroy (struct CadetChannel *ch, const struct GNUNET_CADET_ChannelManage *msg, int fwd) { @@ -2250,7 +2250,7 @@ GMCH_handle_destroy (struct CadetChannel *ch, fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO; } - GMCH_debug (ch); + GCCH_debug (ch); if ( (fwd && NULL == ch->dest) || (!fwd && NULL == ch->root) ) { /* Not for us (don't destroy twice a half-open loopback channel) */ @@ -2261,7 +2261,7 @@ GMCH_handle_destroy (struct CadetChannel *ch, if (0 == rel->n_recv) { send_destroy (ch, GNUNET_YES); - GMCH_destroy (ch); + GCCH_destroy (ch); } else { @@ -2287,7 +2287,7 @@ GMCH_handle_destroy (struct CadetChannel *ch, * @param existing_copy This is a retransmission, don't save a copy. */ void -GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, +GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, struct CadetChannel *ch, int fwd, void *existing_copy) { @@ -2296,9 +2296,9 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, type = ntohs (message->type); LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %s on channel %s\n", - GM_m2s (type), GM_f2s (fwd), GMCH_2s (ch)); + GC_m2s (type), GC_f2s (fwd), GCCH_2s (ch)); - if (GMT_is_loopback (ch->t)) + if (GCT_is_loopback (ch->t)) { handle_loopback (ch, message, fwd); return; @@ -2311,7 +2311,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, payload = (struct GNUNET_CADET_Data *) message; LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n", - GM_m2s (type), ntohl (payload->mid)); + GC_m2s (type), ntohl (payload->mid)); if (GNUNET_YES == ch->reliable) { chq = GNUNET_new (struct CadetChannelQueue); @@ -2344,7 +2344,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, } LOG (GNUNET_ERROR_TYPE_DEBUG, " new chq: %p\n", chq); chq->copy->chq = chq; - chq->tq = GMT_send_prebuilt_message (message, ch->t, NULL, + chq->tq = GCT_send_prebuilt_message (message, ch->t, NULL, NULL != existing_copy, &ch_message_sent, chq); /* q itself is stored in copy */ @@ -2374,7 +2374,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, { if (NULL != chq->rel->uniq->tq) { - GMT_cancel (chq->rel->uniq->tq); + GCT_cancel (chq->rel->uniq->tq); /* ch_message_sent is called, freeing and NULLing uniq */ } else @@ -2383,7 +2383,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, GNUNET_free (chq->rel->uniq); } } - chq->tq = GMT_send_prebuilt_message (message, ch->t, NULL, GNUNET_YES, + chq->tq = GCT_send_prebuilt_message (message, ch->t, NULL, GNUNET_YES, &ch_message_sent, chq); if (NULL == chq->tq) { @@ -2404,7 +2404,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, default: GNUNET_break (0); - LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s unknown!\n", GM_m2s (type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s unknown!\n", GC_m2s (type)); fire_and_forget (message, ch, GNUNET_YES); } } @@ -2418,7 +2418,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, * @return Static string with the channel IDs. */ const char * -GMCH_2s (const struct CadetChannel *ch) +GCCH_2s (const struct CadetChannel *ch) { static char buf[64]; @@ -2426,7 +2426,7 @@ GMCH_2s (const struct CadetChannel *ch) return "(NULL Channel)"; sprintf (buf, "%s:%u gid:%X (%X / %X)", - GMT_2s (ch->t), ch->port, ch->gid, ch->lid_root, ch->lid_dest); + GCT_2s (ch->t), ch->port, ch->gid, ch->lid_root, ch->lid_dest); return buf; } diff --git a/src/cadet/gnunet-service-cadet_channel.h b/src/cadet/gnunet-service-cadet_channel.h index f5a89a423..a472669c5 100644 --- a/src/cadet/gnunet-service-cadet_channel.h +++ b/src/cadet/gnunet-service-cadet_channel.h @@ -59,7 +59,7 @@ struct CadetChannel; * @param ch Channel to destroy. */ void -GMCH_destroy (struct CadetChannel *ch); +GCCH_destroy (struct CadetChannel *ch); /** @@ -70,7 +70,7 @@ GMCH_destroy (struct CadetChannel *ch); * @return ID used to identify the channel with the remote peer. */ CADET_ChannelNumber -GMCH_get_id (const struct CadetChannel *ch); +GCCH_get_id (const struct CadetChannel *ch); /** * Get the channel tunnel. @@ -80,7 +80,7 @@ GMCH_get_id (const struct CadetChannel *ch); * @return tunnel of the channel. */ struct CadetTunnel3 * -GMCH_get_tunnel (const struct CadetChannel *ch); +GCCH_get_tunnel (const struct CadetChannel *ch); /** * Get free buffer space towards the client on a specific channel. @@ -91,7 +91,7 @@ GMCH_get_tunnel (const struct CadetChannel *ch); * @return Free buffer space [0 - 64] */ unsigned int -GMCH_get_buffer (struct CadetChannel *ch, int fwd); +GCCH_get_buffer (struct CadetChannel *ch, int fwd); /** @@ -103,7 +103,7 @@ GMCH_get_buffer (struct CadetChannel *ch, int fwd); * @return #GNUNET_YES if client is allowed to send us data. */ int -GMCH_get_allowed (struct CadetChannel *ch, int fwd); +GCCH_get_allowed (struct CadetChannel *ch, int fwd); /** @@ -115,7 +115,7 @@ GMCH_get_allowed (struct CadetChannel *ch, int fwd); * @return #GNUNET_YES in case it is. */ int -GMCH_is_origin (struct CadetChannel *ch, int fwd); +GCCH_is_origin (struct CadetChannel *ch, int fwd); /** * Is the destination client for this channel on this peer? @@ -126,7 +126,7 @@ GMCH_is_origin (struct CadetChannel *ch, int fwd); * @return #GNUNET_YES in case it is. */ int -GMCH_is_terminal (struct CadetChannel *ch, int fwd); +GCCH_is_terminal (struct CadetChannel *ch, int fwd); /** * Send an end-to-end ACK message for the most recent in-sequence payload. @@ -137,7 +137,7 @@ GMCH_is_terminal (struct CadetChannel *ch, int fwd); * @param fwd Is for FWD traffic? (ACK dest->owner) */ void -GMCH_send_data_ack (struct CadetChannel *ch, int fwd); +GCCH_send_data_ack (struct CadetChannel *ch, int fwd); /** * Notify the destination client that a new incoming channel was created. @@ -145,7 +145,7 @@ GMCH_send_data_ack (struct CadetChannel *ch, int fwd); * @param ch Channel that was created. */ void -GMCH_send_create (struct CadetChannel *ch); +GCCH_send_create (struct CadetChannel *ch); /** * Allow a client to send us more data, in case it was choked. @@ -154,7 +154,7 @@ GMCH_send_create (struct CadetChannel *ch); * @param fwd Is this about FWD traffic? (Root client). */ void -GMCH_allow_client (struct CadetChannel *ch, int fwd); +GCCH_allow_client (struct CadetChannel *ch, int fwd); /** * Log channel info. @@ -162,7 +162,7 @@ GMCH_allow_client (struct CadetChannel *ch, int fwd); * @param ch Channel. */ void -GMCH_debug (struct CadetChannel *ch); +GCCH_debug (struct CadetChannel *ch); /** * Handle an ACK given by a client. @@ -173,7 +173,7 @@ GMCH_debug (struct CadetChannel *ch); * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by root and go BCK) */ void -GMCH_handle_local_ack (struct CadetChannel *ch, int fwd); +GCCH_handle_local_ack (struct CadetChannel *ch, int fwd); /** * Handle data given by a client. @@ -190,7 +190,7 @@ GMCH_handle_local_ack (struct CadetChannel *ch, int fwd); * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error. */ int -GMCH_handle_local_data (struct CadetChannel *ch, +GCCH_handle_local_data (struct CadetChannel *ch, struct CadetClient *c, struct GNUNET_MessageHeader *message, int fwd); @@ -205,7 +205,7 @@ GMCH_handle_local_data (struct CadetChannel *ch, * @param is_root Is the request coming from root? */ void -GMCH_handle_local_destroy (struct CadetChannel *ch, +GCCH_handle_local_destroy (struct CadetChannel *ch, struct CadetClient *c, int is_root); @@ -220,7 +220,7 @@ GMCH_handle_local_destroy (struct CadetChannel *ch, * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise. */ int -GMCH_handle_local_create (struct CadetClient *c, +GCCH_handle_local_create (struct CadetClient *c, struct GNUNET_CADET_ChannelMessage *msg); /** @@ -234,7 +234,7 @@ GMCH_handle_local_create (struct CadetClient *c, * #GNUNET_SYSERR if message on a one-ended channel (remote) */ void -GMCH_handle_data (struct CadetChannel *ch, +GCCH_handle_data (struct CadetChannel *ch, const struct GNUNET_CADET_Data *msg, int fwd); @@ -249,7 +249,7 @@ GMCH_handle_data (struct CadetChannel *ch, * #GNUNET_SYSERR if message on a one-ended channel (remote) */ void -GMCH_handle_data_ack (struct CadetChannel *ch, +GCCH_handle_data_ack (struct CadetChannel *ch, const struct GNUNET_CADET_DataACK *msg, int fwd); @@ -262,7 +262,7 @@ GMCH_handle_data_ack (struct CadetChannel *ch, * @param msg Channel crate message. */ struct CadetChannel * -GMCH_handle_create (struct CadetTunnel3 *t, +GCCH_handle_create (struct CadetTunnel3 *t, const struct GNUNET_CADET_ChannelCreate *msg); /** @@ -273,7 +273,7 @@ GMCH_handle_create (struct CadetTunnel3 *t, * @param ch Channel. */ void -GMCH_handle_nack (struct CadetChannel *ch); +GCCH_handle_nack (struct CadetChannel *ch); /** * Handler for channel ack messages. @@ -286,7 +286,7 @@ GMCH_handle_nack (struct CadetChannel *ch); * #GNUNET_SYSERR if message on a one-ended channel (remote) */ void -GMCH_handle_ack (struct CadetChannel *ch, +GCCH_handle_ack (struct CadetChannel *ch, const struct GNUNET_CADET_ChannelManage *msg, int fwd); @@ -301,7 +301,7 @@ GMCH_handle_ack (struct CadetChannel *ch, * #GNUNET_SYSERR if message on a one-ended channel (remote) */ void -GMCH_handle_destroy (struct CadetChannel *ch, +GCCH_handle_destroy (struct CadetChannel *ch, const struct GNUNET_CADET_ChannelManage *msg, int fwd); @@ -322,7 +322,7 @@ GMCH_handle_destroy (struct CadetChannel *ch, * @param existing_copy This is a retransmission, don't save a copy. */ void -GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, +GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, struct CadetChannel *ch, int fwd, void *existing_copy); @@ -334,7 +334,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message, * @return Static string with the channel IDs. */ const char * -GMCH_2s (const struct CadetChannel *ch); +GCCH_2s (const struct CadetChannel *ch); #if 0 /* keep Emacsens' auto-indent happy */ diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 9c07e006b..3552a942c 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c @@ -236,7 +236,7 @@ struct CadetConnectionQueue /** * Continuation to call once sent. */ - GMC_sent cont; + GCC_sent cont; /** * Closure for @c cont. @@ -316,7 +316,7 @@ connection_debug (struct CadetConnection *c) return; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s:%X\n", - peer2s (c->t->peer), GMC_2s (c)); + peer2s (c->t->peer), GCC_2s (c)); LOG (GNUNET_ERROR_TYPE_DEBUG, " state: %u, pending msgs: %u\n", c->state, c->pending_messages); LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n"); @@ -362,7 +362,7 @@ connection_reset_timeout (struct CadetConnection *c, int fwd); * @return String representation. */ static const char * -GMC_state2s (enum CadetConnectionState s) +GCC_state2s (enum CadetConnectionState s) { switch (s) { @@ -409,7 +409,7 @@ fc_init (struct CadetFlowControl *fc) static struct CadetConnection * connection_get (const struct GNUNET_CADET_Hash *cid) { - return GNUNET_CONTAINER_multihashmap_get (connections, GM_h2hc (cid)); + return GNUNET_CONTAINER_multihashmap_get (connections, GC_h2hc (cid)); } @@ -419,7 +419,7 @@ connection_change_state (struct CadetConnection* c, { LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s state %s -> %s\n", - GMC_2s (c), GMC_state2s (c->state), GMC_state2s (state)); + GCC_2s (c), GCC_state2s (c->state), GCC_state2s (state)); if (CADET_CONNECTION_DESTROYED == c->state) { LOG (GNUNET_ERROR_TYPE_DEBUG, "state not changing anymore\n"); @@ -476,10 +476,10 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force) int delta; /* If origin, there is no connection to send ACKs. Wrong function! */ - if (GMC_is_origin (c, fwd)) + if (GCC_is_origin (c, fwd)) { LOG (GNUNET_ERROR_TYPE_DEBUG, "connection %s is origin in %s\n", - GMC_2s (c), GM_f2s (fwd)); + GCC_2s (c), GC_f2s (fwd)); GNUNET_break (0); return; } @@ -488,7 +488,7 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force) prev_fc = fwd ? &c->bck_fc : &c->fwd_fc; LOG (GNUNET_ERROR_TYPE_DEBUG, "connection send %s ack on %s\n", - GM_f2s (fwd), GMC_2s (c)); + GC_f2s (fwd), GCC_2s (c)); /* Check if we need to transmit the ACK. */ delta = prev_fc->last_ack_sent - prev_fc->last_pid_recv; @@ -517,11 +517,11 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force) /* Check if message is already in queue */ if (NULL != prev_fc->ack_msg) { - if (GM_is_pid_bigger (ack, prev_fc->last_ack_sent)) + if (GC_is_pid_bigger (ack, prev_fc->last_ack_sent)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " canceling old ACK\n"); - GMC_cancel (prev_fc->ack_msg); - /* GMC_cancel triggers ack_sent(), which clears fc->ack_msg */ + GCC_cancel (prev_fc->ack_msg); + /* GCC_cancel triggers ack_sent(), which clears fc->ack_msg */ } else { @@ -538,7 +538,7 @@ send_ack (struct CadetConnection *c, unsigned int buffer, int fwd, int force) msg.ack = htonl (ack); msg.cid = c->id; - prev_fc->ack_msg = GMC_send_prebuilt_message (&msg.header, + prev_fc->ack_msg = GCC_send_prebuilt_message (&msg.header, GNUNET_MESSAGE_TYPE_CADET_ACK, ack, c, !fwd, GNUNET_YES, &ack_sent, prev_fc); @@ -575,7 +575,7 @@ conn_message_sent (void *cls, fc = fwd ? &c->fwd_fc : &c->bck_fc; LOG (GNUNET_ERROR_TYPE_DEBUG, " %ssent %s %s\n", - sent ? "" : "not ", GM_f2s (fwd), GM_m2s (type)); + sent ? "" : "not ", GC_f2s (fwd), GC_m2s (type)); if (NULL != q) { forced = q->forced; @@ -600,7 +600,7 @@ conn_message_sent (void *cls, GNUNET_break (type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN || type == GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY); LOG (GNUNET_ERROR_TYPE_ERROR, "Message %s sent on NULL connection!\n", - GM_m2s (type)); + GC_m2s (type)); return; } LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P- %p %u\n", c, c->pending_messages); @@ -608,7 +608,7 @@ conn_message_sent (void *cls, if (GNUNET_YES == c->destroy && 0 == c->pending_messages) { LOG (GNUNET_ERROR_TYPE_DEBUG, "! destroying connection!\n"); - GMC_destroy (c); + GCC_destroy (c); return; } /* Send ACK if needed, after accounting for sent ID in fc->queue_n */ @@ -627,7 +627,7 @@ conn_message_sent (void *cls, { GNUNET_assert (NULL != q); fc->last_pid_sent = pid; // FIXME - GMC_send_ack (c, fwd, GNUNET_NO); + GCC_send_ack (c, fwd, GNUNET_NO); connection_reset_timeout (c, fwd); } @@ -703,7 +703,7 @@ get_prev_hop (const struct CadetConnection *c) GNUNET_PEER_Id id; LOG (GNUNET_ERROR_TYPE_DEBUG, " get prev hop %s [%u/%u]\n", - GMC_2s (c), c->own_pos, c->path->length); + GCC_2s (c), c->own_pos, c->path->length); if (0 == c->own_pos || c->path->length < 2) id = c->path->peers[0]; else @@ -712,7 +712,7 @@ get_prev_hop (const struct CadetConnection *c) LOG (GNUNET_ERROR_TYPE_DEBUG, " ID: %s (%u)\n", GNUNET_i2s (GNUNET_PEER_resolve2 (id)), id); - return GMP_get_short (id); + return GCP_get_short (id); } @@ -729,7 +729,7 @@ get_next_hop (const struct CadetConnection *c) GNUNET_PEER_Id id; LOG (GNUNET_ERROR_TYPE_DEBUG, " get next hop %s [%u/%u]\n", - GMC_2s (c), c->own_pos, c->path->length); + GCC_2s (c), c->own_pos, c->path->length); if ((c->path->length - 1) == c->own_pos || c->path->length < 2) id = c->path->peers[c->path->length - 1]; else @@ -738,7 +738,7 @@ get_next_hop (const struct CadetConnection *c) LOG (GNUNET_ERROR_TYPE_DEBUG, " ID: %s (%u)\n", GNUNET_i2s (GNUNET_PEER_resolve2 (id)), id); - return GMP_get_short (id); + return GCP_get_short (id); } @@ -777,10 +777,10 @@ is_fwd (const struct CadetConnection *c, GNUNET_PEER_Id id; id = GNUNET_PEER_search (sender); - if (GMP_get_short_id (get_prev_hop (c)) == id) + if (GCP_get_short_id (get_prev_hop (c)) == id) return GNUNET_YES; - if (GMP_get_short_id (get_next_hop (c)) == id) + if (GCP_get_short_id (get_next_hop (c)) == id) return GNUNET_NO; GNUNET_break (0); @@ -803,15 +803,15 @@ send_connection_ack (struct CadetConnection *connection, int fwd) t = connection->t; LOG (GNUNET_ERROR_TYPE_INFO, "===> {%14s ACK} on connection %s\n", - GM_f2s (!fwd), GMC_2s (connection)); - GMP_queue_add (get_hop (connection, fwd), NULL, + GC_f2s (!fwd), GCC_2s (connection)); + GCP_queue_add (get_hop (connection, fwd), NULL, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0, sizeof (struct GNUNET_CADET_ConnectionACK), connection, fwd, &conn_message_sent, NULL); connection->pending_messages++; - if (CADET_TUNNEL3_NEW == GMT_get_cstate (t)) - GMT_change_cstate (t, CADET_TUNNEL3_WAITING); + if (CADET_TUNNEL3_NEW == GCT_get_cstate (t)) + GCT_change_cstate (t, CADET_TUNNEL3_WAITING); if (CADET_CONNECTION_READY != connection->state) connection_change_state (connection, CADET_CONNECTION_SENT); } @@ -838,7 +838,7 @@ send_broken (struct CadetConnection *c, msg.cid = c->id; msg.peer1 = *id1; msg.peer2 = *id2; - GMC_send_prebuilt_message (&msg.header, + GCC_send_prebuilt_message (&msg.header, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0, c, fwd, GNUNET_YES, NULL, NULL); } @@ -863,7 +863,7 @@ send_broken_unknown (const struct GNUNET_CADET_Hash *connection_id, struct CadetPeer *neighbor; LOG (GNUNET_ERROR_TYPE_INFO, "===> BROKEN on unknown connection %s\n", - GNUNET_h2s (GM_h2hc (connection_id))); + GNUNET_h2s (GC_h2hc (connection_id))); msg = GNUNET_new (struct GNUNET_CADET_ConnectionBroken); msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionBroken)); @@ -874,8 +874,8 @@ send_broken_unknown (const struct GNUNET_CADET_Hash *connection_id, msg->peer2 = *id2; else memset (&msg->peer2, 0, sizeof (msg->peer2)); - neighbor = GMP_get (peer_id); - GMP_queue_add (neighbor, msg, + neighbor = GCP_get (peer_id); + GCP_queue_add (neighbor, msg, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 2, sizeof (struct GNUNET_CADET_ConnectionBroken), @@ -898,7 +898,7 @@ send_connection_keepalive (struct CadetConnection *c, int fwd) LOG (GNUNET_ERROR_TYPE_INFO, "keepalive %s for connection %s\n", - GM_f2s (fwd), GMC_2s (c)); + GC_f2s (fwd), GCC_2s (c)); fc = fwd ? &c->fwd_fc : &c->bck_fc; if (0 < fc->queue_n) @@ -913,7 +913,7 @@ send_connection_keepalive (struct CadetConnection *c, int fwd) msg.type = htons (GNUNET_MESSAGE_TYPE_CADET_KEEPALIVE); GNUNET_assert (NULL == - GMT_send_prebuilt_message (&msg, c->t, c, + GCT_send_prebuilt_message (&msg, c->t, c, GNUNET_NO, NULL, NULL)); } @@ -929,7 +929,7 @@ connection_recreate (struct CadetConnection *c, int fwd) { LOG (GNUNET_ERROR_TYPE_DEBUG, "sending connection recreate\n"); if (fwd) - GMC_send_create (c); + GCC_send_create (c); else send_connection_ack (c, GNUNET_NO); } @@ -949,7 +949,7 @@ connection_maintain (struct CadetConnection *c, int fwd) if (GNUNET_NO != c->destroy) return; - if (CADET_TUNNEL3_SEARCHING == GMT_get_cstate (c->t)) + if (CADET_TUNNEL3_SEARCHING == GCT_get_cstate (c->t)) { /* TODO DHT GET with RO_BART */ return; @@ -984,7 +984,7 @@ static void connection_keepalive (struct CadetConnection *c, int fwd, int shutdown) { LOG (GNUNET_ERROR_TYPE_DEBUG, "%s keepalive for %s\n", - GM_f2s (fwd), GMC_2s (c)); + GC_f2s (fwd), GCC_2s (c)); if (fwd) c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK; @@ -1048,7 +1048,7 @@ schedule_next_keepalive (struct CadetConnection *c, int fwd) GNUNET_SCHEDULER_TaskIdentifier *task_id; GNUNET_SCHEDULER_Task keepalive_task; - if (GNUNET_NO == GMC_is_origin (c, fwd)) + if (GNUNET_NO == GCC_is_origin (c, fwd)) return; /* Calculate delay to use, depending on the state of the connection */ @@ -1110,16 +1110,16 @@ connection_unlock_queue (struct CadetConnection *c, int fwd) LOG (GNUNET_ERROR_TYPE_DEBUG, "connection_unlock_queue %s on %s\n", - GM_f2s (fwd), GMC_2s (c)); + GC_f2s (fwd), GCC_2s (c)); - if (GMC_is_terminal (c, fwd)) + if (GCC_is_terminal (c, fwd)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " is terminal!\n"); return; } peer = get_hop (c, fwd); - GMP_queue_unlock (peer, c); + GCP_queue_unlock (peer, c); } @@ -1140,7 +1140,7 @@ connection_cancel_queues (struct CadetConnection *c, int fwd) LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Cancel %s queues for connection %s\n", - GM_f2s (fwd), GMC_2s (c)); + GC_f2s (fwd), GCC_2s (c)); if (NULL == c) { GNUNET_break (0); @@ -1155,7 +1155,7 @@ connection_cancel_queues (struct CadetConnection *c, int fwd) LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Cancel POLL in ccq for fc %p\n", fc); } peer = get_hop (c, fwd); - GMP_queue_cancel (peer, c); + GCP_queue_cancel (peer, c); } @@ -1225,14 +1225,14 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) c = fc->c; LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Polling connection %s %s\n", - GMC_2s (c), fc == &c->fwd_fc ? "FWD" : "BCK"); + GCC_2s (c), fc == &c->fwd_fc ? "FWD" : "BCK"); msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_POLL); msg.header.size = htons (sizeof (msg)); msg.pid = htonl (fc->last_pid_sent); LOG (GNUNET_ERROR_TYPE_DEBUG, " *** last pid sent: %u!\n", fc->last_pid_sent); fc->poll_msg = - GMC_send_prebuilt_message (&msg.header, + GCC_send_prebuilt_message (&msg.header, GNUNET_MESSAGE_TYPE_CADET_POLL, fc->last_pid_sent, c, fc == &c->fwd_fc, GNUNET_YES, @@ -1258,14 +1258,14 @@ connection_fwd_timeout (void *cls, return; LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s FWD timed out. Destroying.\n", - GMC_2s (c)); - if (GMC_is_origin (c, GNUNET_YES)) /* If local, leave. */ + GCC_2s (c)); + if (GCC_is_origin (c, GNUNET_YES)) /* If local, leave. */ { GNUNET_break (0); return; } - GMC_destroy (c); + GCC_destroy (c); } @@ -1287,15 +1287,15 @@ connection_bck_timeout (void *cls, return; LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s BCK timed out. Destroying.\n", - GMC_2s (c)); + GCC_2s (c)); - if (GMC_is_origin (c, GNUNET_NO)) /* If local, leave. */ + if (GCC_is_origin (c, GNUNET_NO)) /* If local, leave. */ { GNUNET_break (0); return; } - GMC_destroy (c); + GCC_destroy (c); } @@ -1316,9 +1316,9 @@ connection_bck_timeout (void *cls, static void connection_reset_timeout (struct CadetConnection *c, int fwd) { - LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s reset timeout\n", GM_f2s (fwd)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection %s reset timeout\n", GC_f2s (fwd)); - if (GMC_is_origin (c, fwd)) /* Startpoint */ + if (GCC_is_origin (c, fwd)) /* Startpoint */ { schedule_next_keepalive (c, fwd); } @@ -1357,33 +1357,33 @@ register_neighbors (struct CadetConnection *c) prev_peer = get_prev_hop (c); LOG (GNUNET_ERROR_TYPE_DEBUG, "register neighbors for connection %s\n", - GMC_2s (c)); + GCC_2s (c)); path_debug (c->path); LOG (GNUNET_ERROR_TYPE_DEBUG, "own pos %u\n", c->own_pos); LOG (GNUNET_ERROR_TYPE_DEBUG, "putting connection %s to next peer %p\n", - GMC_2s (c), next_peer); - LOG (GNUNET_ERROR_TYPE_DEBUG, "next peer %p %s\n", next_peer, GMP_2s (next_peer)); + GCC_2s (c), next_peer); + LOG (GNUNET_ERROR_TYPE_DEBUG, "next peer %p %s\n", next_peer, GCP_2s (next_peer)); LOG (GNUNET_ERROR_TYPE_DEBUG, "putting connection %s to prev peer %p\n", - GMC_2s (c), prev_peer); - LOG (GNUNET_ERROR_TYPE_DEBUG, "prev peer %p %s\n", prev_peer, GMP_2s (prev_peer)); + GCC_2s (c), prev_peer); + LOG (GNUNET_ERROR_TYPE_DEBUG, "prev peer %p %s\n", prev_peer, GCP_2s (prev_peer)); - if (GNUNET_NO == GMP_is_neighbor (next_peer) - || GNUNET_NO == GMP_is_neighbor (prev_peer)) + if (GNUNET_NO == GCP_is_neighbor (next_peer) + || GNUNET_NO == GCP_is_neighbor (prev_peer)) { - if (GMC_is_origin (c, GNUNET_YES)) + if (GCC_is_origin (c, GNUNET_YES)) GNUNET_STATISTICS_update (stats, "# local bad paths", 1, GNUNET_NO); GNUNET_STATISTICS_update (stats, "# bad paths", 1, GNUNET_NO); LOG (GNUNET_ERROR_TYPE_DEBUG, " register neighbors failed\n"); LOG (GNUNET_ERROR_TYPE_DEBUG, " prev: %s, neighbor?: %d\n", - GMP_2s (prev_peer), GMP_is_neighbor (prev_peer)); + GCP_2s (prev_peer), GCP_is_neighbor (prev_peer)); LOG (GNUNET_ERROR_TYPE_DEBUG, " next: %s, neighbor?: %d\n", - GMP_2s (next_peer), GMP_is_neighbor (next_peer)); + GCP_2s (next_peer), GCP_is_neighbor (next_peer)); return GNUNET_SYSERR; } - GMP_add_connection (next_peer, c); - GMP_add_connection (prev_peer, c); + GCP_add_connection (next_peer, c); + GCP_add_connection (prev_peer, c); return GNUNET_OK; } @@ -1400,21 +1400,21 @@ unregister_neighbors (struct CadetConnection *c) struct CadetPeer *peer; peer = get_next_hop (c); - if (GNUNET_OK != GMP_remove_connection (peer, c)) + if (GNUNET_OK != GCP_remove_connection (peer, c)) { GNUNET_assert (CADET_CONNECTION_NEW == c->state || CADET_CONNECTION_DESTROYED == c->state); LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state); - if (NULL != c->t) GMT_debug (c->t); + if (NULL != c->t) GCT_debug (c->t); } peer = get_prev_hop (c); - if (GNUNET_OK != GMP_remove_connection (peer, c)) + if (GNUNET_OK != GCP_remove_connection (peer, c)) { GNUNET_assert (CADET_CONNECTION_NEW == c->state || CADET_CONNECTION_DESTROYED == c->state); LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate: %u\n", c->state); - if (NULL != c->t) GMT_debug (c->t); + if (NULL != c->t) GCT_debug (c->t); } } @@ -1431,9 +1431,9 @@ unregister_neighbors (struct CadetConnection *c) static void add_to_peer (struct CadetConnection *c, struct CadetPeer *peer) { - GMP_add_tunnel (peer); - c->t = GMP_get_tunnel (peer); - GMT_add_connection (c->t, c); + GCP_add_tunnel (peer); + c->t = GCP_get_tunnel (peer); + GCT_add_connection (c->t, c); } @@ -1511,7 +1511,7 @@ log_message (const struct GNUNET_MessageHeader *message, const struct GNUNET_CADET_Hash *hash) { LOG (GNUNET_ERROR_TYPE_INFO, "<-- %s on connection %s from %s\n", - GM_m2s (ntohs (message->type)), GNUNET_h2s (GM_h2hc (hash)), + GC_m2s (ntohs (message->type)), GNUNET_h2s (GC_h2hc (hash)), GNUNET_i2s (peer)); } @@ -1530,7 +1530,7 @@ log_message (const struct GNUNET_MessageHeader *message, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { struct GNUNET_CADET_ConnectionCreate *msg; @@ -1589,7 +1589,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, } LOG (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos); LOG (GNUNET_ERROR_TYPE_DEBUG, " Creating connection\n"); - c = GMC_new (cid, NULL, path_duplicate (path), own_pos); + c = GCC_new (cid, NULL, path_duplicate (path), own_pos); if (NULL == c) { if (path->length - 1 == own_pos) @@ -1604,7 +1604,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, path_destroy (path); return GNUNET_OK; } - GMP_add_path_to_all (path, GNUNET_NO); + GCP_add_path_to_all (path, GNUNET_NO); connection_reset_timeout (c, GNUNET_YES); } else @@ -1615,18 +1615,18 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, connection_change_state (c, CADET_CONNECTION_SENT); /* Remember peers */ - dest_peer = GMP_get (&id[size - 1]); - orig_peer = GMP_get (&id[0]); + dest_peer = GCP_get (&id[size - 1]); + orig_peer = GCP_get (&id[0]); /* Is it a connection to us? */ if (c->own_pos == path->length - 1) { LOG (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n"); - GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_YES); + GCP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_YES); add_to_peer (c, orig_peer); - if (CADET_TUNNEL3_NEW == GMT_get_cstate (c->t)) - GMT_change_cstate (c->t, CADET_TUNNEL3_WAITING); + if (CADET_TUNNEL3_NEW == GCT_get_cstate (c->t)) + GCT_change_cstate (c->t, CADET_TUNNEL3_WAITING); send_connection_ack (c, GNUNET_NO); if (CADET_CONNECTION_SENT == c->state) @@ -1636,9 +1636,9 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, { /* It's for somebody else! Retransmit. */ LOG (GNUNET_ERROR_TYPE_DEBUG, " Retransmitting.\n"); - GMP_add_path (dest_peer, path_duplicate (path), GNUNET_NO); - GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO); - GMC_send_prebuilt_message (message, + GCP_add_path (dest_peer, path_duplicate (path), GNUNET_NO); + GCP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO); + GCC_send_prebuilt_message (message, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0, c, GNUNET_YES, GNUNET_YES, NULL, NULL); @@ -1659,7 +1659,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { struct GNUNET_CADET_ConnectionACK *msg; @@ -1689,7 +1689,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, oldstate = c->state; LOG (GNUNET_ERROR_TYPE_DEBUG, " via peer %s\n", GNUNET_i2s (peer)); - pi = GMP_get (peer); + pi = GCP_get (peer); if (get_next_hop (c) == pi) { LOG (GNUNET_ERROR_TYPE_DEBUG, " SYNACK\n"); @@ -1715,7 +1715,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, p = c->path; if (NULL != p) { - GMP_add_path_to_all (p, GNUNET_YES); + GCP_add_path_to_all (p, GNUNET_YES); } else { @@ -1723,7 +1723,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, } /* Message for us as creator? */ - if (GMC_is_origin (c, GNUNET_YES)) + if (GCC_is_origin (c, GNUNET_YES)) { if (GNUNET_NO != fwd) { @@ -1741,14 +1741,14 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, send_connection_ack (c, GNUNET_YES); /* Change tunnel state, trigger KX */ - if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t)) - GMT_change_cstate (c->t, CADET_TUNNEL3_READY); + if (CADET_TUNNEL3_WAITING == GCT_get_cstate (c->t)) + GCT_change_cstate (c->t, CADET_TUNNEL3_READY); return GNUNET_OK; } /* Message for us as destination? */ - if (GMC_is_terminal (c, GNUNET_YES)) + if (GCC_is_terminal (c, GNUNET_YES)) { if (GNUNET_YES != fwd) { @@ -1762,14 +1762,14 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, connection_reset_timeout (c, GNUNET_NO); /* Change tunnel state */ - if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t)) - GMT_change_cstate (c->t, CADET_TUNNEL3_READY); + if (CADET_TUNNEL3_WAITING == GCT_get_cstate (c->t)) + GCT_change_cstate (c->t, CADET_TUNNEL3_READY); return GNUNET_OK; } LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); - GMC_send_prebuilt_message (message, + GCC_send_prebuilt_message (message, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, 0, c, fwd, GNUNET_YES, NULL, NULL); return GNUNET_OK; @@ -1787,7 +1787,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_broken (void* cls, +GCC_handle_broken (void* cls, const struct GNUNET_PeerIdentity* id, const struct GNUNET_MessageHeader* message) { @@ -1809,29 +1809,29 @@ GMC_handle_broken (void* cls, } fwd = is_fwd (c, id); - if (GMC_is_terminal (c, fwd)) + if (GCC_is_terminal (c, fwd)) { struct GNUNET_MessageHeader *out_msg; struct CadetPeer *neighbor; struct CadetPeer *endpoint; neighbor = get_hop (c, !fwd); - endpoint = GMP_get_short (c->path->peers[c->path->length - 1]); + endpoint = GCP_get_short (c->path->peers[c->path->length - 1]); path_invalidate (c->path); - GMP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2); + GCP_notify_broken_link (endpoint, &msg->peer1, &msg->peer2); c->state = CADET_CONNECTION_DESTROYED; - while (NULL != (out_msg = GMP_connection_pop (neighbor, c))) + while (NULL != (out_msg = GCP_connection_pop (neighbor, c))) { GNUNET_assert (NULL == - GMT_send_prebuilt_message (out_msg, c->t, NULL, GNUNET_YES, + GCT_send_prebuilt_message (out_msg, c->t, NULL, GNUNET_YES, NULL, NULL)); } - GMC_destroy (c); + GCC_destroy (c); } else { - GMC_send_prebuilt_message (message, + GCC_send_prebuilt_message (message, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, 0, c, fwd, GNUNET_YES, NULL, NULL); c->destroy = GNUNET_YES; @@ -1854,7 +1854,7 @@ GMC_handle_broken (void* cls, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { struct GNUNET_CADET_ConnectionDestroy *msg; @@ -1881,21 +1881,21 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_break_op (0); /* FIXME */ return GNUNET_OK; } - if (GNUNET_NO == GMC_is_terminal (c, fwd)) - GMC_send_prebuilt_message (message, + if (GNUNET_NO == GCC_is_terminal (c, fwd)) + GCC_send_prebuilt_message (message, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0, c, fwd, GNUNET_YES, NULL, NULL); else if (0 == c->pending_messages) { LOG (GNUNET_ERROR_TYPE_DEBUG, " directly destroying connection!\n"); - GMC_destroy (c); + GCC_destroy (c); return GNUNET_OK; } c->destroy = GNUNET_YES; c->state = CADET_CONNECTION_DESTROYED; if (NULL != c->t) { - GMT_remove_connection (c->t, c); + GCT_remove_connection (c->t, c); c->t = NULL; } @@ -1942,24 +1942,24 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer, { GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO); LOG (GNUNET_ERROR_TYPE_DEBUG, "enc on unknown connection %s\n", - GNUNET_h2s (GM_h2hc (&msg->cid))); + GNUNET_h2s (GC_h2hc (&msg->cid))); send_broken_unknown (&msg->cid, &my_full_id, NULL, peer); return GNUNET_OK; } - LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s\n", GMC_2s (c)); + LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s\n", GCC_2s (c)); /* Check if origin is as expected */ neighbor = get_prev_hop (c); peer_id = GNUNET_PEER_search (peer); - if (peer_id == GMP_get_short_id (neighbor)) + if (peer_id == GCP_get_short_id (neighbor)) { fwd = GNUNET_YES; } else { neighbor = get_next_hop (c); - if (peer_id == GMP_get_short_id (neighbor)) + if (peer_id == GCP_get_short_id (neighbor)) { fwd = GNUNET_NO; } @@ -1976,7 +1976,7 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer, pid = ntohl (msg->pid); LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u (expected %u+)\n", pid, fc->last_pid_recv + 1); - if (GM_is_pid_bigger (pid, fc->last_ack_sent)) + if (GC_is_pid_bigger (pid, fc->last_ack_sent)) { GNUNET_STATISTICS_update (stats, "# unsolicited message", 1, GNUNET_NO); GNUNET_break_op (0); @@ -1985,7 +1985,7 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer, pid, fc->last_pid_recv, fc->last_ack_sent); return GNUNET_OK; } - if (GNUNET_NO == GM_is_pid_bigger (pid, fc->last_pid_recv)) + if (GNUNET_NO == GC_is_pid_bigger (pid, fc->last_pid_recv)) { GNUNET_STATISTICS_update (stats, "# duplicate PID", 1, GNUNET_NO); LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1999,7 +1999,7 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer, fc->last_pid_recv = pid; /* Is this message for us? */ - if (GMC_is_terminal (c, fwd)) + if (GCC_is_terminal (c, fwd)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n"); GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO); @@ -2010,8 +2010,8 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer, return GNUNET_OK; } fc->last_pid_recv = pid; - GMT_handle_encrypted (c->t, msg); - GMC_send_ack (c, fwd, GNUNET_NO); + GCT_handle_encrypted (c->t, msg); + GCC_send_ack (c, fwd, GNUNET_NO); return GNUNET_OK; } @@ -2023,12 +2023,12 @@ handle_cadet_encrypted (const struct GNUNET_PeerIdentity *peer, { GNUNET_STATISTICS_update (stats, "# TTL drops", 1, GNUNET_NO); LOG (GNUNET_ERROR_TYPE_WARNING, " TTL is 0, DROPPING!\n"); - GMC_send_ack (c, fwd, GNUNET_NO); + GCC_send_ack (c, fwd, GNUNET_NO); return GNUNET_OK; } GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); - GMC_send_prebuilt_message (&msg->header, + GCC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0, c, fwd, GNUNET_NO, NULL, NULL); @@ -2072,23 +2072,23 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer, { GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO); LOG (GNUNET_ERROR_TYPE_DEBUG, "kx on unknown connection %s\n", - GNUNET_h2s (GM_h2hc (&msg->cid))); + GNUNET_h2s (GC_h2hc (&msg->cid))); send_broken_unknown (&msg->cid, &my_full_id, NULL, peer); return GNUNET_OK; } - LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GMC_2s (c)); + LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GCC_2s (c)); /* Check if origin is as expected */ neighbor = get_prev_hop (c); peer_id = GNUNET_PEER_search (peer); - if (peer_id == GMP_get_short_id (neighbor)) + if (peer_id == GCP_get_short_id (neighbor)) { fwd = GNUNET_YES; } else { neighbor = get_next_hop (c); - if (peer_id == GMP_get_short_id (neighbor)) + if (peer_id == GCP_get_short_id (neighbor)) { fwd = GNUNET_NO; } @@ -2106,14 +2106,14 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer, connection_change_state (c, CADET_CONNECTION_READY); if (NULL != c->t) { - if (CADET_TUNNEL3_WAITING == GMT_get_cstate (c->t)) - GMT_change_cstate (c->t, CADET_TUNNEL3_READY); + if (CADET_TUNNEL3_WAITING == GCT_get_cstate (c->t)) + GCT_change_cstate (c->t, CADET_TUNNEL3_READY); } } connection_reset_timeout (c, fwd); /* Is this message for us? */ - if (GMC_is_terminal (c, fwd)) + if (GCC_is_terminal (c, fwd)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " message for us!\n"); GNUNET_STATISTICS_update (stats, "# messages received", 1, GNUNET_NO); @@ -2122,14 +2122,14 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer, GNUNET_break (0); return GNUNET_OK; } - GMT_handle_kx (c->t, &msg[1].header); + GCT_handle_kx (c->t, &msg[1].header); return GNUNET_OK; } /* Message not for us: forward to next hop */ LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n"); GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO); - GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, 0, + GCC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, 0, c, fwd, GNUNET_NO, NULL, NULL); return GNUNET_OK; @@ -2147,7 +2147,7 @@ handle_cadet_kx (const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { return handle_cadet_encrypted (peer, @@ -2166,7 +2166,7 @@ GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { return handle_cadet_kx (peer, @@ -2185,7 +2185,7 @@ GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { struct GNUNET_CADET_ACK *msg; @@ -2208,13 +2208,13 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, /* Is this a forward or backward ACK? */ id = GNUNET_PEER_search (peer); - if (GMP_get_short_id (get_next_hop (c)) == id) + if (GCP_get_short_id (get_next_hop (c)) == id) { LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n"); fc = &c->fwd_fc; fwd = GNUNET_YES; } - else if (GMP_get_short_id (get_prev_hop (c)) == id) + else if (GCP_get_short_id (get_prev_hop (c)) == id) { LOG (GNUNET_ERROR_TYPE_DEBUG, " BCK ACK\n"); fc = &c->bck_fc; @@ -2229,12 +2229,12 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, ack = ntohl (msg->ack); LOG (GNUNET_ERROR_TYPE_DEBUG, " ACK %u (was %u)\n", ack, fc->last_ack_recv); - if (GM_is_pid_bigger (ack, fc->last_ack_recv)) + if (GC_is_pid_bigger (ack, fc->last_ack_recv)) fc->last_ack_recv = ack; /* Cancel polling if the ACK is big enough. */ if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task && - GM_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) + GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n"); GNUNET_SCHEDULER_cancel (fc->poll_task); @@ -2259,7 +2259,7 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message) { struct GNUNET_CADET_Poll *msg; @@ -2277,7 +2277,7 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_STATISTICS_update (stats, "# poll on unknown connection", 1, GNUNET_NO); LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL message on unknown connection %s!\n", - GNUNET_h2s (GM_h2hc (&msg->cid))); + GNUNET_h2s (GC_h2hc (&msg->cid))); send_broken_unknown (&msg->cid, &my_full_id, NULL, peer); return GNUNET_OK; } @@ -2288,12 +2288,12 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, * this way of discerining FWD/BCK should not be a problem. */ id = GNUNET_PEER_search (peer); - if (GMP_get_short_id (get_next_hop (c)) == id) + if (GCP_get_short_id (get_next_hop (c)) == id) { LOG (GNUNET_ERROR_TYPE_DEBUG, " FWD FC\n"); fc = &c->fwd_fc; } - else if (GMP_get_short_id (get_prev_hop (c)) == id) + else if (GCP_get_short_id (get_prev_hop (c)) == id) { LOG (GNUNET_ERROR_TYPE_DEBUG, " BCK FC\n"); fc = &c->bck_fc; @@ -2308,7 +2308,7 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, LOG (GNUNET_ERROR_TYPE_DEBUG, " PID %u, OLD %u\n", pid, fc->last_pid_recv); fc->last_pid_recv = pid; fwd = fc == &c->bck_fc; - GMC_send_ack (c, fwd, GNUNET_YES); + GCC_send_ack (c, fwd, GNUNET_YES); return GNUNET_OK; } @@ -2323,13 +2323,13 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, * @param force Send the ACK even if suboptimal (e.g. requested by POLL). */ void -GMC_send_ack (struct CadetConnection *c, int fwd, int force) +GCC_send_ack (struct CadetConnection *c, int fwd, int force) { unsigned int buffer; LOG (GNUNET_ERROR_TYPE_DEBUG, "GMC send %s ACK on %s\n", - GM_f2s (fwd), GMC_2s (c)); + GC_f2s (fwd), GCC_2s (c)); if (NULL == c) { @@ -2344,26 +2344,26 @@ GMC_send_ack (struct CadetConnection *c, int fwd, int force) } /* Get available buffer space */ - if (GMC_is_terminal (c, fwd)) + if (GCC_is_terminal (c, fwd)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from all channels\n"); - buffer = GMT_get_channels_buffer (c->t); + buffer = GCT_get_channels_buffer (c->t); } else { LOG (GNUNET_ERROR_TYPE_DEBUG, " getting from one connection\n"); - buffer = GMC_get_buffer (c, fwd); + buffer = GCC_get_buffer (c, fwd); } LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer available: %u\n", buffer); if (0 == buffer && GNUNET_NO == force) return; /* Send available buffer space */ - if (GMC_is_origin (c, fwd)) + if (GCC_is_origin (c, fwd)) { GNUNET_assert (NULL != c->t); LOG (GNUNET_ERROR_TYPE_DEBUG, " sending on channels...\n"); - GMT_unchoke_channels (c->t); + GCT_unchoke_channels (c->t); } else { @@ -2379,7 +2379,7 @@ GMC_send_ack (struct CadetConnection *c, int fwd, int force) * @param c Configuration handle. */ void -GMC_init (const struct GNUNET_CONFIGURATION_Handle *c) +GCC_init (const struct GNUNET_CONFIGURATION_Handle *c) { LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); if (GNUNET_OK != @@ -2432,7 +2432,7 @@ shutdown_iterator (void *cls, { struct CadetConnection *c = value; - GMC_destroy (c); + GCC_destroy (c); return GNUNET_YES; } @@ -2441,7 +2441,7 @@ shutdown_iterator (void *cls, * Shut down the connections subsystem. */ void -GMC_shutdown (void) +GCC_shutdown (void) { GNUNET_CONTAINER_multihashmap_iterate (connections, &shutdown_iterator, NULL); GNUNET_CONTAINER_multihashmap_destroy (connections); @@ -2450,7 +2450,7 @@ GMC_shutdown (void) struct CadetConnection * -GMC_new (const struct GNUNET_CADET_Hash *cid, +GCC_new (const struct GNUNET_CADET_Hash *cid, struct CadetTunnel3 *t, struct CadetPeerPath *p, unsigned int own_pos) @@ -2461,7 +2461,7 @@ GMC_new (const struct GNUNET_CADET_Hash *cid, c->id = *cid; GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (connections, - GMC_get_h (c), c, + GCC_get_h (c), c, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); fc_init (&c->fwd_fc); fc_init (&c->bck_fc); @@ -2482,7 +2482,7 @@ GMC_new (const struct GNUNET_CADET_Hash *cid, c->t = NULL; c->path = NULL; } - GMC_destroy (c); + GCC_destroy (c); return NULL; } @@ -2491,7 +2491,7 @@ GMC_new (const struct GNUNET_CADET_Hash *cid, void -GMC_destroy (struct CadetConnection *c) +GCC_destroy (struct CadetConnection *c) { if (NULL == c) { @@ -2499,11 +2499,11 @@ GMC_destroy (struct CadetConnection *c) return; } - if (2 == c->destroy) /* cancel queues -> GMP_queue_cancel -> q_destroy -> */ - return; /* -> message_sent -> GMC_destroy. Don't loop. */ + if (2 == c->destroy) /* cancel queues -> GCP_queue_cancel -> q_destroy -> */ + return; /* -> message_sent -> GCC_destroy. Don't loop. */ c->destroy = 2; - LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying connection %s\n", GMC_2s (c)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying connection %s\n", GCC_2s (c)); LOG (GNUNET_ERROR_TYPE_DEBUG, " fc's f: %p, b: %p\n", &c->fwd_fc, &c->bck_fc); LOG (GNUNET_ERROR_TYPE_DEBUG, " fc tasks f: %u, b: %u\n", @@ -2523,20 +2523,20 @@ GMC_destroy (struct CadetConnection *c) /* Cancel maintainance task (keepalive/timeout) */ if (NULL != c->fwd_fc.poll_msg) { - GMC_cancel (c->fwd_fc.poll_msg); + GCC_cancel (c->fwd_fc.poll_msg); LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL msg FWD canceled\n"); } if (NULL != c->bck_fc.poll_msg) { - GMC_cancel (c->bck_fc.poll_msg); + GCC_cancel (c->bck_fc.poll_msg); LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL msg BCK canceled\n"); } /* Delete from tunnel */ if (NULL != c->t) - GMT_remove_connection (c->t, c); + GCT_remove_connection (c->t, c); - if (GNUNET_NO == GMC_is_origin (c, GNUNET_YES) && NULL != c->path) + if (GNUNET_NO == GCC_is_origin (c, GNUNET_YES) && NULL != c->path) path_destroy (c->path); if (GNUNET_SCHEDULER_NO_TASK != c->fwd_maintenance_task) GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task); @@ -2555,7 +2555,7 @@ GMC_destroy (struct CadetConnection *c) GNUNET_break (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (connections, - GMC_get_h (c), c)); + GCC_get_h (c), c)); GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO); GNUNET_free (c); @@ -2569,7 +2569,7 @@ GMC_destroy (struct CadetConnection *c) * @return ID of the connection. */ const struct GNUNET_CADET_Hash * -GMC_get_id (const struct CadetConnection *c) +GCC_get_id (const struct CadetConnection *c) { return &c->id; } @@ -2583,9 +2583,9 @@ GMC_get_id (const struct CadetConnection *c) * @return ID of the connection. */ const struct GNUNET_HashCode * -GMC_get_h (const struct CadetConnection *c) +GCC_get_h (const struct CadetConnection *c) { - return GM_h2hc (&c->id); + return GC_h2hc (&c->id); } @@ -2597,7 +2597,7 @@ GMC_get_h (const struct CadetConnection *c) * @return path used by the connection. */ const struct CadetPeerPath * -GMC_get_path (const struct CadetConnection *c) +GCC_get_path (const struct CadetConnection *c) { if (GNUNET_NO == c->destroy) return c->path; @@ -2613,7 +2613,7 @@ GMC_get_path (const struct CadetConnection *c) * @return state of the connection. */ enum CadetConnectionState -GMC_get_state (const struct CadetConnection *c) +GCC_get_state (const struct CadetConnection *c) { return c->state; } @@ -2626,7 +2626,7 @@ GMC_get_state (const struct CadetConnection *c) * @return tunnel of the connection. */ struct CadetTunnel3 * -GMC_get_tunnel (const struct CadetConnection *c) +GCC_get_tunnel (const struct CadetConnection *c) { return c->t; } @@ -2641,7 +2641,7 @@ GMC_get_tunnel (const struct CadetConnection *c) * @return Free buffer space [0 - max_msgs_queue/max_connections] */ unsigned int -GMC_get_buffer (struct CadetConnection *c, int fwd) +GCC_get_buffer (struct CadetConnection *c, int fwd) { struct CadetFlowControl *fc; @@ -2659,12 +2659,12 @@ GMC_get_buffer (struct CadetConnection *c, int fwd) * @return last_ack_sent - last_pid_recv */ unsigned int -GMC_get_allowed (struct CadetConnection *c, int fwd) +GCC_get_allowed (struct CadetConnection *c, int fwd) { struct CadetFlowControl *fc; fc = fwd ? &c->fwd_fc : &c->bck_fc; - if (GM_is_pid_bigger(fc->last_pid_recv, fc->last_ack_sent)) + if (GC_is_pid_bigger(fc->last_pid_recv, fc->last_ack_sent)) { return 0; } @@ -2680,7 +2680,7 @@ GMC_get_allowed (struct CadetConnection *c, int fwd) * @return Number of messages queued. */ unsigned int -GMC_get_qn (struct CadetConnection *c, int fwd) +GCC_get_qn (struct CadetConnection *c, int fwd) { struct CadetFlowControl *fc; @@ -2699,7 +2699,7 @@ GMC_get_qn (struct CadetConnection *c, int fwd) * @return Last PID used + 1. */ unsigned int -GMC_get_pid (struct CadetConnection *c, int fwd) +GCC_get_pid (struct CadetConnection *c, int fwd) { struct CadetFlowControl *fc; @@ -2720,10 +2720,10 @@ GMC_get_pid (struct CadetConnection *c, int fwd) * @param fwd Is this about FWD traffic? (The ack will go dest->root). */ void -GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd) +GCC_allow (struct CadetConnection *c, unsigned int buffer, int fwd) { LOG (GNUNET_ERROR_TYPE_DEBUG, " allowing %s %u messages %s\n", - GMC_2s (c), buffer, GM_f2s (fwd)); + GCC_2s (c), buffer, GC_f2s (fwd)); send_ack (c, buffer, fwd, GNUNET_NO); } @@ -2736,25 +2736,25 @@ GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd) * @param peer Peer that disconnected. */ void -GMC_notify_broken (struct CadetConnection *c, +GCC_notify_broken (struct CadetConnection *c, struct CadetPeer *peer) { int fwd; LOG (GNUNET_ERROR_TYPE_DEBUG, " notify broken on %s due to %s disconnect\n", - GMC_2s (c), GMP_2s (peer)); + GCC_2s (c), GCP_2s (peer)); fwd = peer == get_prev_hop (c); - if (GNUNET_YES == GMC_is_terminal (c, fwd)) + if (GNUNET_YES == GCC_is_terminal (c, fwd)) { /* Local shutdown, no one to notify about this. */ - GMC_destroy (c); + GCC_destroy (c); return; } if (GNUNET_NO == c->destroy) - send_broken (c, &my_full_id, GMP_get_id (peer), fwd); + send_broken (c, &my_full_id, GCP_get_id (peer), fwd); /* Connection will have at least one pending message * (the one we just scheduled), so no point in checking whether to @@ -2780,7 +2780,7 @@ GMC_notify_broken (struct CadetConnection *c, * @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal. */ int -GMC_is_origin (struct CadetConnection *c, int fwd) +GCC_is_origin (struct CadetConnection *c, int fwd) { if (!fwd && c->path->length - 1 == c->own_pos ) return GNUNET_YES; @@ -2800,9 +2800,9 @@ GMC_is_origin (struct CadetConnection *c, int fwd) * @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin. */ int -GMC_is_terminal (struct CadetConnection *c, int fwd) +GCC_is_terminal (struct CadetConnection *c, int fwd) { - return GMC_is_origin (c, !fwd); + return GCC_is_origin (c, !fwd); } @@ -2815,12 +2815,12 @@ GMC_is_terminal (struct CadetConnection *c, int fwd) * @return #GNUNET_YES in case it's OK to send. */ int -GMC_is_sendable (struct CadetConnection *c, int fwd) +GCC_is_sendable (struct CadetConnection *c, int fwd) { struct CadetFlowControl *fc; LOG (GNUNET_ERROR_TYPE_DEBUG, " checking sendability of %s traffic on %s\n", - GM_f2s (fwd), GMC_2s (c)); + GC_f2s (fwd), GCC_2s (c)); if (NULL == c) { GNUNET_break (0); @@ -2830,7 +2830,7 @@ GMC_is_sendable (struct CadetConnection *c, int fwd) LOG (GNUNET_ERROR_TYPE_DEBUG, " last ack recv: %u, last pid sent: %u\n", fc->last_ack_recv, fc->last_pid_sent); - if (GM_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) + if (GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " sendable\n"); return GNUNET_YES; @@ -2848,7 +2848,7 @@ GMC_is_sendable (struct CadetConnection *c, int fwd) * @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise. */ int -GMC_is_direct (struct CadetConnection *c) +GCC_is_direct (struct CadetConnection *c) { return (c->path->length == 2) ? GNUNET_YES : GNUNET_NO; } @@ -2871,10 +2871,10 @@ GMC_is_direct (struct CadetConnection *c) * Invalid on @c cont call. */ struct CadetConnectionQueue * -GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, +GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, uint16_t payload_type, uint32_t payload_id, struct CadetConnection *c, int fwd, int force, - GMC_sent cont, void *cont_cls) + GCC_sent cont, void *cont_cls) { struct CadetFlowControl *fc; struct CadetConnectionQueue *q; @@ -2888,7 +2888,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, memcpy (data, message, size); type = ntohs (message->type); LOG (GNUNET_ERROR_TYPE_INFO, "--> %s (%s %u) on connection %s (%u bytes)\n", - GM_m2s (type), GM_m2s (payload_type), payload_id, GMC_2s (c), size); + GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), size); fc = fwd ? &c->fwd_fc : &c->bck_fc; droppable = GNUNET_NO == force; @@ -2925,9 +2925,9 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, { LOG (GNUNET_ERROR_TYPE_DEBUG, " not droppable, Q_N stays the same\n"); } - if (GM_is_pid_bigger (fc->last_pid_sent + 1, fc->last_ack_recv)) + if (GC_is_pid_bigger (fc->last_pid_sent + 1, fc->last_ack_recv)) { - GMC_start_poll (c, fwd); + GCC_start_poll (c, fwd); } break; @@ -2994,11 +2994,11 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, q = GNUNET_new (struct CadetConnectionQueue); q->forced = !droppable; - q->q = GMP_queue_add (get_hop (c, fwd), data, type, payload_type, payload_id, + q->q = GCP_queue_add (get_hop (c, fwd), data, type, payload_type, payload_id, size, c, fwd, &conn_message_sent, q); if (NULL == q->q) { - LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING dropping msg on %s\n", GMC_2s (c)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING dropping msg on %s\n", GCC_2s (c)); GNUNET_free (data); GNUNET_free (q); return NULL; @@ -3019,12 +3019,12 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, * @param q Handle to the queue. */ void -GMC_cancel (struct CadetConnectionQueue *q) +GCC_cancel (struct CadetConnectionQueue *q) { LOG (GNUNET_ERROR_TYPE_DEBUG, "! GMC cancel message\n"); /* queue destroy calls message_sent, which calls q->cont and frees q */ - GMP_queue_destroy (q->q, GNUNET_YES, GNUNET_NO, 0); + GCP_queue_destroy (q->q, GNUNET_YES, GNUNET_NO, 0); } @@ -3035,7 +3035,7 @@ GMC_cancel (struct CadetConnectionQueue *q) * @param connection Connection to create. */ void -GMC_send_create (struct CadetConnection *connection) +GCC_send_create (struct CadetConnection *connection) { enum CadetTunnel3CState state; size_t size; @@ -3044,21 +3044,21 @@ GMC_send_create (struct CadetConnection *connection) size += connection->path->length * sizeof (struct GNUNET_PeerIdentity); LOG (GNUNET_ERROR_TYPE_INFO, "===> %s on connection %s (%u bytes)\n", - GM_m2s (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE), - GMC_2s (connection), size); + GC_m2s (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE), + GCC_2s (connection), size); LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u (create)\n", connection, connection->pending_messages); connection->pending_messages++; connection->maintenance_q = - GMP_queue_add (get_next_hop (connection), NULL, + GCP_queue_add (get_next_hop (connection), NULL, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0, size, connection, GNUNET_YES, &conn_message_sent, NULL); - state = GMT_get_cstate (connection->t); + state = GCT_get_cstate (connection->t); if (CADET_TUNNEL3_SEARCHING == state || CADET_TUNNEL3_NEW == state) - GMT_change_cstate (connection->t, CADET_TUNNEL3_WAITING); + GCT_change_cstate (connection->t, CADET_TUNNEL3_WAITING); if (CADET_CONNECTION_NEW == connection->state) connection_change_state (connection, CADET_CONNECTION_SENT); } @@ -3074,7 +3074,7 @@ GMC_send_create (struct CadetConnection *connection) * @param c The connection whose peers to notify. */ void -GMC_send_destroy (struct CadetConnection *c) +GCC_send_destroy (struct CadetConnection *c) { struct GNUNET_CADET_ConnectionDestroy msg; @@ -3086,14 +3086,14 @@ GMC_send_destroy (struct CadetConnection *c) msg.cid = c->id; LOG (GNUNET_ERROR_TYPE_DEBUG, " sending connection destroy for connection %s\n", - GMC_2s (c)); + GCC_2s (c)); - if (GNUNET_NO == GMC_is_terminal (c, GNUNET_YES)) - GMC_send_prebuilt_message (&msg.header, + if (GNUNET_NO == GCC_is_terminal (c, GNUNET_YES)) + GCC_send_prebuilt_message (&msg.header, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0, c, GNUNET_YES, GNUNET_YES, NULL, NULL); - if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO)) - GMC_send_prebuilt_message (&msg.header, + if (GNUNET_NO == GCC_is_terminal (c, GNUNET_NO)) + GCC_send_prebuilt_message (&msg.header, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, 0, c, GNUNET_NO, GNUNET_YES, NULL, NULL); c->destroy = GNUNET_YES; @@ -3112,13 +3112,13 @@ GMC_send_destroy (struct CadetConnection *c) * @param fwd Should we poll in the FWD direction? */ void -GMC_start_poll (struct CadetConnection *c, int fwd) +GCC_start_poll (struct CadetConnection *c, int fwd) { struct CadetFlowControl *fc; fc = fwd ? &c->fwd_fc : &c->bck_fc; LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n", - GM_f2s (fwd)); + GC_f2s (fwd)); if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task || NULL != fc->poll_msg) { LOG (GNUNET_ERROR_TYPE_DEBUG, " *** not needed (%u, %p)\n", @@ -3141,7 +3141,7 @@ GMC_start_poll (struct CadetConnection *c, int fwd) * @param fwd Should we stop the poll in the FWD direction? */ void -GMC_stop_poll (struct CadetConnection *c, int fwd) +GCC_stop_poll (struct CadetConnection *c, int fwd) { struct CadetFlowControl *fc; @@ -3159,7 +3159,7 @@ GMC_stop_poll (struct CadetConnection *c, int fwd) * @param c Connection. */ const char * -GMC_2s (const struct CadetConnection *c) +GCC_2s (const struct CadetConnection *c) { if (NULL == c) return "NULL"; @@ -3169,8 +3169,8 @@ GMC_2s (const struct CadetConnection *c) static char buf[128]; sprintf (buf, "%s (->%s)", - GNUNET_h2s (GM_h2hc (GMC_get_id (c))), GMT_2s (c->t)); + GNUNET_h2s (GC_h2hc (GCC_get_id (c))), GCT_2s (c->t)); return buf; } - return GNUNET_h2s (GM_h2hc (&c->id)); + return GNUNET_h2s (GC_h2hc (&c->id)); } diff --git a/src/cadet/gnunet-service-cadet_connection.h b/src/cadet/gnunet-service-cadet_connection.h index 4e1104c2b..535488260 100644 --- a/src/cadet/gnunet-service-cadet_connection.h +++ b/src/cadet/gnunet-service-cadet_connection.h @@ -97,7 +97,7 @@ struct CadetConnectionQueue; * @param fwd Was this a FWD going message? * @param size Size of the message. */ -typedef void (*GMC_sent) (void *cls, +typedef void (*GCC_sent) (void *cls, struct CadetConnection *c, struct CadetConnectionQueue *q, uint16_t type, int fwd, size_t size); @@ -113,7 +113,7 @@ typedef void (*GMC_sent) (void *cls, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message); /** @@ -127,7 +127,7 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message); /** @@ -141,7 +141,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_broken (void* cls, +GCC_handle_broken (void* cls, const struct GNUNET_PeerIdentity* id, const struct GNUNET_MessageHeader* message); @@ -156,7 +156,7 @@ GMC_handle_broken (void* cls, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message); /** @@ -170,7 +170,7 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message); /** @@ -184,7 +184,7 @@ GMC_handle_encrypted (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message); /** @@ -198,7 +198,7 @@ GMC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message); /** @@ -212,7 +212,7 @@ GMC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, * GNUNET_SYSERR to close it (signal serious error) */ int -GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message); /** @@ -227,7 +227,7 @@ GMC_handle_poll (void *cls, const struct GNUNET_PeerIdentity *peer, * TODO: Check who we got this from, to validate route. */ int -GMC_handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, +GCC_handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message); /** @@ -239,7 +239,7 @@ GMC_handle_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, * @param force Send the ACK even if suboptimal (e.g. requested by POLL). */ void -GMC_send_ack (struct CadetConnection *c, int fwd, int force); +GCC_send_ack (struct CadetConnection *c, int fwd, int force); /** * Initialize the connections subsystem @@ -247,13 +247,13 @@ GMC_send_ack (struct CadetConnection *c, int fwd, int force); * @param c Configuration handle. */ void -GMC_init (const struct GNUNET_CONFIGURATION_Handle *c); +GCC_init (const struct GNUNET_CONFIGURATION_Handle *c); /** * Shut down the connections subsystem. */ void -GMC_shutdown (void); +GCC_shutdown (void); /** * Create a connection. @@ -266,7 +266,7 @@ GMC_shutdown (void); * @return Newly created connection, NULL in case of error (own id not in path). */ struct CadetConnection * -GMC_new (const struct GNUNET_CADET_Hash *cid, +GCC_new (const struct GNUNET_CADET_Hash *cid, struct CadetTunnel3 *t, struct CadetPeerPath *p, unsigned int own_pos); @@ -280,7 +280,7 @@ GMC_new (const struct GNUNET_CADET_Hash *cid, * @param c Connection to destroy. */ void -GMC_destroy (struct CadetConnection *c); +GCC_destroy (struct CadetConnection *c); /** * Get the connection ID. @@ -290,7 +290,7 @@ GMC_destroy (struct CadetConnection *c); * @return ID of the connection. */ const struct GNUNET_CADET_Hash * -GMC_get_id (const struct CadetConnection *c); +GCC_get_id (const struct CadetConnection *c); /** @@ -301,7 +301,7 @@ GMC_get_id (const struct CadetConnection *c); * @return Hash expanded from the ID of the connection. */ const struct GNUNET_HashCode * -GMC_get_h (const struct CadetConnection *c); +GCC_get_h (const struct CadetConnection *c); /** @@ -312,7 +312,7 @@ GMC_get_h (const struct CadetConnection *c); * @return path used by the connection. */ const struct CadetPeerPath * -GMC_get_path (const struct CadetConnection *c); +GCC_get_path (const struct CadetConnection *c); /** * Get the connection state. @@ -322,7 +322,7 @@ GMC_get_path (const struct CadetConnection *c); * @return state of the connection. */ enum CadetConnectionState -GMC_get_state (const struct CadetConnection *c); +GCC_get_state (const struct CadetConnection *c); /** * Get the connection tunnel. @@ -332,7 +332,7 @@ GMC_get_state (const struct CadetConnection *c); * @return tunnel of the connection. */ struct CadetTunnel3 * -GMC_get_tunnel (const struct CadetConnection *c); +GCC_get_tunnel (const struct CadetConnection *c); /** * Get free buffer space in a connection. @@ -343,7 +343,7 @@ GMC_get_tunnel (const struct CadetConnection *c); * @return Free buffer space [0 - max_msgs_queue/max_connections] */ unsigned int -GMC_get_buffer (struct CadetConnection *c, int fwd); +GCC_get_buffer (struct CadetConnection *c, int fwd); /** * Get how many messages have we allowed to send to us from a direction. @@ -354,7 +354,7 @@ GMC_get_buffer (struct CadetConnection *c, int fwd); * @return last_ack_sent - last_pid_recv */ unsigned int -GMC_get_allowed (struct CadetConnection *c, int fwd); +GCC_get_allowed (struct CadetConnection *c, int fwd); /** * Get messages queued in a connection. @@ -365,7 +365,7 @@ GMC_get_allowed (struct CadetConnection *c, int fwd); * @return Number of messages queued. */ unsigned int -GMC_get_qn (struct CadetConnection *c, int fwd); +GCC_get_qn (struct CadetConnection *c, int fwd); /** * Get next PID to use. @@ -376,7 +376,7 @@ GMC_get_qn (struct CadetConnection *c, int fwd); * @return Last PID used + 1. */ unsigned int -GMC_get_pid (struct CadetConnection *c, int fwd); +GCC_get_pid (struct CadetConnection *c, int fwd); /** * Allow the connection to advertise a buffer of the given size. @@ -389,7 +389,7 @@ GMC_get_pid (struct CadetConnection *c, int fwd); * @param fwd Is this about FWD traffic? (The ack will go dest->root). */ void -GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd); +GCC_allow (struct CadetConnection *c, unsigned int buffer, int fwd); /** * Send FWD keepalive packets for a connection. @@ -398,7 +398,7 @@ GMC_allow (struct CadetConnection *c, unsigned int buffer, int fwd); * @param tc Notification context. */ void -GMC_fwd_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +GCC_fwd_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); /** * Send BCK keepalive packets for a connection. @@ -407,7 +407,7 @@ GMC_fwd_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); * @param tc Notification context. */ void -GMC_bck_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); +GCC_bck_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); /** @@ -418,7 +418,7 @@ GMC_bck_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); * @param peer Peer that disconnected. */ void -GMC_notify_broken (struct CadetConnection *c, +GCC_notify_broken (struct CadetConnection *c, struct CadetPeer *peer); /** @@ -430,7 +430,7 @@ GMC_notify_broken (struct CadetConnection *c, * @return #GNUNET_YES if origin, #GNUNET_NO if relay/terminal. */ int -GMC_is_origin (struct CadetConnection *c, int fwd); +GCC_is_origin (struct CadetConnection *c, int fwd); /** * Is this peer the last one on the connection? @@ -442,7 +442,7 @@ GMC_is_origin (struct CadetConnection *c, int fwd); * @return #GNUNET_YES if terminal, #GNUNET_NO if relay/origin. */ int -GMC_is_terminal (struct CadetConnection *c, int fwd); +GCC_is_terminal (struct CadetConnection *c, int fwd); /** * See if we are allowed to send by the next hop in the given direction. @@ -453,7 +453,7 @@ GMC_is_terminal (struct CadetConnection *c, int fwd); * @return #GNUNET_YES in case it's OK to send. */ int -GMC_is_sendable (struct CadetConnection *c, int fwd); +GCC_is_sendable (struct CadetConnection *c, int fwd); /** * Check if this connection is a direct one (never trim a direct connection). @@ -463,7 +463,7 @@ GMC_is_sendable (struct CadetConnection *c, int fwd); * @return #GNUNET_YES in case it's a direct connection, #GNUNET_NO otherwise. */ int -GMC_is_direct (struct CadetConnection *c); +GCC_is_direct (struct CadetConnection *c); /** * Cancel a previously sent message while it's in the queue. @@ -475,7 +475,7 @@ GMC_is_direct (struct CadetConnection *c); * @param q Handle to the queue. */ void -GMC_cancel (struct CadetConnectionQueue *q); +GCC_cancel (struct CadetConnectionQueue *q); /** * Sends an already built message on a connection, properly registering @@ -495,10 +495,10 @@ GMC_cancel (struct CadetConnectionQueue *q); * Invalid on @c cont call. */ struct CadetConnectionQueue * -GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, +GCC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, uint16_t payload_type, uint32_t payload_id, struct CadetConnection *c, int fwd, int force, - GMC_sent cont, void *cont_cls); + GCC_sent cont, void *cont_cls); /** * Sends a CREATE CONNECTION message for a path to a peer. @@ -507,7 +507,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, * @param connection Connection to create. */ void -GMC_send_create (struct CadetConnection *connection); +GCC_send_create (struct CadetConnection *connection); /** * Send a message to all peers in this connection that the connection @@ -519,7 +519,7 @@ GMC_send_create (struct CadetConnection *connection); * @param c The connection whose peers to notify. */ void -GMC_send_destroy (struct CadetConnection *c); +GCC_send_destroy (struct CadetConnection *c); /** * @brief Start a polling timer for the connection. @@ -532,7 +532,7 @@ GMC_send_destroy (struct CadetConnection *c); * @param fwd Should we poll in the FWD direction? */ void -GMC_start_poll (struct CadetConnection *c, int fwd); +GCC_start_poll (struct CadetConnection *c, int fwd); /** @@ -544,7 +544,7 @@ GMC_start_poll (struct CadetConnection *c, int fwd); * @param fwd Should we stop the poll in the FWD direction? */ void -GMC_stop_poll (struct CadetConnection *c, int fwd); +GCC_stop_poll (struct CadetConnection *c, int fwd); /** * Get a (static) string for a connection. @@ -552,7 +552,7 @@ GMC_stop_poll (struct CadetConnection *c, int fwd); * @param c Connection. */ const char * -GMC_2s (const struct CadetConnection *c); +GCC_2s (const struct CadetConnection *c); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c index b187e3cd9..7d31603df 100644 --- a/src/cadet/gnunet-service-cadet_dht.c +++ b/src/cadet/gnunet-service-cadet_dht.c @@ -40,13 +40,13 @@ /** * Handle for DHT searches. */ -struct GMD_search_handle +struct GCD_search_handle { /** DHT_GET handle. */ struct GNUNET_DHT_GetHandle *dhtget; /** Provided callback to call when a path is found. */ - GMD_search_callback callback; + GCD_search_callback callback; /** Provided closure. */ void *cls; @@ -219,7 +219,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, unsigned int put_path_length, enum GNUNET_BLOCK_Type type, size_t size, const void *data) { - struct GMD_search_handle *h = cls; + struct GCD_search_handle *h = cls; struct GNUNET_HELLO_Message *hello; struct CadetPeerPath *p; struct CadetPeer *peer; @@ -230,13 +230,13 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, s = path_2s (p); LOG (GNUNET_ERROR_TYPE_INFO, "Got path from DHT: %s\n", s); GNUNET_free_non_null (s); - peer = GMP_get_short (p->peers[p->length - 1]); - LOG (GNUNET_ERROR_TYPE_DEBUG, "Got HELLO for %s\n", GMP_2s (peer)); + peer = GCP_get_short (p->peers[p->length - 1]); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Got HELLO for %s\n", GCP_2s (peer)); h->callback (h->cls, p); path_destroy (p); hello = (struct GNUNET_HELLO_Message *) data; - GMP_set_hello (peer, hello); - GMP_try_connect (peer); + GCP_set_hello (peer, hello); + GCP_try_connect (peer); return; } @@ -267,7 +267,7 @@ announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * - Set data expiration in function of X * - Adapt X to churn */ - hello = GMH_get_mine (); + hello = GCH_get_mine (); if (NULL == hello || (size = GNUNET_HELLO_size (hello)) == 0) { /* Peerinfo gave us no hello yet, try again in a second. */ @@ -304,7 +304,7 @@ announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * * @param cls Closure (unused) * @param key Current peer ID. - * @param value Value in the hash map (GMD_search_handle). + * @param value Value in the hash map (GCD_search_handle). * * @return #GNUNET_YES, we should continue to iterate, */ @@ -313,9 +313,9 @@ stop_get (void *cls, uint32_t key, void *value) { - struct GMD_search_handle *h = value; + struct GCD_search_handle *h = value; - GMD_search_stop (h); + GCD_search_stop (h); return GNUNET_YES; } @@ -330,7 +330,7 @@ stop_get (void *cls, * @param c Configuration. */ void -GMD_init (const struct GNUNET_CONFIGURATION_Handle *c) +GCD_init (const struct GNUNET_CONFIGURATION_Handle *c) { LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); if (GNUNET_OK != @@ -367,7 +367,7 @@ GMD_init (const struct GNUNET_CONFIGURATION_Handle *c) * Shut down the DHT subsystem. */ void -GMD_shutdown (void) +GCD_shutdown (void) { GNUNET_CONTAINER_multihashmap32_iterate (get_requests, &stop_get, NULL); GNUNET_CONTAINER_multihashmap32_destroy (get_requests); @@ -383,18 +383,18 @@ GMD_shutdown (void) } } -struct GMD_search_handle * -GMD_search (const struct GNUNET_PeerIdentity *peer_id, - GMD_search_callback callback, void *cls) +struct GCD_search_handle * +GCD_search (const struct GNUNET_PeerIdentity *peer_id, + GCD_search_callback callback, void *cls) { struct GNUNET_HashCode phash; - struct GMD_search_handle *h; + struct GCD_search_handle *h; LOG (GNUNET_ERROR_TYPE_DEBUG, " Starting DHT GET for peer %s\n", GNUNET_i2s (peer_id)); memset (&phash, 0, sizeof (phash)); memcpy (&phash, peer_id, sizeof (*peer_id)); - h = GNUNET_new (struct GMD_search_handle); + h = GNUNET_new (struct GCD_search_handle); h->peer_id = GNUNET_PEER_intern (peer_id); h->callback = callback; h->cls = cls; @@ -413,7 +413,7 @@ GMD_search (const struct GNUNET_PeerIdentity *peer_id, } void -GMD_search_stop (struct GMD_search_handle *h) +GCD_search_stop (struct GCD_search_handle *h) { GNUNET_break (GNUNET_OK == GNUNET_CONTAINER_multihashmap32_remove (get_requests, diff --git a/src/cadet/gnunet-service-cadet_dht.h b/src/cadet/gnunet-service-cadet_dht.h index 6cac531ff..85cb6ea24 100644 --- a/src/cadet/gnunet-service-cadet_dht.h +++ b/src/cadet/gnunet-service-cadet_dht.h @@ -40,7 +40,7 @@ extern "C" #include "platform.h" #include "gnunet_util_lib.h" -struct GMD_search_handle; +struct GCD_search_handle; /** @@ -50,7 +50,7 @@ struct GMD_search_handle; * @param path An unchecked, unoptimized path to the target node. * After callback will no longer be valid! */ -typedef void (*GMD_search_callback) (void *cls, +typedef void (*GCD_search_callback) (void *cls, const struct CadetPeerPath *path); /******************************************************************************/ @@ -63,22 +63,22 @@ typedef void (*GMD_search_callback) (void *cls, * @param c Configuration. */ void -GMD_init (const struct GNUNET_CONFIGURATION_Handle *c); +GCD_init (const struct GNUNET_CONFIGURATION_Handle *c); /** * Shut down the DHT subsystem. */ void -GMD_shutdown (void); +GCD_shutdown (void); -struct GMD_search_handle * -GMD_search (const struct GNUNET_PeerIdentity *peer_id, - GMD_search_callback callback, void *cls); +struct GCD_search_handle * +GCD_search (const struct GNUNET_PeerIdentity *peer_id, + GCD_search_callback callback, void *cls); void -GMD_search_stop (struct GMD_search_handle *h); +GCD_search_stop (struct GCD_search_handle *h); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/src/cadet/gnunet-service-cadet_hello.c b/src/cadet/gnunet-service-cadet_hello.c index 7eda3f507..edb1a96a2 100644 --- a/src/cadet/gnunet-service-cadet_hello.c +++ b/src/cadet/gnunet-service-cadet_hello.c @@ -108,12 +108,12 @@ got_hello (void *cls, const struct GNUNET_PeerIdentity *id, LOG (GNUNET_ERROR_TYPE_DEBUG, " hello for %s (%d bytes), expires on %s\n", GNUNET_i2s (id), GNUNET_HELLO_size (hello), GNUNET_STRINGS_absolute_time_to_string (GNUNET_HELLO_get_last_expiration(hello))); - peer = GMP_get (id); - GMP_set_hello (peer, hello); + peer = GCP_get (id); + GCP_set_hello (peer, hello); - if (GMP_get_short_id (peer) == myid) + if (GCP_get_short_id (peer) == myid) { - mine = GMP_get_hello (peer); + mine = GCP_get_hello (peer); LOG (GNUNET_ERROR_TYPE_DEBUG, " updated mine to %p\n", mine); } } @@ -129,7 +129,7 @@ got_hello (void *cls, const struct GNUNET_PeerIdentity *id, * @param c Configuration. */ void -GMH_init (const struct GNUNET_CONFIGURATION_Handle *c) +GCH_init (const struct GNUNET_CONFIGURATION_Handle *c) { LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); GNUNET_assert (NULL == nc); @@ -142,7 +142,7 @@ GMH_init (const struct GNUNET_CONFIGURATION_Handle *c) * Shut down the hello subsystem. */ void -GMH_shutdown () +GCH_shutdown () { if (NULL != nc) { @@ -163,7 +163,7 @@ GMH_shutdown () * @return Own hello message. */ const struct GNUNET_HELLO_Message * -GMH_get_mine (void) +GCH_get_mine (void) { LOG (GNUNET_ERROR_TYPE_DEBUG, " mine is %p\n", mine); return mine; @@ -178,9 +178,9 @@ GMH_get_mine (void) * @return Hello message, if any (NULL possible). */ const struct GNUNET_HELLO_Message * -GMH_get (const struct GNUNET_PeerIdentity *id) +GCH_get (const struct GNUNET_PeerIdentity *id) { - return GMP_get_hello (GMP_get (id)); + return GCP_get_hello (GCP_get (id)); } @@ -190,7 +190,7 @@ GMH_get (const struct GNUNET_PeerIdentity *id) * @param h Hello message. */ char * -GMH_2s (const struct GNUNET_HELLO_Message *h) +GCH_2s (const struct GNUNET_HELLO_Message *h) { return "hello (TODO)"; } diff --git a/src/cadet/gnunet-service-cadet_hello.h b/src/cadet/gnunet-service-cadet_hello.h index 8e978ea9d..3e894e197 100644 --- a/src/cadet/gnunet-service-cadet_hello.h +++ b/src/cadet/gnunet-service-cadet_hello.h @@ -48,13 +48,13 @@ extern "C" * @param c Configuration. */ void -GMH_init (const struct GNUNET_CONFIGURATION_Handle *c); +GCH_init (const struct GNUNET_CONFIGURATION_Handle *c); /** * Shut down the hello subsystem. */ void -GMH_shutdown (); +GCH_shutdown (); /** * Get own hello message. @@ -62,7 +62,7 @@ GMH_shutdown (); * @return Own hello message. */ const struct GNUNET_HELLO_Message * -GMH_get_mine (void); +GCH_get_mine (void); #if 0 /* keep Emacsens' auto-indent happy */ { diff --git a/src/cadet/gnunet-service-cadet_local.c b/src/cadet/gnunet-service-cadet_local.c index 96596ce68..9a36aae86 100644 --- a/src/cadet/gnunet-service-cadet_local.c +++ b/src/cadet/gnunet-service-cadet_local.c @@ -216,9 +216,9 @@ channel_destroy_iterator (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, " Channel %s destroy, due to client %s shutdown.\n", - GMCH_2s (ch), GML_2s (c)); + GCCH_2s (ch), GML_2s (c)); - GMCH_handle_local_destroy (ch, c, key < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV); + GCCH_handle_local_destroy (ch, c, key < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV); return GNUNET_OK; } @@ -383,7 +383,7 @@ handle_channel_create (void *cls, struct GNUNET_SERVER_Client *client, } if (GNUNET_OK != - GMCH_handle_local_create (c, + GCCH_handle_local_create (c, (struct GNUNET_CADET_ChannelMessage *) message)) { GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); @@ -446,7 +446,7 @@ handle_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client, return; } - GMCH_handle_local_destroy (ch, c, chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV); + GCCH_handle_local_destroy (ch, c, chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV); GNUNET_SERVER_receive_done (client, GNUNET_OK); return; @@ -508,7 +508,7 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client, } if (GNUNET_OK != - GMCH_handle_local_data (ch, c, + GCCH_handle_local_data (ch, c, (struct GNUNET_MessageHeader *)&msg[1], fwd)) { GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); @@ -573,7 +573,7 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client, /* If client is dest, the ACK is going BCK, therefore this is "FWD ACK" */ fwd = chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV; - GMCH_handle_local_ack (ch, fwd); + GCCH_handle_local_ack (ch, fwd); GNUNET_SERVER_receive_done (client, GNUNET_OK); return; @@ -602,8 +602,8 @@ get_all_peers_iterator (void *cls, msg.header.size = htons (sizeof (msg)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); msg.destination = *peer; - msg.paths = htons (GMP_count_paths (p)); - msg.tunnel = htons (NULL != GMP_get_tunnel (p)); + msg.paths = htons (GCP_count_paths (p)); + msg.tunnel = htons (NULL != GCP_get_tunnel (p)); LOG (GNUNET_ERROR_TYPE_DEBUG, "sending info about peer %s\n", GNUNET_i2s (peer)); @@ -640,7 +640,7 @@ handle_get_peers (void *cls, struct GNUNET_SERVER_Client *client, "Received get peers request from client %u (%p)\n", c->id, client); - GMP_iterate_all (get_all_peers_iterator, client); + GCP_iterate_all (get_all_peers_iterator, client); reply.size = htons (sizeof (reply)); reply.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO); @@ -672,10 +672,10 @@ get_all_tunnels_iterator (void *cls, msg.header.size = htons (sizeof (msg)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS); msg.destination = *peer; - msg.channels = htonl (GMT_count_channels (t)); - msg.connections = htonl (GMT_count_connections (t)); - msg.cstate = htons ((uint16_t) GMT_get_cstate (t)); - msg.estate = htons ((uint16_t) GMT_get_estate (t)); + msg.channels = htonl (GCT_count_channels (t)); + msg.connections = htonl (GCT_count_connections (t)); + msg.cstate = htons ((uint16_t) GCT_get_cstate (t)); + msg.estate = htons ((uint16_t) GCT_get_estate (t)); LOG (GNUNET_ERROR_TYPE_DEBUG, "sending info about tunnel ->%s\n", GNUNET_i2s (peer)); @@ -712,7 +712,7 @@ handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client, "Received get tunnels request from client %u (%p)\n", c->id, client); - GMT_iterate_all (get_all_tunnels_iterator, client); + GCT_iterate_all (get_all_tunnels_iterator, client); reply.size = htons (sizeof (reply)); reply.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS); GNUNET_SERVER_notification_context_unicast (nc, client, &reply, GNUNET_NO); @@ -729,7 +729,7 @@ iter_connection (void *cls, struct CadetConnection *c) struct GNUNET_CADET_LocalInfoTunnel *msg = cls; struct GNUNET_CADET_Hash *h = (struct GNUNET_CADET_Hash *) &msg[1]; - h[msg->connections] = *(GMC_get_id (c)); + h[msg->connections] = *(GCC_get_id (c)); msg->connections++; } @@ -740,7 +740,7 @@ iter_channel (void *cls, struct CadetChannel *ch) struct GNUNET_HashCode *h = (struct GNUNET_HashCode *) &msg[1]; CADET_ChannelNumber *chn = (CADET_ChannelNumber *) &h[msg->connections]; - chn[msg->channels] = GMCH_get_id (ch); + chn[msg->channels] = GCCH_get_id (ch); msg->channels++; } @@ -777,7 +777,7 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, "Received tunnel info request from client %u for tunnel %s\n", c->id, GNUNET_i2s_full(&msg->peer)); - t = GMP_get_tunnel (GMP_get (&msg->peer)); + t = GCP_get_tunnel (GCP_get (&msg->peer)); if (NULL == t) { /* We don't know the tunnel */ @@ -801,8 +801,8 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, } /* Initialize context */ - ch_n = GMT_count_channels (t); - c_n = GMT_count_connections (t); + ch_n = GCT_count_channels (t); + c_n = GCT_count_connections (t); size = sizeof (struct GNUNET_CADET_LocalInfoTunnel); size += c_n * sizeof (struct GNUNET_CADET_Hash); @@ -811,14 +811,14 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, resp = GNUNET_malloc (size); resp->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL); resp->header.size = htons (size); - GMT_iterate_connections (t, &iter_connection, resp); - GMT_iterate_channels (t, &iter_channel, resp); + GCT_iterate_connections (t, &iter_connection, resp); + GCT_iterate_channels (t, &iter_channel, resp); /* Do not interleave with iterators, iter_channel needs conn in HBO */ resp->destination = msg->peer; resp->connections = htonl (resp->connections); resp->channels = htonl (resp->channels); - resp->cstate = htons (GMT_get_cstate (t)); - resp->estate = htons (GMT_get_estate (t)); + resp->cstate = htons (GCT_get_cstate (t)); + resp->estate = htons (GCT_get_estate (t)); GNUNET_SERVER_notification_context_unicast (nc, c->handle, &resp->header, GNUNET_NO); GNUNET_free (resp); diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 287d42efe..716165374 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c @@ -103,7 +103,7 @@ struct CadetPeerQueue /** * Function to call on sending. */ - GMP_sent callback; + GCP_sent callback; /** * Closure for callback. @@ -139,7 +139,7 @@ struct CadetPeer /** * Handle to stop the DHT search for paths to this peer */ - struct GMD_search_handle *search_h; + struct GCD_search_handle *search_h; /** * Tunnel to this peer, if any. @@ -232,16 +232,16 @@ queue_debug (struct CadetPeer *peer) { struct CadetPeerQueue *q; - LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ Messages queued towards %s\n", GMP_2s (peer)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ Messages queued towards %s\n", GCP_2s (peer)); LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ core tmt rdy: %p\n", peer->core_transmit); for (q = peer->queue_head; NULL != q; q = q->next) { LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ - %s %s on %s\n", - GM_m2s (q->type), GM_f2s (q->fwd), GMC_2s (q->c)); + GC_m2s (q->type), GC_f2s (q->fwd), GCC_2s (q->c)); } - LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ End queued towards %s\n", GMP_2s (peer)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "QQQ End queued towards %s\n", GCP_2s (peer)); } @@ -269,8 +269,8 @@ notify_broken (void *cls, struct CadetConnection *c = value; LOG (GNUNET_ERROR_TYPE_DEBUG, " notifying %s due to %s\n", - GMC_2s (c), GMP_2s (peer)); - GMC_notify_broken (c, peer); + GCC_2s (c), GCP_2s (peer)); + GCC_notify_broken (c, peer); return GNUNET_YES; } @@ -317,7 +317,7 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) char own_id[16]; strncpy (own_id, GNUNET_i2s (&my_full_id), 15); - mp = GMP_get (peer); + mp = GCP_get (peer); if (myid == mp->id) { LOG (GNUNET_ERROR_TYPE_INFO, "CONNECTED %s (self)\n", own_id); @@ -334,14 +334,14 @@ core_connect (void *cls, const struct GNUNET_PeerIdentity *peer) } path->peers[0] = myid; GNUNET_PEER_change_rc (myid, 1); - GMP_add_path (mp, path, GNUNET_YES); + GCP_add_path (mp, path, GNUNET_YES); mp->connections = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES); - if (NULL != GMP_get_tunnel (mp) && + if (NULL != GCP_get_tunnel (mp) && 0 > GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, peer)) { - GMP_connect (mp); + GCP_connect (mp); } return; @@ -393,19 +393,19 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) * Functions to handle messages from core */ static struct GNUNET_CORE_MessageHandler core_handlers[] = { - {&GMC_handle_create, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0}, - {&GMC_handle_confirm, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, + {&GCC_handle_create, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, 0}, + {&GCC_handle_confirm, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK, sizeof (struct GNUNET_CADET_ConnectionACK)}, - {&GMC_handle_broken, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, + {&GCC_handle_broken, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, sizeof (struct GNUNET_CADET_ConnectionBroken)}, - {&GMC_handle_destroy, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, + {&GCC_handle_destroy, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, sizeof (struct GNUNET_CADET_ConnectionDestroy)}, - {&GMC_handle_ack, GNUNET_MESSAGE_TYPE_CADET_ACK, + {&GCC_handle_ack, GNUNET_MESSAGE_TYPE_CADET_ACK, sizeof (struct GNUNET_CADET_ACK)}, - {&GMC_handle_poll, GNUNET_MESSAGE_TYPE_CADET_POLL, + {&GCC_handle_poll, GNUNET_MESSAGE_TYPE_CADET_POLL, sizeof (struct GNUNET_CADET_Poll)}, - {&GMC_handle_encrypted, GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0}, - {&GMC_handle_kx, GNUNET_MESSAGE_TYPE_CADET_KX, 0}, + {&GCC_handle_encrypted, GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED, 0}, + {&GCC_handle_kx, GNUNET_MESSAGE_TYPE_CADET_KX, 0}, {NULL, 0, 0} }; @@ -490,7 +490,7 @@ send_core_connection_create (struct CadetConnection *c, size_t size, void *buf) { struct GNUNET_CADET_ConnectionCreate *msg; struct GNUNET_PeerIdentity *peer_ptr; - const struct CadetPeerPath *p = GMC_get_path (c); + const struct CadetPeerPath *p = GCC_get_path (c); size_t size_needed; int i; @@ -510,7 +510,7 @@ send_core_connection_create (struct CadetConnection *c, size_t size, void *buf) msg = (struct GNUNET_CADET_ConnectionCreate *) buf; msg->header.size = htons (size_needed); msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE); - msg->cid = *GMC_get_id (c); + msg->cid = *GCC_get_id (c); peer_ptr = (struct GNUNET_PeerIdentity *) &msg[1]; for (i = 0; i < p->length; i++) @@ -547,7 +547,7 @@ send_core_connection_ack (struct CadetConnection *c, size_t size, void *buf) } msg->header.size = htons (sizeof (struct GNUNET_CADET_ConnectionACK)); msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK); - msg->cid = *GMC_get_id (c); + msg->cid = *GCC_get_id (c); LOG (GNUNET_ERROR_TYPE_DEBUG, "CONNECTION ACK sent!\n"); return sizeof (struct GNUNET_CADET_ConnectionACK); @@ -579,7 +579,7 @@ get_priority (struct CadetPeerQueue *q) } /* Relayed traffic has lower priority, our own traffic has higher */ - if (NULL == q->c || GNUNET_NO == GMC_is_origin (q->c, q->fwd)) + if (NULL == q->c || GNUNET_NO == GCC_is_origin (q->c, q->fwd)) { low = GNUNET_CORE_PRIO_BEST_EFFORT; high = GNUNET_CORE_PRIO_URGENT; @@ -616,7 +616,7 @@ shutdown_tunnel (void *cls, struct CadetTunnel3 *t = p->tunnel; if (NULL != t) - GMT_destroy (t); + GCT_destroy (t); return GNUNET_YES; } @@ -648,7 +648,7 @@ peer_destroy (struct CadetPeer *peer) } if (NULL != peer->search_h) { - GMD_search_stop (peer->search_h); + GCD_search_stop (peer->search_h); } p = peer->path_head; while (NULL != p) @@ -658,7 +658,7 @@ peer_destroy (struct CadetPeer *peer) path_destroy (p); p = nextp; } - GMT_destroy_empty (peer->tunnel); + GCT_destroy_empty (peer->tunnel); GNUNET_free (peer); return GNUNET_OK; } @@ -783,10 +783,10 @@ peer_get_best_path (const struct CadetPeer *peer) { if (GNUNET_NO == path_is_valid (p)) continue; /* Don't use invalid paths. */ - if (GNUNET_YES == GMT_is_path_used (peer->tunnel, p)) + if (GNUNET_YES == GCT_is_path_used (peer->tunnel, p)) continue; /* If path is already in use, skip it. */ - if ((cost = GMT_get_path_cost (peer->tunnel, p)) < best_cost) + if ((cost = GCT_get_path_cost (peer->tunnel, p)) < best_cost) { best_cost = cost; best_p = p; @@ -828,7 +828,7 @@ queue_is_sendable (struct CadetPeerQueue *q) GNUNET_break (0); } - return GMC_is_sendable (q->c, q->fwd); + return GCC_is_sendable (q->c, q->fwd); } @@ -846,7 +846,7 @@ peer_get_first_message (const struct CadetPeer *peer) for (q = peer->queue_head; NULL != q; q = q->next) { - LOG (GNUNET_ERROR_TYPE_DEBUG, "Checking %p towards %s\n", q, GMC_2s (q->c)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Checking %p towards %s\n", q, GCC_2s (q->c)); if (queue_is_sendable (q)) return q; } @@ -869,19 +869,19 @@ search_handler (void *cls, const struct CadetPeerPath *path) struct CadetPeer *peer = cls; unsigned int connection_count; - GMP_add_path_to_all (path, GNUNET_NO); + GCP_add_path_to_all (path, GNUNET_NO); /* Count connections */ - connection_count = GMT_count_connections (peer->tunnel); + connection_count = GCT_count_connections (peer->tunnel); /* If we already have 3 (or more (?!)) connections, it's enough */ if (3 <= connection_count) return; - if (CADET_TUNNEL3_SEARCHING == GMT_get_cstate (peer->tunnel)) + if (CADET_TUNNEL3_SEARCHING == GCT_get_cstate (peer->tunnel)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n"); - GMP_connect (peer); + GCP_connect (peer); } return; } @@ -910,7 +910,7 @@ queue_send (void *cls, size_t size, void *buf) pid = 0; peer->core_transmit = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, "Queue send towards %s (max %u)\n", - GMP_2s (peer), size); + GCP_2s (peer), size); if (NULL == buf || 0 == size) { @@ -929,7 +929,7 @@ queue_send (void *cls, size_t size, void *buf) dst_id = GNUNET_PEER_resolve2 (peer->id); LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s %s\n", - GMC_2s (c), GM_f2s(queue->fwd)); + GCC_2s (c), GC_f2s(queue->fwd)); /* Check if buffer size is enough for the message */ if (queue->size > size) { @@ -951,7 +951,7 @@ queue_send (void *cls, size_t size, void *buf) switch (queue->type) { case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: - pid = GMC_get_pid (queue->c, queue->fwd); + pid = GCC_get_pid (queue->c, queue->fwd); LOG (GNUNET_ERROR_TYPE_DEBUG, " payload ID %u\n", pid); data_size = send_core_data_raw (queue->cls, size, buf); ((struct GNUNET_CADET_Encrypted *) buf)->pid = htonl (pid); @@ -961,20 +961,20 @@ queue_send (void *cls, size_t size, void *buf) case GNUNET_MESSAGE_TYPE_CADET_KX: case GNUNET_MESSAGE_TYPE_CADET_ACK: case GNUNET_MESSAGE_TYPE_CADET_POLL: - LOG (GNUNET_ERROR_TYPE_DEBUG, " raw %s\n", GM_m2s (queue->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, " raw %s\n", GC_m2s (queue->type)); data_size = send_core_data_raw (queue->cls, size, buf); break; case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE: LOG (GNUNET_ERROR_TYPE_DEBUG, " path create\n"); - if (GMC_is_origin (c, GNUNET_YES)) + if (GCC_is_origin (c, GNUNET_YES)) data_size = send_core_connection_create (queue->c, size, buf); else data_size = send_core_data_raw (queue->cls, size, buf); break; case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK: LOG (GNUNET_ERROR_TYPE_DEBUG, " path ack\n"); - if (GMC_is_origin (c, GNUNET_NO) || - GMC_is_origin (c, GNUNET_YES)) + if (GCC_is_origin (c, GNUNET_NO) || + GCC_is_origin (c, GNUNET_YES)) data_size = send_core_connection_ack (queue->c, size, buf); else data_size = send_core_data_raw (queue->cls, size, buf); @@ -996,19 +996,19 @@ queue_send (void *cls, size_t size, void *buf) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 101) < drop_percent) { LOG (GNUNET_ERROR_TYPE_WARNING, "DD %s on connection %s\n", - GM_m2s (queue->type), GMC_2s (c)); + GC_m2s (queue->type), GCC_2s (c)); data_size = 0; } else { LOG (GNUNET_ERROR_TYPE_INFO, "snd %s (%s %u) on connection %s (%p) %s (size %u)\n", - GM_m2s (queue->type), GM_m2s (queue->payload_type), - queue->payload_type, GMC_2s (c), c, GM_f2s (queue->fwd), data_size); + GC_m2s (queue->type), GC_m2s (queue->payload_type), + queue->payload_type, GCC_2s (c), c, GC_f2s (queue->fwd), data_size); } /* Free queue, but cls was freed by send_core_* */ - GMP_queue_destroy (queue, GNUNET_NO, GNUNET_YES, pid); + GCP_queue_destroy (queue, GNUNET_NO, GNUNET_YES, pid); /* If more data in queue, send next */ queue = peer_get_first_message (peer); @@ -1032,11 +1032,11 @@ queue_send (void *cls, size_t size, void *buf) LOG (GNUNET_ERROR_TYPE_DEBUG, "* tmt rdy called somewhere else\n"); } -// GMC_start_poll (); FIXME needed? +// GCC_start_poll (); FIXME needed? } else { -// GMC_stop_poll(); FIXME needed? +// GCC_stop_poll(); FIXME needed? } LOG (GNUNET_ERROR_TYPE_DEBUG, " return %d\n", data_size); @@ -1060,7 +1060,7 @@ queue_send (void *cls, size_t size, void *buf) * @param pid PID, if relevant (was sent and was a payload message). */ void -GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, +GCP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, int sent, uint32_t pid) { struct CadetPeer *peer; @@ -1070,7 +1070,7 @@ GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, if (GNUNET_YES == clear_cls) { LOG (GNUNET_ERROR_TYPE_DEBUG, "queue destroy type %s\n", - GM_m2s (queue->type)); + GC_m2s (queue->type)); switch (queue->type) { case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY: @@ -1090,7 +1090,7 @@ GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, default: GNUNET_break (0); LOG (GNUNET_ERROR_TYPE_ERROR, " type %s unknown!\n", - GM_m2s (queue->type)); + GC_m2s (queue->type)); } } GNUNET_CONTAINER_DLL_remove (peer->queue_head, peer->queue_tail, queue); @@ -1137,10 +1137,10 @@ GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, * message has been sent and therefore the handle is no longer valid. */ struct CadetPeerQueue * -GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, +GCP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, uint16_t payload_type, uint32_t payload_id, size_t size, struct CadetConnection *c, int fwd, - GMP_sent cont, void *cont_cls) + GCP_sent cont, void *cont_cls) { struct CadetPeerQueue *queue; int priority; @@ -1148,13 +1148,13 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, LOG (GNUNET_ERROR_TYPE_INFO, "que %s (%s %u) on connection %s (%p) %s towards %s (size %u)\n", - GM_m2s (type), GM_m2s (payload_type), payload_id, - GMC_2s (c), c, GM_f2s (fwd), GMP_2s (peer), size); + GC_m2s (type), GC_m2s (payload_type), payload_id, + GCC_2s (c), c, GC_f2s (fwd), GCP_2s (peer), size); if (NULL == peer->connections) { /* We are not connected to this peer, ignore request. */ - LOG (GNUNET_ERROR_TYPE_WARNING, "%s not a neighbor\n", GMP_2s (peer)); + LOG (GNUNET_ERROR_TYPE_WARNING, "%s not a neighbor\n", GCP_2s (peer)); GNUNET_STATISTICS_update (stats, "# messages dropped due to wrong hop", 1, GNUNET_NO); return NULL; @@ -1170,7 +1170,7 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, LOG (GNUNET_ERROR_TYPE_DEBUG, "priority %d\n", priority); - call_core = NULL == c ? GNUNET_YES : GMC_is_sendable (c, fwd); + call_core = NULL == c ? GNUNET_YES : GCC_is_sendable (c, fwd); queue = GNUNET_new (struct CadetPeerQueue); queue->cls = cls; queue->type = type; @@ -1197,7 +1197,7 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, { LOG (GNUNET_ERROR_TYPE_DEBUG, "calling core tmt rdy towards %s for %u bytes\n", - GMP_2s (peer), size); + GCP_2s (peer), size); peer->core_transmit = GNUNET_CORE_notify_transmit_ready (core_handle, GNUNET_NO, get_priority (queue), @@ -1211,13 +1211,13 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, else if (GNUNET_NO == call_core) { LOG (GNUNET_ERROR_TYPE_DEBUG, "core tmt rdy towards %s not needed\n", - GMP_2s (peer)); + GCP_2s (peer)); } else { LOG (GNUNET_ERROR_TYPE_DEBUG, "core tmt rdy towards %s already called\n", - GMP_2s (peer)); + GCP_2s (peer)); } queue_debug (peer); @@ -1233,7 +1233,7 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, * the sent continuation call. */ void -GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c) +GCP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c) { struct CadetPeerQueue *q; struct CadetPeerQueue *next; @@ -1244,18 +1244,18 @@ GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c) prev = q->prev; if (q->c == c) { - LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP queue cancel %s\n", GM_m2s (q->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "GMP queue cancel %s\n", GC_m2s (q->type)); if (GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY != q->type) { q->c = NULL; } else { - GMP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0); + GCP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0); } /* Get next from prev, q->next might be already freed: - * queue destroy -> callback -> GMC_destroy -> cancel_queues -> here + * queue destroy -> callback -> GCC_destroy -> cancel_queues -> here */ if (NULL == prev) next = peer->queue_head; @@ -1316,13 +1316,13 @@ connection_get_first_message (struct CadetPeer *peer, struct CadetConnection *c) * @return First message for this connection. */ struct GNUNET_MessageHeader * -GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c) +GCP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c) { struct CadetPeerQueue *q; struct CadetPeerQueue *next; struct GNUNET_MessageHeader *msg; - LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection pop on %s\n", GMC_2s (c)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Connection pop on %s\n", GCC_2s (c)); for (q = peer->queue_head; NULL != q; q = next) { next = q->next; @@ -1336,13 +1336,13 @@ GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c) case GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN: case GNUNET_MESSAGE_TYPE_CADET_ACK: case GNUNET_MESSAGE_TYPE_CADET_POLL: - GMP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0); + GCP_queue_destroy (q, GNUNET_YES, GNUNET_NO, 0); continue; case GNUNET_MESSAGE_TYPE_CADET_KX: case GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED: msg = (struct GNUNET_MessageHeader *) q->cls; - GMP_queue_destroy (q, GNUNET_NO, GNUNET_NO, 0); + GCP_queue_destroy (q, GNUNET_NO, GNUNET_NO, 0); return msg; default: @@ -1355,7 +1355,7 @@ GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c) void -GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c) +GCP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c) { struct CadetPeerQueue *q; size_t size; @@ -1391,7 +1391,7 @@ GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c) * @param c Configuration. */ void -GMP_init (const struct GNUNET_CONFIGURATION_Handle *c) +GCP_init (const struct GNUNET_CONFIGURATION_Handle *c) { LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); @@ -1460,7 +1460,7 @@ GMP_init (const struct GNUNET_CONFIGURATION_Handle *c) * Shut down the peer subsystem. */ void -GMP_shutdown (void) +GCP_shutdown (void) { GNUNET_CONTAINER_multipeermap_iterate (peers, &shutdown_tunnel, NULL); @@ -1486,7 +1486,7 @@ GMP_shutdown (void) * @return Existing or newly created peer structure. */ struct CadetPeer * -GMP_get (const struct GNUNET_PeerIdentity *peer_id) +GCP_get (const struct GNUNET_PeerIdentity *peer_id) { struct CadetPeer *peer; @@ -1517,9 +1517,9 @@ GMP_get (const struct GNUNET_PeerIdentity *peer_id) * @return Existing or newly created peer structure. */ struct CadetPeer * -GMP_get_short (const GNUNET_PEER_Id peer) +GCP_get_short (const GNUNET_PEER_Id peer) { - return GMP_get (GNUNET_PEER_resolve2 (peer)); + return GCP_get (GNUNET_PEER_resolve2 (peer)); } @@ -1550,17 +1550,17 @@ try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param peer Peer to connect to. */ void -GMP_connect (struct CadetPeer *peer) +GCP_connect (struct CadetPeer *peer) { struct CadetTunnel3 *t; struct CadetPeerPath *p; struct CadetConnection *c; int rerun_search; - LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GMP_2s (peer)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GCP_2s (peer)); /* If we have a current hello, try to connect using it. */ - GMP_try_connect (peer); + GCP_try_connect (peer); t = peer->tunnel; c = NULL; @@ -1578,7 +1578,7 @@ GMP_connect (struct CadetPeer *peer) LOG (GNUNET_ERROR_TYPE_DEBUG, " path to use: %s\n", s); GNUNET_free (s); - c = GMT_use_path (t, p); + c = GCT_use_path (t, p); if (NULL == c) { /* This case can happen when the path includes a first hop that is @@ -1593,14 +1593,14 @@ GMP_connect (struct CadetPeer *peer) * * Re-running the DHT GET should give core time to callback. * - * GMT_use_path -> GMC_new -> register_neighbors takes care of + * GCT_use_path -> GCC_new -> register_neighbors takes care of * updating statistics about this issue. */ rerun_search = GNUNET_YES; } else { - GMC_send_create (c); + GCC_send_create (c); return; } } @@ -1612,11 +1612,11 @@ GMP_connect (struct CadetPeer *peer) if (NULL != peer->search_h && GNUNET_YES == rerun_search) { - GMD_search_stop (peer->search_h); + GCD_search_stop (peer->search_h); peer->search_h = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, " Stopping DHT GET for peer %s\n", - GMP_2s (peer)); + GCP_2s (peer)); } if (NULL == peer->search_h) @@ -1625,10 +1625,10 @@ GMP_connect (struct CadetPeer *peer) id = GNUNET_PEER_resolve2 (peer->id); LOG (GNUNET_ERROR_TYPE_DEBUG, - " Starting DHT GET for peer %s\n", GMP_2s (peer)); - peer->search_h = GMD_search (id, &search_handler, peer); - if (CADET_TUNNEL3_NEW == GMT_get_cstate (t)) - GMT_change_cstate (t, CADET_TUNNEL3_SEARCHING); + " Starting DHT GET for peer %s\n", GCP_2s (peer)); + peer->search_h = GCD_search (id, &search_handler, peer); + if (CADET_TUNNEL3_NEW == GCT_get_cstate (t)) + GCT_change_cstate (t, CADET_TUNNEL3_SEARCHING); } } @@ -1641,7 +1641,7 @@ GMP_connect (struct CadetPeer *peer) * @return #GNUNET_YES if there is a direct connection. */ int -GMP_is_neighbor (const struct CadetPeer *peer) +GCP_is_neighbor (const struct CadetPeer *peer) { struct CadetPeerPath *path; @@ -1668,11 +1668,11 @@ GMP_is_neighbor (const struct CadetPeer *peer) * @param peer Peer towards which to create the tunnel. */ void -GMP_add_tunnel (struct CadetPeer *peer) +GCP_add_tunnel (struct CadetPeer *peer) { if (NULL != peer->tunnel) return; - peer->tunnel = GMT_new (peer); + peer->tunnel = GCT_new (peer); } @@ -1689,26 +1689,26 @@ GMP_add_tunnel (struct CadetPeer *peer) * @return GNUNET_OK on success. */ int -GMP_add_connection (struct CadetPeer *peer, +GCP_add_connection (struct CadetPeer *peer, struct CadetConnection *c) { int result; - LOG (GNUNET_ERROR_TYPE_DEBUG, "adding connection %s\n", GMC_2s (c)); - LOG (GNUNET_ERROR_TYPE_DEBUG, "to peer %s\n", GMP_2s (peer)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "adding connection %s\n", GCC_2s (c)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "to peer %s\n", GCP_2s (peer)); if (NULL == peer->connections) { GNUNET_break (0); LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %s is not a neighbor!\n", - GMP_2s (peer)); + GCP_2s (peer)); return GNUNET_SYSERR; } LOG (GNUNET_ERROR_TYPE_DEBUG, "peer %s ok, has %u connections.\n", - GMP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections)); + GCP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections)); result = GNUNET_CONTAINER_multihashmap_put (peer->connections, - GMC_get_h (c), + GCC_get_h (c), c, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -1733,7 +1733,7 @@ GMP_add_connection (struct CadetPeer *peer, * NULL on error. */ struct CadetPeerPath * -GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, +GCP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, int trusted) { struct CadetPeerPath *aux; @@ -1741,7 +1741,7 @@ GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, unsigned int l2; LOG (GNUNET_ERROR_TYPE_DEBUG, "adding path [%u] to peer %s\n", - path->length, GMP_2s (peer)); + path->length, GCP_2s (peer)); if ((NULL == peer) || (NULL == path)) { @@ -1797,9 +1797,9 @@ GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, LOG (GNUNET_ERROR_TYPE_DEBUG, " added\n"); GNUNET_CONTAINER_DLL_insert_before (peer->path_head, peer->path_tail, aux, path); - if (NULL != peer->tunnel && 3 < GMT_count_connections (peer->tunnel)) + if (NULL != peer->tunnel && 3 < GCT_count_connections (peer->tunnel)) { - GMP_connect (peer); + GCP_connect (peer); } return path; } @@ -1816,9 +1816,9 @@ GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, GNUNET_CONTAINER_DLL_insert_tail (peer->path_head, peer->path_tail, path); LOG (GNUNET_ERROR_TYPE_DEBUG, " added last\n"); - if (NULL != peer->tunnel && 3 < GMT_count_connections (peer->tunnel)) + if (NULL != peer->tunnel && 3 < GCT_count_connections (peer->tunnel)) { - GMP_connect (peer); + GCP_connect (peer); } return path; } @@ -1839,14 +1839,14 @@ GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *path, * NULL on error. */ struct CadetPeerPath * -GMP_add_path_to_origin (struct CadetPeer *peer, +GCP_add_path_to_origin (struct CadetPeer *peer, struct CadetPeerPath *path, int trusted) { if (NULL == path) return NULL; path_invert (path); - return GMP_add_path (peer, path, trusted); + return GCP_add_path (peer, path, trusted); } @@ -1857,7 +1857,7 @@ GMP_add_path_to_origin (struct CadetPeer *peer, * @param confirmed Whether we know if the path works or not. */ void -GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) +GCP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) { unsigned int i; @@ -1868,10 +1868,10 @@ GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) struct CadetPeer *aux; struct CadetPeerPath *copy; - aux = GMP_get_short (p->peers[i]); + aux = GCP_get_short (p->peers[i]); copy = path_duplicate (p); copy->length = i + 1; - GMP_add_path (aux, copy, p->length < 3 ? GNUNET_NO : confirmed); + GCP_add_path (aux, copy, p->length < 3 ? GNUNET_NO : confirmed); } } @@ -1883,7 +1883,7 @@ GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed) * @param path Path to remove. Is always destroyed . */ void -GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) +GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) { struct CadetPeerPath *iter; struct CadetPeerPath *next; @@ -1915,25 +1915,25 @@ GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path) * @return GNUNET_OK on success. */ int -GMP_remove_connection (struct CadetPeer *peer, +GCP_remove_connection (struct CadetPeer *peer, const struct CadetConnection *c) { - LOG (GNUNET_ERROR_TYPE_DEBUG, "removing connection %s\n", GMC_2s (c)); - LOG (GNUNET_ERROR_TYPE_DEBUG, "from peer %s\n", GMP_2s (peer)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "removing connection %s\n", GCC_2s (c)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "from peer %s\n", GCP_2s (peer)); if (NULL == peer || NULL == peer->connections) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %s is not a neighbor!\n", - GMP_2s (peer)); + GCP_2s (peer)); return GNUNET_SYSERR; } LOG (GNUNET_ERROR_TYPE_DEBUG, "peer %s ok, has %u connections.\n", - GMP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections)); + GCP_2s (peer), GNUNET_CONTAINER_multihashmap_size (peer->connections)); return GNUNET_CONTAINER_multihashmap_remove (peer->connections, - GMC_get_h (c), + GCC_get_h (c), c); } @@ -1944,7 +1944,7 @@ GMP_remove_connection (struct CadetPeer *peer, * @param peer Destination peer. */ void -GMP_start_search (struct CadetPeer *peer) +GCP_start_search (struct CadetPeer *peer) { if (NULL != peer->search_h) { @@ -1952,7 +1952,7 @@ GMP_start_search (struct CadetPeer *peer) return; } - peer->search_h = GMD_search (GMP_get_id (peer), &search_handler, peer); + peer->search_h = GCD_search (GCP_get_id (peer), &search_handler, peer); } @@ -1963,14 +1963,14 @@ GMP_start_search (struct CadetPeer *peer) * @param peer Destination peer. */ void -GMP_stop_search (struct CadetPeer *peer) +GCP_stop_search (struct CadetPeer *peer) { if (NULL == peer->search_h) { return; } - GMD_search_stop (peer->search_h); + GCD_search_stop (peer->search_h); peer->search_h = NULL; } @@ -1983,7 +1983,7 @@ GMP_stop_search (struct CadetPeer *peer) * @return Full ID of peer. */ const struct GNUNET_PeerIdentity * -GMP_get_id (const struct CadetPeer *peer) +GCP_get_id (const struct CadetPeer *peer) { return GNUNET_PEER_resolve2 (peer->id); } @@ -1997,7 +1997,7 @@ GMP_get_id (const struct CadetPeer *peer) * @return Short ID of peer. */ GNUNET_PEER_Id -GMP_get_short_id (const struct CadetPeer *peer) +GCP_get_short_id (const struct CadetPeer *peer) { return peer->id; } @@ -2010,12 +2010,12 @@ GMP_get_short_id (const struct CadetPeer *peer) * @param t Tunnel. */ void -GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t) +GCP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t) { peer->tunnel = t; if (NULL == t && NULL != peer->search_h) { - GMP_stop_search (peer); + GCP_stop_search (peer); } } @@ -2028,7 +2028,7 @@ GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t) * @return Tunnel towards peer. */ struct CadetTunnel3 * -GMP_get_tunnel (const struct CadetPeer *peer) +GCP_get_tunnel (const struct CadetPeer *peer) { return peer->tunnel; } @@ -2041,16 +2041,16 @@ GMP_get_tunnel (const struct CadetPeer *peer) * @param hello Hello message. */ void -GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello) +GCP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello) { struct GNUNET_HELLO_Message *old; size_t size; - LOG (GNUNET_ERROR_TYPE_DEBUG, "set hello for %s\n", GMP_2s (peer)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "set hello for %s\n", GCP_2s (peer)); if (NULL == hello) return; - old = GMP_get_hello (peer); + old = GCP_get_hello (peer); if (NULL == old) { size = GNUNET_HELLO_size (hello); @@ -2076,7 +2076,7 @@ GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello) * @return Hello message. */ struct GNUNET_HELLO_Message * -GMP_get_hello (struct CadetPeer *peer) +GCP_get_hello (struct CadetPeer *peer) { struct GNUNET_TIME_Absolute expiration; struct GNUNET_TIME_Relative remaining; @@ -2103,7 +2103,7 @@ GMP_get_hello (struct CadetPeer *peer) * @param peer Peer to whom to connect. */ void -GMP_try_connect (struct CadetPeer *peer) +GCP_try_connect (struct CadetPeer *peer) { struct GNUNET_HELLO_Message *hello; struct GNUNET_MessageHeader *mh; @@ -2111,7 +2111,7 @@ GMP_try_connect (struct CadetPeer *peer) if (NULL == transport_handle) return; - hello = GMP_get_hello (peer); + hello = GCP_get_hello (peer); if (NULL == hello) return; @@ -2129,7 +2129,7 @@ GMP_try_connect (struct CadetPeer *peer) * @param peer2 Peer whose link is broken. */ void -GMP_notify_broken_link (struct CadetPeer *peer, +GCP_notify_broken_link (struct CadetPeer *peer, struct GNUNET_PeerIdentity *peer1, struct GNUNET_PeerIdentity *peer2) { @@ -2178,7 +2178,7 @@ GMP_notify_broken_link (struct CadetPeer *peer, * @return Number of known paths. */ unsigned int -GMP_count_paths (const struct CadetPeer *peer) +GCP_count_paths (const struct CadetPeer *peer) { struct CadetPeerPath *iter; unsigned int i; @@ -2197,7 +2197,7 @@ GMP_count_paths (const struct CadetPeer *peer) * @param cls Closure for @c iter. */ void -GMP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) +GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) { GNUNET_CONTAINER_multipeermap_iterate (peers, iter, cls); } @@ -2211,7 +2211,7 @@ GMP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) * @return Static string for it's ID. */ const char * -GMP_2s (const struct CadetPeer *peer) +GCP_2s (const struct CadetPeer *peer) { if (NULL == peer) return "(NULL)"; diff --git a/src/cadet/gnunet-service-cadet_peer.h b/src/cadet/gnunet-service-cadet_peer.h index 9f1146e9f..e9668305b 100644 --- a/src/cadet/gnunet-service-cadet_peer.h +++ b/src/cadet/gnunet-service-cadet_peer.h @@ -64,7 +64,7 @@ struct CadetPeerQueue; * @param size Size of the message. * @param wait Time spent waiting for core (only the time for THIS message) */ -typedef void (*GMP_sent) (void *cls, +typedef void (*GCP_sent) (void *cls, struct CadetConnection *c, int sent, uint16_t type, uint32_t pid, int fwd, size_t size, struct GNUNET_TIME_Relative wait); @@ -79,13 +79,13 @@ typedef void (*GMP_sent) (void *cls, * @param c Configuration. */ void -GMP_init (const struct GNUNET_CONFIGURATION_Handle *c); +GCP_init (const struct GNUNET_CONFIGURATION_Handle *c); /** * Shut down the peer subsystem. */ void -GMP_shutdown (void); +GCP_shutdown (void); /** @@ -97,7 +97,7 @@ GMP_shutdown (void); * @return Existing or newly created peer structure. */ struct CadetPeer * -GMP_get (const struct GNUNET_PeerIdentity *peer_id); +GCP_get (const struct GNUNET_PeerIdentity *peer_id); /** @@ -109,7 +109,7 @@ GMP_get (const struct GNUNET_PeerIdentity *peer_id); * @return Existing or newly created peer structure. */ struct CadetPeer * -GMP_get_short (const GNUNET_PEER_Id peer); +GCP_get_short (const GNUNET_PEER_Id peer); /** * Try to establish a new connection to this peer (in its tunnel). @@ -119,7 +119,7 @@ GMP_get_short (const GNUNET_PEER_Id peer); * @param peer Peer to connect to. */ void -GMP_connect (struct CadetPeer *peer); +GCP_connect (struct CadetPeer *peer); /** * Free a transmission that was already queued with all resources @@ -131,7 +131,7 @@ GMP_connect (struct CadetPeer *peer); * @param pid PID, if relevant (was sent and was a payload message). */ void -GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, +GCP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, int sent, uint32_t pid); /** @@ -151,10 +151,10 @@ GMP_queue_destroy (struct CadetPeerQueue *queue, int clear_cls, * message has been sent and therefore the handle is no longer valid. */ struct CadetPeerQueue * -GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, +GCP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, uint16_t payload_type, uint32_t payload_id, size_t size, struct CadetConnection *c, int fwd, - GMP_sent cont, void *cont_cls); + GCP_sent cont, void *cont_cls); /** * Cancel all queued messages to a peer that belong to a certain connection. @@ -164,7 +164,7 @@ GMP_queue_add (struct CadetPeer *peer, void *cls, uint16_t type, * the sent continuation call. */ void -GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c); +GCP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c); /** * Get the first message for a connection and unqueue it. @@ -175,10 +175,10 @@ GMP_queue_cancel (struct CadetPeer *peer, struct CadetConnection *c); * @return First message for this connection. */ struct GNUNET_MessageHeader * -GMP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c); +GCP_connection_pop (struct CadetPeer *peer, struct CadetConnection *c); void -GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c); +GCP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c); /** * Set tunnel. @@ -187,7 +187,7 @@ GMP_queue_unlock (struct CadetPeer *peer, struct CadetConnection *c); * @param t Tunnel. */ void -GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t); +GCP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t); /** * Check whether there is a direct (core level) connection to peer. @@ -197,7 +197,7 @@ GMP_set_tunnel (struct CadetPeer *peer, struct CadetTunnel3 *t); * @return #GNUNET_YES if there is a direct connection. */ int -GMP_is_neighbor (const struct CadetPeer *peer); +GCP_is_neighbor (const struct CadetPeer *peer); /** * Create and initialize a new tunnel towards a peer, in case it has none. @@ -207,7 +207,7 @@ GMP_is_neighbor (const struct CadetPeer *peer); * @param peer Peer towards which to create the tunnel. */ void -GMP_add_tunnel (struct CadetPeer *peer); +GCP_add_tunnel (struct CadetPeer *peer); /** * Add a connection to a neighboring peer. @@ -222,7 +222,7 @@ GMP_add_tunnel (struct CadetPeer *peer); * @return GNUNET_OK on success. */ int -GMP_add_connection (struct CadetPeer *peer, struct CadetConnection *c); +GCP_add_connection (struct CadetPeer *peer, struct CadetConnection *c); /** * Add the path to the peer and update the path used to reach it in case this @@ -237,7 +237,7 @@ GMP_add_connection (struct CadetPeer *peer, struct CadetConnection *c); * NULL on error. */ struct CadetPeerPath * -GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *p, int trusted); +GCP_add_path (struct CadetPeer *peer, struct CadetPeerPath *p, int trusted); /** * Add the path to the origin peer and update the path used to reach it in case @@ -254,7 +254,7 @@ GMP_add_path (struct CadetPeer *peer, struct CadetPeerPath *p, int trusted); * NULL on error. */ struct CadetPeerPath * -GMP_add_path_to_origin (struct CadetPeer *peer, +GCP_add_path_to_origin (struct CadetPeer *peer, struct CadetPeerPath *path, int trusted); @@ -265,7 +265,7 @@ GMP_add_path_to_origin (struct CadetPeer *peer, * @param confirmed Whether we know if the path works or not. */ void -GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed); +GCP_add_path_to_all (const struct CadetPeerPath *p, int confirmed); /** * Remove any path to the peer that has the extact same peers as the one given. @@ -274,7 +274,7 @@ GMP_add_path_to_all (const struct CadetPeerPath *p, int confirmed); * @param path Path to remove. Is always destroyed . */ void -GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path); +GCP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path); /** * Remove a connection from a neighboring peer. @@ -285,7 +285,7 @@ GMP_remove_path (struct CadetPeer *peer, struct CadetPeerPath *path); * @return GNUNET_OK on success. */ int -GMP_remove_connection (struct CadetPeer *peer, const struct CadetConnection *c); +GCP_remove_connection (struct CadetPeer *peer, const struct CadetConnection *c); /** * Start the DHT search for new paths towards the peer: we don't have @@ -294,7 +294,7 @@ GMP_remove_connection (struct CadetPeer *peer, const struct CadetConnection *c); * @param peer Destination peer. */ void -GMP_start_search (struct CadetPeer *peer); +GCP_start_search (struct CadetPeer *peer); /** * Stop the DHT search for new paths towards the peer: we already have @@ -303,7 +303,7 @@ GMP_start_search (struct CadetPeer *peer); * @param peer Destination peer. */ void -GMP_stop_search (struct CadetPeer *peer); +GCP_stop_search (struct CadetPeer *peer); /** * Get the Full ID of a peer. @@ -313,7 +313,7 @@ GMP_stop_search (struct CadetPeer *peer); * @return Full ID of peer. */ const struct GNUNET_PeerIdentity * -GMP_get_id (const struct CadetPeer *peer); +GCP_get_id (const struct CadetPeer *peer); /** * Get the Short ID of a peer. @@ -323,7 +323,7 @@ GMP_get_id (const struct CadetPeer *peer); * @return Short ID of peer. */ GNUNET_PEER_Id -GMP_get_short_id (const struct CadetPeer *peer); +GCP_get_short_id (const struct CadetPeer *peer); /** * Get the tunnel towards a peer. @@ -333,7 +333,7 @@ GMP_get_short_id (const struct CadetPeer *peer); * @return Tunnel towards peer. */ struct CadetTunnel3 * -GMP_get_tunnel (const struct CadetPeer *peer); +GCP_get_tunnel (const struct CadetPeer *peer); /** * Set the hello message. @@ -342,7 +342,7 @@ GMP_get_tunnel (const struct CadetPeer *peer); * @param hello Hello message. */ void -GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello); +GCP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello); /** * Get the hello message. @@ -352,7 +352,7 @@ GMP_set_hello (struct CadetPeer *peer, const struct GNUNET_HELLO_Message *hello) * @return Hello message. */ struct GNUNET_HELLO_Message * -GMP_get_hello (struct CadetPeer *peer); +GCP_get_hello (struct CadetPeer *peer); /** @@ -361,7 +361,7 @@ GMP_get_hello (struct CadetPeer *peer); * @param peer Peer to whom to connect. */ void -GMP_try_connect (struct CadetPeer *peer); +GCP_try_connect (struct CadetPeer *peer); /** * Notify a peer that a link between two other peers is broken. If any path @@ -372,7 +372,7 @@ GMP_try_connect (struct CadetPeer *peer); * @param peer2 Peer whose link is broken. */ void -GMP_notify_broken_link (struct CadetPeer *peer, +GCP_notify_broken_link (struct CadetPeer *peer, struct GNUNET_PeerIdentity *peer1, struct GNUNET_PeerIdentity *peer2); @@ -384,7 +384,7 @@ GMP_notify_broken_link (struct CadetPeer *peer, * @return Number of known paths. */ unsigned int -GMP_count_paths (const struct CadetPeer *peer); +GCP_count_paths (const struct CadetPeer *peer); /** * Iterate all known peers. @@ -393,7 +393,7 @@ GMP_count_paths (const struct CadetPeer *peer); * @param cls Closure for @c iter. */ void -GMP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls); +GCP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls); /** * Get the static string for a peer ID. @@ -403,7 +403,7 @@ GMP_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls); * @return Static string for it's ID. */ const char * -GMP_2s (const struct CadetPeer *peer); +GCP_2s (const struct CadetPeer *peer); #if 0 /* keep Emacsens' auto-indent happy */ diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index 15883b43e..971b186c9 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c @@ -219,7 +219,7 @@ struct CadetTunnel3Queue /** * Continuation to call once sent. */ - GMT_sent cont; + GCT_sent cont; /** * Closure for @c cont. @@ -370,9 +370,9 @@ is_ready (struct CadetTunnel3 *t) { int ready; - GMT_debug (t); + GCT_debug (t); ready = (CADET_TUNNEL3_READY == t->cstate && CADET_TUNNEL3_KEY_OK == t->estate); - ready = ready || GMT_is_loopback (t); + ready = ready || GCT_is_loopback (t); return ready; } @@ -418,9 +418,9 @@ get_channel_buffer (const struct CadetTChannel *tch) int fwd; /* If channel is outgoing, is origin in the FWD direction and fwd is YES */ - fwd = GMCH_is_origin (tch->ch, GNUNET_YES); + fwd = GCCH_is_origin (tch->ch, GNUNET_YES); - return GMCH_get_buffer (tch->ch, fwd); + return GCCH_get_buffer (tch->ch, fwd); } @@ -437,9 +437,9 @@ get_channel_allowed (const struct CadetTChannel *tch) int fwd; /* If channel is outgoing, is origin in the FWD direction and fwd is YES */ - fwd = GMCH_is_origin (tch->ch, GNUNET_YES); + fwd = GCCH_is_origin (tch->ch, GNUNET_YES); - return GMCH_get_allowed (tch->ch, fwd); + return GCCH_get_allowed (tch->ch, fwd); } @@ -456,9 +456,9 @@ get_connection_buffer (const struct CadetTConnection *tc) int fwd; /* If connection is outgoing, is origin in the FWD direction and fwd is YES */ - fwd = GMC_is_origin (tc->c, GNUNET_YES); + fwd = GCC_is_origin (tc->c, GNUNET_YES); - return GMC_get_buffer (tc->c, fwd); + return GCC_get_buffer (tc->c, fwd); } @@ -475,9 +475,9 @@ get_connection_allowed (const struct CadetTConnection *tc) int fwd; /* If connection is outgoing, is origin in the FWD direction and fwd is YES */ - fwd = GMC_is_origin (tc->c, GNUNET_YES); + fwd = GCC_is_origin (tc->c, GNUNET_YES); - return GMC_get_allowed (tc->c, fwd); + return GCC_get_allowed (tc->c, fwd); } @@ -503,7 +503,7 @@ check_ephemeral (struct CadetTunnel3 *t, /* Check origin */ if (0 != memcmp (&msg->origin_identity, - GMP_get_id (t->peer), + GCP_get_id (t->peer), sizeof (struct GNUNET_PeerIdentity))) return GNUNET_SYSERR; @@ -578,8 +578,8 @@ t_decrypt (struct CadetTunnel3 *t, GNUNET_STATISTICS_update (stats, "# non decryptable data", 1, GNUNET_NO); LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING got data on %s without a valid key\n", - GMT_2s (t)); - GMT_debug (t); + GCT_2s (t)); + GCT_debug (t); return 0; } @@ -652,16 +652,16 @@ tunnel_get_connection (struct CadetTunnel3 *t) unsigned int qn; unsigned int lowest_q; - LOG (GNUNET_ERROR_TYPE_DEBUG, "tunnel_get_connection %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "tunnel_get_connection %s\n", GCT_2s (t)); best = NULL; lowest_q = UINT_MAX; for (iter = t->connection_head; NULL != iter; iter = iter->next) { LOG (GNUNET_ERROR_TYPE_DEBUG, " connection %s: %u\n", - GMC_2s (iter->c), GMC_get_state (iter->c)); - if (CADET_CONNECTION_READY == GMC_get_state (iter->c)) + GCC_2s (iter->c), GCC_get_state (iter->c)); + if (CADET_CONNECTION_READY == GCC_get_state (iter->c)) { - qn = GMC_get_qn (iter->c, GMC_is_origin (iter->c, GNUNET_YES)); + qn = GCC_get_qn (iter->c, GCC_is_origin (iter->c, GNUNET_YES)); LOG (GNUNET_ERROR_TYPE_DEBUG, " q_n %u, \n", qn); if (qn < lowest_q) { @@ -670,7 +670,7 @@ tunnel_get_connection (struct CadetTunnel3 *t) } } } - LOG (GNUNET_ERROR_TYPE_DEBUG, " selected: connection %s\n", GMC_2s (best)); + LOG (GNUNET_ERROR_TYPE_DEBUG, " selected: connection %s\n", GCC_2s (best)); return best; } @@ -699,7 +699,7 @@ tun_message_sent (void *cls, LOG (GNUNET_ERROR_TYPE_DEBUG, "tun_message_sent\n"); GNUNET_assert (NULL != qt->cont); - t = NULL == c ? NULL : GMC_get_tunnel (c); + t = NULL == c ? NULL : GCC_get_tunnel (c); qt->cont (qt->cont_cls, t, qt, type, size); GNUNET_free (qt); } @@ -731,7 +731,7 @@ queue_data (struct CadetTunnel3 *t, const struct GNUNET_MessageHeader *msg) struct CadetTunnelDelayed *tqd; uint16_t size = ntohs (msg->size); - LOG (GNUNET_ERROR_TYPE_DEBUG, "queue data on Tunnel %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "queue data on Tunnel %s\n", GCT_2s (t)); if (GNUNET_YES == is_ready (t)) { @@ -797,7 +797,7 @@ t_hmac (struct CadetTunnel3 *t, const void *plaintext, size_t size, uint32_t iv, static struct CadetTunnel3Queue * send_prebuilt_message (const struct GNUNET_MessageHeader *message, struct CadetTunnel3 *t, struct CadetConnection *c, - int force, GMT_sent cont, void *cont_cls, + int force, GCT_sent cont, void *cont_cls, struct CadetTunnel3Queue *existing_q) { struct CadetTunnel3Queue *tq; @@ -809,7 +809,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, uint16_t type; int fwd; - LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT Send on Tunnel %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT Send on Tunnel %s\n", GCT_2s (t)); if (GNUNET_NO == is_ready (t)) { @@ -829,7 +829,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, return tq; } - GNUNET_assert (GNUNET_NO == GMT_is_loopback (t)); + GNUNET_assert (GNUNET_NO == GCT_is_loopback (t)); iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); msg = (struct GNUNET_CADET_Encrypted *) cbuf; @@ -847,7 +847,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, || CADET_TUNNEL3_SEARCHING != t->cstate) { GNUNET_break (0); - GMT_debug (t); + GCT_debug (t); } return NULL; } @@ -868,20 +868,20 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_ACK: case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: - msg->cid = *GMC_get_id (c); + msg->cid = *GCC_get_id (c); msg->ttl = htonl (default_ttl); break; default: GNUNET_break (0); } - LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s\n", GM_m2s (type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s\n", GC_m2s (type)); - fwd = GMC_is_origin (c, GNUNET_YES); + fwd = GCC_is_origin (c, GNUNET_YES); if (NULL == cont) { GNUNET_break (NULL == - GMC_send_prebuilt_message (&msg->header, type, mid, + GCC_send_prebuilt_message (&msg->header, type, mid, c, fwd, force, NULL, NULL)); return NULL; } @@ -894,7 +894,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, tq = existing_q; tq->tqd = NULL; } - tq->cq = GMC_send_prebuilt_message (&msg->header, type, mid, c, fwd, force, + tq->cq = GCC_send_prebuilt_message (&msg->header, type, mid, c, fwd, force, &tun_message_sent, tq); tq->cont = cont; tq->cont_cls = cont_cls; @@ -916,10 +916,10 @@ send_queued_data (struct CadetTunnel3 *t) unsigned int room; LOG (GNUNET_ERROR_TYPE_DEBUG, - "GMT_send_queued_data on tunnel %s\n", - GMT_2s (t)); + "GCT_send_queued_data on tunnel %s\n", + GCT_2s (t)); - if (GMT_is_loopback (t)) + if (GCT_is_loopback (t)) { GNUNET_break (0); return; @@ -932,7 +932,7 @@ send_queued_data (struct CadetTunnel3 *t) return; } - room = GMT_get_connections_buffer (t); + room = GCT_get_connections_buffer (t); LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room); LOG (GNUNET_ERROR_TYPE_DEBUG, " tq head: %p\n", t->tq_head); for (tqd = t->tq_head; NULL != tqd && room > 0; tqd = next) @@ -947,7 +947,7 @@ send_queued_data (struct CadetTunnel3 *t) tqd->tq); unqueue_data (tqd); } - LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_send_queued_data end\n", GMP_2s (t->peer)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "GCT_send_queued_data end\n", GCP_2s (t->peer)); } @@ -969,10 +969,10 @@ send_kx (struct CadetTunnel3 *t, uint16_t type; int fwd; - LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT KX on Tunnel %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT KX on Tunnel %s\n", GCT_2s (t)); /* Avoid loopback. */ - if (GMT_is_loopback (t)) + if (GCT_is_loopback (t)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " loopback!\n"); GNUNET_break (0); @@ -988,7 +988,7 @@ send_kx (struct CadetTunnel3 *t, if (NULL == t->connection_head) { GNUNET_break (CADET_TUNNEL3_SEARCHING == t->cstate); - GMT_debug (t); + GCT_debug (t); return; } @@ -1000,7 +1000,7 @@ send_kx (struct CadetTunnel3 *t, { GNUNET_break (GNUNET_SCHEDULER_NO_TASK != t->destroy_task || CADET_TUNNEL3_READY != t->cstate); - GMT_debug (t); + GCT_debug (t); return; } type = ntohs (message->type); @@ -1013,13 +1013,13 @@ send_kx (struct CadetTunnel3 *t, break; default: LOG (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n", - GM_m2s (type)); + GC_m2s (type)); GNUNET_break (0); } - fwd = GMC_is_origin (t->connection_head->c, GNUNET_YES); + fwd = GCC_is_origin (t->connection_head->c, GNUNET_YES); /* TODO save handle and cancel in case of a unneeded retransmission */ - GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, + GCC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_CADET_KX, message->type, c, fwd, GNUNET_YES, NULL, NULL); } @@ -1032,7 +1032,7 @@ send_kx (struct CadetTunnel3 *t, static void send_ephemeral (struct CadetTunnel3 *t) { - LOG (GNUNET_ERROR_TYPE_INFO, "=> EPHM for %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_INFO, "=> EPHM for %s\n", GCT_2s (t)); kx_msg.sender_status = htonl (t->estate); send_kx (t, &kx_msg.header); @@ -1048,11 +1048,11 @@ send_ping (struct CadetTunnel3 *t) { struct GNUNET_CADET_KX_Ping msg; - LOG (GNUNET_ERROR_TYPE_INFO, "=> PING for %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_INFO, "=> PING for %s\n", GCT_2s (t)); msg.header.size = htons (sizeof (msg)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PING); msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); - msg.target = *GMP_get_id (t->peer); + msg.target = *GCP_get_id (t->peer); msg.nonce = t->kx_ctx->challenge; LOG (GNUNET_ERROR_TYPE_DEBUG, " sending %u\n", msg.nonce); @@ -1076,7 +1076,7 @@ send_pong (struct CadetTunnel3 *t, uint32_t challenge) { struct GNUNET_CADET_KX_Pong msg; - LOG (GNUNET_ERROR_TYPE_INFO, "=> PONG for %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_INFO, "=> PONG for %s\n", GCT_2s (t)); msg.header.size = htons (sizeof (msg)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX_PONG); msg.iv = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); @@ -1102,7 +1102,7 @@ rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) t->rekey_task = GNUNET_SCHEDULER_NO_TASK; - LOG (GNUNET_ERROR_TYPE_DEBUG, "Re-key Tunnel %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "Re-key Tunnel %s\n", GCT_2s (t)); if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) return; @@ -1114,7 +1114,7 @@ rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); t->kx_ctx->d_key_old = t->d_key; LOG (GNUNET_ERROR_TYPE_DEBUG, " new challenge for %s: %u\n", - GMT_2s (t), t->kx_ctx->challenge); + GCT_2s (t), t->kx_ctx->challenge); } send_ephemeral (t); switch (t->estate) @@ -1161,7 +1161,7 @@ rekey_iterator (void *cls, if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) return GNUNET_YES; - if (GNUNET_YES == GMT_is_loopback (t)) + if (GNUNET_YES == GCT_is_loopback (t)) return GNUNET_YES; r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t) n * 100); @@ -1227,8 +1227,8 @@ destroy_iterator (void *cls, { struct CadetTunnel3 *t = value; - LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_shutdown destroying tunnel at %p\n", t); - GMT_destroy (t); + LOG (GNUNET_ERROR_TYPE_DEBUG, "GCT_shutdown destroying tunnel at %p\n", t); + GCT_destroy (t); return GNUNET_YES; } @@ -1251,7 +1251,7 @@ send_channel_destroy (struct CadetTunnel3 *t, unsigned int gid) LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING destroying unknown channel %u on tunnel %s\n", - gid, GMT_2s (t)); + gid, GCT_2s (t)); send_prebuilt_message (&msg.header, t, NULL, GNUNET_YES, NULL, NULL, NULL); } @@ -1284,10 +1284,10 @@ handle_data (struct CadetTunnel3 *t, return; } LOG (GNUNET_ERROR_TYPE_DEBUG, " payload of type %s\n", - GM_m2s (ntohs (msg[1].header.type))); + GC_m2s (ntohs (msg[1].header.type))); /* Check channel */ - ch = GMT_get_channel (t, ntohl (msg->chid)); + ch = GCT_get_channel (t, ntohl (msg->chid)); if (NULL == ch) { GNUNET_STATISTICS_update (stats, "# data on unknown channel", @@ -1298,7 +1298,7 @@ handle_data (struct CadetTunnel3 *t, return; } - GMCH_handle_data (ch, msg, fwd); + GCCH_handle_data (ch, msg, fwd); } @@ -1329,7 +1329,7 @@ handle_data_ack (struct CadetTunnel3 *t, } /* Check channel */ - ch = GMT_get_channel (t, ntohl (msg->chid)); + ch = GCT_get_channel (t, ntohl (msg->chid)); if (NULL == ch) { GNUNET_STATISTICS_update (stats, "# data ack on unknown channel", @@ -1339,7 +1339,7 @@ handle_data_ack (struct CadetTunnel3 *t, return; } - GMCH_handle_data_ack (ch, msg, fwd); + GCCH_handle_data_ack (ch, msg, fwd); } @@ -1365,15 +1365,15 @@ handle_ch_create (struct CadetTunnel3 *t, } /* Check channel */ - ch = GMT_get_channel (t, ntohl (msg->chid)); - if (NULL != ch && ! GMT_is_loopback (t)) + ch = GCT_get_channel (t, ntohl (msg->chid)); + if (NULL != ch && ! GCT_is_loopback (t)) { /* Probably a retransmission, safe to ignore */ LOG (GNUNET_ERROR_TYPE_DEBUG, " already exists...\n"); } - ch = GMCH_handle_create (t, msg); + ch = GCCH_handle_create (t, msg); if (NULL != ch) - GMT_add_channel (t, ch); + GCT_add_channel (t, ch); } @@ -1400,7 +1400,7 @@ handle_ch_nack (struct CadetTunnel3 *t, } /* Check channel */ - ch = GMT_get_channel (t, ntohl (msg->chid)); + ch = GCT_get_channel (t, ntohl (msg->chid)); if (NULL == ch) { GNUNET_STATISTICS_update (stats, "# channel NACK on unknown channel", @@ -1410,7 +1410,7 @@ handle_ch_nack (struct CadetTunnel3 *t, return; } - GMCH_handle_nack (ch); + GCCH_handle_nack (ch); } @@ -1441,7 +1441,7 @@ handle_ch_ack (struct CadetTunnel3 *t, } /* Check channel */ - ch = GMT_get_channel (t, ntohl (msg->chid)); + ch = GCT_get_channel (t, ntohl (msg->chid)); if (NULL == ch) { GNUNET_STATISTICS_update (stats, "# channel ack on unknown channel", @@ -1451,7 +1451,7 @@ handle_ch_ack (struct CadetTunnel3 *t, return; } - GMCH_handle_ack (ch, msg, fwd); + GCCH_handle_ack (ch, msg, fwd); } @@ -1483,14 +1483,14 @@ handle_ch_destroy (struct CadetTunnel3 *t, } /* Check channel */ - ch = GMT_get_channel (t, ntohl (msg->chid)); + ch = GCT_get_channel (t, ntohl (msg->chid)); if (NULL == ch) { /* Probably a retransmission, safe to ignore */ return; } - GMCH_handle_destroy (ch, msg, fwd); + GCCH_handle_destroy (ch, msg, fwd); } @@ -1505,7 +1505,7 @@ handle_ephemeral (struct CadetTunnel3 *t, const struct GNUNET_CADET_KX_Ephemeral *msg) { struct GNUNET_HashCode km; - LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_INFO, "<=== EPHM for %s\n", GCT_2s (t)); if (GNUNET_OK != check_ephemeral (t, msg)) { @@ -1514,8 +1514,8 @@ handle_ephemeral (struct CadetTunnel3 *t, } derive_key_material (&km, &msg->ephemeral_key); LOG (GNUNET_ERROR_TYPE_DEBUG, " km is %s\n", GNUNET_h2s (&km)); - derive_symmertic (&t->e_key, &my_full_id, GMP_get_id (t->peer), &km); - derive_symmertic (&t->d_key, GMP_get_id (t->peer), &my_full_id, &km); + derive_symmertic (&t->e_key, &my_full_id, GCP_get_id (t->peer), &km); + derive_symmertic (&t->d_key, GCP_get_id (t->peer), &my_full_id, &km); if (CADET_TUNNEL3_KEY_SENT == t->estate) { LOG (GNUNET_ERROR_TYPE_DEBUG, " our key was sent, send ping\n"); @@ -1544,12 +1544,12 @@ handle_ping (struct CadetTunnel3 *t, return; } - LOG (GNUNET_ERROR_TYPE_INFO, "<=== PING for %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_INFO, "<=== PING for %s\n", GCT_2s (t)); t_decrypt (t, &res.target, &msg->target, ping_encryption_size (), msg->iv); if (0 != memcmp (&my_full_id, &res.target, sizeof (my_full_id))) { GNUNET_STATISTICS_update (stats, "# malformed PINGs", 1, GNUNET_NO); - LOG (GNUNET_ERROR_TYPE_WARNING, " malformed PING on %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_WARNING, " malformed PING on %s\n", GCT_2s (t)); LOG (GNUNET_ERROR_TYPE_DEBUG, " e got %u\n", msg->nonce); LOG (GNUNET_ERROR_TYPE_DEBUG, " e towards %s\n", GNUNET_i2s (&msg->target)); LOG (GNUNET_ERROR_TYPE_DEBUG, " got %u\n", res.nonce); @@ -1577,7 +1577,7 @@ handle_pong (struct CadetTunnel3 *t, { uint32_t challenge; - LOG (GNUNET_ERROR_TYPE_INFO, "<=== PONG for %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_INFO, "<=== PONG for %s\n", GCT_2s (t)); if (GNUNET_SCHEDULER_NO_TASK == t->rekey_task) { GNUNET_STATISTICS_update (stats, "# duplicate PONG messages", 1, GNUNET_NO); @@ -1587,7 +1587,7 @@ handle_pong (struct CadetTunnel3 *t, if (challenge != t->kx_ctx->challenge) { - LOG (GNUNET_ERROR_TYPE_WARNING, "Wrong PONG challenge on %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_WARNING, "Wrong PONG challenge on %s\n", GCT_2s (t)); LOG (GNUNET_ERROR_TYPE_DEBUG, "PONG: %u (e: %u). Expected: %u.\n", challenge, msg->nonce, t->kx_ctx->challenge); send_ephemeral (t); @@ -1598,7 +1598,7 @@ handle_pong (struct CadetTunnel3 *t, t->rekey_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_free (t->kx_ctx); t->kx_ctx = NULL; - GMT_change_estate (t, CADET_TUNNEL3_KEY_OK); + GCT_change_estate (t, CADET_TUNNEL3_KEY_OK); } @@ -1621,7 +1621,7 @@ handle_decrypted (struct CadetTunnel3 *t, uint16_t type; type = ntohs (msgh->type); - LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s on %s\n", GM_m2s (type), GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s on %s\n", GC_m2s (type), GCT_2s (t)); switch (type) { @@ -1666,7 +1666,7 @@ handle_decrypted (struct CadetTunnel3 *t, LOG (GNUNET_ERROR_TYPE_WARNING, "end-to-end message not known (%u)\n", ntohs (msgh->type)); - GMT_debug (t); + GCT_debug (t); } } @@ -1682,7 +1682,7 @@ handle_decrypted (struct CadetTunnel3 *t, * @param msg Encrypted message. */ void -GMT_handle_encrypted (struct CadetTunnel3 *t, +GCT_handle_encrypted (struct CadetTunnel3 *t, const struct GNUNET_CADET_Encrypted *msg) { size_t size = ntohs (msg->header.size); @@ -1700,7 +1700,7 @@ GMT_handle_encrypted (struct CadetTunnel3 *t, /* checksum failed */ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed checksum validation for a message on tunnel `%s'\n", - GMT_2s (t)); + GCT_2s (t)); GNUNET_STATISTICS_update (stats, "# wrong HMAC", 1, GNUNET_NO); return; } @@ -1721,7 +1721,7 @@ GMT_handle_encrypted (struct CadetTunnel3 *t, * @param message Payload of KX message. */ void -GMT_handle_kx (struct CadetTunnel3 *t, +GCT_handle_kx (struct CadetTunnel3 *t, const struct GNUNET_MessageHeader *message) { uint16_t type; @@ -1756,7 +1756,7 @@ GMT_handle_kx (struct CadetTunnel3 *t, * @param key ECC private key, to derive all other keys and do crypto. */ void -GMT_init (const struct GNUNET_CONFIGURATION_Handle *c, +GCT_init (const struct GNUNET_CONFIGURATION_Handle *c, const struct GNUNET_CRYPTO_EddsaPrivateKey *key) { LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n"); @@ -1791,7 +1791,7 @@ GMT_init (const struct GNUNET_CONFIGURATION_Handle *c, * Shut down the tunnel subsystem. */ void -GMT_shutdown (void) +GCT_shutdown (void) { if (GNUNET_SCHEDULER_NO_TASK != rekey_task) { @@ -1809,7 +1809,7 @@ GMT_shutdown (void) * @param destination Peer this tunnel is towards. */ struct CadetTunnel3 * -GMT_new (struct CadetPeer *destination) +GCT_new (struct CadetPeer *destination) { struct CadetTunnel3 *t; @@ -1818,7 +1818,7 @@ GMT_new (struct CadetPeer *destination) t->peer = destination; if (GNUNET_OK != - GNUNET_CONTAINER_multipeermap_put (tunnels, GMP_get_id (destination), t, + GNUNET_CONTAINER_multipeermap_put (tunnels, GCP_get_id (destination), t, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) { GNUNET_break (0); @@ -1836,13 +1836,13 @@ GMT_new (struct CadetPeer *destination) * @param cstate New connection state. */ void -GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate) +GCT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate) { if (NULL == t) return; LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s cstate %s => %s\n", - GMP_2s (t->peer), cstate2s (t->cstate), cstate2s (cstate)); - if (myid != GMP_get_short_id (t->peer) && + GCP_2s (t->peer), cstate2s (t->cstate), cstate2s (cstate)); + if (myid != GCP_get_short_id (t->peer) && CADET_TUNNEL3_READY != t->cstate && CADET_TUNNEL3_READY == cstate) { @@ -1861,10 +1861,10 @@ GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate) t->cstate = cstate; if (CADET_TUNNEL3_READY == cstate - && CONNECTIONS_PER_TUNNEL <= GMT_count_connections (t)) + && CONNECTIONS_PER_TUNNEL <= GCT_count_connections (t)) { LOG (GNUNET_ERROR_TYPE_DEBUG, " cstate triggered stop dht\n"); - GMP_stop_search (t->peer); + GCP_stop_search (t->peer); } } @@ -1875,17 +1875,17 @@ GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate) * @param state New encryption state. */ void -GMT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state) +GCT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state) { if (NULL == t) return; LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s estate was %s\n", - GMP_2s (t->peer), estate2s (t->estate)); + GCP_2s (t->peer), estate2s (t->estate)); LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s estate is now %s\n", - GMP_2s (t->peer), estate2s (state)); - if (myid != GMP_get_short_id (t->peer) && + GCP_2s (t->peer), estate2s (state)); + if (myid != GCP_get_short_id (t->peer) && CADET_TUNNEL3_KEY_OK != t->estate && CADET_TUNNEL3_KEY_OK == state) { t->estate = state; @@ -1914,7 +1914,7 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; - if (GMT_count_connections (t) > 2 * CONNECTIONS_PER_TUNNEL) + if (GCT_count_connections (t) > 2 * CONNECTIONS_PER_TUNNEL) { struct CadetTConnection *iter; struct CadetTConnection *c; @@ -1922,7 +1922,7 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) for (c = iter = t->connection_head; NULL != iter; iter = iter->next) { if ((NULL == c || iter->created.abs_value_us > c->created.abs_value_us) - && GNUNET_NO == GMC_is_direct (iter->c)) + && GNUNET_NO == GCC_is_direct (iter->c)) { c = iter; } @@ -1930,10 +1930,10 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (NULL != c) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Too many connections on tunnel %s\n", - GMT_2s (t)); + GCT_2s (t)); LOG (GNUNET_ERROR_TYPE_DEBUG, "Destroying connection %s\n", - GMC_2s (c->c)); - GMC_destroy (c->c); + GCC_2s (c->c)); + GCC_destroy (c->c); } else { @@ -1950,14 +1950,14 @@ trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param c Connection. */ void -GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c) +GCT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c) { struct CadetTConnection *aux; GNUNET_assert (NULL != c); - LOG (GNUNET_ERROR_TYPE_DEBUG, "add connection %s\n", GMC_2s (c)); - LOG (GNUNET_ERROR_TYPE_DEBUG, " to tunnel %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "add connection %s\n", GCC_2s (c)); + LOG (GNUNET_ERROR_TYPE_DEBUG, " to tunnel %s\n", GCT_2s (t)); for (aux = t->connection_head; aux != NULL; aux = aux->next) if (aux->c == c) return; @@ -1979,9 +1979,9 @@ GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c) * @param path Invalid path to remove. Is destroyed after removal. */ void -GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path) +GCT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path) { - GMP_remove_path (t->peer, path); + GCP_remove_path (t->peer, path); } @@ -1992,14 +1992,14 @@ GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path) * @param c Connection. */ void -GMT_remove_connection (struct CadetTunnel3 *t, +GCT_remove_connection (struct CadetTunnel3 *t, struct CadetConnection *c) { struct CadetTConnection *aux; struct CadetTConnection *next; LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n", - GMC_2s (c), GMT_2s (t)); + GCC_2s (c), GCT_2s (t)); for (aux = t->connection_head; aux != NULL; aux = next) { next = aux->next; @@ -2011,14 +2011,14 @@ GMT_remove_connection (struct CadetTunnel3 *t, } /* Start new connections if needed */ - if (CONNECTIONS_PER_TUNNEL < GMT_count_connections (t) + if (CONNECTIONS_PER_TUNNEL < GCT_count_connections (t) && GNUNET_SCHEDULER_NO_TASK == t->destroy_task && CADET_TUNNEL3_SHUTDOWN != t->cstate && GNUNET_NO == shutting_down) { LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections, getting new ones\n"); t->cstate = CADET_TUNNEL3_SEARCHING; - GMP_connect (t->peer); + GCP_connect (t->peer); return; } @@ -2028,7 +2028,7 @@ GMT_remove_connection (struct CadetTunnel3 *t, /* Check if any connection is ready to maintaing cstate */ for (aux = t->connection_head; aux != NULL; aux = aux->next) - if (CADET_CONNECTION_READY == GMC_get_state (aux->c)) + if (CADET_CONNECTION_READY == GCC_get_state (aux->c)) return; t->cstate = CADET_TUNNEL3_WAITING; @@ -2042,7 +2042,7 @@ GMT_remove_connection (struct CadetTunnel3 *t, * @param ch Channel. */ void -GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) +GCT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) { struct CadetTChannel *aux; @@ -2078,7 +2078,7 @@ GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) * @param ch Channel. */ void -GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) +GCT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) { struct CadetTChannel *aux; @@ -2087,7 +2087,7 @@ GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) { if (aux->ch == ch) { - LOG (GNUNET_ERROR_TYPE_DEBUG, " found! %s\n", GMCH_2s (ch)); + LOG (GNUNET_ERROR_TYPE_DEBUG, " found! %s\n", GCCH_2s (ch)); GNUNET_CONTAINER_DLL_remove (t->channel_head, t->channel_tail, aux); GNUNET_free (aux); return; @@ -2105,7 +2105,7 @@ GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch) * @return channel handler, NULL if doesn't exist */ struct CadetChannel * -GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid) +GCT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid) { struct CadetTChannel *iter; @@ -2114,7 +2114,7 @@ GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid) for (iter = t->channel_head; NULL != iter; iter = iter->next) { - if (GMCH_get_id (iter->ch) == chid) + if (GCCH_get_id (iter->ch) == chid) break; } @@ -2143,7 +2143,7 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { LOG (GNUNET_ERROR_TYPE_WARNING, "Not destroying tunnel, due to shutdown. " - "Tunnel at %p should have been freed by GMT_shutdown\n", t); + "Tunnel at %p should have been freed by GCT_shutdown\n", t); return; } t->destroy_task = GNUNET_SCHEDULER_NO_TASK; @@ -2151,9 +2151,9 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) for (iter = t->connection_head; NULL != iter; iter = iter->next) { - GMC_send_destroy (iter->c); + GCC_send_destroy (iter->c); } - GMT_destroy (t); + GCT_destroy (t); } @@ -2165,7 +2165,7 @@ delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param t Tunnel to destroy. */ void -GMT_destroy_empty (struct CadetTunnel3 *t) +GCT_destroy_empty (struct CadetTunnel3 *t) { if (GNUNET_YES == shutting_down) return; /* Will be destroyed immediately anyway */ @@ -2174,7 +2174,7 @@ GMT_destroy_empty (struct CadetTunnel3 *t) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s is already scheduled for destruction\n", - GMT_2s (t)); + GCT_2s (t)); GNUNET_break (0); /* should never happen, tunnel can only become empty once, and the * task identifier should be NO_TASK (cleaned when the tunnel was created @@ -2184,7 +2184,7 @@ GMT_destroy_empty (struct CadetTunnel3 *t) } LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s empty: destroying scheduled\n", - GMT_2s (t)); + GCT_2s (t)); t->destroy_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &delayed_destroy, t); @@ -2199,13 +2199,13 @@ GMT_destroy_empty (struct CadetTunnel3 *t) * @param t Tunnel to destroy if empty. */ void -GMT_destroy_if_empty (struct CadetTunnel3 *t) +GCT_destroy_if_empty (struct CadetTunnel3 *t) { - LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s destroy if empty\n", GMT_2s (t)); - if (1 < GMT_count_channels (t)) + LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel %s destroy if empty\n", GCT_2s (t)); + if (1 < GCT_count_channels (t)) return; - GMT_destroy_empty (t); + GCT_destroy_empty (t); } @@ -2221,7 +2221,7 @@ GMT_destroy_if_empty (struct CadetTunnel3 *t) * @param t The tunnel to destroy. */ void -GMT_destroy (struct CadetTunnel3 *t) +GCT_destroy (struct CadetTunnel3 *t) { struct CadetTConnection *iter_c; struct CadetTConnection *next_c; @@ -2231,21 +2231,21 @@ GMT_destroy (struct CadetTunnel3 *t) if (NULL == t) return; - LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying tunnel %s\n", GMP_2s (t->peer)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying tunnel %s\n", GCP_2s (t->peer)); GNUNET_break (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (tunnels, - GMP_get_id (t->peer), t)); + GCP_get_id (t->peer), t)); for (iter_c = t->connection_head; NULL != iter_c; iter_c = next_c) { next_c = iter_c->next; - GMC_destroy (iter_c->c); + GCC_destroy (iter_c->c); } for (iter_ch = t->channel_head; NULL != iter_ch; iter_ch = next_ch) { next_ch = iter_ch->next; - GMCH_destroy (iter_ch->ch); + GCCH_destroy (iter_ch->ch); /* Should only happen on shutdown, but it's ok. */ } @@ -2257,7 +2257,7 @@ GMT_destroy (struct CadetTunnel3 *t) } GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO); - GMP_set_tunnel (t->peer, NULL); + GCP_set_tunnel (t->peer, NULL); if (GNUNET_SCHEDULER_NO_TASK != t->rekey_task) { @@ -2284,7 +2284,7 @@ GMT_destroy (struct CadetTunnel3 *t) * @return Connection created. */ struct CadetConnection * -GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p) +GCT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p) { struct CadetConnection *c; struct GNUNET_CADET_Hash cid; @@ -2314,13 +2314,13 @@ GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p) } GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, &cid, sizeof (cid)); - c = GMC_new (&cid, t, p, own_pos); + c = GCC_new (&cid, t, p, own_pos); if (NULL == c) { /* Path was flawed */ return NULL; } - GMT_add_connection (t, c); + GCT_add_connection (t, c); return c; } @@ -2333,7 +2333,7 @@ GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p) * @return Number of connections. */ unsigned int -GMT_count_connections (struct CadetTunnel3 *t) +GCT_count_connections (struct CadetTunnel3 *t) { struct CadetTConnection *iter; unsigned int count; @@ -2342,7 +2342,7 @@ GMT_count_connections (struct CadetTunnel3 *t) return 0; for (count = 0, iter = t->connection_head; NULL != iter; iter = iter->next) - if (CADET_CONNECTION_DESTROYED != GMC_get_state (iter->c)) + if (CADET_CONNECTION_DESTROYED != GCC_get_state (iter->c)) count++; return count; @@ -2356,7 +2356,7 @@ GMT_count_connections (struct CadetTunnel3 *t) * @return Number of channels. */ unsigned int -GMT_count_channels (struct CadetTunnel3 *t) +GCT_count_channels (struct CadetTunnel3 *t) { struct CadetTChannel *iter; unsigned int count; @@ -2377,7 +2377,7 @@ GMT_count_channels (struct CadetTunnel3 *t) * @return Tunnel's connectivity state. */ enum CadetTunnel3CState -GMT_get_cstate (struct CadetTunnel3 *t) +GCT_get_cstate (struct CadetTunnel3 *t) { if (NULL == t) { @@ -2396,7 +2396,7 @@ GMT_get_cstate (struct CadetTunnel3 *t) * @return Tunnel's encryption state. */ enum CadetTunnel3EState -GMT_get_estate (struct CadetTunnel3 *t) +GCT_get_estate (struct CadetTunnel3 *t) { if (NULL == t) { @@ -2414,7 +2414,7 @@ GMT_get_estate (struct CadetTunnel3 *t) * @return Biggest buffer space offered by any channel in the tunnel. */ unsigned int -GMT_get_channels_buffer (struct CadetTunnel3 *t) +GCT_get_channels_buffer (struct CadetTunnel3 *t) { struct CadetTChannel *iter; unsigned int buffer; @@ -2445,7 +2445,7 @@ GMT_get_channels_buffer (struct CadetTunnel3 *t) * @return Buffer space offered by all connections in the tunnel. */ unsigned int -GMT_get_connections_buffer (struct CadetTunnel3 *t) +GCT_get_connections_buffer (struct CadetTunnel3 *t) { struct CadetTConnection *iter; unsigned int buffer; @@ -2453,7 +2453,7 @@ GMT_get_connections_buffer (struct CadetTunnel3 *t) buffer = 0; for (iter = t->connection_head; NULL != iter; iter = iter->next) { - if (GMC_get_state (iter->c) != CADET_CONNECTION_READY) + if (GCC_get_state (iter->c) != CADET_CONNECTION_READY) { continue; } @@ -2472,9 +2472,9 @@ GMT_get_connections_buffer (struct CadetTunnel3 *t) * @return ID of the destination peer. */ const struct GNUNET_PeerIdentity * -GMT_get_destination (struct CadetTunnel3 *t) +GCT_get_destination (struct CadetTunnel3 *t) { - return GMP_get_id (t->peer); + return GCP_get_id (t->peer); } @@ -2486,7 +2486,7 @@ GMT_get_destination (struct CadetTunnel3 *t) * @return GID of a channel free to use. */ CADET_ChannelNumber -GMT_get_next_chid (struct CadetTunnel3 *t) +GCT_get_next_chid (struct CadetTunnel3 *t) { CADET_ChannelNumber chid; CADET_ChannelNumber mask; @@ -2496,14 +2496,14 @@ GMT_get_next_chid (struct CadetTunnel3 *t) * If our ID is bigger or loopback tunnel, start at 0, bit 30 = 0 * If peer's ID is bigger, start at 0x4... bit 30 = 1 */ - result = GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, GMP_get_id (t->peer)); + result = GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, GCP_get_id (t->peer)); if (0 > result) mask = 0x40000000; else mask = 0x0; t->next_chid |= mask; - while (NULL != GMT_get_channel (t, t->next_chid)) + while (NULL != GCT_get_channel (t, t->next_chid)) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %u exists...\n", t->next_chid); t->next_chid = (t->next_chid + 1) & ~GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; @@ -2523,21 +2523,21 @@ GMT_get_next_chid (struct CadetTunnel3 *t) * @param t Channel which has some free buffer space. */ void -GMT_unchoke_channels (struct CadetTunnel3 *t) +GCT_unchoke_channels (struct CadetTunnel3 *t) { struct CadetTChannel *iter; unsigned int buffer; - unsigned int channels = GMT_count_channels (t); + unsigned int channels = GCT_count_channels (t); unsigned int choked_n; struct CadetChannel *choked[channels]; - LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT_unchoke_channels on %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "GCT_unchoke_channels on %s\n", GCT_2s (t)); LOG (GNUNET_ERROR_TYPE_DEBUG, " head: %p\n", t->channel_head); if (NULL != t->channel_head) LOG (GNUNET_ERROR_TYPE_DEBUG, " head ch: %p\n", t->channel_head->ch); /* Get buffer space */ - buffer = GMT_get_connections_buffer (t); + buffer = GCT_get_connections_buffer (t); if (0 == buffer) { return; @@ -2558,7 +2558,7 @@ GMT_unchoke_channels (struct CadetTunnel3 *t) { unsigned int r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, choked_n); - GMCH_allow_client (choked[r], GMCH_is_origin (choked[r], GNUNET_YES)); + GCCH_allow_client (choked[r], GCCH_is_origin (choked[r], GNUNET_YES)); choked_n--; buffer--; choked[r] = choked[choked_n]; @@ -2574,7 +2574,7 @@ GMT_unchoke_channels (struct CadetTunnel3 *t) * @param t Tunnel. */ void -GMT_send_connection_acks (struct CadetTunnel3 *t) +GCT_send_connection_acks (struct CadetTunnel3 *t) { struct CadetTConnection *iter; uint32_t allowed; @@ -2584,7 +2584,7 @@ GMT_send_connection_acks (struct CadetTunnel3 *t) unsigned int buffer; LOG (GNUNET_ERROR_TYPE_DEBUG, "Tunnel send connection ACKs on %s\n", - GMT_2s (t)); + GCT_2s (t)); if (NULL == t) { @@ -2592,11 +2592,11 @@ GMT_send_connection_acks (struct CadetTunnel3 *t) return; } - buffer = GMT_get_channels_buffer (t); + buffer = GCT_get_channels_buffer (t); LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer %u\n", buffer); /* Count connections, how many messages are already allowed */ - cs = GMT_count_connections (t); + cs = GCT_count_connections (t); for (allowed = 0, iter = t->connection_head; NULL != iter; iter = iter->next) { allowed += get_connection_allowed (iter); @@ -2623,8 +2623,8 @@ GMT_send_connection_acks (struct CadetTunnel3 *t) { continue; } - GMC_allow (iter->c, allow_per_connection, - GMC_is_origin (iter->c, GNUNET_NO)); + GCC_allow (iter->c, allow_per_connection, + GCC_is_origin (iter->c, GNUNET_NO)); } GNUNET_break (to_allow == 0); @@ -2641,11 +2641,11 @@ GMT_send_connection_acks (struct CadetTunnel3 *t) * @param q Handle to the queue. */ void -GMT_cancel (struct CadetTunnel3Queue *q) +GCT_cancel (struct CadetTunnel3Queue *q) { if (NULL != q->cq) { - GMC_cancel (q->cq); + GCC_cancel (q->cq); /* tun_message_sent() will be called and free q */ } else if (NULL != q->tqd) @@ -2677,9 +2677,9 @@ GMT_cancel (struct CadetTunnel3Queue *q) * @return Handle to cancel message. NULL if @c cont is NULL. */ struct CadetTunnel3Queue * -GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, +GCT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, struct CadetTunnel3 *t, struct CadetConnection *c, - int force, GMT_sent cont, void *cont_cls) + int force, GCT_sent cont, void *cont_cls) { return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL); } @@ -2693,9 +2693,9 @@ GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, * @return #GNUNET_YES if it is loopback. */ int -GMT_is_loopback (const struct CadetTunnel3 *t) +GCT_is_loopback (const struct CadetTunnel3 *t) { - return (myid == GMP_get_short_id (t->peer)); + return (myid == GCP_get_short_id (t->peer)); } @@ -2708,12 +2708,12 @@ GMT_is_loopback (const struct CadetTunnel3 *t) * @return #GNUNET_YES a connection uses this path. */ int -GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p) +GCT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p) { struct CadetTConnection *iter; for (iter = t->connection_head; NULL != iter; iter = iter->next) - if (GMC_get_path (iter->c) == p) + if (GCC_get_path (iter->c) == p) return GNUNET_YES; return GNUNET_NO; @@ -2729,7 +2729,7 @@ GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p) * @return Cost of the path (path length + number of overlapping nodes) */ unsigned int -GMT_get_path_cost (const struct CadetTunnel3 *t, +GCT_get_path_cost (const struct CadetTunnel3 *t, const struct CadetPeerPath *path) { struct CadetTConnection *iter; @@ -2748,7 +2748,7 @@ GMT_get_path_cost (const struct CadetTunnel3 *t, { for (iter = t->connection_head; NULL != iter; iter = iter->next) { - aux = GMC_get_path (iter->c); + aux = GCC_get_path (iter->c); if (NULL == aux) continue; @@ -2774,12 +2774,12 @@ GMT_get_path_cost (const struct CadetTunnel3 *t, * @return Static string the destination peer's ID. */ const char * -GMT_2s (const struct CadetTunnel3 *t) +GCT_2s (const struct CadetTunnel3 *t) { if (NULL == t) return "(NULL)"; - return GMP_2s (t->peer); + return GCP_2s (t->peer); } @@ -2794,12 +2794,12 @@ GMT_2s (const struct CadetTunnel3 *t) * @param t Tunnel to debug. */ void -GMT_debug (const struct CadetTunnel3 *t) +GCT_debug (const struct CadetTunnel3 *t) { struct CadetTChannel *iterch; struct CadetTConnection *iterc; - LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL TOWARDS %s\n", GMT_2s (t)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL TOWARDS %s\n", GCT_2s (t)); LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT cstate %s, estate %s\n", cstate2s (t->cstate), estate2s (t->estate)); LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT kx_ctx %p, rekey_task %u\n", @@ -2811,18 +2811,18 @@ GMT_debug (const struct CadetTunnel3 *t) LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT channels:\n"); for (iterch = t->channel_head; NULL != iterch; iterch = iterch->next) { - LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT - %s\n", GMCH_2s (iterch->ch)); + LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT - %s\n", GCCH_2s (iterch->ch)); } LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT connections:\n"); for (iterc = t->connection_head; NULL != iterc; iterc = iterc->next) { LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT - %s [%u] buf: %u/%u (qn %u/%u)\n", - GMC_2s (iterc->c), GMC_get_state (iterc->c), - GMC_get_buffer (iterc->c, GNUNET_YES), - GMC_get_buffer (iterc->c, GNUNET_NO), - GMC_get_qn (iterc->c, GNUNET_YES), - GMC_get_qn (iterc->c, GNUNET_NO)); + GCC_2s (iterc->c), GCC_get_state (iterc->c), + GCC_get_buffer (iterc->c, GNUNET_YES), + GCC_get_buffer (iterc->c, GNUNET_NO), + GCC_get_qn (iterc->c, GNUNET_YES), + GCC_get_qn (iterc->c, GNUNET_NO)); } LOG (GNUNET_ERROR_TYPE_DEBUG, "TTT DEBUG TUNNEL END\n"); @@ -2836,7 +2836,7 @@ GMT_debug (const struct CadetTunnel3 *t) * @param cls Closure for @c iter. */ void -GMT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) +GCT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) { GNUNET_CONTAINER_multipeermap_iterate (tunnels, iter, cls); } @@ -2848,7 +2848,7 @@ GMT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls) * @return Number of tunnels to remote peers kept by this peer. */ unsigned int -GMT_count_all (void) +GCT_count_all (void) { return GNUNET_CONTAINER_multipeermap_size (tunnels); } @@ -2862,7 +2862,7 @@ GMT_count_all (void) * @param cls Closure for @c iter. */ void -GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void *cls) +GCT_iterate_connections (struct CadetTunnel3 *t, GCT_conn_iter iter, void *cls) { struct CadetTConnection *ct; @@ -2879,7 +2879,7 @@ GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void *cls) * @param cls Closure for @c iter. */ void -GMT_iterate_channels (struct CadetTunnel3 *t, GMT_chan_iter iter, void *cls) +GCT_iterate_channels (struct CadetTunnel3 *t, GCT_chan_iter iter, void *cls) { struct CadetTChannel *cht; diff --git a/src/cadet/gnunet-service-cadet_tunnel.h b/src/cadet/gnunet-service-cadet_tunnel.h index 16616de59..304015fa5 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.h +++ b/src/cadet/gnunet-service-cadet_tunnel.h @@ -123,13 +123,13 @@ struct CadetTunnel3Queue; * @param type Type of message sent. * @param size Size of the message. */ -typedef void (*GMT_sent) (void *cls, +typedef void (*GCT_sent) (void *cls, struct CadetTunnel3 *t, struct CadetTunnel3Queue *q, uint16_t type, size_t size); -typedef void (*GMT_conn_iter) (void *cls, struct CadetConnection *c); -typedef void (*GMT_chan_iter) (void *cls, struct CadetChannel *ch); +typedef void (*GCT_conn_iter) (void *cls, struct CadetConnection *c); +typedef void (*GCT_chan_iter) (void *cls, struct CadetChannel *ch); /******************************************************************************/ @@ -143,14 +143,14 @@ typedef void (*GMT_chan_iter) (void *cls, struct CadetChannel *ch); * @param key ECC private key, to derive all other keys and do crypto. */ void -GMT_init (const struct GNUNET_CONFIGURATION_Handle *c, +GCT_init (const struct GNUNET_CONFIGURATION_Handle *c, const struct GNUNET_CRYPTO_EddsaPrivateKey *key); /** * Shut down the tunnel subsystem. */ void -GMT_shutdown (void); +GCT_shutdown (void); /** * Create a tunnel. @@ -158,7 +158,7 @@ GMT_shutdown (void); * @param destination Peer this tunnel is towards. */ struct CadetTunnel3 * -GMT_new (struct CadetPeer *destination); +GCT_new (struct CadetPeer *destination); /** * Tunnel is empty: destroy it. @@ -168,7 +168,7 @@ GMT_new (struct CadetPeer *destination); * @param t Tunnel to destroy. */ void -GMT_destroy_empty (struct CadetTunnel3 *t); +GCT_destroy_empty (struct CadetTunnel3 *t); /** * Destroy tunnel if empty (no more channels). @@ -176,7 +176,7 @@ GMT_destroy_empty (struct CadetTunnel3 *t); * @param t Tunnel to destroy if empty. */ void -GMT_destroy_if_empty (struct CadetTunnel3 *t); +GCT_destroy_if_empty (struct CadetTunnel3 *t); /** * Destroy the tunnel. @@ -190,7 +190,7 @@ GMT_destroy_if_empty (struct CadetTunnel3 *t); * @param t The tunnel to destroy. */ void -GMT_destroy (struct CadetTunnel3 *t); +GCT_destroy (struct CadetTunnel3 *t); /** @@ -200,7 +200,7 @@ GMT_destroy (struct CadetTunnel3 *t); * @param cstate New connection state. */ void -GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate); +GCT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate); /** @@ -210,7 +210,7 @@ GMT_change_cstate (struct CadetTunnel3* t, enum CadetTunnel3CState cstate); * @param state New encryption state. */ void -GMT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state); +GCT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state); /** * Add a connection to a tunnel. @@ -219,7 +219,7 @@ GMT_change_estate (struct CadetTunnel3* t, enum CadetTunnel3EState state); * @param c Connection. */ void -GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c); +GCT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c); /** * Mark a path as no longer valid for this tunnel: has been tried and failed. @@ -228,7 +228,7 @@ GMT_add_connection (struct CadetTunnel3 *t, struct CadetConnection *c); * @param path Invalid path to remove. Is destroyed after removal. */ void -GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path); +GCT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path); /** * Remove a connection from a tunnel. @@ -237,7 +237,7 @@ GMT_remove_path (struct CadetTunnel3 *t, struct CadetPeerPath *path); * @param c Connection. */ void -GMT_remove_connection (struct CadetTunnel3 *t, struct CadetConnection *c); +GCT_remove_connection (struct CadetTunnel3 *t, struct CadetConnection *c); /** * Add a channel to a tunnel. @@ -246,7 +246,7 @@ GMT_remove_connection (struct CadetTunnel3 *t, struct CadetConnection *c); * @param ch Channel. */ void -GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch); +GCT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch); /** * Remove a channel from a tunnel. @@ -255,7 +255,7 @@ GMT_add_channel (struct CadetTunnel3 *t, struct CadetChannel *ch); * @param ch Channel. */ void -GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch); +GCT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch); /** * Search for a channel by global ID. @@ -266,7 +266,7 @@ GMT_remove_channel (struct CadetTunnel3 *t, struct CadetChannel *ch); * @return channel handler, NULL if doesn't exist */ struct CadetChannel * -GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid); +GCT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid); /** * Decrypt and demultiplex by message type. Call appropriate handler @@ -277,7 +277,7 @@ GMT_get_channel (struct CadetTunnel3 *t, CADET_ChannelNumber chid); * @param msg Message header. */ void -GMT_handle_encrypted (struct CadetTunnel3 *t, +GCT_handle_encrypted (struct CadetTunnel3 *t, const struct GNUNET_CADET_Encrypted *msg); /** @@ -287,7 +287,7 @@ GMT_handle_encrypted (struct CadetTunnel3 *t, * @param message KX message itself. */ void -GMT_handle_kx (struct CadetTunnel3 *t, +GCT_handle_kx (struct CadetTunnel3 *t, const struct GNUNET_MessageHeader *message); /** @@ -301,7 +301,7 @@ GMT_handle_kx (struct CadetTunnel3 *t, * @return Connection created. */ struct CadetConnection * -GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p); +GCT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p); /** * Count established (ready) connections of a tunnel. @@ -311,7 +311,7 @@ GMT_use_path (struct CadetTunnel3 *t, struct CadetPeerPath *p); * @return Number of connections. */ unsigned int -GMT_count_connections (struct CadetTunnel3 *t); +GCT_count_connections (struct CadetTunnel3 *t); /** * Count channels of a tunnel. @@ -321,7 +321,7 @@ GMT_count_connections (struct CadetTunnel3 *t); * @return Number of channels. */ unsigned int -GMT_count_channels (struct CadetTunnel3 *t); +GCT_count_channels (struct CadetTunnel3 *t); /** * Get the connectivity state of a tunnel. @@ -331,7 +331,7 @@ GMT_count_channels (struct CadetTunnel3 *t); * @return Tunnel's connectivity state. */ enum CadetTunnel3CState -GMT_get_cstate (struct CadetTunnel3 *t); +GCT_get_cstate (struct CadetTunnel3 *t); /** * Get the encryption state of a tunnel. @@ -341,7 +341,7 @@ GMT_get_cstate (struct CadetTunnel3 *t); * @return Tunnel's encryption state. */ enum CadetTunnel3EState -GMT_get_estate (struct CadetTunnel3 *t); +GCT_get_estate (struct CadetTunnel3 *t); /** * Get the maximum buffer space for a tunnel towards a local client. @@ -351,7 +351,7 @@ GMT_get_estate (struct CadetTunnel3 *t); * @return Biggest buffer space offered by any channel in the tunnel. */ unsigned int -GMT_get_channels_buffer (struct CadetTunnel3 *t); +GCT_get_channels_buffer (struct CadetTunnel3 *t); /** * Get the total buffer space for a tunnel for P2P traffic. @@ -361,7 +361,7 @@ GMT_get_channels_buffer (struct CadetTunnel3 *t); * @return Buffer space offered by all connections in the tunnel. */ unsigned int -GMT_get_connections_buffer (struct CadetTunnel3 *t); +GCT_get_connections_buffer (struct CadetTunnel3 *t); /** * Get the tunnel's destination. @@ -371,7 +371,7 @@ GMT_get_connections_buffer (struct CadetTunnel3 *t); * @return ID of the destination peer. */ const struct GNUNET_PeerIdentity * -GMT_get_destination (struct CadetTunnel3 *t); +GCT_get_destination (struct CadetTunnel3 *t); /** * Get the tunnel's next free Channel ID. @@ -381,7 +381,7 @@ GMT_get_destination (struct CadetTunnel3 *t); * @return ID of a channel free to use. */ CADET_ChannelNumber -GMT_get_next_chid (struct CadetTunnel3 *t); +GCT_get_next_chid (struct CadetTunnel3 *t); /** * Send ACK on one or more channels due to buffer in connections. @@ -389,7 +389,7 @@ GMT_get_next_chid (struct CadetTunnel3 *t); * @param t Channel which has some free buffer space. */ void -GMT_unchoke_channels (struct CadetTunnel3 *t); +GCT_unchoke_channels (struct CadetTunnel3 *t); /** * Send ACK on one or more connections due to buffer space to the client. @@ -399,7 +399,7 @@ GMT_unchoke_channels (struct CadetTunnel3 *t); * @param t Tunnel which has some free buffer space. */ void -GMT_send_connection_acks (struct CadetTunnel3 *t); +GCT_send_connection_acks (struct CadetTunnel3 *t); /** * Cancel a previously sent message while it's in the queue. @@ -411,7 +411,7 @@ GMT_send_connection_acks (struct CadetTunnel3 *t); * @param q Handle to the queue. */ void -GMT_cancel (struct CadetTunnel3Queue *q); +GCT_cancel (struct CadetTunnel3Queue *q); /** * Sends an already built message on a tunnel, encrypting it and @@ -427,9 +427,9 @@ GMT_cancel (struct CadetTunnel3Queue *q); * @return Handle to cancel message. NULL if @c cont is NULL. */ struct CadetTunnel3Queue * -GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, +GCT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, struct CadetTunnel3 *t, struct CadetConnection *c, - int force, GMT_sent cont, void *cont_cls); + int force, GCT_sent cont, void *cont_cls); /** * Is the tunnel directed towards the local peer? @@ -439,7 +439,7 @@ GMT_send_prebuilt_message (const struct GNUNET_MessageHeader *message, * @return #GNUNET_YES if it is loopback. */ int -GMT_is_loopback (const struct CadetTunnel3 *t); +GCT_is_loopback (const struct CadetTunnel3 *t); /** * Is the tunnel using this path already? @@ -450,7 +450,7 @@ GMT_is_loopback (const struct CadetTunnel3 *t); * @return #GNUNET_YES a connection uses this path. */ int -GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p); +GCT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p); /** * Get a cost of a path for a tunnel considering existing connections. @@ -461,7 +461,7 @@ GMT_is_path_used (const struct CadetTunnel3 *t, const struct CadetPeerPath *p); * @return Cost of the path (path length + number of overlapping nodes) */ unsigned int -GMT_get_path_cost (const struct CadetTunnel3 *t, +GCT_get_path_cost (const struct CadetTunnel3 *t, const struct CadetPeerPath *path); /** @@ -472,7 +472,7 @@ GMT_get_path_cost (const struct CadetTunnel3 *t, * @return Static string the destination peer's ID. */ const char * -GMT_2s (const struct CadetTunnel3 *t); +GCT_2s (const struct CadetTunnel3 *t); /** * Log all possible info about the tunnel state. @@ -480,7 +480,7 @@ GMT_2s (const struct CadetTunnel3 *t); * @param t Tunnel to debug. */ void -GMT_debug (const struct CadetTunnel3 *t); +GCT_debug (const struct CadetTunnel3 *t); /** * Iterate all tunnels. @@ -489,7 +489,7 @@ GMT_debug (const struct CadetTunnel3 *t); * @param cls Closure for @c iter. */ void -GMT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls); +GCT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls); /** * Count all tunnels. @@ -497,7 +497,7 @@ GMT_iterate_all (GNUNET_CONTAINER_PeerMapIterator iter, void *cls); * @return Number of tunnels to remote peers kept by this peer. */ unsigned int -GMT_count_all (void); +GCT_count_all (void); /** * Iterate all connections of a tunnel. @@ -507,7 +507,7 @@ GMT_count_all (void); * @param cls Closure for @c iter. */ void -GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void *cls); +GCT_iterate_connections (struct CadetTunnel3 *t, GCT_conn_iter iter, void *cls); /** * Iterate all channels of a tunnel. @@ -517,7 +517,7 @@ GMT_iterate_connections (struct CadetTunnel3 *t, GMT_conn_iter iter, void *cls); * @param cls Closure for @c iter. */ void -GMT_iterate_channels (struct CadetTunnel3 *t, GMT_chan_iter iter, void *cls); +GCT_iterate_channels (struct CadetTunnel3 *t, GCT_chan_iter iter, void *cls); #if 0 /* keep Emacsens' auto-indent happy */ { -- cgit v1.2.3