diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-07-13 15:33:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-07-13 15:33:30 +0000 |
commit | ee21a783ec2bb31b26a508d12ffad5d8b3c866e9 (patch) | |
tree | 93b4b89131605a3cde1bdd599c94e0eba37ae6f7 | |
parent | 9fa742ef8a7b4299f20292107dbe7a40fc08e2bf (diff) | |
download | gnunet-ee21a783ec2bb31b26a508d12ffad5d8b3c866e9.tar.gz gnunet-ee21a783ec2bb31b26a508d12ffad5d8b3c866e9.zip |
-add dv_get_network to DV API, improve signature to use 'struct Session *' instead of 'void *'
-rw-r--r-- | src/dv/plugin_transport_dv.c | 23 | ||||
-rw-r--r-- | src/include/gnunet_transport_plugin.h | 5 | ||||
-rw-r--r-- | src/transport/plugin_transport_bluetooth.c | 8 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_client.c | 9 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 8 | ||||
-rw-r--r-- | src/transport/plugin_transport_template.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 9 | ||||
-rw-r--r-- | src/transport/plugin_transport_unix.c | 8 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 9 |
10 files changed, 66 insertions, 33 deletions
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index f094075e8..8f22246eb 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -634,6 +634,26 @@ dv_plugin_string_to_address (void *cls, | |||
634 | } | 634 | } |
635 | 635 | ||
636 | 636 | ||
637 | |||
638 | /** | ||
639 | * Function to obtain the network type for a session | ||
640 | * FIXME: we should probably look at the network type | ||
641 | * used by the next hop here. Or find some other way | ||
642 | * to properly allow ATS-DV resource allocation. | ||
643 | * | ||
644 | * @param cls closure ('struct Plugin*') | ||
645 | * @param session the session | ||
646 | * @return the network type | ||
647 | */ | ||
648 | static enum GNUNET_ATS_Network_Type | ||
649 | dv_get_network (void *cls, | ||
650 | struct Session *session) | ||
651 | { | ||
652 | GNUNET_assert (NULL != session); | ||
653 | return GNUNET_ATS_NET_UNSPECIFIED; | ||
654 | } | ||
655 | |||
656 | |||
637 | /** | 657 | /** |
638 | * Entry point for the plugin. | 658 | * Entry point for the plugin. |
639 | */ | 659 | */ |
@@ -670,7 +690,8 @@ libgnunet_plugin_transport_dv_init (void *cls) | |||
670 | api->check_address = &dv_plugin_check_address; | 690 | api->check_address = &dv_plugin_check_address; |
671 | api->address_to_string = &dv_plugin_address_to_string; | 691 | api->address_to_string = &dv_plugin_address_to_string; |
672 | api->string_to_address = &dv_plugin_string_to_address; | 692 | api->string_to_address = &dv_plugin_string_to_address; |
673 | api->get_session = dv_get_session; | 693 | api->get_session = &dv_get_session; |
694 | api->get_network = &dv_get_network; | ||
674 | return api; | 695 | return api; |
675 | } | 696 | } |
676 | 697 | ||
diff --git a/src/include/gnunet_transport_plugin.h b/src/include/gnunet_transport_plugin.h index 456bd1ada..1579980ea 100644 --- a/src/include/gnunet_transport_plugin.h +++ b/src/include/gnunet_transport_plugin.h | |||
@@ -497,14 +497,14 @@ typedef int (*GNUNET_TRANSPORT_StringToAddress) (void *cls, | |||
497 | 497 | ||
498 | 498 | ||
499 | /** | 499 | /** |
500 | * Function obtain the network type for a session | 500 | * Function to obtain the network type for a session |
501 | * | 501 | * |
502 | * @param cls closure ('struct Plugin*') | 502 | * @param cls closure ('struct Plugin*') |
503 | * @param session the session | 503 | * @param session the session |
504 | * @return the network type | 504 | * @return the network type |
505 | */ | 505 | */ |
506 | typedef enum GNUNET_ATS_Network_Type (*GNUNET_TRANSPORT_GetNetworkType) (void *cls, | 506 | typedef enum GNUNET_ATS_Network_Type (*GNUNET_TRANSPORT_GetNetworkType) (void *cls, |
507 | void *session); | 507 | struct Session *session); |
508 | 508 | ||
509 | 509 | ||
510 | /** | 510 | /** |
@@ -571,7 +571,6 @@ struct GNUNET_TRANSPORT_PluginFunctions | |||
571 | */ | 571 | */ |
572 | GNUNET_TRANSPORT_CreateSession get_session; | 572 | GNUNET_TRANSPORT_CreateSession get_session; |
573 | 573 | ||
574 | |||
575 | /** | 574 | /** |
576 | * Function to obtain the network type for a session | 575 | * Function to obtain the network type for a session |
577 | */ | 576 | */ |
diff --git a/src/transport/plugin_transport_bluetooth.c b/src/transport/plugin_transport_bluetooth.c index 57de3022b..3f432b90e 100644 --- a/src/transport/plugin_transport_bluetooth.c +++ b/src/transport/plugin_transport_bluetooth.c | |||
@@ -1024,6 +1024,7 @@ create_macendpoint (struct Plugin *plugin, | |||
1024 | return pos; | 1024 | return pos; |
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | |||
1027 | /** | 1028 | /** |
1028 | * Function obtain the network type for a session | 1029 | * Function obtain the network type for a session |
1029 | * | 1030 | * |
@@ -1032,10 +1033,11 @@ create_macendpoint (struct Plugin *plugin, | |||
1032 | * @return the network type in HBO or GNUNET_SYSERR | 1033 | * @return the network type in HBO or GNUNET_SYSERR |
1033 | */ | 1034 | */ |
1034 | static enum GNUNET_ATS_Network_Type | 1035 | static enum GNUNET_ATS_Network_Type |
1035 | bluetooth_get_network (void *cls, void *session) | 1036 | bluetooth_get_network (void *cls, |
1037 | struct Session *session) | ||
1036 | { | 1038 | { |
1037 | GNUNET_assert (NULL != session); | 1039 | GNUNET_assert (NULL != session); |
1038 | return GNUNET_ATS_NET_BT; | 1040 | return GNUNET_ATS_NET_BT; |
1039 | } | 1041 | } |
1040 | 1042 | ||
1041 | 1043 | ||
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 8f814b590..75daeab71 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -1438,6 +1438,7 @@ client_connect (struct Session *s) | |||
1438 | return res; | 1438 | return res; |
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | |||
1441 | /** | 1442 | /** |
1442 | * Function obtain the network type for a session | 1443 | * Function obtain the network type for a session |
1443 | * | 1444 | * |
@@ -1446,11 +1447,11 @@ client_connect (struct Session *s) | |||
1446 | * @return the network type in HBO or GNUNET_SYSERR | 1447 | * @return the network type in HBO or GNUNET_SYSERR |
1447 | */ | 1448 | */ |
1448 | static enum GNUNET_ATS_Network_Type | 1449 | static enum GNUNET_ATS_Network_Type |
1449 | http_client_get_network (void *cls, void *session) | 1450 | http_client_get_network (void *cls, |
1451 | struct Session *session) | ||
1450 | { | 1452 | { |
1451 | struct Session *s = (struct Session *) session; | 1453 | GNUNET_assert (NULL != session); |
1452 | GNUNET_assert (NULL != s); | 1454 | return ntohl (session->ats_address_network_type); |
1453 | return ntohl(s->ats_address_network_type); | ||
1454 | } | 1455 | } |
1455 | 1456 | ||
1456 | 1457 | ||
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 10ba80a19..968ee23fa 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -3021,6 +3021,7 @@ const char *http_plugin_address_to_string (void *cls, | |||
3021 | 3021 | ||
3022 | } | 3022 | } |
3023 | 3023 | ||
3024 | |||
3024 | /** | 3025 | /** |
3025 | * Function obtain the network type for a session | 3026 | * Function obtain the network type for a session |
3026 | * | 3027 | * |
@@ -3029,13 +3030,14 @@ const char *http_plugin_address_to_string (void *cls, | |||
3029 | * @return the network type in HBO or GNUNET_SYSERR | 3030 | * @return the network type in HBO or GNUNET_SYSERR |
3030 | */ | 3031 | */ |
3031 | static enum GNUNET_ATS_Network_Type | 3032 | static enum GNUNET_ATS_Network_Type |
3032 | http_server_get_network (void *cls, void *session) | 3033 | http_server_get_network (void *cls, |
3034 | struct Session *session) | ||
3033 | { | 3035 | { |
3034 | struct Session *s = (struct Session *) session; | 3036 | GNUNET_assert (NULL != session); |
3035 | GNUNET_assert (NULL != s); | 3037 | return ntohl (session->ats_address_network_type); |
3036 | return ntohl(s->ats_address_network_type); | ||
3037 | } | 3038 | } |
3038 | 3039 | ||
3040 | |||
3039 | /** | 3041 | /** |
3040 | * Entry point for the plugin. | 3042 | * Entry point for the plugin. |
3041 | * | 3043 | * |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 85b91ecad..b124fc618 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -2394,11 +2394,11 @@ stop_session_timeout (struct Session *s) | |||
2394 | * @return the network type in HBO or GNUNET_SYSERR | 2394 | * @return the network type in HBO or GNUNET_SYSERR |
2395 | */ | 2395 | */ |
2396 | static enum GNUNET_ATS_Network_Type | 2396 | static enum GNUNET_ATS_Network_Type |
2397 | tcp_get_network (void *cls,void *session) | 2397 | tcp_get_network (void *cls, |
2398 | struct Session *session) | ||
2398 | { | 2399 | { |
2399 | struct Session *s = (struct Session *) session; | 2400 | GNUNET_assert (NULL != session); |
2400 | GNUNET_assert (NULL != session); | 2401 | return ntohl (session->ats_address_network_type); |
2401 | return ntohl(s->ats_address_network_type); | ||
2402 | } | 2402 | } |
2403 | 2403 | ||
2404 | 2404 | ||
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c index bf405dba6..007290504 100644 --- a/src/transport/plugin_transport_template.c +++ b/src/transport/plugin_transport_template.c | |||
@@ -205,6 +205,7 @@ template_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) | |||
205 | // FIXME | 205 | // FIXME |
206 | } | 206 | } |
207 | 207 | ||
208 | |||
208 | /** | 209 | /** |
209 | * Function obtain the network type for a session | 210 | * Function obtain the network type for a session |
210 | * | 211 | * |
@@ -213,13 +214,14 @@ template_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) | |||
213 | * @return the network type in HBO or GNUNET_SYSERR | 214 | * @return the network type in HBO or GNUNET_SYSERR |
214 | */ | 215 | */ |
215 | static enum GNUNET_ATS_Network_Type | 216 | static enum GNUNET_ATS_Network_Type |
216 | template_plugin_get_network (void *cls, void *session) | 217 | template_plugin_get_network (void *cls, |
218 | struct Session *session) | ||
217 | { | 219 | { |
218 | struct Session *s = (struct Session *) session; | 220 | GNUNET_assert (NULL != session); |
219 | GNUNET_assert (NULL != s); | 221 | return GNUNET_ATS_NET_UNSPECIFIED; /* Change to correct network type */ |
220 | return GNUNET_ATS_NET_UNSPECIFIED; /* Change to correct network type */ | ||
221 | } | 222 | } |
222 | 223 | ||
224 | |||
223 | /** | 225 | /** |
224 | * Convert the transports address to a nice, human-readable | 226 | * Convert the transports address to a nice, human-readable |
225 | * format. | 227 | * format. |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 421da9812..4d74e272e 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1443,6 +1443,7 @@ session_cmp_it (void *cls, | |||
1443 | return GNUNET_YES; | 1443 | return GNUNET_YES; |
1444 | } | 1444 | } |
1445 | 1445 | ||
1446 | |||
1446 | /** | 1447 | /** |
1447 | * Function obtain the network type for a session | 1448 | * Function obtain the network type for a session |
1448 | * | 1449 | * |
@@ -1451,13 +1452,13 @@ session_cmp_it (void *cls, | |||
1451 | * @return the network type in HBO or GNUNET_SYSERR | 1452 | * @return the network type in HBO or GNUNET_SYSERR |
1452 | */ | 1453 | */ |
1453 | static enum GNUNET_ATS_Network_Type | 1454 | static enum GNUNET_ATS_Network_Type |
1454 | udp_get_network (void *cls, void *session) | 1455 | udp_get_network (void *cls, |
1456 | struct Session *session) | ||
1455 | { | 1457 | { |
1456 | struct Session *s = (struct Session *) session; | 1458 | return ntohl (session->ats.value); |
1457 | |||
1458 | return ntohl(s->ats.value); | ||
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | |||
1461 | /** | 1462 | /** |
1462 | * Creates a new outbound session the transport service will use to send data to the | 1463 | * Creates a new outbound session the transport service will use to send data to the |
1463 | * peer | 1464 | * peer |
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index afa19d0e8..88df45223 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -732,6 +732,7 @@ session_timeout (void *cls, | |||
732 | disconnect_session (s); | 732 | disconnect_session (s); |
733 | } | 733 | } |
734 | 734 | ||
735 | |||
735 | /** | 736 | /** |
736 | * Function obtain the network type for a session | 737 | * Function obtain the network type for a session |
737 | * | 738 | * |
@@ -740,10 +741,11 @@ session_timeout (void *cls, | |||
740 | * @return the network type in HBO or GNUNET_SYSERR | 741 | * @return the network type in HBO or GNUNET_SYSERR |
741 | */ | 742 | */ |
742 | static enum GNUNET_ATS_Network_Type | 743 | static enum GNUNET_ATS_Network_Type |
743 | unix_get_network (void *cls, void *session) | 744 | unix_get_network (void *cls, |
745 | struct Session *session) | ||
744 | { | 746 | { |
745 | GNUNET_assert (NULL != session); | 747 | GNUNET_assert (NULL != session); |
746 | return GNUNET_ATS_NET_LOOPBACK; | 748 | return GNUNET_ATS_NET_LOOPBACK; |
747 | } | 749 | } |
748 | 750 | ||
749 | 751 | ||
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 298d55653..a376a2642 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -1057,6 +1057,7 @@ create_macendpoint (struct Plugin *plugin, | |||
1057 | return pos; | 1057 | return pos; |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | |||
1060 | /** | 1061 | /** |
1061 | * Function obtain the network type for a session | 1062 | * Function obtain the network type for a session |
1062 | * | 1063 | * |
@@ -1065,12 +1066,14 @@ create_macendpoint (struct Plugin *plugin, | |||
1065 | * @return the network type in HBO or GNUNET_SYSERR | 1066 | * @return the network type in HBO or GNUNET_SYSERR |
1066 | */ | 1067 | */ |
1067 | static enum GNUNET_ATS_Network_Type | 1068 | static enum GNUNET_ATS_Network_Type |
1068 | wlan_get_network (void *cls, void *session) | 1069 | wlan_get_network (void *cls, |
1070 | struct Session *session) | ||
1069 | { | 1071 | { |
1070 | GNUNET_assert (NULL != session); | 1072 | GNUNET_assert (NULL != session); |
1071 | return GNUNET_ATS_NET_WLAN; | 1073 | return GNUNET_ATS_NET_WLAN; |
1072 | } | 1074 | } |
1073 | 1075 | ||
1076 | |||
1074 | /** | 1077 | /** |
1075 | * Creates a new outbound session the transport service will use to send data to the | 1078 | * Creates a new outbound session the transport service will use to send data to the |
1076 | * peer | 1079 | * peer |