diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-13 13:00:14 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-13 13:00:14 +0000 |
commit | 5e900316b0b70bb65f573d0ad110f3d93551b11b (patch) | |
tree | e78e9d55d8c5da7272acc472c2e8441458e6f84c /src/dv/gnunet-service-dv.c | |
parent | 280ca97ba6c2df197a0e6a3ca5b6cb9da0df9ec2 (diff) | |
download | gnunet-5e900316b0b70bb65f573d0ad110f3d93551b11b.tar.gz gnunet-5e900316b0b70bb65f573d0ad110f3d93551b11b.zip |
use enum GNUNET_ATS_Network_Type instead of uint32_t where appropriate
Diffstat (limited to 'src/dv/gnunet-service-dv.c')
-rw-r--r-- | src/dv/gnunet-service-dv.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 39671edcb..50d21feef 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -272,7 +272,7 @@ struct DirectNeighbor | |||
272 | /** | 272 | /** |
273 | * The network this peer is in | 273 | * The network this peer is in |
274 | */ | 274 | */ |
275 | uint32_t network; | 275 | enum GNUNET_ATS_Network_Type network; |
276 | 276 | ||
277 | /** | 277 | /** |
278 | * Is this neighbor connected at the core level? | 278 | * Is this neighbor connected at the core level? |
@@ -517,7 +517,7 @@ send_ack_to_plugin (const struct GNUNET_PeerIdentity *target, | |||
517 | static void | 517 | static void |
518 | send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, | 518 | send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, |
519 | uint32_t distance, | 519 | uint32_t distance, |
520 | uint32_t network) | 520 | enum GNUNET_ATS_Network_Type network) |
521 | { | 521 | { |
522 | struct GNUNET_DV_DistanceUpdateMessage du_msg; | 522 | struct GNUNET_DV_DistanceUpdateMessage du_msg; |
523 | 523 | ||
@@ -529,7 +529,7 @@ send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, | |||
529 | du_msg.header.type = htons (GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED); | 529 | du_msg.header.type = htons (GNUNET_MESSAGE_TYPE_DV_DISTANCE_CHANGED); |
530 | du_msg.distance = htonl (distance); | 530 | du_msg.distance = htonl (distance); |
531 | du_msg.peer = *peer; | 531 | du_msg.peer = *peer; |
532 | du_msg.network = htonl (network); | 532 | du_msg.network = htonl ((uint32_t) network); |
533 | send_control_to_plugin (&du_msg.header); | 533 | send_control_to_plugin (&du_msg.header); |
534 | } | 534 | } |
535 | 535 | ||
@@ -543,7 +543,8 @@ send_distance_change_to_plugin (const struct GNUNET_PeerIdentity *peer, | |||
543 | */ | 543 | */ |
544 | static void | 544 | static void |
545 | send_connect_to_plugin (const struct GNUNET_PeerIdentity *target, | 545 | send_connect_to_plugin (const struct GNUNET_PeerIdentity *target, |
546 | uint32_t distance, uint32_t network) | 546 | uint32_t distance, |
547 | enum GNUNET_ATS_Network_Type network) | ||
547 | { | 548 | { |
548 | struct GNUNET_DV_ConnectMessage cm; | 549 | struct GNUNET_DV_ConnectMessage cm; |
549 | 550 | ||
@@ -553,7 +554,7 @@ send_connect_to_plugin (const struct GNUNET_PeerIdentity *target, | |||
553 | cm.header.size = htons (sizeof (cm)); | 554 | cm.header.size = htons (sizeof (cm)); |
554 | cm.header.type = htons (GNUNET_MESSAGE_TYPE_DV_CONNECT); | 555 | cm.header.type = htons (GNUNET_MESSAGE_TYPE_DV_CONNECT); |
555 | cm.distance = htonl (distance); | 556 | cm.distance = htonl (distance); |
556 | cm.network = htonl (network); | 557 | cm.network = htonl ((uint32_t) network); |
557 | cm.peer = *target; | 558 | cm.peer = *target; |
558 | send_control_to_plugin (&cm.header); | 559 | send_control_to_plugin (&cm.header); |
559 | } | 560 | } |
@@ -1158,7 +1159,7 @@ get_atsi_distance (const struct GNUNET_ATS_Information *atsi, | |||
1158 | * @param atsi_count number of entries in atsi | 1159 | * @param atsi_count number of entries in atsi |
1159 | * @return connected transport network | 1160 | * @return connected transport network |
1160 | */ | 1161 | */ |
1161 | static uint32_t | 1162 | static enum GNUNET_ATS_Network_Type |
1162 | get_atsi_network (const struct GNUNET_ATS_Information *atsi, | 1163 | get_atsi_network (const struct GNUNET_ATS_Information *atsi, |
1163 | uint32_t atsi_count) | 1164 | uint32_t atsi_count) |
1164 | { | 1165 | { |
@@ -1166,7 +1167,7 @@ get_atsi_network (const struct GNUNET_ATS_Information *atsi, | |||
1166 | 1167 | ||
1167 | for (i = 0; i < atsi_count; i++) | 1168 | for (i = 0; i < atsi_count; i++) |
1168 | if (ntohl (atsi[i].type) == GNUNET_ATS_NETWORK_TYPE) | 1169 | if (ntohl (atsi[i].type) == GNUNET_ATS_NETWORK_TYPE) |
1169 | return ntohl (atsi[i].value); | 1170 | return (enum GNUNET_ATS_Network_Type) ntohl (atsi[i].value); |
1170 | return GNUNET_ATS_NET_UNSPECIFIED; | 1171 | return GNUNET_ATS_NET_UNSPECIFIED; |
1171 | } | 1172 | } |
1172 | 1173 | ||
@@ -1291,7 +1292,7 @@ handle_ats_update (void *cls, | |||
1291 | { | 1292 | { |
1292 | struct DirectNeighbor *neighbor; | 1293 | struct DirectNeighbor *neighbor; |
1293 | uint32_t distance; | 1294 | uint32_t distance; |
1294 | uint32_t network = GNUNET_ATS_NET_UNSPECIFIED; | 1295 | enum GNUNET_ATS_Network_Type network = GNUNET_ATS_NET_UNSPECIFIED; |
1295 | 1296 | ||
1296 | if (GNUNET_NO == active) | 1297 | if (GNUNET_NO == active) |
1297 | return; | 1298 | return; |