/**
* Tunnel this connection is part of.
*/
- struct CadetTunnel3 *t;
+ struct CadetTunnel *t;
/**
* Flow control information for traffic fwd.
/**
* Continuation to call once sent.
*/
- GMC_sent cont;
+ GCC_sent cont;
/**
* Closure for @c cont.
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");
* @return String representation.
*/
static const char *
-GMC_state2s (enum CadetConnectionState s)
+GCC_state2s (enum CadetConnectionState s)
{
switch (s)
{
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));
}
{
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");
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;
}
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;
/* 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
{
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);
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;
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);
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 */
{
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);
}
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
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);
}
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
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);
}
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);
static void
send_connection_ack (struct CadetConnection *connection, int fwd)
{
- struct CadetTunnel3 *t;
+ struct CadetTunnel *t;
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);
}
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);
}
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));
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),
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)
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));
}
{
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);
}
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;
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;
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 */
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);
}
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);
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);
}
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,
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);
}
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);
}
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);
}
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;
}
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);
}
}
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);
}
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));
}
* 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;
}
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)
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
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)
{
/* 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);
* 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;
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");
p = c->path;
if (NULL != p)
{
- GMP_add_path_to_all (p, GNUNET_YES);
+ GCP_add_path_to_all (p, GNUNET_YES);
}
else
{
}
/* Message for us as creator? */
- if (GMC_is_origin (c, GNUNET_YES))
+ if (GCC_is_origin (c, GNUNET_YES))
{
if (GNUNET_NO != fwd)
{
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)
{
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;
* 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)
{
}
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;
* 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;
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;
}
{
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;
}
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);
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,
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);
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;
}
{
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);
{
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;
}
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);
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;
* 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,
* 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,
* 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;
/* 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;
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);
* 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;
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;
}
* 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;
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;
}
* @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)
{
}
/* 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
{
* @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 !=
{
struct CadetConnection *c = value;
- GMC_destroy (c);
+ GCC_destroy (c);
return GNUNET_YES;
}
* 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);
struct CadetConnection *
-GMC_new (const struct GNUNET_CADET_Hash *cid,
- struct CadetTunnel3 *t,
+GCC_new (const struct GNUNET_CADET_Hash *cid,
+ struct CadetTunnel *t,
struct CadetPeerPath *p,
unsigned int own_pos)
{
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);
c->t = NULL;
c->path = NULL;
}
- GMC_destroy (c);
+ GCC_destroy (c);
return NULL;
}
void
-GMC_destroy (struct CadetConnection *c)
+GCC_destroy (struct CadetConnection *c)
{
if (NULL == 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",
/* 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);
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);
* @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;
}
* @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);
}
* @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;
* @return state of the connection.
*/
enum CadetConnectionState
-GMC_get_state (const struct CadetConnection *c)
+GCC_get_state (const struct CadetConnection *c)
{
return c->state;
}
*
* @return tunnel of the connection.
*/
-struct CadetTunnel3 *
-GMC_get_tunnel (const struct CadetConnection *c)
+struct CadetTunnel *
+GCC_get_tunnel (const struct CadetConnection *c)
{
return c->t;
}
* @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;
* @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;
}
* @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;
* @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;
* @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);
}
* @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
* @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;
* @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);
}
* @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);
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;
* @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;
}
* 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;
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;
{
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;
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;
* @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);
}
* @param connection Connection to create.
*/
void
-GMC_send_create (struct CadetConnection *connection)
+GCC_send_create (struct CadetConnection *connection)
{
- enum CadetTunnel3CState state;
+ enum CadetTunnelCState state;
size_t size;
size = sizeof (struct GNUNET_CADET_ConnectionCreate);
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);
}
* @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;
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;
* @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",
* @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;
* @param c Connection.
*/
const char *
-GMC_2s (const struct CadetConnection *c)
+GCC_2s (const struct CadetConnection *c)
{
if (NULL == c)
return "NULL";
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));
}