diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-09 15:39:23 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-09 15:39:23 +0000 |
commit | cb6a3ffd26cad8cda2c2b47eea54621dfff025e2 (patch) | |
tree | 62219fd4fcb4cf067e456a149486f30cd756cd95 /src | |
parent | c8a965baf8d65b79d03570c05bcc962fae8239c6 (diff) | |
download | gnunet-cb6a3ffd26cad8cda2c2b47eea54621dfff025e2.tar.gz gnunet-cb6a3ffd26cad8cda2c2b47eea54621dfff025e2.zip |
get function implementation in all plugins
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/plugin_transport_http_client.c | 17 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 15 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 15 |
4 files changed, 47 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index e06c41b3b..7c3cebee3 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -1437,6 +1437,21 @@ client_connect (struct Session *s) | |||
1437 | return res; | 1437 | return res; |
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | /** | ||
1441 | * Function obtain the network type for a session | ||
1442 | * | ||
1443 | * @param cls closure ('struct Plugin*') | ||
1444 | * @param session the session | ||
1445 | * @return the network type in HBO or GNUNET_SYSERR | ||
1446 | */ | ||
1447 | int http_client_get_network (void *cls, | ||
1448 | void *session) | ||
1449 | { | ||
1450 | struct Session *s = (struct Session *) session; | ||
1451 | GNUNET_assert (NULL != s); | ||
1452 | return ntohl(s->ats_address_network_type); | ||
1453 | } | ||
1454 | |||
1440 | 1455 | ||
1441 | /** | 1456 | /** |
1442 | * Creates a new outbound session the transport service will use to send data to the | 1457 | * Creates a new outbound session the transport service will use to send data to the |
@@ -1786,7 +1801,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) | |||
1786 | api->address_to_string = &http_plugin_address_to_string; | 1801 | api->address_to_string = &http_plugin_address_to_string; |
1787 | api->string_to_address = &http_common_plugin_string_to_address; | 1802 | api->string_to_address = &http_common_plugin_string_to_address; |
1788 | api->address_pretty_printer = &http_common_plugin_address_pretty_printer; | 1803 | api->address_pretty_printer = &http_common_plugin_address_pretty_printer; |
1789 | 1804 | api->get_network = &http_client_get_network; | |
1790 | 1805 | ||
1791 | #if BUILD_HTTPS | 1806 | #if BUILD_HTTPS |
1792 | plugin->name = "transport-https_client"; | 1807 | plugin->name = "transport-https_client"; |
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index b7967296f..dfa3a4998 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -3004,6 +3004,20 @@ const char *http_plugin_address_to_string (void *cls, | |||
3004 | return http_common_plugin_address_to_string (cls, p->protocol, addr, addrlen); | 3004 | return http_common_plugin_address_to_string (cls, p->protocol, addr, addrlen); |
3005 | } | 3005 | } |
3006 | 3006 | ||
3007 | /** | ||
3008 | * Function obtain the network type for a session | ||
3009 | * | ||
3010 | * @param cls closure ('struct Plugin*') | ||
3011 | * @param session the session | ||
3012 | * @return the network type in HBO or GNUNET_SYSERR | ||
3013 | */ | ||
3014 | int http_server_get_network (void *cls, | ||
3015 | void *session) | ||
3016 | { | ||
3017 | struct Session *s = (struct Session *) session; | ||
3018 | GNUNET_assert (NULL != s); | ||
3019 | return ntohl(s->ats_address_network_type); | ||
3020 | } | ||
3007 | 3021 | ||
3008 | /** | 3022 | /** |
3009 | * Entry point for the plugin. | 3023 | * Entry point for the plugin. |
@@ -3044,6 +3058,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) | |||
3044 | api->address_to_string = &http_plugin_address_to_string; | 3058 | api->address_to_string = &http_plugin_address_to_string; |
3045 | api->string_to_address = &http_common_plugin_string_to_address; | 3059 | api->string_to_address = &http_common_plugin_string_to_address; |
3046 | api->address_pretty_printer = &http_common_plugin_address_pretty_printer; | 3060 | api->address_pretty_printer = &http_common_plugin_address_pretty_printer; |
3061 | api->get_network = &http_server_get_network; | ||
3047 | 3062 | ||
3048 | #if BUILD_HTTPS | 3063 | #if BUILD_HTTPS |
3049 | plugin->name = "transport-https_server"; | 3064 | plugin->name = "transport-https_server"; |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 03f6528d2..025554a26 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -2391,7 +2391,7 @@ int tcp_get_network (void *cls, | |||
2391 | { | 2391 | { |
2392 | struct Session *s = (struct Session *) session; | 2392 | struct Session *s = (struct Session *) session; |
2393 | GNUNET_assert (NULL != session); | 2393 | GNUNET_assert (NULL != session); |
2394 | return s->ats_address_network_type; | 2394 | return ntohl(s->ats_address_network_type); |
2395 | } | 2395 | } |
2396 | 2396 | ||
2397 | 2397 | ||
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 5707415a8..565573081 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1427,6 +1427,20 @@ session_cmp_it (void *cls, | |||
1427 | return GNUNET_YES; | 1427 | return GNUNET_YES; |
1428 | } | 1428 | } |
1429 | 1429 | ||
1430 | /** | ||
1431 | * Function obtain the network type for a session | ||
1432 | * | ||
1433 | * @param cls closure ('struct Plugin*') | ||
1434 | * @param session the session | ||
1435 | * @return the network type in HBO or GNUNET_SYSERR | ||
1436 | */ | ||
1437 | int udp_get_network (void *cls, | ||
1438 | void *session) | ||
1439 | { | ||
1440 | struct Session *s = (struct Session *) session; | ||
1441 | |||
1442 | return ntohl(s->ats.value); | ||
1443 | } | ||
1430 | 1444 | ||
1431 | /** | 1445 | /** |
1432 | * Creates a new outbound session the transport service will use to send data to the | 1446 | * Creates a new outbound session the transport service will use to send data to the |
@@ -2967,6 +2981,7 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
2967 | api->check_address = &udp_plugin_check_address; | 2981 | api->check_address = &udp_plugin_check_address; |
2968 | api->get_session = &udp_plugin_get_session; | 2982 | api->get_session = &udp_plugin_get_session; |
2969 | api->send = &udp_plugin_send; | 2983 | api->send = &udp_plugin_send; |
2984 | api->get_network = &udp_get_network; | ||
2970 | 2985 | ||
2971 | return api; | 2986 | return api; |
2972 | } | 2987 | } |