diff options
-rw-r--r-- | src/rps/gnunet-service-rps.c | 218 | ||||
-rw-r--r-- | src/rps/gnunet-service-rps_peers.c | 91 | ||||
-rw-r--r-- | src/rps/gnunet-service-rps_peers.h | 37 | ||||
-rw-r--r-- | src/rps/test_service_rps_peers.c | 8 |
4 files changed, 211 insertions, 143 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index adcfe7d02..443b50215 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -217,6 +217,11 @@ static struct GNUNET_NSE_Handle *nse; | |||
217 | static struct GNUNET_CADET_Handle *cadet_handle; | 217 | static struct GNUNET_CADET_Handle *cadet_handle; |
218 | 218 | ||
219 | /** | 219 | /** |
220 | * @brief Port to communicate to other peers. | ||
221 | */ | ||
222 | static struct GNUNET_CADET_Port *cadet_port; | ||
223 | |||
224 | /** | ||
220 | * Handler to PEERINFO. | 225 | * Handler to PEERINFO. |
221 | */ | 226 | */ |
222 | static struct GNUNET_PEERINFO_Handle *peerinfo_handle; | 227 | static struct GNUNET_PEERINFO_Handle *peerinfo_handle; |
@@ -838,14 +843,10 @@ clean_peer (const struct GNUNET_PeerIdentity *peer) | |||
838 | */ | 843 | */ |
839 | static void | 844 | static void |
840 | cleanup_destroyed_channel (void *cls, | 845 | cleanup_destroyed_channel (void *cls, |
841 | const struct GNUNET_CADET_Channel *channel, | 846 | const struct GNUNET_CADET_Channel *channel) |
842 | void *channel_ctx) | ||
843 | { | 847 | { |
844 | struct GNUNET_PeerIdentity *peer; | 848 | struct GNUNET_PeerIdentity *peer = cls; |
845 | 849 | uint32_t *channel_flag; | |
846 | peer = (struct GNUNET_PeerIdentity *) GNUNET_CADET_channel_get_info ( | ||
847 | (struct GNUNET_CADET_Channel *) channel, GNUNET_CADET_OPTION_PEER); | ||
848 | // FIXME wait for cadet to change this function | ||
849 | 850 | ||
850 | if (GNUNET_NO == Peers_check_peer_known (peer)) | 851 | if (GNUNET_NO == Peers_check_peer_known (peer)) |
851 | { /* We don't know a context to that peer */ | 852 | { /* We don't know a context to that peer */ |
@@ -858,7 +859,7 @@ cleanup_destroyed_channel (void *cls, | |||
858 | if (GNUNET_YES == Peers_check_peer_flag (peer, Peers_TO_DESTROY)) | 859 | if (GNUNET_YES == Peers_check_peer_flag (peer, Peers_TO_DESTROY)) |
859 | { /* We are in the middle of removing that peer from our knowledge. In this | 860 | { /* We are in the middle of removing that peer from our knowledge. In this |
860 | case simply make sure that the channels are cleaned. */ | 861 | case simply make sure that the channels are cleaned. */ |
861 | Peers_cleanup_destroyed_channel (cls, channel, channel_ctx); | 862 | Peers_cleanup_destroyed_channel (cls, channel); |
862 | to_file (file_name_view_log, | 863 | to_file (file_name_view_log, |
863 | "-%s\t(cleanup channel, ourself)", | 864 | "-%s\t(cleanup channel, ourself)", |
864 | GNUNET_i2s_full (peer)); | 865 | GNUNET_i2s_full (peer)); |
@@ -872,16 +873,17 @@ cleanup_destroyed_channel (void *cls, | |||
872 | * - ourselves -> cleaning send channel -> clean context | 873 | * - ourselves -> cleaning send channel -> clean context |
873 | * - other peer -> peer probably went down -> remove | 874 | * - other peer -> peer probably went down -> remove |
874 | */ | 875 | */ |
875 | if (GNUNET_YES == Peers_check_channel_flag (channel_ctx, Peers_CHANNEL_CLEAN)) | 876 | channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_SENDING); |
877 | if (GNUNET_YES == Peers_check_channel_flag (channel_flag, Peers_CHANNEL_CLEAN)) | ||
876 | { /* We are about to clean the sending channel. Clean the respective | 878 | { /* We are about to clean the sending channel. Clean the respective |
877 | * context */ | 879 | * context */ |
878 | Peers_cleanup_destroyed_channel (cls, channel, channel_ctx); | 880 | Peers_cleanup_destroyed_channel (cls, channel); |
879 | return; | 881 | return; |
880 | } | 882 | } |
881 | else | 883 | else |
882 | { /* Other peer destroyed our sending channel that he is supposed to keep | 884 | { /* Other peer destroyed our sending channel that he is supposed to keep |
883 | * open. It probably went down. Remove it from our knowledge. */ | 885 | * open. It probably went down. Remove it from our knowledge. */ |
884 | Peers_cleanup_destroyed_channel (cls, channel, channel_ctx); | 886 | Peers_cleanup_destroyed_channel (cls, channel); |
885 | remove_peer (peer); | 887 | remove_peer (peer); |
886 | return; | 888 | return; |
887 | } | 889 | } |
@@ -893,17 +895,18 @@ cleanup_destroyed_channel (void *cls, | |||
893 | * - ourselves -> peer tried to establish channel twice -> clean context | 895 | * - ourselves -> peer tried to establish channel twice -> clean context |
894 | * - other peer -> peer doesn't want to send us data -> clean | 896 | * - other peer -> peer doesn't want to send us data -> clean |
895 | */ | 897 | */ |
898 | channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_RECEIVING); | ||
896 | if (GNUNET_YES == | 899 | if (GNUNET_YES == |
897 | Peers_check_channel_flag (channel_ctx, Peers_CHANNEL_ESTABLISHED_TWICE)) | 900 | Peers_check_channel_flag (channel_flag, Peers_CHANNEL_ESTABLISHED_TWICE)) |
898 | { /* Other peer tried to establish a channel to us twice. We do not accept | 901 | { /* Other peer tried to establish a channel to us twice. We do not accept |
899 | * that. Clean the context. */ | 902 | * that. Clean the context. */ |
900 | Peers_cleanup_destroyed_channel (cls, channel, channel_ctx); | 903 | Peers_cleanup_destroyed_channel (cls, channel); |
901 | return; | 904 | return; |
902 | } | 905 | } |
903 | else | 906 | else |
904 | { /* Other peer doesn't want to send us data anymore. We are free to clean | 907 | { /* Other peer doesn't want to send us data anymore. We are free to clean |
905 | * it. */ | 908 | * it. */ |
906 | Peers_cleanup_destroyed_channel (cls, channel, channel_ctx); | 909 | Peers_cleanup_destroyed_channel (cls, channel); |
907 | clean_peer (peer); | 910 | clean_peer (peer); |
908 | return; | 911 | return; |
909 | } | 912 | } |
@@ -1048,7 +1051,6 @@ client_respond (void *cls, | |||
1048 | * Handle RPS request from the client. | 1051 | * Handle RPS request from the client. |
1049 | * | 1052 | * |
1050 | * @param cls closure | 1053 | * @param cls closure |
1051 | * @param client identification of the client | ||
1052 | * @param message the actual message | 1054 | * @param message the actual message |
1053 | */ | 1055 | */ |
1054 | static void | 1056 | static void |
@@ -1100,12 +1102,11 @@ handle_client_request (void *cls, | |||
1100 | * @brief Handle a message that requests the cancellation of a request | 1102 | * @brief Handle a message that requests the cancellation of a request |
1101 | * | 1103 | * |
1102 | * @param cls unused | 1104 | * @param cls unused |
1103 | * @param client the client that requests the cancellation | ||
1104 | * @param message the message containing the id of the request | 1105 | * @param message the message containing the id of the request |
1105 | */ | 1106 | */ |
1106 | static void | 1107 | static void |
1107 | handle_client_request_cancel (void *cls, | 1108 | handle_client_request_cancel (void *cls, |
1108 | const struct GNUNET_RPS_CS_RequestCancelMessage *msg) | 1109 | const struct GNUNET_RPS_CS_RequestCancelMessage *msg) |
1109 | { | 1110 | { |
1110 | struct ClientContext *cli_ctx = cls; | 1111 | struct ClientContext *cli_ctx = cls; |
1111 | struct ReplyCls *rep_cls; | 1112 | struct ReplyCls *rep_cls; |
@@ -1157,7 +1158,6 @@ check_client_seed (void *cls, const struct GNUNET_RPS_CS_SeedMessage *msg) | |||
1157 | * Handle seed from the client. | 1158 | * Handle seed from the client. |
1158 | * | 1159 | * |
1159 | * @param cls closure | 1160 | * @param cls closure |
1160 | * @param client identification of the client | ||
1161 | * @param message the actual message | 1161 | * @param message the actual message |
1162 | */ | 1162 | */ |
1163 | static void | 1163 | static void |
@@ -1172,7 +1172,7 @@ handle_client_seed (void *cls, | |||
1172 | num_peers = ntohl (msg->num_peers); | 1172 | num_peers = ntohl (msg->num_peers); |
1173 | peers = (struct GNUNET_PeerIdentity *) &msg[1]; | 1173 | peers = (struct GNUNET_PeerIdentity *) &msg[1]; |
1174 | //peers = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity); | 1174 | //peers = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity); |
1175 | //GNUNET_memcpy (peers, &in_msg[1], num_peers * sizeof (struct GNUNET_PeerIdentity)); | 1175 | //GNUNET_memcpy (peers, &msg[1], num_peers * sizeof (struct GNUNET_PeerIdentity)); |
1176 | 1176 | ||
1177 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1177 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1178 | "Client seeded peers:\n"); | 1178 | "Client seeded peers:\n"); |
@@ -1200,18 +1200,15 @@ handle_client_seed (void *cls, | |||
1200 | * the channel is blocked for all other communication. | 1200 | * the channel is blocked for all other communication. |
1201 | * | 1201 | * |
1202 | * @param cls Closure | 1202 | * @param cls Closure |
1203 | * @param channel The channel the CHECK was received over | ||
1204 | * @param channel_ctx The context associated with this channel | ||
1205 | * @param msg The message header | 1203 | * @param msg The message header |
1206 | */ | 1204 | */ |
1207 | static int | 1205 | static void |
1208 | handle_peer_check (void *cls, | 1206 | handle_peer_check (void *cls, |
1209 | struct GNUNET_CADET_Channel *channel, | 1207 | const struct GNUNET_MessageHeader *msg) |
1210 | void **channel_ctx, | ||
1211 | const struct GNUNET_MessageHeader *msg) | ||
1212 | { | 1208 | { |
1213 | GNUNET_CADET_receive_done (channel); | 1209 | const struct GNUNET_PeerIdentity *peer = cls; |
1214 | return GNUNET_OK; | 1210 | |
1211 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); | ||
1215 | } | 1212 | } |
1216 | 1213 | ||
1217 | /** | 1214 | /** |
@@ -1221,24 +1218,16 @@ handle_peer_check (void *cls, | |||
1221 | * in the temporary list for pushed PeerIDs. | 1218 | * in the temporary list for pushed PeerIDs. |
1222 | * | 1219 | * |
1223 | * @param cls Closure | 1220 | * @param cls Closure |
1224 | * @param channel The channel the PUSH was received over | ||
1225 | * @param channel_ctx The context associated with this channel | ||
1226 | * @param msg The message header | 1221 | * @param msg The message header |
1227 | */ | 1222 | */ |
1228 | static int | 1223 | static void |
1229 | handle_peer_push (void *cls, | 1224 | handle_peer_push (void *cls, |
1230 | struct GNUNET_CADET_Channel *channel, | 1225 | const struct GNUNET_MessageHeader *msg) |
1231 | void **channel_ctx, | ||
1232 | const struct GNUNET_MessageHeader *msg) | ||
1233 | { | 1226 | { |
1234 | const struct GNUNET_PeerIdentity *peer; | 1227 | const struct GNUNET_PeerIdentity *peer = cls; |
1235 | 1228 | ||
1236 | // (check the proof of work (?)) | 1229 | // (check the proof of work (?)) |
1237 | 1230 | ||
1238 | peer = (const struct GNUNET_PeerIdentity *) | ||
1239 | GNUNET_CADET_channel_get_info (channel, GNUNET_CADET_OPTION_PEER); | ||
1240 | // FIXME wait for cadet to change this function | ||
1241 | |||
1242 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1231 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1243 | "Received PUSH (%s)\n", | 1232 | "Received PUSH (%s)\n", |
1244 | GNUNET_i2s (peer)); | 1233 | GNUNET_i2s (peer)); |
@@ -1261,23 +1250,20 @@ handle_peer_push (void *cls, | |||
1261 | tmp_att_peer); | 1250 | tmp_att_peer); |
1262 | add_peer_array_to_set (peer, 1, att_peer_set); | 1251 | add_peer_array_to_set (peer, 1, att_peer_set); |
1263 | } | 1252 | } |
1264 | GNUNET_CADET_receive_done (channel); | 1253 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); |
1265 | return GNUNET_OK; | ||
1266 | } | 1254 | } |
1267 | 1255 | ||
1268 | 1256 | ||
1269 | else if (2 == mal_type) | 1257 | else if (2 == mal_type) |
1270 | { /* We attack one single well-known peer - simply ignore */ | 1258 | { /* We attack one single well-known peer - simply ignore */ |
1271 | GNUNET_CADET_receive_done (channel); | 1259 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); |
1272 | return GNUNET_OK; | ||
1273 | } | 1260 | } |
1274 | #endif /* ENABLE_MALICIOUS */ | 1261 | #endif /* ENABLE_MALICIOUS */ |
1275 | 1262 | ||
1276 | /* Add the sending peer to the push_map */ | 1263 | /* Add the sending peer to the push_map */ |
1277 | CustomPeerMap_put (push_map, peer); | 1264 | CustomPeerMap_put (push_map, peer); |
1278 | 1265 | ||
1279 | GNUNET_CADET_receive_done (channel); | 1266 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); |
1280 | return GNUNET_OK; | ||
1281 | } | 1267 | } |
1282 | 1268 | ||
1283 | 1269 | ||
@@ -1287,24 +1273,15 @@ handle_peer_push (void *cls, | |||
1287 | * Reply with the view of PeerIDs. | 1273 | * Reply with the view of PeerIDs. |
1288 | * | 1274 | * |
1289 | * @param cls Closure | 1275 | * @param cls Closure |
1290 | * @param channel The channel the PULL REQUEST was received over | ||
1291 | * @param channel_ctx The context associated with this channel | ||
1292 | * @param msg The message header | 1276 | * @param msg The message header |
1293 | */ | 1277 | */ |
1294 | static int | 1278 | static void |
1295 | handle_peer_pull_request (void *cls, | 1279 | handle_peer_pull_request (void *cls, |
1296 | struct GNUNET_CADET_Channel *channel, | 1280 | const struct GNUNET_MessageHeader *msg) |
1297 | void **channel_ctx, | ||
1298 | const struct GNUNET_MessageHeader *msg) | ||
1299 | { | 1281 | { |
1300 | struct GNUNET_PeerIdentity *peer; | 1282 | struct GNUNET_PeerIdentity *peer = cls; |
1301 | const struct GNUNET_PeerIdentity *view_array; | 1283 | const struct GNUNET_PeerIdentity *view_array; |
1302 | 1284 | ||
1303 | peer = (struct GNUNET_PeerIdentity *) | ||
1304 | GNUNET_CADET_channel_get_info (channel, | ||
1305 | GNUNET_CADET_OPTION_PEER); | ||
1306 | // FIXME wait for cadet to change this function | ||
1307 | |||
1308 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer)); | 1285 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer)); |
1309 | 1286 | ||
1310 | #ifdef ENABLE_MALICIOUS | 1287 | #ifdef ENABLE_MALICIOUS |
@@ -1312,8 +1289,7 @@ handle_peer_pull_request (void *cls, | |||
1312 | || 3 == mal_type) | 1289 | || 3 == mal_type) |
1313 | { /* Try to maximise representation */ | 1290 | { /* Try to maximise representation */ |
1314 | send_pull_reply (peer, mal_peers, num_mal_peers); | 1291 | send_pull_reply (peer, mal_peers, num_mal_peers); |
1315 | GNUNET_CADET_receive_done (channel); | 1292 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); |
1316 | return GNUNET_OK; | ||
1317 | } | 1293 | } |
1318 | 1294 | ||
1319 | else if (2 == mal_type) | 1295 | else if (2 == mal_type) |
@@ -1322,101 +1298,93 @@ handle_peer_pull_request (void *cls, | |||
1322 | { | 1298 | { |
1323 | send_pull_reply (peer, mal_peers, num_mal_peers); | 1299 | send_pull_reply (peer, mal_peers, num_mal_peers); |
1324 | } | 1300 | } |
1325 | GNUNET_CADET_receive_done (channel); | 1301 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); |
1326 | return GNUNET_OK; | ||
1327 | } | 1302 | } |
1328 | #endif /* ENABLE_MALICIOUS */ | 1303 | #endif /* ENABLE_MALICIOUS */ |
1329 | 1304 | ||
1330 | view_array = View_get_as_array (); | 1305 | view_array = View_get_as_array (); |
1331 | |||
1332 | send_pull_reply (peer, view_array, View_size ()); | 1306 | send_pull_reply (peer, view_array, View_size ()); |
1333 | 1307 | ||
1334 | GNUNET_CADET_receive_done (channel); | 1308 | GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); |
1335 | return GNUNET_OK; | ||
1336 | } | 1309 | } |
1337 | 1310 | ||
1338 | 1311 | ||
1339 | /** | 1312 | /** |
1340 | * Handle PULL REPLY message from another peer. | ||
1341 | * | ||
1342 | * Check whether we sent a corresponding request and | 1313 | * Check whether we sent a corresponding request and |
1343 | * whether this reply is the first one. | 1314 | * whether this reply is the first one. |
1344 | * | 1315 | * |
1345 | * @param cls Closure | 1316 | * @param cls Closure |
1346 | * @param channel The channel the PUSH was received over | ||
1347 | * @param channel_ctx The context associated with this channel | ||
1348 | * @param msg The message header | 1317 | * @param msg The message header |
1349 | */ | 1318 | */ |
1350 | static int | 1319 | static int |
1351 | handle_peer_pull_reply (void *cls, | 1320 | check_peer_pull_reply (void *cls, |
1352 | struct GNUNET_CADET_Channel *channel, | 1321 | const struct GNUNET_RPS_P2P_PullReplyMessage *msg) |
1353 | void **channel_ctx, | ||
1354 | const struct GNUNET_MessageHeader *msg) | ||
1355 | { | 1322 | { |
1356 | struct GNUNET_RPS_P2P_PullReplyMessage *in_msg; | 1323 | struct GNUNET_PeerIdentity *sender = cls; |
1357 | struct GNUNET_PeerIdentity *peers; | ||
1358 | struct GNUNET_PeerIdentity *sender; | ||
1359 | uint32_t i; | ||
1360 | #ifdef ENABLE_MALICIOUS | ||
1361 | struct AttackedPeer *tmp_att_peer; | ||
1362 | #endif /* ENABLE_MALICIOUS */ | ||
1363 | 1324 | ||
1364 | /* Check for protocol violation */ | 1325 | if (sizeof (struct GNUNET_RPS_P2P_PullReplyMessage) > ntohs (msg->header.size)) |
1365 | if (sizeof (struct GNUNET_RPS_P2P_PullReplyMessage) > ntohs (msg->size)) | ||
1366 | { | 1326 | { |
1367 | GNUNET_break_op (0); | 1327 | GNUNET_break_op (0); |
1368 | GNUNET_CADET_receive_done (channel); | ||
1369 | return GNUNET_SYSERR; | 1328 | return GNUNET_SYSERR; |
1370 | } | 1329 | } |
1371 | 1330 | ||
1372 | in_msg = (struct GNUNET_RPS_P2P_PullReplyMessage *) msg; | 1331 | if ((ntohs (msg->header.size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) / |
1373 | if ((ntohs (msg->size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) / | 1332 | sizeof (struct GNUNET_PeerIdentity) != ntohl (msg->num_peers)) |
1374 | sizeof (struct GNUNET_PeerIdentity) != ntohl (in_msg->num_peers)) | ||
1375 | { | 1333 | { |
1376 | LOG (GNUNET_ERROR_TYPE_ERROR, | 1334 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1377 | "message says it sends %" PRIu32 " peers, have space for %lu peers\n", | 1335 | "message says it sends %" PRIu32 " peers, have space for %lu peers\n", |
1378 | ntohl (in_msg->num_peers), | 1336 | ntohl (msg->num_peers), |
1379 | (ntohs (msg->size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) / | 1337 | (ntohs (msg->header.size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) / |
1380 | sizeof (struct GNUNET_PeerIdentity)); | 1338 | sizeof (struct GNUNET_PeerIdentity)); |
1381 | GNUNET_break_op (0); | 1339 | GNUNET_break_op (0); |
1382 | GNUNET_CADET_receive_done (channel); | ||
1383 | return GNUNET_SYSERR; | 1340 | return GNUNET_SYSERR; |
1384 | } | 1341 | } |
1385 | 1342 | ||
1386 | // Guess simply casting isn't the nicest way... | ||
1387 | // FIXME wait for cadet to change this function | ||
1388 | sender = (struct GNUNET_PeerIdentity *) | ||
1389 | GNUNET_CADET_channel_get_info (channel, GNUNET_CADET_OPTION_PEER); | ||
1390 | |||
1391 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REPLY (%s)\n", GNUNET_i2s (sender)); | ||
1392 | |||
1393 | if (GNUNET_YES != Peers_check_peer_flag (sender, Peers_PULL_REPLY_PENDING)) | 1343 | if (GNUNET_YES != Peers_check_peer_flag (sender, Peers_PULL_REPLY_PENDING)) |
1394 | { | 1344 | { |
1395 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1345 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1396 | "Received a pull reply from a peer we didn't request one from!\n"); | 1346 | "Received a pull reply from a peer we didn't request one from!\n"); |
1397 | GNUNET_CADET_receive_done (channel); | ||
1398 | GNUNET_break_op (0); | 1347 | GNUNET_break_op (0); |
1399 | return GNUNET_OK; | 1348 | return GNUNET_SYSERR; |
1400 | } | 1349 | } |
1350 | return GNUNET_OK; | ||
1351 | } | ||
1352 | |||
1353 | /** | ||
1354 | * Handle PULL REPLY message from another peer. | ||
1355 | * | ||
1356 | * @param cls Closure | ||
1357 | * @param msg The message header | ||
1358 | */ | ||
1359 | static void | ||
1360 | handle_peer_pull_reply (void *cls, | ||
1361 | const struct GNUNET_RPS_P2P_PullReplyMessage *msg) | ||
1362 | { | ||
1363 | struct GNUNET_PeerIdentity *peers; | ||
1364 | struct GNUNET_PeerIdentity *sender = cls; | ||
1365 | uint32_t i; | ||
1366 | #ifdef ENABLE_MALICIOUS | ||
1367 | struct AttackedPeer *tmp_att_peer; | ||
1368 | #endif /* ENABLE_MALICIOUS */ | ||
1401 | 1369 | ||
1370 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REPLY (%s)\n", GNUNET_i2s (sender)); | ||
1402 | 1371 | ||
1403 | #ifdef ENABLE_MALICIOUS | 1372 | #ifdef ENABLE_MALICIOUS |
1404 | // We shouldn't even receive pull replies as we're not sending | 1373 | // We shouldn't even receive pull replies as we're not sending |
1405 | if (2 == mal_type) | 1374 | if (2 == mal_type) |
1406 | { | 1375 | { |
1407 | GNUNET_CADET_receive_done (channel); | 1376 | GNUNET_CADET_receive_done (Peers_get_recv_channel (sender)); |
1408 | return GNUNET_OK; | ||
1409 | } | 1377 | } |
1410 | #endif /* ENABLE_MALICIOUS */ | 1378 | #endif /* ENABLE_MALICIOUS */ |
1411 | 1379 | ||
1412 | /* Do actual logic */ | 1380 | /* Do actual logic */ |
1413 | peers = (struct GNUNET_PeerIdentity *) &in_msg[1]; | 1381 | peers = (struct GNUNET_PeerIdentity *) &msg[1]; |
1414 | 1382 | ||
1415 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1383 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1416 | "PULL REPLY received, got following %u peers:\n", | 1384 | "PULL REPLY received, got following %u peers:\n", |
1417 | ntohl (in_msg->num_peers)); | 1385 | ntohl (msg->num_peers)); |
1418 | 1386 | ||
1419 | for (i = 0 ; i < ntohl (in_msg->num_peers) ; i++) | 1387 | for (i = 0; i < ntohl (msg->num_peers); i++) |
1420 | { | 1388 | { |
1421 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1389 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1422 | "%u. %s\n", | 1390 | "%u. %s\n", |
@@ -1466,8 +1434,7 @@ handle_peer_pull_reply (void *cls, | |||
1466 | Peers_unset_peer_flag (sender, Peers_PULL_REPLY_PENDING); | 1434 | Peers_unset_peer_flag (sender, Peers_PULL_REPLY_PENDING); |
1467 | clean_peer (sender); | 1435 | clean_peer (sender); |
1468 | 1436 | ||
1469 | GNUNET_CADET_receive_done (channel); | 1437 | GNUNET_CADET_receive_done (Peers_get_recv_channel (sender)); |
1470 | return GNUNET_OK; | ||
1471 | } | 1438 | } |
1472 | 1439 | ||
1473 | 1440 | ||
@@ -2273,15 +2240,24 @@ run (void *cls, | |||
2273 | const struct GNUNET_CONFIGURATION_Handle *c, | 2240 | const struct GNUNET_CONFIGURATION_Handle *c, |
2274 | struct GNUNET_SERVICE_Handle *service) | 2241 | struct GNUNET_SERVICE_Handle *service) |
2275 | { | 2242 | { |
2276 | static const struct GNUNET_CADET_MessageHandler cadet_handlers[] = { | 2243 | struct GNUNET_MQ_MessageHandler cadet_handlers[] = { |
2277 | {&handle_peer_check , GNUNET_MESSAGE_TYPE_RPS_PP_CHECK_LIVE, | 2244 | GNUNET_MQ_hd_fixed_size (peer_check, |
2278 | sizeof (struct GNUNET_MessageHeader)}, | 2245 | GNUNET_MESSAGE_TYPE_RPS_PP_CHECK_LIVE, |
2279 | {&handle_peer_push , GNUNET_MESSAGE_TYPE_RPS_PP_PUSH, | 2246 | struct GNUNET_MessageHeader, |
2280 | sizeof (struct GNUNET_MessageHeader)}, | 2247 | NULL), |
2281 | {&handle_peer_pull_request, GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST, | 2248 | GNUNET_MQ_hd_fixed_size (peer_push, |
2282 | sizeof (struct GNUNET_MessageHeader)}, | 2249 | GNUNET_MESSAGE_TYPE_RPS_PP_PUSH, |
2283 | {&handle_peer_pull_reply , GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY, 0}, | 2250 | struct GNUNET_MessageHeader, |
2284 | {NULL, 0, 0} | 2251 | NULL), |
2252 | GNUNET_MQ_hd_fixed_size (peer_pull_request, | ||
2253 | GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REQUEST, | ||
2254 | struct GNUNET_MessageHeader, | ||
2255 | NULL), | ||
2256 | GNUNET_MQ_hd_var_size (peer_pull_reply, | ||
2257 | GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY, | ||
2258 | struct GNUNET_RPS_P2P_PullReplyMessage, | ||
2259 | NULL), | ||
2260 | GNUNET_MQ_handler_end () | ||
2285 | }; | 2261 | }; |
2286 | 2262 | ||
2287 | int size; | 2263 | int size; |
@@ -2373,21 +2349,23 @@ run (void *cls, | |||
2373 | 2349 | ||
2374 | 2350 | ||
2375 | /* Initialise cadet */ | 2351 | /* Initialise cadet */ |
2376 | cadet_handle = GNUNET_CADET_connect (cfg, | 2352 | cadet_handle = GNUNET_CADET_connecT (cfg); |
2377 | cls, | ||
2378 | &cleanup_destroyed_channel, | ||
2379 | cadet_handlers); | ||
2380 | GNUNET_assert (NULL != cadet_handle); | 2353 | GNUNET_assert (NULL != cadet_handle); |
2381 | GNUNET_CRYPTO_hash (GNUNET_APPLICATION_PORT_RPS, | 2354 | GNUNET_CRYPTO_hash (GNUNET_APPLICATION_PORT_RPS, |
2382 | strlen (GNUNET_APPLICATION_PORT_RPS), | 2355 | strlen (GNUNET_APPLICATION_PORT_RPS), |
2383 | &port); | 2356 | &port); |
2384 | GNUNET_CADET_open_port (cadet_handle, | 2357 | cadet_port = GNUNET_CADET_open_porT (cadet_handle, |
2385 | &port, | 2358 | &port, |
2386 | &Peers_handle_inbound_channel, cls); | 2359 | &Peers_handle_inbound_channel, /* Connect handler */ |
2360 | NULL, /* cls */ | ||
2361 | NULL, /* WindowSize handler */ | ||
2362 | cleanup_destroyed_channel, /* Disconnect handler */ | ||
2363 | cadet_handlers); | ||
2387 | 2364 | ||
2388 | 2365 | ||
2389 | peerinfo_handle = GNUNET_PEERINFO_connect (cfg); | 2366 | peerinfo_handle = GNUNET_PEERINFO_connect (cfg); |
2390 | Peers_initialise (fn_valid_peers, cadet_handle, &own_identity); | 2367 | Peers_initialise (fn_valid_peers, cadet_handle, cleanup_destroyed_channel, |
2368 | cadet_handlers, &own_identity); | ||
2391 | GNUNET_free (fn_valid_peers); | 2369 | GNUNET_free (fn_valid_peers); |
2392 | 2370 | ||
2393 | /* Initialise sampler */ | 2371 | /* Initialise sampler */ |
diff --git a/src/rps/gnunet-service-rps_peers.c b/src/rps/gnunet-service-rps_peers.c index e0b278bd0..db540fa3d 100644 --- a/src/rps/gnunet-service-rps_peers.c +++ b/src/rps/gnunet-service-rps_peers.c | |||
@@ -251,6 +251,17 @@ static const struct GNUNET_PeerIdentity *own_identity; | |||
251 | */ | 251 | */ |
252 | static struct GNUNET_CADET_Handle *cadet_handle; | 252 | static struct GNUNET_CADET_Handle *cadet_handle; |
253 | 253 | ||
254 | /** | ||
255 | * @brief Disconnect handler | ||
256 | */ | ||
257 | static GNUNET_CADET_DisconnectEventHandler cleanup_destroyed_channel; | ||
258 | |||
259 | /** | ||
260 | * @brief cadet handlers | ||
261 | */ | ||
262 | static const struct GNUNET_MQ_MessageHandler *cadet_handlers; | ||
263 | |||
264 | |||
254 | 265 | ||
255 | /** | 266 | /** |
256 | * @brief Get the #PeerContext associated with a peer | 267 | * @brief Get the #PeerContext associated with a peer |
@@ -522,11 +533,14 @@ get_channel (const struct GNUNET_PeerIdentity *peer) | |||
522 | strlen (GNUNET_APPLICATION_PORT_RPS), | 533 | strlen (GNUNET_APPLICATION_PORT_RPS), |
523 | &port); | 534 | &port); |
524 | peer_ctx->send_channel = | 535 | peer_ctx->send_channel = |
525 | GNUNET_CADET_channel_create (cadet_handle, | 536 | GNUNET_CADET_channel_creatE (cadet_handle, |
526 | peer_ctx->send_channel_flags, /* context */ | 537 | (struct GNUNET_PeerIdentity *) peer, /* context */ |
527 | peer, | 538 | peer, |
528 | &port, | 539 | &port, |
529 | GNUNET_CADET_OPTION_RELIABLE); | 540 | GNUNET_CADET_OPTION_RELIABLE, |
541 | NULL, /* WindowSize handler */ | ||
542 | cleanup_destroyed_channel, /* Disconnect handler */ | ||
543 | cadet_handlers); | ||
530 | } | 544 | } |
531 | GNUNET_assert (NULL != peer_ctx->send_channel); | 545 | GNUNET_assert (NULL != peer_ctx->send_channel); |
532 | return peer_ctx->send_channel; | 546 | return peer_ctx->send_channel; |
@@ -932,15 +946,21 @@ restore_valid_peers () | |||
932 | * | 946 | * |
933 | * @param fn_valid_peers filename of the file used to store valid peer ids | 947 | * @param fn_valid_peers filename of the file used to store valid peer ids |
934 | * @param cadet_h cadet handle | 948 | * @param cadet_h cadet handle |
949 | * @param disconnect_handler Disconnect handler | ||
950 | * @param c_handlers cadet handlers | ||
935 | * @param own_id own peer identity | 951 | * @param own_id own peer identity |
936 | */ | 952 | */ |
937 | void | 953 | void |
938 | Peers_initialise (char* fn_valid_peers, | 954 | Peers_initialise (char* fn_valid_peers, |
939 | struct GNUNET_CADET_Handle *cadet_h, | 955 | struct GNUNET_CADET_Handle *cadet_h, |
956 | GNUNET_CADET_DisconnectEventHandler disconnect_handler, | ||
957 | const struct GNUNET_MQ_MessageHandler *c_handlers, | ||
940 | const struct GNUNET_PeerIdentity *own_id) | 958 | const struct GNUNET_PeerIdentity *own_id) |
941 | { | 959 | { |
942 | filename_valid_peers = GNUNET_strdup (fn_valid_peers); | 960 | filename_valid_peers = GNUNET_strdup (fn_valid_peers); |
943 | cadet_handle = cadet_h; | 961 | cadet_handle = cadet_h; |
962 | cleanup_destroyed_channel = disconnect_handler; | ||
963 | cadet_handlers = c_handlers; | ||
944 | own_identity = own_id; | 964 | own_identity = own_id; |
945 | peer_map = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO); | 965 | peer_map = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO); |
946 | valid_peers = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO); | 966 | valid_peers = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO); |
@@ -1279,6 +1299,34 @@ Peers_check_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags | |||
1279 | return check_channel_flag_set (channel_flags, flags); | 1299 | return check_channel_flag_set (channel_flags, flags); |
1280 | } | 1300 | } |
1281 | 1301 | ||
1302 | /** | ||
1303 | * @brief Get the flags for the channel in @a role for @a peer. | ||
1304 | * | ||
1305 | * @param peer Peer to get the channel flags for. | ||
1306 | * @param role Role of channel to get flags for | ||
1307 | * | ||
1308 | * @return The flags. | ||
1309 | */ | ||
1310 | uint32_t * | ||
1311 | Peers_get_channel_flag (const struct GNUNET_PeerIdentity *peer, | ||
1312 | enum Peers_ChannelRole role) | ||
1313 | { | ||
1314 | const struct PeerContext *peer_ctx; | ||
1315 | |||
1316 | peer_ctx = get_peer_ctx (peer); | ||
1317 | if (Peers_CHANNEL_ROLE_SENDING == role) | ||
1318 | { | ||
1319 | return peer_ctx->send_channel_flags; | ||
1320 | } | ||
1321 | else if (Peers_CHANNEL_ROLE_RECEIVING == role) | ||
1322 | { | ||
1323 | return peer_ctx->recv_channel_flags; | ||
1324 | } | ||
1325 | else | ||
1326 | { | ||
1327 | GNUNET_assert (0); | ||
1328 | } | ||
1329 | } | ||
1282 | 1330 | ||
1283 | /** | 1331 | /** |
1284 | * @brief Check whether we have information about the given peer. | 1332 | * @brief Check whether we have information about the given peer. |
@@ -1358,8 +1406,6 @@ Peers_check_peer_send_intention (const struct GNUNET_PeerIdentity *peer) | |||
1358 | * @param cls The closure | 1406 | * @param cls The closure |
1359 | * @param channel The channel the peer wants to establish | 1407 | * @param channel The channel the peer wants to establish |
1360 | * @param initiator The peer's peer ID | 1408 | * @param initiator The peer's peer ID |
1361 | * @param port The port the channel is being established over | ||
1362 | * @param options Further options | ||
1363 | * | 1409 | * |
1364 | * @return initial channel context for the channel | 1410 | * @return initial channel context for the channel |
1365 | * (can be NULL -- that's not an error) | 1411 | * (can be NULL -- that's not an error) |
@@ -1367,9 +1413,7 @@ Peers_check_peer_send_intention (const struct GNUNET_PeerIdentity *peer) | |||
1367 | void * | 1413 | void * |
1368 | Peers_handle_inbound_channel (void *cls, | 1414 | Peers_handle_inbound_channel (void *cls, |
1369 | struct GNUNET_CADET_Channel *channel, | 1415 | struct GNUNET_CADET_Channel *channel, |
1370 | const struct GNUNET_PeerIdentity *initiator, | 1416 | const struct GNUNET_PeerIdentity *initiator) |
1371 | const struct GNUNET_HashCode *port, | ||
1372 | enum GNUNET_CADET_ChannelOption options) | ||
1373 | { | 1417 | { |
1374 | struct PeerContext *peer_ctx; | 1418 | struct PeerContext *peer_ctx; |
1375 | 1419 | ||
@@ -1387,10 +1431,10 @@ Peers_handle_inbound_channel (void *cls, | |||
1387 | Peers_CHANNEL_ESTABLISHED_TWICE); | 1431 | Peers_CHANNEL_ESTABLISHED_TWICE); |
1388 | GNUNET_CADET_channel_destroy (channel); | 1432 | GNUNET_CADET_channel_destroy (channel); |
1389 | /* return the channel context */ | 1433 | /* return the channel context */ |
1390 | return peer_ctx->recv_channel_flags; | 1434 | return (struct PeerContext *) initiator; |
1391 | } | 1435 | } |
1392 | peer_ctx->recv_channel = channel; | 1436 | peer_ctx->recv_channel = channel; |
1393 | return peer_ctx->recv_channel_flags; | 1437 | return (struct PeerContext *) initiator; |
1394 | } | 1438 | } |
1395 | 1439 | ||
1396 | 1440 | ||
@@ -1500,8 +1544,7 @@ Peers_destroy_sending_channel (const struct GNUNET_PeerIdentity *peer) | |||
1500 | */ | 1544 | */ |
1501 | void | 1545 | void |
1502 | Peers_cleanup_destroyed_channel (void *cls, | 1546 | Peers_cleanup_destroyed_channel (void *cls, |
1503 | const struct GNUNET_CADET_Channel *channel, | 1547 | const struct GNUNET_CADET_Channel *channel) |
1504 | void *channel_ctx) | ||
1505 | { | 1548 | { |
1506 | struct GNUNET_PeerIdentity *peer; | 1549 | struct GNUNET_PeerIdentity *peer; |
1507 | struct PeerContext *peer_ctx; | 1550 | struct PeerContext *peer_ctx; |
@@ -1635,4 +1678,28 @@ Peers_schedule_operation (const struct GNUNET_PeerIdentity *peer, | |||
1635 | return GNUNET_NO; | 1678 | return GNUNET_NO; |
1636 | } | 1679 | } |
1637 | 1680 | ||
1681 | /** | ||
1682 | * @brief Get the recv_channel of @a peer. | ||
1683 | * Needed to correctly handle (call #GNUNET_CADET_receive_done()) incoming | ||
1684 | * messages. | ||
1685 | * | ||
1686 | * @param peer The peer to get the recv_channel from. | ||
1687 | * | ||
1688 | * @return The recv_channel. | ||
1689 | */ | ||
1690 | struct GNUNET_CADET_Channel * | ||
1691 | Peers_get_recv_channel (const struct GNUNET_PeerIdentity *peer) | ||
1692 | { | ||
1693 | struct PeerContext *peer_ctx; | ||
1694 | |||
1695 | if (0 == GNUNET_CRYPTO_cmp_peer_identity (peer, own_identity)) | ||
1696 | { | ||
1697 | return GNUNET_NO; | ||
1698 | } | ||
1699 | GNUNET_assert (GNUNET_YES == Peers_check_peer_known (peer)); | ||
1700 | |||
1701 | peer_ctx = get_peer_ctx (peer); | ||
1702 | return peer_ctx->recv_channel; | ||
1703 | } | ||
1704 | |||
1638 | /* end of gnunet-service-rps_peers.c */ | 1705 | /* end of gnunet-service-rps_peers.c */ |
diff --git a/src/rps/gnunet-service-rps_peers.h b/src/rps/gnunet-service-rps_peers.h index bbac86003..15970a7ce 100644 --- a/src/rps/gnunet-service-rps_peers.h +++ b/src/rps/gnunet-service-rps_peers.h | |||
@@ -117,11 +117,15 @@ typedef int | |||
117 | * | 117 | * |
118 | * @param fn_valid_peers filename of the file used to store valid peer ids | 118 | * @param fn_valid_peers filename of the file used to store valid peer ids |
119 | * @param cadet_h cadet handle | 119 | * @param cadet_h cadet handle |
120 | * @param disconnect_handler Disconnect handler | ||
121 | * @param c_handlers cadet handlers | ||
120 | * @param own_id own peer identity | 122 | * @param own_id own peer identity |
121 | */ | 123 | */ |
122 | void | 124 | void |
123 | Peers_initialise (char* fn_valid_peers, | 125 | Peers_initialise (char* fn_valid_peers, |
124 | struct GNUNET_CADET_Handle *cadet_h, | 126 | struct GNUNET_CADET_Handle *cadet_h, |
127 | GNUNET_CADET_DisconnectEventHandler disconnect_handler, | ||
128 | const struct GNUNET_MQ_MessageHandler *c_handlers, | ||
125 | const struct GNUNET_PeerIdentity *own_id); | 129 | const struct GNUNET_PeerIdentity *own_id); |
126 | 130 | ||
127 | /** | 131 | /** |
@@ -259,6 +263,18 @@ int | |||
259 | Peers_check_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags); | 263 | Peers_check_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags); |
260 | 264 | ||
261 | /** | 265 | /** |
266 | * @brief Get the flags for the channel in @a role for @a peer. | ||
267 | * | ||
268 | * @param peer Peer to get the channel flags for. | ||
269 | * @param role Role of channel to get flags for | ||
270 | * | ||
271 | * @return The flags. | ||
272 | */ | ||
273 | uint32_t * | ||
274 | Peers_get_channel_flag (const struct GNUNET_PeerIdentity *peer, | ||
275 | enum Peers_ChannelRole role); | ||
276 | |||
277 | /** | ||
262 | * @brief Check whether we have information about the given peer. | 278 | * @brief Check whether we have information about the given peer. |
263 | * | 279 | * |
264 | * FIXME probably deprecated. Make this the new _online. | 280 | * FIXME probably deprecated. Make this the new _online. |
@@ -312,8 +328,6 @@ Peers_check_peer_send_intention (const struct GNUNET_PeerIdentity *peer); | |||
312 | * @param cls The closure | 328 | * @param cls The closure |
313 | * @param channel The channel the peer wants to establish | 329 | * @param channel The channel the peer wants to establish |
314 | * @param initiator The peer's peer ID | 330 | * @param initiator The peer's peer ID |
315 | * @param port The port the channel is being established over | ||
316 | * @param options Further options | ||
317 | * | 331 | * |
318 | * @return initial channel context for the channel | 332 | * @return initial channel context for the channel |
319 | * (can be NULL -- that's not an error) | 333 | * (can be NULL -- that's not an error) |
@@ -321,9 +335,7 @@ Peers_check_peer_send_intention (const struct GNUNET_PeerIdentity *peer); | |||
321 | void * | 335 | void * |
322 | Peers_handle_inbound_channel (void *cls, | 336 | Peers_handle_inbound_channel (void *cls, |
323 | struct GNUNET_CADET_Channel *channel, | 337 | struct GNUNET_CADET_Channel *channel, |
324 | const struct GNUNET_PeerIdentity *initiator, | 338 | const struct GNUNET_PeerIdentity *initiator); |
325 | const struct GNUNET_HashCode *port, | ||
326 | enum GNUNET_CADET_ChannelOption options); | ||
327 | 339 | ||
328 | /** | 340 | /** |
329 | * @brief Check whether a sending channel towards the given peer exists | 341 | * @brief Check whether a sending channel towards the given peer exists |
@@ -379,8 +391,7 @@ Peers_destroy_sending_channel (const struct GNUNET_PeerIdentity *peer); | |||
379 | */ | 391 | */ |
380 | void | 392 | void |
381 | Peers_cleanup_destroyed_channel (void *cls, | 393 | Peers_cleanup_destroyed_channel (void *cls, |
382 | const struct GNUNET_CADET_Channel *channel, | 394 | const struct GNUNET_CADET_Channel *channel); |
383 | void *channel_ctx); | ||
384 | 395 | ||
385 | /** | 396 | /** |
386 | * @brief Send a message to another peer. | 397 | * @brief Send a message to another peer. |
@@ -411,4 +422,16 @@ int | |||
411 | Peers_schedule_operation (const struct GNUNET_PeerIdentity *peer, | 422 | Peers_schedule_operation (const struct GNUNET_PeerIdentity *peer, |
412 | const PeerOp peer_op); | 423 | const PeerOp peer_op); |
413 | 424 | ||
425 | /** | ||
426 | * @brief Get the recv_channel of @a peer. | ||
427 | * Needed to correctly handle (call #GNUNET_CADET_receive_done()) incoming | ||
428 | * messages. | ||
429 | * | ||
430 | * @param peer The peer to get the recv_channel from. | ||
431 | * | ||
432 | * @return The recv_channel. | ||
433 | */ | ||
434 | struct GNUNET_CADET_Channel * | ||
435 | Peers_get_recv_channel (const struct GNUNET_PeerIdentity *peer); | ||
436 | |||
414 | /* end of gnunet-service-rps_peers.h */ | 437 | /* end of gnunet-service-rps_peers.h */ |
diff --git a/src/rps/test_service_rps_peers.c b/src/rps/test_service_rps_peers.c index 37ed1974c..9cd677fef 100644 --- a/src/rps/test_service_rps_peers.c +++ b/src/rps/test_service_rps_peers.c | |||
@@ -59,25 +59,25 @@ check () | |||
59 | memset (&own_id, 1, sizeof (own_id)); | 59 | memset (&own_id, 1, sizeof (own_id)); |
60 | 60 | ||
61 | /* Do nothing */ | 61 | /* Do nothing */ |
62 | Peers_initialise (FN_VALID_PEERS, NULL, &own_id); | 62 | Peers_initialise (FN_VALID_PEERS, NULL, NULL, NULL, &own_id); |
63 | Peers_terminate (); | 63 | Peers_terminate (); |
64 | 64 | ||
65 | 65 | ||
66 | /* Create peer */ | 66 | /* Create peer */ |
67 | Peers_initialise (FN_VALID_PEERS, NULL, &own_id); | 67 | Peers_initialise (FN_VALID_PEERS, NULL, NULL, NULL, &own_id); |
68 | CHECK (GNUNET_YES == Peers_insert_peer (&k1)); | 68 | CHECK (GNUNET_YES == Peers_insert_peer (&k1)); |
69 | Peers_terminate (); | 69 | Peers_terminate (); |
70 | 70 | ||
71 | 71 | ||
72 | /* Create peer */ | 72 | /* Create peer */ |
73 | Peers_initialise (FN_VALID_PEERS, NULL, &own_id); | 73 | Peers_initialise (FN_VALID_PEERS, NULL, NULL, NULL, &own_id); |
74 | CHECK (GNUNET_YES == Peers_insert_peer (&k1)); | 74 | CHECK (GNUNET_YES == Peers_insert_peer (&k1)); |
75 | CHECK (GNUNET_YES == Peers_remove_peer (&k1)); | 75 | CHECK (GNUNET_YES == Peers_remove_peer (&k1)); |
76 | Peers_terminate (); | 76 | Peers_terminate (); |
77 | 77 | ||
78 | 78 | ||
79 | /* Insertion and Removal */ | 79 | /* Insertion and Removal */ |
80 | Peers_initialise (FN_VALID_PEERS, NULL, &own_id); | 80 | Peers_initialise (FN_VALID_PEERS, NULL, NULL, NULL, &own_id); |
81 | CHECK (GNUNET_NO == Peers_check_peer_known (&k1)); | 81 | CHECK (GNUNET_NO == Peers_check_peer_known (&k1)); |
82 | 82 | ||
83 | CHECK (GNUNET_YES == Peers_insert_peer (&k1)); | 83 | CHECK (GNUNET_YES == Peers_insert_peer (&k1)); |