diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-28 15:43:23 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-28 15:43:23 +0000 |
commit | 91140caa33349036934b5b86238c0ec6265e0a13 (patch) | |
tree | 7340da5a8452a12588be643e59458f2f0a6891e1 /src/transport/gnunet-service-transport_validation.c | |
parent | a55b2de0863937cfe9c0fcbf41882b81f4c82c9c (diff) | |
download | gnunet-91140caa33349036934b5b86238c0ec6265e0a13.tar.gz gnunet-91140caa33349036934b5b86238c0ec6265e0a13.zip |
support for FRIEND_HELLO messages
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index f5c57d864..dbe5adf4f 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -1283,6 +1283,9 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello) | |||
1283 | (const struct GNUNET_HELLO_Message *) hello; | 1283 | (const struct GNUNET_HELLO_Message *) hello; |
1284 | struct ValidateAddressContext vac; | 1284 | struct ValidateAddressContext vac; |
1285 | struct GNUNET_HELLO_Message *h; | 1285 | struct GNUNET_HELLO_Message *h; |
1286 | int type; | ||
1287 | int friend; | ||
1288 | |||
1286 | 1289 | ||
1287 | if ((GNUNET_OK != GNUNET_HELLO_get_id (hm, &vac.pid)) || | 1290 | if ((GNUNET_OK != GNUNET_HELLO_get_id (hm, &vac.pid)) || |
1288 | (GNUNET_OK != GNUNET_HELLO_get_key (hm, &vac.public_key))) | 1291 | (GNUNET_OK != GNUNET_HELLO_get_key (hm, &vac.public_key))) |
@@ -1295,7 +1298,20 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello) | |||
1295 | memcmp (&GST_my_identity, &vac.pid, sizeof (struct GNUNET_PeerIdentity))) | 1298 | memcmp (&GST_my_identity, &vac.pid, sizeof (struct GNUNET_PeerIdentity))) |
1296 | return; | 1299 | return; |
1297 | /* Add peer identity without addresses to peerinfo service */ | 1300 | /* Add peer identity without addresses to peerinfo service */ |
1298 | h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL, GNUNET_NO); | 1301 | type = ntohs(hello->type); |
1302 | switch (type) { | ||
1303 | case GNUNET_MESSAGE_TYPE_HELLO: | ||
1304 | friend = GNUNET_NO; | ||
1305 | break; | ||
1306 | case GNUNET_MESSAGE_TYPE_FRIEND_HELLO: | ||
1307 | friend = GNUNET_YES; | ||
1308 | break; | ||
1309 | default: | ||
1310 | GNUNET_break (0); | ||
1311 | friend = GNUNET_NO; | ||
1312 | break; | ||
1313 | } | ||
1314 | h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL, friend); | ||
1299 | GNUNET_PEERINFO_add_peer (GST_peerinfo, h, NULL, NULL); | 1315 | GNUNET_PEERINFO_add_peer (GST_peerinfo, h, NULL, NULL); |
1300 | 1316 | ||
1301 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1317 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |