diff options
author | Supriti Singh <supritisingh08@gmail.com> | 2014-01-31 18:51:50 +0000 |
---|---|---|
committer | Supriti Singh <supritisingh08@gmail.com> | 2014-01-31 18:51:50 +0000 |
commit | f6d4779fb0c29c4028389659c5f7be34cedfeae7 (patch) | |
tree | a7cf743565ddfcc8d9149225b27326785f41d463 /src/dht | |
parent | 585bf7d499409f42a5c293119c426e2f02107768 (diff) | |
download | gnunet-f6d4779fb0c29c4028389659c5f7be34cedfeae7.tar.gz gnunet-f6d4779fb0c29c4028389659c5f7be34cedfeae7.zip |
Handling trail setup result message.
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-service-dht.c | 1 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_neighbours.c | 188 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_routing.c | 41 | ||||
-rw-r--r-- | src/dht/gnunet-service-xdht_routing.h | 20 |
4 files changed, 131 insertions, 119 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index cc1e0dc6b..5efa9ddc6 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -145,7 +145,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
145 | const struct GNUNET_CONFIGURATION_Handle *c) | 145 | const struct GNUNET_CONFIGURATION_Handle *c) |
146 | { | 146 | { |
147 | GDS_cfg = c; | 147 | GDS_cfg = c; |
148 | |||
149 | if (GNUNET_OK != | 148 | if (GNUNET_OK != |
150 | GNUNET_CONFIGURATION_get_value_time (c, "transport", "HELLO_EXPIRATION", &hello_expiration)) | 149 | GNUNET_CONFIGURATION_get_value_time (c, "transport", "HELLO_EXPIRATION", &hello_expiration)) |
151 | { | 150 | { |
diff --git a/src/dht/gnunet-service-xdht_neighbours.c b/src/dht/gnunet-service-xdht_neighbours.c index ac21c67b0..d15c43105 100644 --- a/src/dht/gnunet-service-xdht_neighbours.c +++ b/src/dht/gnunet-service-xdht_neighbours.c | |||
@@ -50,12 +50,8 @@ | |||
50 | 50 | ||
51 | 51 | ||
52 | /*TODO | 52 | /*TODO |
53 | 1. Add logic to get connected to your predecessor | 53 | * 1. Remove extra comments - FIXME,TODO,SUPU |
54 | because when nodes join/fail , you need to maintain correct | 54 | */ |
55 | pointers to predecessor and your successor (your first finger), | ||
56 | to update tables. | ||
57 | 2. Remove extra comments - FIXME,TODO,SUPU | ||
58 | 3. When do we call GDS_Routing_add()? */ | ||
59 | 55 | ||
60 | /** | 56 | /** |
61 | * Maximum possible fingers of a peer. | 57 | * Maximum possible fingers of a peer. |
@@ -243,7 +239,7 @@ struct PeerGetMessage | |||
243 | /** | 239 | /** |
244 | * FIXME: I have defined this struct between GNUNET_NETWORK_STRUCT_BEGIN. Is | 240 | * FIXME: I have defined this struct between GNUNET_NETWORK_STRUCT_BEGIN. Is |
245 | * it correct? Also, I am using the same struct inside finger info and trailsetup | 241 | * it correct? Also, I am using the same struct inside finger info and trailsetup |
246 | * trailsetupresult message. Is it correct? */ | 242 | * trailsetupresult message. Is it correct? Verify while testing. */ |
247 | /** | 243 | /** |
248 | * Linked List of peers which are part of trail to reach a particular Finger. | 244 | * Linked List of peers which are part of trail to reach a particular Finger. |
249 | */ | 245 | */ |
@@ -268,7 +264,7 @@ struct TrailPeerList | |||
268 | 264 | ||
269 | 265 | ||
270 | /** | 266 | /** |
271 | * FIXME : I am using the same structure trail list in both finger info | 267 | * FIXME : I am using the same struct TrailPeerList in both finger info |
272 | * and peertrailsetupmessage. Verify if its okay. | 268 | * and peertrailsetupmessage. Verify if its okay. |
273 | * P2P Trail setup message | 269 | * P2P Trail setup message |
274 | */ | 270 | */ |
@@ -309,10 +305,6 @@ struct PeerTrailSetupMessage | |||
309 | 305 | ||
310 | /** | 306 | /** |
311 | * P2P Trail setup Result message | 307 | * P2P Trail setup Result message |
312 | * FIXME: There seem to be no difference between trail_setup and trailsetupresult | ||
313 | * Can we somehow merge these two. As in result we don't have to do any | ||
314 | * search in our finger or friend table thats why I kept it separate. But is it | ||
315 | * actually required to keep these two things different. | ||
316 | */ | 308 | */ |
317 | struct PeerTrailSetupResultMessage | 309 | struct PeerTrailSetupResultMessage |
318 | { | 310 | { |
@@ -320,21 +312,16 @@ struct PeerTrailSetupResultMessage | |||
320 | * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_RESULT_SETUP | 312 | * Type: #GNUNET_MESSAGE_TYPE_DHT_P2P_TRAIL_RESULT_SETUP |
321 | */ | 313 | */ |
322 | struct GNUNET_MessageHeader header; | 314 | struct GNUNET_MessageHeader header; |
323 | |||
324 | /* SUPU: It should contain the list of peers which form the trail. | ||
325 | and also maintain a pointer to the current_peer to which we have to forward | ||
326 | the packet. We have to maintain the whole list in this message because | ||
327 | at the end source peer will store this list in its finger table. */ | ||
328 | 315 | ||
329 | /** | 316 | /** |
330 | * Source peer which wants to find trail to one of its finger. | 317 | * Finger to which we have found the path. |
331 | */ | 318 | */ |
332 | struct GNUNET_PeerIdentity *source_peer; | 319 | struct GNUNET_PeerIdentity *finger; |
333 | 320 | ||
334 | /** | 321 | /** |
335 | * Finger id to which we want to set up the trail to. | 322 | * Peer which was looking for the trail to finger. |
336 | */ | 323 | */ |
337 | struct GNUNET_PeerIdentity *destination_finger; | 324 | struct GNUNET_PeerIdentity *destination_peer; |
338 | 325 | ||
339 | /** | 326 | /** |
340 | * This field contains the peer to which this packet is forwarded. | 327 | * This field contains the peer to which this packet is forwarded. |
@@ -430,11 +417,10 @@ struct FriendInfo | |||
430 | struct FingerInfo | 417 | struct FingerInfo |
431 | { | 418 | { |
432 | /** | 419 | /** |
433 | * What is the identity of the peer? | 420 | * What is the identity of the finger peer? |
434 | */ | 421 | */ |
435 | struct GNUNET_PeerIdentity id; | 422 | struct GNUNET_PeerIdentity id; |
436 | 423 | ||
437 | |||
438 | /** | 424 | /** |
439 | * Start of the interval of keys for which this finger is responsible. | 425 | * Start of the interval of keys for which this finger is responsible. |
440 | */ | 426 | */ |
@@ -469,6 +455,7 @@ static GNUNET_SCHEDULER_TaskIdentifier find_finger_trail_task; | |||
469 | static struct GNUNET_PeerIdentity my_identity; | 455 | static struct GNUNET_PeerIdentity my_identity; |
470 | 456 | ||
471 | /** | 457 | /** |
458 | * FIXME: Not used anywhere in the code yet. | ||
472 | * Hash of the identity of this peer. | 459 | * Hash of the identity of this peer. |
473 | */ | 460 | */ |
474 | static struct GNUNET_HashCode my_identity_hash; | 461 | static struct GNUNET_HashCode my_identity_hash; |
@@ -484,6 +471,7 @@ static struct GNUNET_CONTAINER_MultiPeerMap *friend_peers; | |||
484 | static struct GNUNET_CONTAINER_MultiPeerMap *finger_peers; | 471 | static struct GNUNET_CONTAINER_MultiPeerMap *finger_peers; |
485 | 472 | ||
486 | /** | 473 | /** |
474 | * TODO: Ask whats the use of ATS. | ||
487 | * Handle to ATS. | 475 | * Handle to ATS. |
488 | */ | 476 | */ |
489 | static struct GNUNET_ATS_PerformanceHandle *atsAPI; | 477 | static struct GNUNET_ATS_PerformanceHandle *atsAPI; |
@@ -494,14 +482,12 @@ static struct GNUNET_ATS_PerformanceHandle *atsAPI; | |||
494 | static struct GNUNET_CORE_Handle *core_api; | 482 | static struct GNUNET_CORE_Handle *core_api; |
495 | 483 | ||
496 | /** | 484 | /** |
497 | * FIXME:where are we using this field. | ||
498 | * The highest finger_id that we have found trail to. | 485 | * The highest finger_id that we have found trail to. |
499 | */ | 486 | */ |
500 | static unsigned int finger_id; | 487 | static unsigned int highest_finger_id; |
501 | 488 | ||
502 | 489 | ||
503 | /** | 490 | /** |
504 | * TODO: Check this function again. | ||
505 | * Called when core is ready to send a message we asked for | 491 | * Called when core is ready to send a message we asked for |
506 | * out to the destination. | 492 | * out to the destination. |
507 | * | 493 | * |
@@ -773,15 +759,15 @@ get_random_friend() | |||
773 | /* Set the position of iterator to index. */ | 759 | /* Set the position of iterator to index. */ |
774 | while(j < (*index)) | 760 | while(j < (*index)) |
775 | { | 761 | { |
776 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(iter,NULL,NULL)) | 762 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(iter,NULL,NULL)) |
777 | j++; | 763 | j++; |
778 | else | 764 | else |
779 | return NULL; | 765 | return NULL; |
780 | } | 766 | } |
781 | 767 | ||
782 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(iter,&key_ret,(const void **)&friend)) | 768 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(iter,&key_ret,(const void **)&friend)) |
783 | { | 769 | { |
784 | return friend; | 770 | return friend; |
785 | } | 771 | } |
786 | 772 | ||
787 | return NULL; | 773 | return NULL; |
@@ -791,9 +777,9 @@ get_random_friend() | |||
791 | /** | 777 | /** |
792 | * TODO: Complete this function. | 778 | * TODO: Complete this function. |
793 | * Use Chord formula finger[i]=(n+2^(i-1))mod m, | 779 | * Use Chord formula finger[i]=(n+2^(i-1))mod m, |
794 | * where i = current finger map index. | 780 | * where i = current finger map index - max. 256 bits |
795 | * n = own peer identity | 781 | * n = own peer identity - 256 bits |
796 | * m = number of bits in peer id. | 782 | * m = number of bits in peer id - 256 bits |
797 | * @return finger_peer_id for which we have to find the trail through network. | 783 | * @return finger_peer_id for which we have to find the trail through network. |
798 | */ | 784 | */ |
799 | static | 785 | static |
@@ -828,7 +814,7 @@ find_immediate_predecessor() | |||
828 | /* Using your own peer identity, calculate your predecessor | 814 | /* Using your own peer identity, calculate your predecessor |
829 | in the network. Try to setup path to this predecessor using | 815 | in the network. Try to setup path to this predecessor using |
830 | the same logic as used for other fingers. */ | 816 | the same logic as used for other fingers. */ |
831 | return NULL; | 817 | return NULL; |
832 | } | 818 | } |
833 | 819 | ||
834 | 820 | ||
@@ -871,7 +857,7 @@ send_find_finger_trail_message (void *cls, | |||
871 | DHT_MINIMUM_FIND_FINGER_TRAIL_INTERVAL.rel_value_us + | 857 | DHT_MINIMUM_FIND_FINGER_TRAIL_INTERVAL.rel_value_us + |
872 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 858 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
873 | DHT_MAXIMUM_FIND_FINGER_TRAIL_INTERVAL.rel_value_us / | 859 | DHT_MAXIMUM_FIND_FINGER_TRAIL_INTERVAL.rel_value_us / |
874 | (finger_id + 1)); | 860 | (highest_finger_id + 1)); |
875 | 861 | ||
876 | find_finger_trail_task = | 862 | find_finger_trail_task = |
877 | GNUNET_SCHEDULER_add_delayed (next_send_time, &send_find_finger_trail_message, | 863 | GNUNET_SCHEDULER_add_delayed (next_send_time, &send_find_finger_trail_message, |
@@ -993,7 +979,7 @@ handle_dht_p2p_put (void *cls, | |||
993 | * to reach to a particular peer or you are endpoint of trail or just a friend. | 979 | * to reach to a particular peer or you are endpoint of trail or just a friend. |
994 | * | 980 | * |
995 | */ | 981 | */ |
996 | return 0; | 982 | return 0; |
997 | } | 983 | } |
998 | 984 | ||
999 | 985 | ||
@@ -1010,7 +996,7 @@ static int | |||
1010 | handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, | 996 | handle_dht_p2p_get (void *cls, const struct GNUNET_PeerIdentity *peer, |
1011 | const struct GNUNET_MessageHeader *message) | 997 | const struct GNUNET_MessageHeader *message) |
1012 | { | 998 | { |
1013 | return 0; | 999 | return 0; |
1014 | } | 1000 | } |
1015 | 1001 | ||
1016 | 1002 | ||
@@ -1026,24 +1012,11 @@ static int | |||
1026 | handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, | 1012 | handle_dht_p2p_result (void *cls, const struct GNUNET_PeerIdentity *peer, |
1027 | const struct GNUNET_MessageHeader *message) | 1013 | const struct GNUNET_MessageHeader *message) |
1028 | { | 1014 | { |
1029 | return 0; | 1015 | return 0; |
1030 | } | 1016 | } |
1031 | 1017 | ||
1032 | 1018 | ||
1033 | /** | 1019 | /** |
1034 | * Read the trail setup message backwards to find which is the next hop to which | ||
1035 | * it should be send to. | ||
1036 | * @return | ||
1037 | |||
1038 | static | ||
1039 | struct GNUNET_PeerIdentity * | ||
1040 | find_next_hop() | ||
1041 | { | ||
1042 | return NULL; | ||
1043 | }*/ | ||
1044 | |||
1045 | |||
1046 | /** | ||
1047 | * FIXME: | 1020 | * FIXME: |
1048 | * Are we comparing the predecessor with our own identity also. | 1021 | * Are we comparing the predecessor with our own identity also. |
1049 | * Its important. | 1022 | * Its important. |
@@ -1077,15 +1050,15 @@ find_successor(struct GNUNET_PeerIdentity *destination) | |||
1077 | /*iterate over friend map till you reach a peer id such that destination <= peer id */ | 1050 | /*iterate over friend map till you reach a peer id such that destination <= peer id */ |
1078 | for (friend_index = 0; friend_index < GNUNET_CONTAINER_multipeermap_size (friend_peers); friend_index++) | 1051 | for (friend_index = 0; friend_index < GNUNET_CONTAINER_multipeermap_size (friend_peers); friend_index++) |
1079 | { | 1052 | { |
1080 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(friend_iter,&key_ret,(const void **)&friend)) | 1053 | if(GNUNET_YES == GNUNET_CONTAINER_multipeermap_iterator_next(friend_iter,&key_ret,(const void **)&friend)) |
1081 | { | 1054 | { |
1082 | /* | 1055 | /* |
1083 | * 1. Check if friend >= destination. | 1056 | * 1. Check if friend >= destination. |
1084 | * 2. If yes then check if friend <= current_predecessor, | 1057 | * 2. If yes then check if friend <= current_predecessor, |
1085 | * if yes then curret_predecessor = friend. | 1058 | * if yes then curret_predecessor = friend. |
1086 | * 3 If not then do nothing. | 1059 | * 3 If not then do nothing. |
1087 | */ | 1060 | */ |
1088 | } | 1061 | } |
1089 | } | 1062 | } |
1090 | 1063 | ||
1091 | 1064 | ||
@@ -1117,6 +1090,7 @@ find_successor(struct GNUNET_PeerIdentity *destination) | |||
1117 | * 1. Check if we are maintaining the 64k size of struct PeerTrailSetupMessage. | 1090 | * 1. Check if we are maintaining the 64k size of struct PeerTrailSetupMessage. |
1118 | * when we add ourself to the trail list. | 1091 | * when we add ourself to the trail list. |
1119 | * 2. Ensure every case is handled for current_destination. | 1092 | * 2. Ensure every case is handled for current_destination. |
1093 | * 3. When should you call GDS_Routing_Add? | ||
1120 | * Core handler for P2P trail setup message. | 1094 | * Core handler for P2P trail setup message. |
1121 | * @param cls closure | 1095 | * @param cls closure |
1122 | * @param message message | 1096 | * @param message message |
@@ -1162,6 +1136,9 @@ handle_dht_p2p_trail_setup(void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1162 | { | 1136 | { |
1163 | /* I am current destination, find the next peer to pass the trail setup message. */ | 1137 | /* I am current destination, find the next peer to pass the trail setup message. */ |
1164 | next_hop = find_successor(trail_setup->destination_finger); | 1138 | next_hop = find_successor(trail_setup->destination_finger); |
1139 | /* Here we have not reached to final destination, but we found the closest | ||
1140 | predecessor. routing table should have an entry only if its a finger. */ | ||
1141 | //GDS_Routing_add(); | ||
1165 | } | 1142 | } |
1166 | else | 1143 | else |
1167 | { | 1144 | { |
@@ -1195,6 +1172,8 @@ handle_dht_p2p_trail_setup(void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1195 | 1172 | ||
1196 | /* Send trail setup message to next hop friend. */ | 1173 | /* Send trail setup message to next hop friend. */ |
1197 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage)); | 1174 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage)); |
1175 | /*FIXME: This is wrong. Where do you copy the new trail_setup message to | ||
1176 | pending.*/ | ||
1198 | GNUNET_CONTAINER_DLL_insert_tail (friend->head, friend->tail, pending); | 1177 | GNUNET_CONTAINER_DLL_insert_tail (friend->head, friend->tail, pending); |
1199 | friend->pending_count++; | 1178 | friend->pending_count++; |
1200 | process_friend_queue(friend); | 1179 | process_friend_queue(friend); |
@@ -1202,6 +1181,25 @@ handle_dht_p2p_trail_setup(void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1202 | } | 1181 | } |
1203 | 1182 | ||
1204 | 1183 | ||
1184 | /* Add an entry to finger table. */ | ||
1185 | static | ||
1186 | void finger_table_add(struct PeerTrailSetupResultMessage *result) | ||
1187 | { | ||
1188 | /* Add the whole trail in your finger table, | ||
1189 | also add interval. */ | ||
1190 | } | ||
1191 | |||
1192 | |||
1193 | /* Traverse the trail list to find the next hop to pass the result message. */ | ||
1194 | static | ||
1195 | struct GNUNET_PeerIdentity * | ||
1196 | find_trail_list_next_hop(struct PeerTrailSetupResultMessage *trail_result) | ||
1197 | { | ||
1198 | /* Setup the current_destination value to new next hop found. */ | ||
1199 | return NULL; | ||
1200 | } | ||
1201 | |||
1202 | |||
1205 | /** | 1203 | /** |
1206 | * Core handle for p2p trail construction result messages. | 1204 | * Core handle for p2p trail construction result messages. |
1207 | * @param cls closure | 1205 | * @param cls closure |
@@ -1214,32 +1212,56 @@ static int | |||
1214 | handle_dht_p2p_trail_setup_result(void *cls, const struct GNUNET_PeerIdentity *peer, | 1212 | handle_dht_p2p_trail_setup_result(void *cls, const struct GNUNET_PeerIdentity *peer, |
1215 | const struct GNUNET_MessageHeader *message) | 1213 | const struct GNUNET_MessageHeader *message) |
1216 | { | 1214 | { |
1217 | /** | 1215 | /* FIXME: Should it be const? */ |
1218 | * Just read the linked list backwards and send the packet to next hop | 1216 | struct PeerTrailSetupResultMessage *trail_result; |
1219 | * till you don't reach the source | 1217 | struct GNUNET_PeerIdentity *next_hop; |
1220 | * but if you are source, then add an entry in finger table for given finger id. | 1218 | struct FriendInfo *friend; |
1221 | * | 1219 | struct P2PPendingMessage *pending; |
1222 | * | 1220 | trail_result = (struct PeerTrailSetupResultMessage *) message; |
1223 | */ | 1221 | |
1224 | //const struct PeerTrailSetupResultMessage *trail_result; | 1222 | uint16_t msize; |
1225 | //trail_result = (const struct PeerTrailSetupResultMessage *) message; | 1223 | |
1226 | 1224 | msize = ntohs (message->size); | |
1227 | /*FIXME: This code is wrong, I am writing just to understand the flow, | 1225 | if (msize < sizeof (struct PeerTrailSetupResultMessage)) |
1228 | if(trail_result->destination == message->destination) | ||
1229 | { | 1226 | { |
1230 | This condition holds true, then we should add an entry in our | 1227 | GNUNET_break_op (0); |
1231 | routing table and store this finger and its trail. | 1228 | return GNUNET_YES; |
1232 | struct finger_info = with interval . | 1229 | } |
1233 | GNUNET_multipeer_map_insert(finger_map) | 1230 | |
1234 | * GDS_Routing_add(); | 1231 | /* This should always be the case. */ |
1235 | } | 1232 | if( 0 == (GNUNET_CRYPTO_cmp_peer_identity(trail_result->current_destination,&my_identity))) |
1236 | else | ||
1237 | { | 1233 | { |
1238 | Read the trail list, Check the next_hop and pass the packet to it. | 1234 | /* Am I the destination ? */ |
1239 | FIXME: Should we an entry in our own routing table. | 1235 | if( 0 == (GNUNET_CRYPTO_cmp_peer_identity(trail_result->destination_peer,&my_identity))) |
1240 | }*/ | 1236 | { |
1241 | 1237 | /* I am the destination. Add the trail to my finger table. */ | |
1242 | return 0; | 1238 | finger_table_add(trail_result); |
1239 | return GNUNET_YES; | ||
1240 | } | ||
1241 | else | ||
1242 | { | ||
1243 | /* Find the next peer in the trail list to pass the message to. */ | ||
1244 | next_hop = find_trail_list_next_hop(trail_result); | ||
1245 | |||
1246 | /* Find the struct FriendInfo for next_hop peer id. */ | ||
1247 | friend = GNUNET_CONTAINER_multipeermap_get(friend_peers,next_hop); | ||
1248 | |||
1249 | /* Send trail setup result message to next hop friend. */ | ||
1250 | /*FIXME: | ||
1251 | I have not yet written the code to copy struct trail message to | ||
1252 | pending message. Also, before sending the message I need to check | ||
1253 | the MAXIMUM_PENDNIG_PEER limit is not crossed. Modify the same part | ||
1254 | of code for handle_dht_p2p_trail_setup. */ | ||
1255 | pending = GNUNET_malloc (sizeof (struct P2PPendingMessage)); | ||
1256 | GNUNET_CONTAINER_DLL_insert_tail (friend->head, friend->tail, pending); | ||
1257 | friend->pending_count++; | ||
1258 | process_friend_queue(friend); | ||
1259 | |||
1260 | return GNUNET_YES; | ||
1261 | } | ||
1262 | } | ||
1263 | else | ||
1264 | return GNUNET_SYSERR; | ||
1243 | } | 1265 | } |
1244 | 1266 | ||
1245 | 1267 | ||
@@ -1269,10 +1291,8 @@ GDS_NEIGHBOURS_init() | |||
1269 | 1291 | ||
1270 | friend_peers = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); | 1292 | friend_peers = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); |
1271 | finger_peers = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); | 1293 | finger_peers = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); |
1272 | 1294 | ||
1273 | |||
1274 | return GNUNET_OK; | 1295 | return GNUNET_OK; |
1275 | |||
1276 | } | 1296 | } |
1277 | 1297 | ||
1278 | 1298 | ||
@@ -1313,7 +1333,7 @@ GDS_NEIGHBOURS_done () | |||
1313 | struct GNUNET_PeerIdentity * | 1333 | struct GNUNET_PeerIdentity * |
1314 | GDS_NEIGHBOURS_get_id () | 1334 | GDS_NEIGHBOURS_get_id () |
1315 | { | 1335 | { |
1316 | return &my_identity; | 1336 | return &my_identity; |
1317 | } | 1337 | } |
1318 | 1338 | ||
1319 | 1339 | ||
diff --git a/src/dht/gnunet-service-xdht_routing.c b/src/dht/gnunet-service-xdht_routing.c index 0a0b1ac61..6d14ce029 100644 --- a/src/dht/gnunet-service-xdht_routing.c +++ b/src/dht/gnunet-service-xdht_routing.c | |||
@@ -77,28 +77,33 @@ struct RoutingTrail | |||
77 | static struct GNUNET_CONTAINER_MultiPeerMap *routing_table; | 77 | static struct GNUNET_CONTAINER_MultiPeerMap *routing_table; |
78 | 78 | ||
79 | 79 | ||
80 | /**FIXME: Old function added just to remove error for time being. | 80 | /** |
81 | * FIXME: Change the name of variable. | ||
82 | * Ensure that everywhere in this file you are using destination as the key. | ||
81 | * Add a new entry to our routing table. | 83 | * Add a new entry to our routing table. |
82 | * | 84 | * @param source peer |
83 | * @param sender peer that originated the request | 85 | * @param destintation |
84 | * @param type type of the block | 86 | * @param prev_hop |
85 | * @param options options for processing | 87 | * @param next_hop |
86 | * @param key key for the content | ||
87 | * @param xquery extended query | ||
88 | * @param xquery_size number of bytes in @a xquery | ||
89 | * @param reply_bf bloomfilter to filter duplicates | ||
90 | * @param reply_bf_mutator mutator for @a reply_bf | ||
91 | */ | 88 | */ |
92 | void | 89 | void |
93 | GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, | 90 | GDS_ROUTING_add (struct GNUNET_PeerIdentity *source, |
94 | enum GNUNET_BLOCK_Type type, | 91 | struct GNUNET_PeerIdentity *dest, |
95 | enum GNUNET_DHT_RouteOption options, | 92 | struct GNUNET_PeerIdentity *prev_hop, |
96 | const struct GNUNET_HashCode * key, const void *xquery, | 93 | struct GNUNET_PeerIdentity *next_hop) |
97 | size_t xquery_size, | ||
98 | const struct GNUNET_CONTAINER_BloomFilter *reply_bf, | ||
99 | uint32_t reply_bf_mutator) | ||
100 | { | 94 | { |
101 | 95 | struct RoutingTrail *new_routing_entry; | |
96 | |||
97 | new_routing_entry = GNUNET_malloc (sizeof (struct RoutingTrail)); | ||
98 | new_routing_entry->source = source; | ||
99 | new_routing_entry->previous_hop = prev_hop; | ||
100 | new_routing_entry->next_hop = next_hop; | ||
101 | new_routing_entry->destination = dest; | ||
102 | |||
103 | GNUNET_assert (GNUNET_OK == | ||
104 | GNUNET_CONTAINER_multipeermap_put (routing_table, | ||
105 | dest, new_routing_entry, | ||
106 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
102 | } | 107 | } |
103 | 108 | ||
104 | 109 | ||
diff --git a/src/dht/gnunet-service-xdht_routing.h b/src/dht/gnunet-service-xdht_routing.h index d1ca53512..dcb82ef16 100644 --- a/src/dht/gnunet-service-xdht_routing.h +++ b/src/dht/gnunet-service-xdht_routing.h | |||
@@ -33,24 +33,12 @@ | |||
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Add a new entry to our routing table. | 35 | * Add a new entry to our routing table. |
36 | * | ||
37 | * @param sender peer that originated the request | ||
38 | * @param type type of the block | ||
39 | * @param options options for processing | ||
40 | * @param key key for the content | ||
41 | * @param xquery extended query | ||
42 | * @param xquery_size number of bytes in @a xquery | ||
43 | * @param reply_bf bloomfilter to filter duplicates | ||
44 | * @param reply_bf_mutator mutator for @a reply_bf | ||
45 | */ | 36 | */ |
46 | void | 37 | void |
47 | GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, | 38 | GDS_ROUTING_add (struct GNUNET_PeerIdentity *source, |
48 | enum GNUNET_BLOCK_Type type, | 39 | struct GNUNET_PeerIdentity *destination_peer, |
49 | enum GNUNET_DHT_RouteOption options, | 40 | struct GNUNET_PeerIdentity *prev_hop, |
50 | const struct GNUNET_HashCode * key, const void *xquery, | 41 | struct GNUNET_PeerIdentity *next_hop); |
51 | size_t xquery_size, | ||
52 | const struct GNUNET_CONTAINER_BloomFilter *reply_bf, | ||
53 | uint32_t reply_bf_mutator); | ||
54 | 42 | ||
55 | 43 | ||
56 | /** | 44 | /** |