From 61787bfa37e0ac5998e01d9c4806600033c19c74 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 23 Nov 2018 17:19:53 +0100 Subject: rename fest: use new libgnunetnt instead of old libgnunetats logic for network type classification --- src/transport/Makefile.am | 1 + src/transport/gnunet-communicator-unix.c | 4 +-- src/transport/gnunet-service-tng.c | 12 ++++----- src/transport/gnunet-service-transport.c | 10 ++++---- src/transport/gnunet-service-transport.h | 2 +- src/transport/gnunet-service-transport_ats.c | 6 ++--- src/transport/gnunet-service-transport_plugins.c | 6 ++--- .../gnunet-service-transport_validation.c | 8 +++--- src/transport/plugin_transport_http_client.c | 14 +++++----- src/transport/plugin_transport_http_common.c | 6 ++--- src/transport/plugin_transport_http_common.h | 2 +- src/transport/plugin_transport_http_server.c | 8 +++--- src/transport/plugin_transport_tcp.c | 16 ++++++------ src/transport/plugin_transport_template.c | 8 +++--- src/transport/plugin_transport_udp.c | 30 +++++++++++----------- src/transport/plugin_transport_udp.h | 2 +- src/transport/plugin_transport_udp_broadcasting.c | 8 +++--- src/transport/plugin_transport_unix.c | 10 ++++---- src/transport/plugin_transport_wlan.c | 16 ++++++------ src/transport/plugin_transport_xt.c | 16 ++++++------ src/transport/plugin_transport_xu.c | 26 +++++++++---------- src/transport/test_plugin_transport.c | 4 +-- src/transport/test_quota_compliance.c | 6 ++--- src/transport/transport.h | 6 ++--- src/transport/transport_api2_communication.c | 8 +++--- src/transport/transport_api2_monitor.c | 2 +- 26 files changed, 119 insertions(+), 118 deletions(-) (limited to 'src/transport') diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 0693a0b9f..73296abf9 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -314,6 +314,7 @@ gnunet_service_transport_LDADD = \ libgnunettransport.la \ $(top_builddir)/src/ats/libgnunetats.la \ $(top_builddir)/src/hello/libgnunethello.la \ + $(top_builddir)/src/nt/libgnunetnt.la \ $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/util/libgnunetutil.la \ diff --git a/src/transport/gnunet-communicator-unix.c b/src/transport/gnunet-communicator-unix.c index a97560ad4..0df3fd45d 100644 --- a/src/transport/gnunet-communicator-unix.c +++ b/src/transport/gnunet-communicator-unix.c @@ -680,7 +680,7 @@ setup_queue (const struct GNUNET_PeerIdentity *target, &queue->target, foreign_addr, UNIX_MTU, - GNUNET_ATS_NET_LOOPBACK, + GNUNET_NT_LOOPBACK, 0 /* distance */, cs, queue->mq); @@ -1100,7 +1100,7 @@ run (void *cls, GNUNET_free (unix_socket_path); ai = GNUNET_TRANSPORT_communicator_address_add (ch, my_addr, - GNUNET_ATS_NET_LOOPBACK, + GNUNET_NT_LOOPBACK, GNUNET_TIME_UNIT_FOREVER_REL); GNUNET_free (my_addr); } diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index 3e08900bb..b184a0600 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c @@ -162,7 +162,7 @@ struct Queue /** * Network type offered by this queue. */ - enum GNUNET_ATS_Network_Type nt; + enum GNUNET_NetworkType nt; /** * Connection status for this queue. @@ -322,7 +322,7 @@ struct AddressListEntry /** * Network type offered by this address. */ - enum GNUNET_ATS_Network_Type nt; + enum GNUNET_NetworkType nt; }; @@ -549,7 +549,7 @@ static void notify_monitor (struct TransportClient *tc, const struct GNUNET_PeerIdentity *peer, const char *address, - enum GNUNET_ATS_Network_Type nt, + enum GNUNET_NetworkType nt, const struct MonitorEvent *me) { struct GNUNET_MQ_Envelope *env; @@ -588,7 +588,7 @@ notify_monitor (struct TransportClient *tc, static void notify_monitors (const struct GNUNET_PeerIdentity *peer, const char *address, - enum GNUNET_ATS_Network_Type nt, + enum GNUNET_NetworkType nt, const struct MonitorEvent *me) { static struct GNUNET_PeerIdentity zero; @@ -1255,7 +1255,7 @@ handle_add_address (void *cls, ale->address = (const char *) &ale[1]; ale->expiration = GNUNET_TIME_relative_ntoh (aam->expiration); ale->aid = aam->aid; - ale->nt = (enum GNUNET_ATS_Network_Type) ntohl (aam->nt); + ale->nt = (enum GNUNET_NetworkType) ntohl (aam->nt); memcpy (&ale[1], &aam[1], slen); @@ -1427,7 +1427,7 @@ handle_add_queue_message (void *cls, queue->qid = aqm->qid; queue->mtu = ntohl (aqm->mtu); queue->distance = ntohl (aqm->distance); - queue->nt = (enum GNUNET_ATS_Network_Type) ntohl (aqm->nt); + queue->nt = (enum GNUNET_NetworkType) ntohl (aqm->nt); queue->cs = (enum GNUNET_TRANSPORT_ConnectionStatus) ntohl (aqm->cs); queue->neighbour = neighbour; memcpy (&queue[1], diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 2d9803651..2c1ee12fe 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -415,7 +415,7 @@ static struct GNUNET_ATS_SessionKiller *sk_tail; /** * Interface scanner determines our LAN address range(s). */ -struct GNUNET_ATS_InterfaceScanner *GST_is; +struct GNUNET_NT_InterfaceScanner *GST_is; /** @@ -1975,7 +1975,7 @@ static void plugin_env_session_start (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, - enum GNUNET_ATS_Network_Type scope) + enum GNUNET_NetworkType scope) { struct GNUNET_ATS_Properties prop; @@ -2005,7 +2005,7 @@ plugin_env_session_start (void *cls, memset (&prop, 0, sizeof (prop)); - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != scope); + GNUNET_break (GNUNET_NT_UNSPECIFIED != scope); prop.scope = scope; GST_ats_add_inbound_address (address, session, @@ -2261,7 +2261,7 @@ shutdown_task (void *cls) GST_ats = NULL; GNUNET_ATS_connectivity_done (GST_ats_connect); GST_ats_connect = NULL; - GNUNET_ATS_scanner_done (GST_is); + GNUNET_NT_scanner_done (GST_is); GST_is = NULL; while (NULL != (cur = a2s_head)) { @@ -2859,7 +2859,7 @@ run (void *cls, /* start subsystems */ read_blacklist_configuration (GST_cfg, &GST_my_identity); - GST_is = GNUNET_ATS_scanner_init (); + GST_is = GNUNET_NT_scanner_init (); GST_ats_connect = GNUNET_ATS_connectivity_init (GST_cfg); GST_ats = GNUNET_ATS_scheduling_init (GST_cfg, &ats_request_address_change, diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h index fd852f027..253b785e3 100644 --- a/src/transport/gnunet-service-transport.h +++ b/src/transport/gnunet-service-transport.h @@ -69,7 +69,7 @@ extern struct GNUNET_ATS_ConnectivityHandle *GST_ats_connect; /** * Interface scanner determines our LAN address range(s). */ -extern struct GNUNET_ATS_InterfaceScanner *GST_is; +extern struct GNUNET_NT_InterfaceScanner *GST_is; /** diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c index 8b3b998c8..358ed95c3 100644 --- a/src/transport/gnunet-service-transport_ats.c +++ b/src/transport/gnunet-service-transport_ats.c @@ -442,7 +442,7 @@ GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address, GNUNET_break(0); return; } - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != prop->scope); + GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope); GNUNET_assert (GNUNET_YES == GNUNET_HELLO_address_check_option (address, GNUNET_HELLO_ADDRESS_INFO_INBOUND)); @@ -461,7 +461,7 @@ GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address, GNUNET_i2s (&address->peer), GST_plugins_a2s (address), session, - GNUNET_ATS_print_network_type (prop->scope)); + GNUNET_NT_to_string (prop->scope)); ar = GNUNET_ATS_address_add (GST_ats, address, session, @@ -510,7 +510,7 @@ GST_ats_add_address (const struct GNUNET_HELLO_Address *address, GNUNET_HELLO_ADDRESS_INFO_INBOUND)); ai = find_ai_no_session (address); GNUNET_assert (NULL == ai); - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != prop->scope); + GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope); /* address seems sane, let's tell ATS */ LOG (GNUNET_ERROR_TYPE_INFO, diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c index 9c3044450..6ea59e29c 100644 --- a/src/transport/gnunet-service-transport_plugins.c +++ b/src/transport/gnunet-service-transport_plugins.c @@ -104,7 +104,7 @@ plugin_env_update_distance (void *cls, * @param addrlen length of the @a addr * @return type of the network @a addr belongs to */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType plugin_env_address_to_type (void *cls, const struct sockaddr *addr, size_t addrlen) @@ -112,9 +112,9 @@ plugin_env_address_to_type (void *cls, if (NULL == GST_is) { GNUNET_break(0); - return GNUNET_ATS_NET_UNSPECIFIED; + return GNUNET_NT_UNSPECIFIED; } - return GNUNET_ATS_scanner_address_get_type (GST_is, + return GNUNET_NT_scanner_get_type (GST_is, addr, addrlen); } diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index eecc54efa..fc02da5b4 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -317,7 +317,7 @@ struct ValidationEntry /** * Which network type does our address belong to? */ - enum GNUNET_ATS_Network_Type network; + enum GNUNET_NetworkType network; }; @@ -654,7 +654,7 @@ transmit_ping_if_allowed (void *cls, ve->address->transport_name); ve->network = papi->get_network (papi->cls, session); - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != ve->network); + GNUNET_break (GNUNET_NT_UNSPECIFIED != ve->network); GST_neighbours_notify_data_sent (ve->address, session, tsize); @@ -905,7 +905,7 @@ add_valid_address (void *cls, ve = find_validation_entry (address); ve->network = papi->get_network_for_address (papi->cls, address); - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != ve->network); + GNUNET_break (GNUNET_NT_UNSPECIFIED != ve->network); ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); if (NULL == ve->revalidation_task) @@ -1589,7 +1589,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, struct GNUNET_ATS_Properties prop; memset (&prop, 0, sizeof (prop)); - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != ve->network); + GNUNET_break (GNUNET_NT_UNSPECIFIED != ve->network); prop.scope = ve->network; prop.delay = GNUNET_TIME_relative_divide (ve->latency, 2); GNUNET_assert (GNUNET_NO == diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 0afb54943..e88e2c69f 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c @@ -266,7 +266,7 @@ struct GNUNET_ATS_Session /** * ATS network type. */ - enum GNUNET_ATS_Network_Type scope; + enum GNUNET_NetworkType scope; }; @@ -1920,7 +1920,7 @@ client_connect (struct GNUNET_ATS_Session *s) * @param session the session * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType http_client_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { @@ -1935,7 +1935,7 @@ http_client_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType http_client_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { @@ -1997,7 +1997,7 @@ http_client_plugin_get_session (void *cls, struct HTTP_Client_Plugin *plugin = cls; struct GNUNET_ATS_Session *s; struct sockaddr *sa; - enum GNUNET_ATS_Network_Type net_type; + enum GNUNET_NetworkType net_type; size_t salen = 0; int res; @@ -2020,7 +2020,7 @@ http_client_plugin_get_session (void *cls, } /* Determine network location */ - net_type = GNUNET_ATS_NET_UNSPECIFIED; + net_type = GNUNET_NT_UNSPECIFIED; sa = http_common_socket_from_address (address->address, address->address_length, &res); @@ -2043,9 +2043,9 @@ http_client_plugin_get_session (void *cls, else if (GNUNET_NO == res) { /* Cannot convert to sockaddr -> is external hostname */ - net_type = GNUNET_ATS_NET_WAN; + net_type = GNUNET_NT_WAN; } - if (GNUNET_ATS_NET_UNSPECIFIED == net_type) + if (GNUNET_NT_UNSPECIFIED == net_type) { GNUNET_break (0); return NULL; diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c index e9576d72b..3f0452d0b 100644 --- a/src/transport/plugin_transport_http_common.c +++ b/src/transport/plugin_transport_http_common.c @@ -896,17 +896,17 @@ http_common_cmp_addresses (const void *addr1, * @param address the address * @return the network type */ -enum GNUNET_ATS_Network_Type +enum GNUNET_NetworkType http_common_get_network_for_address (struct GNUNET_TRANSPORT_PluginEnvironment *env, const struct GNUNET_HELLO_Address *address) { struct sockaddr *sa; - enum GNUNET_ATS_Network_Type net_type; + enum GNUNET_NetworkType net_type; size_t salen = 0; int res; - net_type = GNUNET_ATS_NET_UNSPECIFIED; + net_type = GNUNET_NT_UNSPECIFIED; sa = http_common_socket_from_address (address->address, address->address_length, &res); diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h index ac62f6ee4..f758015e1 100644 --- a/src/transport/plugin_transport_http_common.h +++ b/src/transport/plugin_transport_http_common.h @@ -253,7 +253,7 @@ http_common_cmp_addresses (const void *addr1, * @param address the address * @return the network type */ -enum GNUNET_ATS_Network_Type +enum GNUNET_NetworkType http_common_get_network_for_address (struct GNUNET_TRANSPORT_PluginEnvironment *env, const struct GNUNET_HELLO_Address *address); diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index abf60280a..8c657503a 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -260,7 +260,7 @@ struct GNUNET_ATS_Session /** * ATS network type. */ - enum GNUNET_ATS_Network_Type scope; + enum GNUNET_NetworkType scope; /** * #GNUNET_YES if this session is known to the service. @@ -1382,7 +1382,7 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, uint32_t options; int direction = GNUNET_SYSERR; unsigned int to; - enum GNUNET_ATS_Network_Type scope; + enum GNUNET_NetworkType scope; conn_info = MHD_get_connection_info (mhd_connection, MHD_CONNECTION_INFO_CLIENT_ADDRESS); @@ -3344,7 +3344,7 @@ http_server_plugin_address_to_string (void *cls, * @param session the session * @return the network type in HBO or #GNUNET_SYSERR */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType http_server_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { @@ -3359,7 +3359,7 @@ http_server_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType http_server_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 75a885535..c056946b6 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -859,7 +859,7 @@ struct GNUNET_ATS_Session /** * Network type of the address. */ - enum GNUNET_ATS_Network_Type scope; + enum GNUNET_NetworkType scope; /** * Are we still expecting the welcome message? (#GNUNET_YES/#GNUNET_NO) @@ -1890,7 +1890,7 @@ reschedule_session_timeout (struct GNUNET_ATS_Session *s) static struct GNUNET_ATS_Session * create_session (struct Plugin *plugin, const struct GNUNET_HELLO_Address *address, - enum GNUNET_ATS_Network_Type scope, + enum GNUNET_NetworkType scope, struct GNUNET_SERVER_Client *client, int is_nat) { @@ -2436,7 +2436,7 @@ tcp_plugin_get_session (void *cls, const struct IPv4TcpAddress *t4; const struct IPv6TcpAddress *t6; unsigned int options; - enum GNUNET_ATS_Network_Type net_type; + enum GNUNET_NetworkType net_type; unsigned int is_natd = GNUNET_NO; size_t addrlen; #ifdef TCP_STEALTH @@ -2539,7 +2539,7 @@ tcp_plugin_get_session (void *cls, net_type = plugin->env->get_address_type (plugin->env->cls, sb, sbs); - GNUNET_break (net_type != GNUNET_ATS_NET_UNSPECIFIED); + GNUNET_break (net_type != GNUNET_NT_UNSPECIFIED); if ( (is_natd == GNUNET_YES) && (addrlen == sizeof(struct IPv6TcpAddress)) ) @@ -3263,7 +3263,7 @@ handle_tcp_welcome (void *cls, alen), client, GNUNET_NO); - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != session->scope); + GNUNET_break (GNUNET_NT_UNSPECIFIED != session->scope); GNUNET_HELLO_address_free (address); LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating new%s session %p for peer `%s' client %p\n", @@ -3623,7 +3623,7 @@ try_connection_reversal (void *cls, * @param session the session * @return the network type in HBO or #GNUNET_SYSERR */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType tcp_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { @@ -3638,7 +3638,7 @@ tcp_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType tcp_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { @@ -3683,7 +3683,7 @@ tcp_plugin_get_network_for_address (void *cls, else { GNUNET_break (0); - return GNUNET_ATS_NET_UNSPECIFIED; + return GNUNET_NT_UNSPECIFIED; } return plugin->env->get_address_type (plugin->env->cls, sb, diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c index 679d83daa..be2dfb1c8 100644 --- a/src/transport/plugin_transport_template.c +++ b/src/transport/plugin_transport_template.c @@ -284,12 +284,12 @@ template_plugin_query_keepalive_factor (void *cls) * @param session the session * @return the network type in HBO or #GNUNET_SYSERR */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType template_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { GNUNET_assert (NULL != session); - return GNUNET_ATS_NET_UNSPECIFIED; /* Change to correct network type */ + return GNUNET_NT_UNSPECIFIED; /* Change to correct network type */ } @@ -300,11 +300,11 @@ template_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType template_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { - return GNUNET_ATS_NET_WAN; /* FOR NOW */ + return GNUNET_NT_WAN; /* FOR NOW */ } diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index abbcca2ae..9fed9b429 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -234,7 +234,7 @@ struct GNUNET_ATS_Session /** * Network type of the address. */ - enum GNUNET_ATS_Network_Type scope; + enum GNUNET_NetworkType scope; /** * Is this session about to be destroyed (sometimes we cannot @@ -290,7 +290,7 @@ struct DefragContext /** * Network type the address belongs to. */ - enum GNUNET_ATS_Network_Type network_type; + enum GNUNET_NetworkType network_type; /** * Has the @e sender field been initialized yet? @@ -660,7 +660,7 @@ udp_query_keepalive_factor (void *cls) * @param session the session * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType udp_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { @@ -675,7 +675,7 @@ udp_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType udp_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { @@ -720,7 +720,7 @@ udp_plugin_get_network_for_address (void *cls, else { GNUNET_break (0); - return GNUNET_ATS_NET_UNSPECIFIED; + return GNUNET_NT_UNSPECIFIED; } return plugin->env->get_address_type (plugin->env->cls, sb, @@ -2627,7 +2627,7 @@ session_timeout (void *cls) static struct GNUNET_ATS_Session * udp_plugin_create_session (void *cls, const struct GNUNET_HELLO_Address *address, - enum GNUNET_ATS_Network_Type network_type) + enum GNUNET_NetworkType network_type) { struct Plugin *plugin = cls; struct GNUNET_ATS_Session *s; @@ -2687,7 +2687,7 @@ udp_plugin_get_session (void *cls, { struct Plugin *plugin = cls; struct GNUNET_ATS_Session *s; - enum GNUNET_ATS_Network_Type network_type = GNUNET_ATS_NET_UNSPECIFIED; + enum GNUNET_NetworkType network_type = GNUNET_NT_UNSPECIFIED; const struct IPv4UdpAddress *udp_v4; const struct IPv6UdpAddress *udp_v6; @@ -2739,7 +2739,7 @@ udp_plugin_get_session (void *cls, (const struct sockaddr *) &v6, sizeof (v6)); } - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network_type); + GNUNET_break (GNUNET_NT_UNSPECIFIED != network_type); return udp_plugin_create_session (cls, address, network_type); @@ -2760,12 +2760,12 @@ process_udp_message (struct Plugin *plugin, const struct UDPMessage *msg, const union UdpAddress *udp_addr, size_t udp_addr_len, - enum GNUNET_ATS_Network_Type network_type) + enum GNUNET_NetworkType network_type) { struct GNUNET_ATS_Session *s; struct GNUNET_HELLO_Address *address; - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network_type); + GNUNET_break (GNUNET_NT_UNSPECIFIED != network_type); if (0 != ntohl (msg->reserved)) { GNUNET_break_op(0); @@ -2992,7 +2992,7 @@ read_process_fragment (struct Plugin *plugin, const struct GNUNET_MessageHeader *msg, const union UdpAddress *udp_addr, size_t udp_addr_len, - enum GNUNET_ATS_Network_Type network_type) + enum GNUNET_NetworkType network_type) { struct DefragContext *d_ctx; struct GNUNET_TIME_Absolute now; @@ -3092,7 +3092,7 @@ udp_select_read (struct Plugin *plugin, const struct sockaddr_in6 *sa6; const union UdpAddress *int_addr; size_t int_addr_len; - enum GNUNET_ATS_Network_Type network_type; + enum GNUNET_NetworkType network_type; fromlen = sizeof (addr); memset (&addr, @@ -3345,13 +3345,13 @@ analyze_send_error (struct Plugin *plugin, socklen_t slen, int error) { - enum GNUNET_ATS_Network_Type type; + enum GNUNET_NetworkType type; type = plugin->env->get_address_type (plugin->env->cls, sa, slen); - if ( ( (GNUNET_ATS_NET_LAN == type) || - (GNUNET_ATS_NET_WAN == type) ) && + if ( ( (GNUNET_NT_LAN == type) || + (GNUNET_NT_WAN == type) ) && ( (ENETUNREACH == errno) || (ENETDOWN == errno) ) ) { diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h index 5a2fa6f05..7a6e09329 100644 --- a/src/transport/plugin_transport_udp.h +++ b/src/transport/plugin_transport_udp.h @@ -338,7 +338,7 @@ udp_broadcast_receive (struct Plugin *plugin, ssize_t size, const union UdpAddress *udp_addr, size_t udp_addr_len, - enum GNUNET_ATS_Network_Type network_type); + enum GNUNET_NetworkType network_type); void diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c index bcb622a46..c802304aa 100644 --- a/src/transport/plugin_transport_udp_broadcasting.c +++ b/src/transport/plugin_transport_udp_broadcasting.c @@ -117,7 +117,7 @@ struct MstContext /** * ATS network type. */ - enum GNUNET_ATS_Network_Type ats_address_network_type; + enum GNUNET_NetworkType ats_address_network_type; }; @@ -186,7 +186,7 @@ udp_broadcast_receive (struct Plugin *plugin, ssize_t size, const union UdpAddress *udp_addr, size_t udp_addr_len, - enum GNUNET_ATS_Network_Type network_type) + enum GNUNET_NetworkType network_type) { struct GNUNET_MessageStreamTokenizer *broadcast_mst; struct MstContext mc; @@ -410,7 +410,7 @@ iface_proc (void *cls, { struct Plugin *plugin = cls; struct BroadcastAddress *ba; - enum GNUNET_ATS_Network_Type network; + enum GNUNET_NetworkType network; if (NULL == addr) return GNUNET_OK; @@ -426,7 +426,7 @@ iface_proc (void *cls, GNUNET_a2s (netmask, addrlen), name, netmask); network = plugin->env->get_address_type (plugin->env->cls, broadcast_addr, addrlen); - if (GNUNET_ATS_NET_LOOPBACK == network) + if (GNUNET_NT_LOOPBACK == network) { /* Broadcasting on loopback does not make sense */ return GNUNET_YES; diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 3d177e703..19961d792 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c @@ -791,12 +791,12 @@ resend: * @param session the session * @return the network type in HBO or #GNUNET_SYSERR */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType unix_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { GNUNET_assert (NULL != session); - return GNUNET_ATS_NET_LOOPBACK; + return GNUNET_NT_LOOPBACK; } @@ -807,12 +807,12 @@ unix_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType unix_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { - return GNUNET_ATS_NET_LOOPBACK; + return GNUNET_NT_LOOPBACK; } @@ -982,7 +982,7 @@ unix_demultiplexer (struct Plugin *plugin, plugin->env->session_start (NULL, session->address, session, - GNUNET_ATS_NET_LOOPBACK); + GNUNET_NT_LOOPBACK); } else { diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 13d2ca466..e34143c59 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c @@ -126,9 +126,9 @@ typedef int * Which network scope do we belong to? */ #if BUILD_WLAN -static const enum GNUNET_ATS_Network_Type scope = GNUNET_ATS_NET_WLAN; +static const enum GNUNET_NetworkType scope = GNUNET_NT_WLAN; #else -static const enum GNUNET_ATS_Network_Type scope = GNUNET_ATS_NET_BT; +static const enum GNUNET_NetworkType scope = GNUNET_NT_BT; #endif @@ -1297,14 +1297,14 @@ create_macendpoint (struct Plugin *plugin, * @param session the session * @return the network type in HBO or #GNUNET_SYSERR */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType wlan_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { #if BUILD_WLAN - return GNUNET_ATS_NET_WLAN; + return GNUNET_NT_WLAN; #else - return GNUNET_ATS_NET_BT; + return GNUNET_NT_BT; #endif } @@ -1316,14 +1316,14 @@ wlan_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType wlan_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { #if BUILD_WLAN - return GNUNET_ATS_NET_WLAN; + return GNUNET_NT_WLAN; #else - return GNUNET_ATS_NET_BT; + return GNUNET_NT_BT; #endif } diff --git a/src/transport/plugin_transport_xt.c b/src/transport/plugin_transport_xt.c index 0f517dd0c..08f59bd70 100644 --- a/src/transport/plugin_transport_xt.c +++ b/src/transport/plugin_transport_xt.c @@ -859,7 +859,7 @@ struct GNUNET_ATS_Session /** * Network type of the address. */ - enum GNUNET_ATS_Network_Type scope; + enum GNUNET_NetworkType scope; /** * Are we still expecting the welcome message? (#GNUNET_YES/#GNUNET_NO) @@ -1896,7 +1896,7 @@ reschedule_session_timeout (struct GNUNET_ATS_Session *s) static struct GNUNET_ATS_Session * create_session (struct Plugin *plugin, const struct GNUNET_HELLO_Address *address, - enum GNUNET_ATS_Network_Type scope, + enum GNUNET_NetworkType scope, struct GNUNET_SERVER_Client *client, int is_nat) { @@ -2442,7 +2442,7 @@ tcp_plugin_get_session (void *cls, const struct IPv4TcpAddress *t4; const struct IPv6TcpAddress *t6; unsigned int options; - enum GNUNET_ATS_Network_Type net_type; + enum GNUNET_NetworkType net_type; unsigned int is_natd = GNUNET_NO; size_t addrlen; #ifdef TCP_STEALTH @@ -2545,7 +2545,7 @@ tcp_plugin_get_session (void *cls, net_type = plugin->env->get_address_type (plugin->env->cls, sb, sbs); - GNUNET_break (net_type != GNUNET_ATS_NET_UNSPECIFIED); + GNUNET_break (net_type != GNUNET_NT_UNSPECIFIED); if ( (is_natd == GNUNET_YES) && (addrlen == sizeof(struct IPv6TcpAddress)) ) @@ -3269,7 +3269,7 @@ handle_tcp_welcome (void *cls, alen), client, GNUNET_NO); - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != session->scope); + GNUNET_break (GNUNET_NT_UNSPECIFIED != session->scope); GNUNET_HELLO_address_free (address); LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating new%s session %p for peer `%s' client %p\n", @@ -3629,7 +3629,7 @@ try_connection_reversal (void *cls, * @param session the session * @return the network type in HBO or #GNUNET_SYSERR */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType tcp_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { @@ -3644,7 +3644,7 @@ tcp_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType tcp_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { @@ -3689,7 +3689,7 @@ tcp_plugin_get_network_for_address (void *cls, else { GNUNET_break (0); - return GNUNET_ATS_NET_UNSPECIFIED; + return GNUNET_NT_UNSPECIFIED; } return plugin->env->get_address_type (plugin->env->cls, sb, diff --git a/src/transport/plugin_transport_xu.c b/src/transport/plugin_transport_xu.c index 59e00f80e..639b38671 100644 --- a/src/transport/plugin_transport_xu.c +++ b/src/transport/plugin_transport_xu.c @@ -203,7 +203,7 @@ struct GNUNET_ATS_Session /** * Network type of the address. */ - enum GNUNET_ATS_Network_Type scope; + enum GNUNET_NetworkType scope; /** * Is this session about to be destroyed (sometimes we cannot @@ -362,7 +362,7 @@ xu_query_keepalive_factor (void *cls) * @param session the session * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType xu_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session) { @@ -378,7 +378,7 @@ xu_plugin_get_network (void *cls, * @param address the address * @return the network type */ -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType xu_plugin_get_network_for_address (void *cls, const struct GNUNET_HELLO_Address *address) { @@ -423,7 +423,7 @@ xu_plugin_get_network_for_address (void *cls, else { GNUNET_break (0); - return GNUNET_ATS_NET_UNSPECIFIED; + return GNUNET_NT_UNSPECIFIED; } return plugin->env->get_address_type (plugin->env->cls, sb, @@ -1215,13 +1215,13 @@ analyze_send_error (struct Plugin *plugin, socklen_t slen, int error) { - enum GNUNET_ATS_Network_Type type; + enum GNUNET_NetworkType type; type = plugin->env->get_address_type (plugin->env->cls, sa, slen); - if ( ( (GNUNET_ATS_NET_LAN == type) || - (GNUNET_ATS_NET_WAN == type) ) && + if ( ( (GNUNET_NT_LAN == type) || + (GNUNET_NT_WAN == type) ) && ( (ENETUNREACH == errno) || (ENETDOWN == errno) ) ) { @@ -1619,7 +1619,7 @@ session_timeout (void *cls) static struct GNUNET_ATS_Session * xu_plugin_create_session (void *cls, const struct GNUNET_HELLO_Address *address, - enum GNUNET_ATS_Network_Type network_type) + enum GNUNET_NetworkType network_type) { struct Plugin *plugin = cls; struct GNUNET_ATS_Session *s; @@ -1679,7 +1679,7 @@ xu_plugin_get_session (void *cls, { struct Plugin *plugin = cls; struct GNUNET_ATS_Session *s; - enum GNUNET_ATS_Network_Type network_type = GNUNET_ATS_NET_UNSPECIFIED; + enum GNUNET_NetworkType network_type = GNUNET_NT_UNSPECIFIED; const struct IPv4XuAddress *xu_v4; const struct IPv6XuAddress *xu_v6; @@ -1731,7 +1731,7 @@ xu_plugin_get_session (void *cls, (const struct sockaddr *) &v6, sizeof (v6)); } - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network_type); + GNUNET_break (GNUNET_NT_UNSPECIFIED != network_type); return xu_plugin_create_session (cls, address, network_type); @@ -1752,12 +1752,12 @@ process_xu_message (struct Plugin *plugin, const struct XUMessage *msg, const union XuAddress *xu_addr, size_t xu_addr_len, - enum GNUNET_ATS_Network_Type network_type) + enum GNUNET_NetworkType network_type) { struct GNUNET_ATS_Session *s; struct GNUNET_HELLO_Address *address; - GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network_type); + GNUNET_break (GNUNET_NT_UNSPECIFIED != network_type); if (0 != ntohl (msg->reserved)) { GNUNET_break_op(0); @@ -1827,7 +1827,7 @@ xu_select_read (struct Plugin *plugin, const struct sockaddr_in6 *sa6; const union XuAddress *int_addr; size_t int_addr_len; - enum GNUNET_ATS_Network_Type network_type; + enum GNUNET_NetworkType network_type; fromlen = sizeof (addr); memset (&addr, diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 85ab9659d..47ba7aed4 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c @@ -499,12 +499,12 @@ env_notify_address (void *cls, } -static enum GNUNET_ATS_Network_Type +static enum GNUNET_NetworkType env_get_address_type (void *cls, const struct sockaddr *addr, size_t addrlen) { - return GNUNET_ATS_NET_LOOPBACK; + return GNUNET_NT_LOOPBACK; } diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index cd93ff855..6309c3278 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c @@ -209,14 +209,14 @@ generate_config (const char *cfg_file, "PATHS", "DEFAULTCONFIG", fname); - for (int c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) + for (int c = 0; c < GNUNET_NT_COUNT; c++) { GNUNET_asprintf (&in_name, "%s_QUOTA_IN", - GNUNET_ATS_print_network_type (c)); + GNUNET_NT_to_string (c)); GNUNET_asprintf (&out_name, "%s_QUOTA_OUT", - GNUNET_ATS_print_network_type (c)); + GNUNET_NT_to_string (c)); GNUNET_CONFIGURATION_set_value_number (cfg, "ats", in_name, diff --git a/src/transport/transport.h b/src/transport/transport.h index 515c178f4..df1321d1a 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -692,7 +692,7 @@ struct GNUNET_TRANSPORT_AddAddressMessage struct GNUNET_TIME_RelativeNBO expiration; /** - * An `enum GNUNET_ATS_Network_Type` in NBO. + * An `enum GNUNET_NetworkType` in NBO. */ uint32_t nt; @@ -801,7 +801,7 @@ struct GNUNET_TRANSPORT_AddQueueMessage struct GNUNET_PeerIdentity receiver; /** - * An `enum GNUNET_ATS_Network_Type` in NBO. + * An `enum GNUNET_NetworkType` in NBO. */ uint32_t nt; @@ -988,7 +988,7 @@ struct GNUNET_TRANSPORT_MonitorData struct GNUNET_MessageHeader header; /** - * Network type (an `enum GNUNET_ATS_Network_Type` in NBO). + * Network type (an `enum GNUNET_NetworkType` in NBO). */ uint32_t nt GNUNET_PACKED; diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index a89802ddd..ffd7f208e 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c @@ -251,7 +251,7 @@ struct GNUNET_TRANSPORT_QueueHandle /** * Network type of the communciation queue. */ - enum GNUNET_ATS_Network_Type nt; + enum GNUNET_NetworkType nt; /** * Communication status of the queue. @@ -318,7 +318,7 @@ struct GNUNET_TRANSPORT_AddressIdentifier /** * Network type for the address. */ - enum GNUNET_ATS_Network_Type nt; + enum GNUNET_NetworkType nt; }; @@ -944,7 +944,7 @@ GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle const struct GNUNET_PeerIdentity *peer, const char *address, uint32_t mtu, - enum GNUNET_ATS_Network_Type nt, + enum GNUNET_NetworkType nt, uint32_t distance, enum GNUNET_TRANSPORT_ConnectionStatus cs, struct GNUNET_MQ_Handle *mq) @@ -1002,7 +1002,7 @@ GNUNET_TRANSPORT_communicator_mq_del (struct GNUNET_TRANSPORT_QueueHandle *qh) struct GNUNET_TRANSPORT_AddressIdentifier * GNUNET_TRANSPORT_communicator_address_add (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const char *address, - enum GNUNET_ATS_Network_Type nt, + enum GNUNET_NetworkType nt, struct GNUNET_TIME_Relative expiration) { struct GNUNET_TRANSPORT_AddressIdentifier *ai; diff --git a/src/transport/transport_api2_monitor.c b/src/transport/transport_api2_monitor.c index 3798296c1..ca9832e45 100644 --- a/src/transport/transport_api2_monitor.c +++ b/src/transport/transport_api2_monitor.c @@ -174,7 +174,7 @@ handle_monitor_data (void *cls, struct GNUNET_TRANSPORT_MonitorInformation mi; mi.address = (const char *) &md[1]; - mi.nt = (enum GNUNET_ATS_Network_Type) ntohl (md->nt); + mi.nt = (enum GNUNET_NetworkType) ntohl (md->nt); mi.cs = (enum GNUNET_TRANSPORT_ConnectionStatus) ntohl (md->cs); mi.num_msg_pending = ntohl (md->num_msg_pending); mi.num_bytes_pending = ntohl (md->num_bytes_pending); -- cgit v1.2.3