aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-10-10 13:27:28 +0000
committerBart Polot <bart@net.in.tum.de>2013-10-10 13:27:28 +0000
commitaf56cd3fcb1fe3adf680ce90e1fbbefd7bd88d75 (patch)
tree1359cd7e2a6a5b743f9a2f1e51b8c14333d17f40
parent290fd094567179f05cdfd60a0187f0ea5d1c39ea (diff)
downloadgnunet-af56cd3fcb1fe3adf680ce90e1fbbefd7bd88d75.tar.gz
gnunet-af56cd3fcb1fe3adf680ce90e1fbbefd7bd88d75.zip
- use different enum to prevent collisions
-rw-r--r--src/mesh/gnunet-service-mesh_channel.c6
-rw-r--r--src/mesh/gnunet-service-mesh_connection.c22
-rw-r--r--src/mesh/gnunet-service-mesh_peer.c10
-rw-r--r--src/mesh/gnunet-service-mesh_tunnel.c26
-rw-r--r--src/mesh/gnunet-service-mesh_tunnel.h10
5 files changed, 34 insertions, 40 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c
index ab0927117..5f2ce2f8d 100644
--- a/src/mesh/gnunet-service-mesh_channel.c
+++ b/src/mesh/gnunet-service-mesh_channel.c
@@ -361,8 +361,6 @@ send_client_data (struct MeshChannel *ch,
361void 361void
362GMCH_add_client (struct MeshChannel *ch, struct MeshClient *c) 362GMCH_add_client (struct MeshChannel *ch, struct MeshClient *c)
363{ 363{
364 struct MeshTunnel3 *t = ch->t;
365
366 if (NULL != ch->dest) 364 if (NULL != ch->dest)
367 { 365 {
368 GNUNET_break (0); 366 GNUNET_break (0);
@@ -501,11 +499,8 @@ channel_retransmit_message (void *cls,
501{ 499{
502 struct MeshChannelReliability *rel = cls; 500 struct MeshChannelReliability *rel = cls;
503 struct MeshReliableMessage *copy; 501 struct MeshReliableMessage *copy;
504 struct MeshPeerQueue *q;
505 struct MeshChannel *ch; 502 struct MeshChannel *ch;
506 struct MeshConnection *c;
507 struct GNUNET_MESH_Data *payload; 503 struct GNUNET_MESH_Data *payload;
508 struct MeshPeer *hop;
509 int fwd; 504 int fwd;
510 505
511 rel->retry_task = GNUNET_SCHEDULER_NO_TASK; 506 rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
@@ -1053,7 +1048,6 @@ GMCH_is_terminal (struct MeshChannel *ch, int fwd)
1053void 1048void
1054GMCH_send_create (struct MeshChannel *ch) 1049GMCH_send_create (struct MeshChannel *ch)
1055{ 1050{
1056 struct GNUNET_MESH_ChannelMessage msg;
1057 uint32_t opt; 1051 uint32_t opt;
1058 1052
1059 if (NULL == ch->dest) 1053 if (NULL == ch->dest)
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c
index d7d6f89f7..86d241a82 100644
--- a/src/mesh/gnunet-service-mesh_connection.c
+++ b/src/mesh/gnunet-service-mesh_connection.c
@@ -407,8 +407,8 @@ send_connection_ack (struct MeshConnection *connection, int fwd)
407 sizeof (struct GNUNET_MESH_ConnectionACK), 407 sizeof (struct GNUNET_MESH_ConnectionACK),
408 connection, NULL, fwd, 408 connection, NULL, fwd,
409 &message_sent, sizeof (struct GNUNET_MESH_ConnectionACK)); 409 &message_sent, sizeof (struct GNUNET_MESH_ConnectionACK));
410 if (MESH_TUNNEL_NEW == t->state) 410 if (MESH_TUNNEL3_NEW == t->state)
411 GMT_change_state (t, MESH_TUNNEL_WAITING); 411 GMT_change_state (t, MESH_TUNNEL3_WAITING);
412 if (MESH_CONNECTION_READY != connection->state) 412 if (MESH_CONNECTION_READY != connection->state)
413 GMC_change_state (connection, MESH_CONNECTION_SENT); 413 GMC_change_state (connection, MESH_CONNECTION_SENT);
414} 414}
@@ -436,8 +436,8 @@ send_connection_create (struct MeshConnection *connection)
436 NULL, 436 NULL,
437 GNUNET_YES); 437 GNUNET_YES);
438 if (NULL != t && 438 if (NULL != t &&
439 (MESH_TUNNEL_SEARCHING == t->state || MESH_TUNNEL_NEW == t->state)) 439 (MESH_TUNNEL3_SEARCHING == t->state || MESH_TUNNEL3_NEW == t->state))
440 tunnel_change_state (t, MESH_TUNNEL_WAITING); 440 tunnel_change_state (t, MESH_TUNNEL3_WAITING);
441 if (MESH_CONNECTION_NEW == connection->state) 441 if (MESH_CONNECTION_NEW == connection->state)
442 connection_change_state (connection, MESH_CONNECTION_SENT); 442 connection_change_state (connection, MESH_CONNECTION_SENT);
443} 443}
@@ -518,7 +518,7 @@ connection_recreate (struct MeshConnection *c, int fwd)
518static void 518static void
519connection_maintain (struct MeshConnection *c, int fwd) 519connection_maintain (struct MeshConnection *c, int fwd)
520{ 520{
521 if (MESH_TUNNEL_SEARCHING == c->t->state) 521 if (MESH_TUNNEL3_SEARCHING == c->t->state)
522 { 522 {
523 /* TODO DHT GET with RO_BART */ 523 /* TODO DHT GET with RO_BART */
524 return; 524 return;
@@ -1086,8 +1086,8 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
1086 orig_peer->tunnel->peer = orig_peer; 1086 orig_peer->tunnel->peer = orig_peer;
1087 } 1087 }
1088 GMT_add_connection (orig_peer->tunnel, c); 1088 GMT_add_connection (orig_peer->tunnel, c);
1089 if (MESH_TUNNEL_NEW == GMT_get_state (c->t)) 1089 if (MESH_TUNNEL3_NEW == GMT_get_state (c->t))
1090 GMT_change_state (c->t, MESH_TUNNEL_WAITING); 1090 GMT_change_state (c->t, MESH_TUNNEL3_WAITING);
1091 1091
1092 send_connection_ack (c, GNUNET_NO); 1092 send_connection_ack (c, GNUNET_NO);
1093 if (MESH_CONNECTION_SENT == c->state) 1093 if (MESH_CONNECTION_SENT == c->state)
@@ -1182,7 +1182,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1182 { 1182 {
1183 LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection (SYN)ACK for us!\n"); 1183 LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection (SYN)ACK for us!\n");
1184 connection_change_state (c, MESH_CONNECTION_READY); 1184 connection_change_state (c, MESH_CONNECTION_READY);
1185 GMT_change_state (c->t, MESH_TUNNEL_READY); 1185 GMT_change_state (c->t, MESH_TUNNEL3_READY);
1186 send_connection_ack (c, GNUNET_YES); 1186 send_connection_ack (c, GNUNET_YES);
1187 GMT_send_queued_data (c->t, GNUNET_YES); 1187 GMT_send_queued_data (c->t, GNUNET_YES);
1188 return GNUNET_OK; 1188 return GNUNET_OK;
@@ -1193,7 +1193,7 @@ GMC_handle_confirm (void *cls, const struct GNUNET_PeerIdentity *peer,
1193 { 1193 {
1194 LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection ACK for us!\n"); 1194 LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection ACK for us!\n");
1195 GMC_change_state (c, MESH_CONNECTION_READY); 1195 GMC_change_state (c, MESH_CONNECTION_READY);
1196 GMT_change_state (c->t, MESH_TUNNEL_READY); 1196 GMT_change_state (c->t, MESH_TUNNEL3_READY);
1197 GMT_send_queued_data (c->t, GNUNET_NO); 1197 GMT_send_queued_data (c->t, GNUNET_NO);
1198 return GNUNET_OK; 1198 return GNUNET_OK;
1199 } 1199 }
@@ -2047,7 +2047,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2047 LOG (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid)); 2047 LOG (GNUNET_ERROR_TYPE_DEBUG, " poll %u\n", ntohl (pmsg->pid));
2048 break; 2048 break;
2049 2049
2050 case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY: 2050 case GNUNET_MESSAGE_TYPE_MESH_TUNNEL3_DESTROY:
2051 dmsg = (struct GNUNET_MESH_ConnectionDestroy *) data; 2051 dmsg = (struct GNUNET_MESH_ConnectionDestroy *) data;
2052 dmsg->cid = c->id; 2052 dmsg->cid = c->id;
2053 dmsg->reserved = 0; 2053 dmsg->reserved = 0;
@@ -2089,7 +2089,7 @@ GMC_send_destroy (struct MeshConnection *c)
2089 return; 2089 return;
2090 2090
2091 msg.header.size = htons (sizeof (msg)); 2091 msg.header.size = htons (sizeof (msg));
2092 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);; 2092 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL3_DESTROY);;
2093 msg.cid = c->id; 2093 msg.cid = c->id;
2094 LOG (GNUNET_ERROR_TYPE_DEBUG, 2094 LOG (GNUNET_ERROR_TYPE_DEBUG,
2095 " sending connection destroy for connection %s\n", 2095 " sending connection destroy for connection %s\n",
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c
index 5e44bbc86..157b48dad 100644
--- a/src/mesh/gnunet-service-mesh_peer.c
+++ b/src/mesh/gnunet-service-mesh_peer.c
@@ -920,7 +920,7 @@ search_handler (void *cls, struct MeshPeerPath *path)
920 if (3 <= connection_count) 920 if (3 <= connection_count)
921 return; 921 return;
922 922
923 if (peer->tunnel->state == MESH_TUNNEL_SEARCHING) 923 if (peer->tunnel->state == MESH_TUNNEL3_SEARCHING)
924 { 924 {
925 LOG (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n"); 925 LOG (GNUNET_ERROR_TYPE_DEBUG, " ... connect!\n");
926 GMP_connect (peer); 926 GMP_connect (peer);
@@ -999,7 +999,7 @@ queue_send (void *cls, size_t size, void *buf)
999 /* Fill buf */ 999 /* Fill buf */
1000 switch (queue->type) 1000 switch (queue->type)
1001 { 1001 {
1002 case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY: 1002 case GNUNET_MESSAGE_TYPE_MESH_TUNNEL3_DESTROY:
1003 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: 1003 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
1004 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN: 1004 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN:
1005 case GNUNET_MESSAGE_TYPE_MESH_FWD: 1005 case GNUNET_MESSAGE_TYPE_MESH_FWD:
@@ -1214,7 +1214,7 @@ GMP_queue_destroy (struct MeshPeerQueue *queue, int clear_cls)
1214 switch (queue->type) 1214 switch (queue->type)
1215 { 1215 {
1216 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY: 1216 case GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY:
1217 case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY: 1217 case GNUNET_MESSAGE_TYPE_MESH_TUNNEL3_DESTROY:
1218 LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n"); 1218 LOG (GNUNET_ERROR_TYPE_INFO, "destroying a DESTROY message\n");
1219 GNUNET_break (GNUNET_YES == queue->c->destroy); 1219 GNUNET_break (GNUNET_YES == queue->c->destroy);
1220 /* fall through */ 1220 /* fall through */
@@ -1584,8 +1584,8 @@ GMP_connect (struct MeshPeer *peer)
1584 LOG (GNUNET_ERROR_TYPE_DEBUG, 1584 LOG (GNUNET_ERROR_TYPE_DEBUG,
1585 " Starting DHT GET for peer %s\n", peer2s (peer)); 1585 " Starting DHT GET for peer %s\n", peer2s (peer));
1586 peer->search_h = GMD_search (id, &search_handler, peer); 1586 peer->search_h = GMD_search (id, &search_handler, peer);
1587 if (MESH_TUNNEL_NEW == t->state) 1587 if (MESH_TUNNEL3_NEW == t->state)
1588 GMT_change_state (t, MESH_TUNNEL_SEARCHING); 1588 GMT_change_state (t, MESH_TUNNEL3_SEARCHING);
1589 } 1589 }
1590} 1590}
1591 1591
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c
index f20492c2c..4e1373663 100644
--- a/src/mesh/gnunet-service-mesh_tunnel.c
+++ b/src/mesh/gnunet-service-mesh_tunnel.c
@@ -202,16 +202,16 @@ GMT_state2s (enum MeshTunnel3State s)
202 202
203 switch (s) 203 switch (s)
204 { 204 {
205 case MESH_TUNNEL_NEW: 205 case MESH_TUNNEL3_NEW:
206 return "MESH_TUNNEL_NEW"; 206 return "MESH_TUNNEL3_NEW";
207 case MESH_TUNNEL_SEARCHING: 207 case MESH_TUNNEL3_SEARCHING:
208 return "MESH_TUNNEL_SEARCHING"; 208 return "MESH_TUNNEL3_SEARCHING";
209 case MESH_TUNNEL_WAITING: 209 case MESH_TUNNEL3_WAITING:
210 return "MESH_TUNNEL_WAITING"; 210 return "MESH_TUNNEL3_WAITING";
211 case MESH_TUNNEL_READY: 211 case MESH_TUNNEL3_READY:
212 return "MESH_TUNNEL_READY"; 212 return "MESH_TUNNEL3_READY";
213 case MESH_TUNNEL_RECONNECTING: 213 case MESH_TUNNEL3_RECONNECTING:
214 return "MESH_TUNNEL_RECONNECTING"; 214 return "MESH_TUNNEL3_RECONNECTING";
215 215
216 default: 216 default:
217 sprintf (buf, "%u (UNKNOWN STATE)", s); 217 sprintf (buf, "%u (UNKNOWN STATE)", s);
@@ -292,7 +292,7 @@ handle_data (struct MeshTunnel3 *t,
292 return; 292 return;
293 } 293 }
294 294
295 GMT_change_state (t, MESH_TUNNEL_READY); 295 GMT_change_state (t, MESH_TUNNEL3_READY);
296 GMCH_handle_data (ch, msg, fwd); 296 GMCH_handle_data (ch, msg, fwd);
297} 297}
298 298
@@ -502,7 +502,7 @@ GMT_queue_data (struct MeshTunnel3 *t,
502 memcpy (&tq[1], msg, size); 502 memcpy (&tq[1], msg, size);
503 GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tq); 503 GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tq);
504 504
505 if (MESH_TUNNEL_READY == t->state) 505 if (MESH_TUNNEL3_READY == t->state)
506 GMT_send_queued_data (t, fwd); 506 GMT_send_queued_data (t, fwd);
507} 507}
508 508
@@ -632,7 +632,7 @@ GMT_change_state (struct MeshTunnel3* t, enum MeshTunnel3State state)
632 GMP_2s (t->peer), 632 GMP_2s (t->peer),
633 GMT_state2s (state)); 633 GMT_state2s (state));
634 t->state = state; 634 t->state = state;
635 if (MESH_TUNNEL_READY == state && 3 <= GMT_count_connections (t)) 635 if (MESH_TUNNEL3_READY == state && 3 <= GMT_count_connections (t))
636 { 636 {
637 GMP_stop_search (t->peer); 637 GMP_stop_search (t->peer);
638 } 638 }
diff --git a/src/mesh/gnunet-service-mesh_tunnel.h b/src/mesh/gnunet-service-mesh_tunnel.h
index dfddae4d1..18104a147 100644
--- a/src/mesh/gnunet-service-mesh_tunnel.h
+++ b/src/mesh/gnunet-service-mesh_tunnel.h
@@ -48,27 +48,27 @@ enum MeshTunnel3State
48 /** 48 /**
49 * Uninitialized status, should never appear in operation. 49 * Uninitialized status, should never appear in operation.
50 */ 50 */
51 MESH_TUNNEL_NEW, 51 MESH_TUNNEL3_NEW,
52 52
53 /** 53 /**
54 * Path to the peer not known yet 54 * Path to the peer not known yet
55 */ 55 */
56 MESH_TUNNEL_SEARCHING, 56 MESH_TUNNEL3_SEARCHING,
57 57
58 /** 58 /**
59 * Request sent, not yet answered. 59 * Request sent, not yet answered.
60 */ 60 */
61 MESH_TUNNEL_WAITING, 61 MESH_TUNNEL3_WAITING,
62 62
63 /** 63 /**
64 * Peer connected and ready to accept data 64 * Peer connected and ready to accept data
65 */ 65 */
66 MESH_TUNNEL_READY, 66 MESH_TUNNEL3_READY,
67 67
68 /** 68 /**
69 * Peer connected previosly but not responding 69 * Peer connected previosly but not responding
70 */ 70 */
71 MESH_TUNNEL_RECONNECTING 71 MESH_TUNNEL3_RECONNECTING
72}; 72};
73 73
74/** 74/**