aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-09-20 13:54:57 +0000
committerBart Polot <bart@net.in.tum.de>2012-09-20 13:54:57 +0000
commit47968506aead2039cb82d6bb1205d14c44f003c7 (patch)
tree33577f68bb2d8552b6fc46065c427315ac0b730d /src
parentbf1b49f1927a4f89563a774ccc609034843ebc18 (diff)
downloadgnunet-47968506aead2039cb82d6bb1205d14c44f003c7.tar.gz
gnunet-47968506aead2039cb82d6bb1205d14c44f003c7.zip
- delete deprected parameters, update doc
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 369339af1..981afdb88 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -1167,9 +1167,17 @@ regex_find_path (const struct GNUNET_HashCode *key,
1167 1167
1168 1168
1169/** 1169/**
1170 * Queue and pass message to core when possible. 1170 * @brief Queue and pass message to core when possible.
1171 *
1172 * If type is payload (UNICAST, TO_ORIGIN, MULTICAST) checks for queue status
1173 * and accounts for it. In case the queue is full, the message is dropped and
1174 * a break issued.
1175 *
1176 * Otherwise, message is treated as internal and allowed to go regardless of
1177 * queue status.
1171 * 1178 *
1172 * @param cls Closure (type dependant). 1179 * @param cls Closure (@c type dependant). It will be used by queue_send to
1180 * build the message to be sent if not already prebuilt.
1173 * @param type Type of the message, 0 for a raw message. 1181 * @param type Type of the message, 0 for a raw message.
1174 * @param size Size of the message. 1182 * @param size Size of the message.
1175 * @param dst Neighbor to send message to. 1183 * @param dst Neighbor to send message to.
@@ -2303,9 +2311,9 @@ send_core_data_raw (void *cls, size_t size, void *buf)
2303 * @param t Tunnel on which this message is transmitted. 2311 * @param t Tunnel on which this message is transmitted.
2304 */ 2312 */
2305static void 2313static void
2306send_message (const struct GNUNET_MessageHeader *message, 2314send_prebuilt_message (const struct GNUNET_MessageHeader *message,
2307 const struct GNUNET_PeerIdentity *peer, 2315 const struct GNUNET_PeerIdentity *peer,
2308 struct MeshTunnel *t) 2316 struct MeshTunnel *t)
2309{ 2317{
2310 struct MeshTransmissionDescriptor *info; 2318 struct MeshTransmissionDescriptor *info;
2311 struct MeshPeerInfo *neighbor; 2319 struct MeshPeerInfo *neighbor;
@@ -2480,7 +2488,7 @@ send_destroy_path (struct MeshTunnel *t, GNUNET_PEER_Id destination)
2480 { 2488 {
2481 GNUNET_PEER_resolve (p->peers[i], &pi[i]); 2489 GNUNET_PEER_resolve (p->peers[i], &pi[i]);
2482 } 2490 }
2483 send_message (&msg->header, tree_get_first_hop (t->tree, destination), t); 2491 send_prebuilt_message (&msg->header, tree_get_first_hop (t->tree, destination), t);
2484 } 2492 }
2485 path_destroy (p); 2493 path_destroy (p);
2486} 2494}
@@ -3306,7 +3314,7 @@ tunnel_notify_connection_broken (struct MeshTunnel *t, GNUNET_PEER_Id p1,
3306 msg.peer1 = my_full_id; 3314 msg.peer1 = my_full_id;
3307 GNUNET_PEER_resolve (pid, &msg.peer2); 3315 GNUNET_PEER_resolve (pid, &msg.peer2);
3308 GNUNET_PEER_resolve (tree_get_predecessor (t->tree), &neighbor); 3316 GNUNET_PEER_resolve (tree_get_predecessor (t->tree), &neighbor);
3309 send_message (&msg.header, &neighbor, t); 3317 send_prebuilt_message (&msg.header, &neighbor, t);
3310 } 3318 }
3311 } 3319 }
3312 return pid; 3320 return pid;
@@ -3325,6 +3333,7 @@ tunnel_send_multicast_iterator (void *cls, GNUNET_PEER_Id neighbor_id)
3325 struct MeshData *mdata = cls; 3333 struct MeshData *mdata = cls;
3326 struct MeshTransmissionDescriptor *info; 3334 struct MeshTransmissionDescriptor *info;
3327 struct GNUNET_PeerIdentity neighbor; 3335 struct GNUNET_PeerIdentity neighbor;
3336 struct GNUNET_MessageHeader *msg;
3328 3337
3329 info = GNUNET_malloc (sizeof (struct MeshTransmissionDescriptor)); 3338 info = GNUNET_malloc (sizeof (struct MeshTransmissionDescriptor));
3330 3339
@@ -3336,8 +3345,9 @@ tunnel_send_multicast_iterator (void *cls, GNUNET_PEER_Id neighbor_id)
3336 GNUNET_i2s (&neighbor)); 3345 GNUNET_i2s (&neighbor));
3337 info->peer = peer_info_get (&neighbor); 3346 info->peer = peer_info_get (&neighbor);
3338 GNUNET_assert (NULL != info->peer); 3347 GNUNET_assert (NULL != info->peer);
3348 msg = (struct GNUNET_MessageHeader *) mdata->data;
3339 queue_add(info, 3349 queue_add(info,
3340 GNUNET_MESSAGE_TYPE_MESH_MULTICAST, 3350 ntohs (msg->type),
3341 info->mesh_data->data_len, 3351 info->mesh_data->data_len,
3342 info->peer, 3352 info->peer,
3343 mdata->t); 3353 mdata->t);
@@ -3350,14 +3360,10 @@ tunnel_send_multicast_iterator (void *cls, GNUNET_PEER_Id neighbor_id)
3350 * 3360 *
3351 * @param t Tunnel in which to send the data. 3361 * @param t Tunnel in which to send the data.
3352 * @param msg Message to be sent. 3362 * @param msg Message to be sent.
3353 * @param internal DEPRECATED Has the service generated this message?
3354 *
3355 * FIXME remove internal if no use comes up
3356 */ 3363 */
3357static void 3364static void
3358tunnel_send_multicast (struct MeshTunnel *t, 3365tunnel_send_multicast (struct MeshTunnel *t,
3359 const struct GNUNET_MessageHeader *msg, 3366 const struct GNUNET_MessageHeader *msg)
3360 int internal)
3361{ 3367{
3362 struct MeshData *mdata; 3368 struct MeshData *mdata;
3363 3369
@@ -3744,7 +3750,7 @@ send_ack (struct MeshTunnel *t, struct GNUNET_PeerIdentity *peer, uint32_t ack)
3744 msg.pid = htonl (ack); 3750 msg.pid = htonl (ack);
3745 msg.tid = htonl (t->id.tid); 3751 msg.tid = htonl (t->id.tid);
3746 3752
3747 send_message (&msg.header, peer, t); 3753 send_prebuilt_message (&msg.header, peer, t);
3748} 3754}
3749 3755
3750 3756
@@ -4059,7 +4065,7 @@ tunnel_send_destroy (struct MeshTunnel *t)
4059 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY); 4065 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);
4060 GNUNET_PEER_resolve (t->id.oid, &msg.oid); 4066 GNUNET_PEER_resolve (t->id.oid, &msg.oid);
4061 msg.tid = htonl (t->id.tid); 4067 msg.tid = htonl (t->id.tid);
4062 tunnel_send_multicast (t, &msg.header, GNUNET_NO); 4068 tunnel_send_multicast (t, &msg.header);
4063} 4069}
4064 4070
4065 4071
@@ -4855,7 +4861,8 @@ queue_send (void *cls, size_t size, void *buf)
4855 * Otherwise, message is treated as internal and allowed to go regardless of 4861 * Otherwise, message is treated as internal and allowed to go regardless of
4856 * queue status. 4862 * queue status.
4857 * 4863 *
4858 * @param cls Closure (type dependant). 4864 * @param cls Closure (@c type dependant). It will be used by queue_send to
4865 * build the message to be sent if not already prebuilt.
4859 * @param type Type of the message, 0 for a raw message. 4866 * @param type Type of the message, 0 for a raw message.
4860 * @param size Size of the message. 4867 * @param size Size of the message.
4861 * @param dst Neighbor to send message to. 4868 * @param dst Neighbor to send message to.
@@ -5117,6 +5124,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
5117 info->origin = &t->id; 5124 info->origin = &t->id;
5118 info->peer = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey); 5125 info->peer = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey);
5119 GNUNET_assert (NULL != info->peer); 5126 GNUNET_assert (NULL != info->peer);
5127 // FIXME don't use queue_add directly, abstact in a send_message_* funcion
5120 queue_add(info, 5128 queue_add(info,
5121 GNUNET_MESSAGE_TYPE_MESH_PATH_ACK, 5129 GNUNET_MESSAGE_TYPE_MESH_PATH_ACK,
5122 sizeof (struct GNUNET_MESH_PathACK), 5130 sizeof (struct GNUNET_MESH_PathACK),
@@ -5213,7 +5221,7 @@ handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
5213 } 5221 }
5214 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos); 5222 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
5215 if (own_pos < path->length - 1) 5223 if (own_pos < path->length - 1)
5216 send_message (message, &pi[own_pos + 1], t); 5224 send_prebuilt_message (message, &pi[own_pos + 1], t);
5217 else 5225 else
5218 send_client_tunnel_disconnect(t, NULL); 5226 send_client_tunnel_disconnect(t, NULL);
5219 5227
@@ -5431,7 +5439,7 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
5431 GNUNET_break_op (0); 5439 GNUNET_break_op (0);
5432 return GNUNET_OK; 5440 return GNUNET_OK;
5433 } 5441 }
5434 send_message (message, neighbor, t); 5442 send_prebuilt_message (message, neighbor, t);
5435 GNUNET_STATISTICS_update (stats, "# unicast forwarded", 1, GNUNET_NO); 5443 GNUNET_STATISTICS_update (stats, "# unicast forwarded", 1, GNUNET_NO);
5436 return GNUNET_OK; 5444 return GNUNET_OK;
5437} 5445}
@@ -5516,7 +5524,7 @@ handle_mesh_data_multicast (void *cls, const struct GNUNET_PeerIdentity *peer,
5516 return GNUNET_OK; 5524 return GNUNET_OK;
5517 } 5525 }
5518 GNUNET_STATISTICS_update (stats, "# multicast forwarded", 1, GNUNET_NO); 5526 GNUNET_STATISTICS_update (stats, "# multicast forwarded", 1, GNUNET_NO);
5519 tunnel_send_multicast (t, message, GNUNET_NO); 5527 tunnel_send_multicast (t, message);
5520 return GNUNET_OK; 5528 return GNUNET_OK;
5521} 5529}
5522 5530
@@ -5596,7 +5604,7 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
5596 return GNUNET_OK; 5604 return GNUNET_OK;
5597 } 5605 }
5598 GNUNET_PEER_resolve (tree_get_predecessor (t->tree), &id); 5606 GNUNET_PEER_resolve (tree_get_predecessor (t->tree), &id);
5599 send_message (message, &id, t); 5607 send_prebuilt_message (message, &id, t);
5600 GNUNET_STATISTICS_update (stats, "# to origin forwarded", 1, GNUNET_NO); 5608 GNUNET_STATISTICS_update (stats, "# to origin forwarded", 1, GNUNET_NO);
5601 5609
5602 return GNUNET_OK; 5610 return GNUNET_OK;
@@ -5760,7 +5768,7 @@ handle_mesh_path_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
5760 GNUNET_break (0); 5768 GNUNET_break (0);
5761 return GNUNET_OK; 5769 return GNUNET_OK;
5762 } 5770 }
5763 send_message (message, &id, t); 5771 send_prebuilt_message (message, &id, t);
5764 return GNUNET_OK; 5772 return GNUNET_OK;
5765} 5773}
5766 5774
@@ -5804,7 +5812,7 @@ handle_mesh_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer,
5804 tunnel_reset_timeout (t); 5812 tunnel_reset_timeout (t);
5805 5813
5806 GNUNET_STATISTICS_update (stats, "# keepalives forwarded", 1, GNUNET_NO); 5814 GNUNET_STATISTICS_update (stats, "# keepalives forwarded", 1, GNUNET_NO);
5807 tunnel_send_multicast (t, message, GNUNET_NO); 5815 tunnel_send_multicast (t, message);
5808 return GNUNET_OK; 5816 return GNUNET_OK;
5809 } 5817 }
5810 5818
@@ -5924,7 +5932,7 @@ path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
5924 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE); 5932 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE);
5925 msg->oid = my_full_id; 5933 msg->oid = my_full_id;
5926 msg->tid = htonl (t->id.tid); 5934 msg->tid = htonl (t->id.tid);
5927 tunnel_send_multicast (t, &msg->header, GNUNET_YES); 5935 tunnel_send_multicast (t, &msg->header);
5928 5936
5929 t->path_refresh_task = 5937 t->path_refresh_task =
5930 GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t); 5938 GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t);