GNUnet  0.10.x
Data Structures | Functions | Variables
plugin_transport_http_common.c File Reference

functionality shared between http(s)client plugins More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_transport_plugin.h"
#include "plugin_transport_http_common.h"
#include "gnunet_resolver_service.h"
Include dependency graph for plugin_transport_http_common.c:

Go to the source code of this file.

Data Structures

struct  PrettyPrinterContext
 Closure for append_port(). More...
 

Functions

static void http_clean_splitted (struct SplittedHTTPAddress *spa)
 
struct SplittedHTTPAddresshttp_split_address (const char *addr)
 Split an HTTP address into protocol, hostname, port and path components. More...
 
static const char * http_common_plugin_dnsresult_to_address (const char *plugin, const struct SplittedHTTPAddress *saddr, uint32_t options, const char *dnsresult)
 Function called for a quick conversion of the binary address to a numeric address. More...
 
static void http_common_dns_reverse_lookup_cb (void *cls, const char *hostname)
 
static int http_common_dns_reverse_lookup (const struct sockaddr *sockaddr, socklen_t sockaddr_len, const char *type, struct SplittedHTTPAddress *saddr, uint32_t options, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls)
 
static void http_common_dns_ip_lookup_cb (void *cls, const struct sockaddr *addr, socklen_t addrlen)
 
static int http_common_dns_ip_lookup (const char *name, const char *type, struct SplittedHTTPAddress *saddr, uint32_t options, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls)
 
void http_common_plugin_address_pretty_printer (void *cls, const char *type, const void *addr, size_t addrlen, int numeric, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls)
 Convert the transports address to a nice, human-readable format. More...
 
const char * http_common_plugin_address_to_url (void *cls, const void *addr, size_t addrlen)
 FIXME. More...
 
const char * http_common_plugin_address_to_string (const char *plugin, const void *addr, size_t addrlen)
 Function called for a quick conversion of the binary address to a numeric address. More...
 
int http_common_plugin_string_to_address (void *cls, const char *addr, uint16_t addrlen, void **buf, size_t *added)
 Function called to convert a string address to a binary address. More...
 
struct HttpAddresshttp_common_address_from_socket (const char *protocol, const struct sockaddr *addr, socklen_t addrlen)
 Create a HTTP address from a socketaddr. More...
 
struct sockaddr * http_common_socket_from_address (const void *addr, size_t addrlen, int *res)
 Create a socketaddr from a HTTP address. More...
 
size_t http_common_address_get_size (const struct HttpAddress *addr)
 Get the length of an address. More...
 
size_t http_common_cmp_addresses (const void *addr1, size_t addrlen1, const void *addr2, size_t addrlen2)
 Compare addr1 to addr2. More...
 
enum GNUNET_NetworkType http_common_get_network_for_address (struct GNUNET_TRANSPORT_PluginEnvironment *env, const struct GNUNET_HELLO_Address *address)
 Function obtain the network type for an address. More...
 

Variables

static struct PrettyPrinterContextdll_ppc_head
 Head of PPC list. More...
 
static struct PrettyPrinterContextdll_ppc_tail
 Tail of PPC list. More...
 

Detailed Description

functionality shared between http(s)client plugins

functionality shared by http client and server transport service plugin

Author
Matthias Wachs
Matthias Wachs
Christian Grothoff

Definition in file plugin_transport_http_common.c.

Function Documentation

◆ http_clean_splitted()

static void http_clean_splitted ( struct SplittedHTTPAddress spa)
static

Definition at line 33 of file plugin_transport_http_common.c.

References GNUNET_free_non_null, SplittedHTTPAddress::host, SplittedHTTPAddress::path, and SplittedHTTPAddress::protocol.

Referenced by http_common_dns_ip_lookup_cb(), http_common_dns_reverse_lookup_cb(), http_common_plugin_address_pretty_printer(), and http_common_socket_from_address().

34 {
35  if (NULL != spa)
36  {
41  }
42 }
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
Here is the caller graph for this function:

◆ http_split_address()

struct SplittedHTTPAddress* http_split_address ( const char *  addr)

Split an HTTP address into protocol, hostname, port and path components.

Definition at line 46 of file plugin_transport_http_common.c.

References GNUNET_break, GNUNET_free, GNUNET_new, GNUNET_strdup, SplittedHTTPAddress::host, HTTP_DEFAULT_PORT, HTTPS_DEFAULT_PORT, SplittedHTTPAddress::path, SplittedHTTPAddress::port, and SplittedHTTPAddress::protocol.

Referenced by http_common_plugin_address_pretty_printer(), and http_common_socket_from_address().

47 {
48  struct SplittedHTTPAddress *sp;
49  char *src = GNUNET_strdup (addr);
50  char *protocol_start = NULL;
51  char *host_start = NULL;
52  char *v6_end = NULL;
53  char *port_start = NULL;
54  char *path_start = NULL;
55  protocol_start = src;
56 
57  sp = GNUNET_new (struct SplittedHTTPAddress);
58  /* Address string consists of protocol://host[:port]path*/
59 
60  host_start = strstr (src, "://");
61  if (NULL == host_start)
62  {
63  GNUNET_free(src);
64  GNUNET_free(sp);
65  return NULL ;
66  }
67  host_start[0] = '\0';
68  sp->protocol = GNUNET_strdup (protocol_start);
69 
70  host_start += strlen ("://");
71  if (strlen (host_start) == 0)
72  {
73  GNUNET_free(src);
74  GNUNET_free(sp->protocol);
75  GNUNET_free(sp);
76  return NULL ;
77  }
78 
79  /* Find path start */
80  path_start = strchr (host_start, '/');
81  if (NULL != path_start)
82  {
83  sp->path = GNUNET_strdup (path_start);
84  path_start[0] = '\0';
85  }
86  else
87  sp->path = GNUNET_strdup ("");
88 
89  if (strlen (host_start) < 1)
90  {
91  GNUNET_free(src);
92  GNUNET_free(sp->protocol);
93  GNUNET_free(sp->path);
94  GNUNET_free(sp);
95  return NULL ;
96  }
97 
98  if (NULL != (port_start = strrchr (host_start, ':')))
99  {
100  /* *We COULD have a port, but also an IPv6 address! */
101  if (NULL != (v6_end = strchr (host_start, ']')))
102  {
103  if (v6_end < port_start)
104  {
105  /* IPv6 address + port */
106  port_start[0] = '\0';
107  port_start++;
108  sp->port = atoi (port_start);
109  if ((0 == sp->port) || (65535 < sp->port))
110  {
111  GNUNET_free(src);
112  GNUNET_free(sp->protocol);
113  GNUNET_free(sp->path);
114  GNUNET_free(sp);
115  return NULL ;
116  }
117  }
118  else
119  {
120  /* IPv6 address + no port */
121  if (0 == strcmp (sp->protocol, "https"))
122  sp->port = HTTPS_DEFAULT_PORT;
123  else if (0 == strcmp (sp->protocol, "http"))
124  sp->port = HTTP_DEFAULT_PORT;
125  }
126  }
127  else
128  {
129  /* No IPv6 address */
130  port_start[0] = '\0';
131  port_start++;
132  sp->port = atoi (port_start);
133  if ((0 == sp->port) || (65535 < sp->port))
134  {
135  GNUNET_free(src);
136  GNUNET_free(sp->protocol);
137  GNUNET_free(sp->path);
138  GNUNET_free(sp);
139  return NULL ;
140  }
141  }
142  }
143  else
144  {
145  /* No ':' as port separator, default port for protocol */
146  if (0 == strcmp (sp->protocol, "https"))
147  sp->port = HTTPS_DEFAULT_PORT;
148  else if (0 == strcmp (sp->protocol, "http"))
149  sp->port = HTTP_DEFAULT_PORT;
150  else
151  {
152  GNUNET_break(0);
153  GNUNET_free(src);
154  GNUNET_free(sp->protocol);
155  GNUNET_free(sp->path);
156  GNUNET_free(sp);
157  return NULL ;
158  }
159  }
160  if (strlen (host_start) > 0)
161  sp->host = GNUNET_strdup (host_start);
162  else
163  {
164  GNUNET_break(0);
165  GNUNET_free(src);
166  GNUNET_free(sp->protocol);
167  GNUNET_free(sp->path);
168  GNUNET_free(sp);
169  return NULL ;
170  }
171  GNUNET_free(src);
172  return sp;
173 }
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define HTTP_DEFAULT_PORT
Representation of HTTP URL split into its components.
#define HTTPS_DEFAULT_PORT
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ http_common_plugin_dnsresult_to_address()

static const char* http_common_plugin_dnsresult_to_address ( const char *  plugin,
const struct SplittedHTTPAddress saddr,
uint32_t  options,
const char *  dnsresult 
)
static

Function called for a quick conversion of the binary address to a numeric address.

Note that the caller must not free the address and that the next call to this function is allowed to override the address again.

Parameters
pluginthe name of the plugin
saddrthe splitted http address
optionsaddress options
dnsresultdns name to include in address
Returns
string representing the same address or NULL on error

Definition at line 254 of file plugin_transport_http_common.c.

References GNUNET_asprintf(), GNUNET_break, GNUNET_free, GNUNET_memcpy, SplittedHTTPAddress::path, SplittedHTTPAddress::port, SplittedHTTPAddress::protocol, and res.

Referenced by http_common_dns_ip_lookup_cb(), and http_common_dns_reverse_lookup_cb().

258 {
259  static char rbuf[1024];
260  char *res;
261 
262  GNUNET_asprintf (&res, "%s.%u.%s://%s:%u%s", plugin, options, saddr->protocol,
263  dnsresult, saddr->port, saddr->path);
264  if (strlen (res) + 1 < 500)
265  {
266  GNUNET_memcpy (rbuf, res, strlen (res) + 1);
267  GNUNET_free(res);
268  return rbuf;
269  }
270  GNUNET_break(0);
271  GNUNET_free(res);
272  return NULL ;
273 }
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
#define GNUNET_memcpy(dst, src, n)
static int res
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_dns_reverse_lookup_cb()

static void http_common_dns_reverse_lookup_cb ( void *  cls,
const char *  hostname 
)
static

Definition at line 277 of file plugin_transport_http_common.c.

References PrettyPrinterContext::asc, PrettyPrinterContext::asc_cls, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, http_clean_splitted(), http_common_plugin_dnsresult_to_address(), PrettyPrinterContext::options, PrettyPrinterContext::plugin, PrettyPrinterContext::saddr, and PrettyPrinterContext::sucess.

Referenced by http_common_dns_reverse_lookup().

278 {
279  struct PrettyPrinterContext *ppc = cls;
280 
281  if (NULL != hostname)
282  {
283  ppc->asc (ppc->asc_cls,
285  hostname), GNUNET_OK);
286  ppc->sucess = GNUNET_YES;
287 
288  }
289  else
290  {
291  ppc->asc (ppc->asc_cls, NULL,
292  (GNUNET_NO == ppc->sucess) ? GNUNET_SYSERR : GNUNET_OK);
293 
295  http_clean_splitted (ppc->saddr);
296  GNUNET_free(ppc->plugin);
297  GNUNET_free(ppc);
298  }
299 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
GNUNET_TRANSPORT_AddressStringCallback asc
Function to call with the result.
struct SplittedHTTPAddress * saddr
Splitted Address.
Closure for append_port().
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
void * asc_cls
Clsoure for asc.
int sucess
Was conversion successful.
static const char * http_common_plugin_dnsresult_to_address(const char *plugin, const struct SplittedHTTPAddress *saddr, uint32_t options, const char *dnsresult)
Function called for a quick conversion of the binary address to a numeric address.
static struct PrettyPrinterContext * dll_ppc_tail
Tail of PPC list.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static char * hostname
Our hostname; we give this to all the peers we start.
uint32_t options
Address options.
static struct PrettyPrinterContext * dll_ppc_head
Head of PPC list.
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_free(ptr)
Wrapper around free.
static void http_clean_splitted(struct SplittedHTTPAddress *spa)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_dns_reverse_lookup()

static int http_common_dns_reverse_lookup ( const struct sockaddr *  sockaddr,
socklen_t  sockaddr_len,
const char *  type,
struct SplittedHTTPAddress saddr,
uint32_t  options,
struct GNUNET_TIME_Relative  timeout,
GNUNET_TRANSPORT_AddressStringCallback  asc,
void *  asc_cls 
)
static

Definition at line 303 of file plugin_transport_http_common.c.

References PrettyPrinterContext::asc, PrettyPrinterContext::asc_cls, GNUNET_CONTAINER_DLL_insert, GNUNET_free, GNUNET_new, GNUNET_OK, GNUNET_RESOLVER_hostname_get(), GNUNET_strdup, GNUNET_SYSERR, GNUNET_YES, http_common_dns_reverse_lookup_cb(), PrettyPrinterContext::options, PrettyPrinterContext::plugin, PrettyPrinterContext::resolver_handle, and PrettyPrinterContext::saddr.

Referenced by http_common_plugin_address_pretty_printer().

311 {
312  struct PrettyPrinterContext *ppc;
313 
314  ppc = GNUNET_new (struct PrettyPrinterContext);
315  ppc->saddr = saddr;
316  ppc->asc = asc;
317  ppc->asc_cls = asc_cls;
318  ppc->plugin = GNUNET_strdup (type);
319  ppc->options = options;
321  sockaddr_len,
322  GNUNET_YES,
323  timeout,
325  ppc);
326  if (NULL == ppc->resolver_handle)
327  {
328  GNUNET_free(ppc->plugin);
329  GNUNET_free(ppc);
330  return GNUNET_SYSERR;
331  }
333  dll_ppc_tail,
334  ppc);
335  return GNUNET_OK;
336 }
GNUNET_TRANSPORT_AddressStringCallback asc
Function to call with the result.
static void http_common_dns_reverse_lookup_cb(void *cls, const char *hostname)
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct SplittedHTTPAddress * saddr
Splitted Address.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_RESOLVER_RequestHandle * resolver_handle
Resolver handle.
Closure for append_port().
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_RESOLVER_RequestHandle * GNUNET_RESOLVER_hostname_get(const struct sockaddr *sa, socklen_t salen, int do_resolve, struct GNUNET_TIME_Relative timeout, GNUNET_RESOLVER_HostnameCallback callback, void *cls)
Perform a reverse DNS lookup.
void * asc_cls
Clsoure for asc.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static struct PrettyPrinterContext * dll_ppc_tail
Tail of PPC list.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
uint32_t options
Address options.
static struct PrettyPrinterContext * dll_ppc_head
Head of PPC list.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_dns_ip_lookup_cb()

static void http_common_dns_ip_lookup_cb ( void *  cls,
const struct sockaddr *  addr,
socklen_t  addrlen 
)
static

Definition at line 340 of file plugin_transport_http_common.c.

References PrettyPrinterContext::asc, PrettyPrinterContext::asc_cls, GNUNET_a2s(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, http_clean_splitted(), http_common_plugin_dnsresult_to_address(), PrettyPrinterContext::options, PrettyPrinterContext::plugin, PrettyPrinterContext::saddr, and PrettyPrinterContext::sucess.

Referenced by http_common_dns_ip_lookup().

343 {
344  struct PrettyPrinterContext *ppc = cls;
345 
346  if (NULL != addr)
347  {
348  ppc->asc (ppc->asc_cls,
350  GNUNET_a2s (addr, addrlen)), GNUNET_OK);
351  ppc->sucess = GNUNET_YES;
352  ppc->asc (ppc->asc_cls, GNUNET_a2s (addr, addrlen), GNUNET_OK);
353  }
354  else
355  {
356  ppc->asc (ppc->asc_cls, NULL,
357  (GNUNET_NO == ppc->sucess) ? GNUNET_SYSERR : GNUNET_OK);
358 
360  GNUNET_free(ppc->plugin);
361  http_clean_splitted (ppc->saddr);
362  GNUNET_free(ppc);
363  }
364 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
GNUNET_TRANSPORT_AddressStringCallback asc
Function to call with the result.
struct SplittedHTTPAddress * saddr
Splitted Address.
Closure for append_port().
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
void * asc_cls
Clsoure for asc.
int sucess
Was conversion successful.
static const char * http_common_plugin_dnsresult_to_address(const char *plugin, const struct SplittedHTTPAddress *saddr, uint32_t options, const char *dnsresult)
Function called for a quick conversion of the binary address to a numeric address.
const char * GNUNET_a2s(const struct sockaddr *addr, socklen_t addrlen)
Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string (for printing debug messages)...
static struct PrettyPrinterContext * dll_ppc_tail
Tail of PPC list.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
uint32_t options
Address options.
static struct PrettyPrinterContext * dll_ppc_head
Head of PPC list.
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_free(ptr)
Wrapper around free.
static void http_clean_splitted(struct SplittedHTTPAddress *spa)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_dns_ip_lookup()

static int http_common_dns_ip_lookup ( const char *  name,
const char *  type,
struct SplittedHTTPAddress saddr,
uint32_t  options,
struct GNUNET_TIME_Relative  timeout,
GNUNET_TRANSPORT_AddressStringCallback  asc,
void *  asc_cls 
)
static

Definition at line 368 of file plugin_transport_http_common.c.

References PrettyPrinterContext::asc, PrettyPrinterContext::asc_cls, GNUNET_CONTAINER_DLL_insert, GNUNET_free, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_RESOLVER_ip_get(), GNUNET_strdup, GNUNET_SYSERR, http_common_dns_ip_lookup_cb(), PrettyPrinterContext::options, PrettyPrinterContext::plugin, PrettyPrinterContext::resolver_handle, PrettyPrinterContext::saddr, and PrettyPrinterContext::sucess.

Referenced by http_common_plugin_address_pretty_printer().

374 {
375  struct PrettyPrinterContext *ppc;
376 
377  ppc = GNUNET_new (struct PrettyPrinterContext);
378  ppc->sucess = GNUNET_NO;
379  ppc->saddr = saddr;
380  ppc->asc = asc;
381  ppc->asc_cls = asc_cls;
382  ppc->plugin = GNUNET_strdup (type);
383  ppc->options = options;
385  AF_UNSPEC,
386  timeout,
388  ppc);
389  if (NULL == ppc->resolver_handle)
390  {
391  GNUNET_free(ppc->plugin);
392  GNUNET_free(ppc);
393  return GNUNET_SYSERR;
394  }
396  dll_ppc_tail,
397  ppc);
398  return GNUNET_OK;
399 }
GNUNET_TRANSPORT_AddressStringCallback asc
Function to call with the result.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct SplittedHTTPAddress * saddr
Splitted Address.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_RESOLVER_RequestHandle * resolver_handle
Resolver handle.
Closure for append_port().
#define GNUNET_NO
Definition: gnunet_common.h:81
struct GNUNET_RESOLVER_RequestHandle * GNUNET_RESOLVER_ip_get(const char *hostname, int af, struct GNUNET_TIME_Relative timeout, GNUNET_RESOLVER_AddressCallback callback, void *callback_cls)
Convert a string to one or more IP addresses.
Definition: resolver_api.c:927
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void * asc_cls
Clsoure for asc.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
int sucess
Was conversion successful.
static struct PrettyPrinterContext * dll_ppc_tail
Tail of PPC list.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static void http_common_dns_ip_lookup_cb(void *cls, const struct sockaddr *addr, socklen_t addrlen)
const char * name
uint32_t options
Address options.
static struct PrettyPrinterContext * dll_ppc_head
Head of PPC list.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_plugin_address_pretty_printer()

void http_common_plugin_address_pretty_printer ( void *  cls,
const char *  type,
const void *  addr,
size_t  addrlen,
int  numeric,
struct GNUNET_TIME_Relative  timeout,
GNUNET_TRANSPORT_AddressStringCallback  asc,
void *  asc_cls 
)

Convert the transports address to a nice, human-readable format.

Parameters
clsclosure
typename of the transport that generated the address
addrone of the addresses of the host, NULL for the last address the specific address format depends on the transport
addrlenlength of the addr
numericshould (IP) addresses be displayed in numeric form?
timeoutafter how long should we give up?
ascfunction to call on each string
asc_clsclosure for asc

Definition at line 417 of file plugin_transport_http_common.c.

References HttpAddress::addr, address, PrettyPrinterContext::asc, GNUNET_break, GNUNET_free_non_null, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, SplittedHTTPAddress::host, http_clean_splitted(), http_common_address_get_size(), http_common_dns_ip_lookup(), http_common_dns_reverse_lookup(), http_common_plugin_address_to_string(), http_common_socket_from_address(), http_split_address(), HttpAddress::options, res, ret, PrettyPrinterContext::saddr, and HttpAddress::urlen.

Referenced by libgnunet_plugin_transport_http_client_init(), and libgnunet_plugin_transport_http_server_init().

424 {
425  const struct HttpAddress *address = addr;
426  struct SplittedHTTPAddress *saddr;
427  struct sockaddr *sock_addr;
428  const char *ret;
429  char *addr_str;
430  int res;
431  int have_ip;
432 
433  saddr = NULL;
434  sock_addr = NULL;
435  if ( (addrlen < sizeof(struct HttpAddress)) ||
436  (addrlen != http_common_address_get_size (address)) )
437  {
438  GNUNET_break(0);
439  goto handle_error;
440  }
441 
442  addr_str = (char *) &address[1];
443  if (addr_str[ntohl (address->urlen) - 1] != '\0')
444  {
445  GNUNET_break(0);
446  goto handle_error;
447  }
448 
449  saddr = http_split_address (addr_str);
450  if (NULL == saddr)
451  {
452  GNUNET_break(0);
453  goto handle_error;
454  }
455 
456  sock_addr = http_common_socket_from_address (addr, addrlen, &res);
457  if (GNUNET_SYSERR == res)
458  {
459  /* Malformed address */
460  GNUNET_break (0);
461  goto handle_error;
462  }
463  else if (GNUNET_NO == res)
464  {
465  /* Could not convert to IP */
466  have_ip = GNUNET_NO;
467  }
468  else if (GNUNET_YES == res)
469  {
470  /* Converted to IP */
471  have_ip = GNUNET_YES;
472  }
473  else
474  {
475  /* Must not happen */
476  GNUNET_break (0);
477  goto handle_error;
478  }
479 
480  if ( (GNUNET_YES == numeric) &&
481  (GNUNET_YES == have_ip) )
482  {
483  /* No lookup required */
484  ret = http_common_plugin_address_to_string (type, address, addrlen);
485  asc (asc_cls, ret, (NULL == ret) ? GNUNET_SYSERR : GNUNET_OK);
486  asc (asc_cls, NULL, GNUNET_OK);
487  http_clean_splitted (saddr);
488  GNUNET_free_non_null (sock_addr);
489  return;
490  }
491  if ( (GNUNET_YES == numeric) &&
492  (GNUNET_NO == have_ip) )
493  {
494  /* Forward lookup */
495  if (GNUNET_SYSERR ==
496  http_common_dns_ip_lookup (saddr->host, type, saddr,
497  address->options, timeout,
498  asc, asc_cls))
499  {
500  GNUNET_break(0);
501  goto handle_error;
502  }
503  /* Wait for resolver callback */
504  GNUNET_free_non_null (sock_addr);
505  return;
506  }
507  if ( (GNUNET_NO == numeric) &&
508  (GNUNET_YES == have_ip) )
509  {
510  /* Reverse lookup */
511  if (GNUNET_SYSERR ==
513  (AF_INET == sock_addr->sa_family)
514  ? sizeof(struct sockaddr_in)
515  : sizeof(struct sockaddr_in6),
516  type,
517  saddr,
518  address->options, timeout,
519  asc, asc_cls))
520  {
521  GNUNET_break(0);
522  goto handle_error;
523  }
524  /* Wait for resolver callback */
525  GNUNET_free_non_null (sock_addr);
526  return;
527  }
528  if ( (GNUNET_NO == numeric) &&
529  (GNUNET_NO == have_ip) )
530  {
531  /* No lookup required */
532  ret = http_common_plugin_address_to_string (type, address, addrlen);
533  asc (asc_cls, ret, (NULL == ret) ? GNUNET_SYSERR : GNUNET_OK);
534  asc (asc_cls, NULL, GNUNET_OK);
535  GNUNET_free_non_null (sock_addr);
536  http_clean_splitted (saddr);
537  return;
538  }
539  /* Error (argument supplied not GNUNET_YES or GNUNET_NO) */
540  GNUNET_break (0);
541  goto handle_error;
542 
543  handle_error:
544  /* Report error */
545  asc (asc_cls, NULL, GNUNET_SYSERR);
546  asc (asc_cls, NULL, GNUNET_OK);
547  GNUNET_free_non_null (sock_addr);
548  if (NULL != saddr)
549  http_clean_splitted (saddr);
550 }
uint32_t options
Address options see enum HttpAddressOptions
struct SplittedHTTPAddress * http_split_address(const char *addr)
Split an HTTP address into protocol, hostname, port and path components.
#define GNUNET_NO
Definition: gnunet_common.h:81
static int numeric
Option -n.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
static int ret
Final status code.
Definition: gnunet-arm.c:89
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
size_t http_common_address_get_size(const struct HttpAddress *addr)
Get the length of an address.
Representation of HTTP URL split into its components.
static int http_common_dns_reverse_lookup(const struct sockaddr *sockaddr, socklen_t sockaddr_len, const char *type, struct SplittedHTTPAddress *saddr, uint32_t options, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls)
void * addr
Address following.
static int res
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static int http_common_dns_ip_lookup(const char *name, const char *type, struct SplittedHTTPAddress *saddr, uint32_t options, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls)
uint32_t urlen
Length of URL located after struct.
const char * http_common_plugin_address_to_string(const char *plugin, const void *addr, size_t addrlen)
Function called for a quick conversion of the binary address to a numeric address.
struct sockaddr * http_common_socket_from_address(const void *addr, size_t addrlen, int *res)
Create a socketaddr from a HTTP address.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
#define GNUNET_YES
Definition: gnunet_common.h:80
static char * address
GNS address for this phone.
HTTP addresses including a full URI.
static void http_clean_splitted(struct SplittedHTTPAddress *spa)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_plugin_address_to_url()

const char* http_common_plugin_address_to_url ( void *  cls,
const void *  addr,
size_t  addrlen 
)

FIXME.

Definition at line 557 of file plugin_transport_http_common.c.

References HttpAddress::addr, address, GNUNET_break, GNUNET_memcpy, http_common_address_get_size(), and HttpAddress::urlen.

Referenced by client_connect().

560 {
561  static char rbuf[1024];
562  const struct HttpAddress *address = addr;
563  const char * addr_str;
564 
565  if (NULL == addr)
566  {
567  GNUNET_break(0);
568  return NULL;
569  }
570  if (0 == addrlen)
571  {
572  GNUNET_break(0);
573  return NULL;
574  }
575  if (addrlen != http_common_address_get_size (address))
576  {
577  GNUNET_break(0);
578  return NULL;
579  }
580  addr_str = (char *) &address[1];
581  if (addr_str[ntohl (address->urlen) - 1] != '\0')
582  return NULL;
583 
584  GNUNET_memcpy (rbuf,
585  &address[1],
586  ntohl (address->urlen));
587  return rbuf;
588 }
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
size_t http_common_address_get_size(const struct HttpAddress *addr)
Get the length of an address.
#define GNUNET_memcpy(dst, src, n)
void * addr
Address following.
uint32_t urlen
Length of URL located after struct.
static char * address
GNS address for this phone.
HTTP addresses including a full URI.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_plugin_address_to_string()

const char* http_common_plugin_address_to_string ( const char *  plugin,
const void *  addr,
size_t  addrlen 
)

Function called for a quick conversion of the binary address to a numeric address.

Note that the caller must not free the address and that the next call to this function is allowed to override the address again.

Parameters
pluginthe name of the plugin
addrbinary address
addrlenlength of the address
Returns
string representing the same address

Definition at line 603 of file plugin_transport_http_common.c.

References HttpAddress::addr, address, GNUNET_asprintf(), GNUNET_assert, GNUNET_break, GNUNET_free, GNUNET_memcpy, http_common_address_get_size(), HttpAddress::options, res, and HttpAddress::urlen.

Referenced by client_connect(), client_receive_mst_cb(), http_client_plugin_address_to_string(), http_client_plugin_get_session(), http_common_plugin_address_pretty_printer(), http_server_plugin_address_to_string(), libgnunet_plugin_transport_http_server_done(), server_access_cb(), server_add_address(), server_disconnect_cb(), server_lookup_connection(), server_receive_mst_cb(), and server_remove_address().

606 {
607  static char rbuf[1024];
608  const struct HttpAddress *address = addr;
609  const char * addr_str;
610  char *res;
611 
612  GNUNET_assert(NULL != plugin);
613  if (NULL == addr)
614  return NULL;
615  if (0 == addrlen)
616  return NULL;
617  if (addrlen != http_common_address_get_size (address))
618  return NULL;
619  addr_str = (char *) &address[1];
620  if (addr_str[ntohl (address->urlen) - 1] != '\0')
621  return NULL;
622  GNUNET_asprintf (&res, "%s.%u.%s", plugin, ntohl (address->options),
623  &address[1]);
624  if (strlen (res) + 1 < 500)
625  {
626  GNUNET_memcpy (rbuf, res, strlen (res) + 1);
627  GNUNET_free(res);
628  return rbuf;
629  }
630  GNUNET_break(0);
631  GNUNET_free(res);
632  return NULL;
633 }
uint32_t options
Address options see enum HttpAddressOptions
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
size_t http_common_address_get_size(const struct HttpAddress *addr)
Get the length of an address.
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
#define GNUNET_memcpy(dst, src, n)
void * addr
Address following.
static int res
uint32_t urlen
Length of URL located after struct.
static char * address
GNS address for this phone.
HTTP addresses including a full URI.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_plugin_string_to_address()

int http_common_plugin_string_to_address ( void *  cls,
const char *  addr,
uint16_t  addrlen,
void **  buf,
size_t *  added 
)

Function called to convert a string address to a binary address.

Parameters
clsclosure ('struct Plugin*')
addrstring address
addrlenlength of the addr
buflocation to store the buffer If the function returns GNUNET_SYSERR, its contents are undefined.
addedlength of created address
Returns
GNUNET_OK on success, GNUNET_SYSERR on failure

Definition at line 648 of file plugin_transport_http_common.c.

References address, GNUNET_break, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, HttpAddress::options, PrettyPrinterContext::options, PrettyPrinterContext::plugin, and HttpAddress::urlen.

Referenced by libgnunet_plugin_transport_http_client_init(), and libgnunet_plugin_transport_http_server_init().

653 {
654  struct HttpAddress *a;
655  char *address;
656  char *plugin;
657  char *optionstr;
658  size_t urlen;
659  uint32_t options;
660 
661  /* Format protocol.options.address:port */
662  address = NULL;
663  plugin = NULL;
664  optionstr = NULL;
665  if ((NULL == addr) || (addrlen == 0))
666  {
667  GNUNET_break(0);
668  return GNUNET_SYSERR;
669  }
670  if ('\0' != addr[addrlen - 1])
671  {
672  GNUNET_break(0);
673  return GNUNET_SYSERR;
674  }
675  if (strlen (addr) != addrlen - 1)
676  {
677  GNUNET_break(0);
678  return GNUNET_SYSERR;
679  }
680  plugin = GNUNET_strdup (addr);
681  optionstr = strchr (plugin, '.');
682  if (NULL == optionstr)
683  {
684  GNUNET_break(0);
685  GNUNET_free(plugin);
686  return GNUNET_SYSERR;
687  }
688  optionstr[0] = '\0';
689  optionstr++;
690  options = atol (optionstr); /* 0 on conversion error, that's ok */
691  address = strchr (optionstr, '.');
692  if (NULL == address)
693  {
694  GNUNET_break(0);
695  GNUNET_free(plugin);
696  return GNUNET_SYSERR;
697  }
698  address[0] = '\0';
699  address++;
700  urlen = strlen (address) + 1;
701 
702  a = GNUNET_malloc (sizeof (struct HttpAddress) + urlen);
703  a->options = htonl (options);
704  a->urlen = htonl (urlen);
705  GNUNET_memcpy (&a[1], address, urlen);
706 
707  (*buf) = a;
708  (*added) = sizeof(struct HttpAddress) + urlen;
709  GNUNET_free(plugin);
710  return GNUNET_OK;
711 }
uint32_t options
Address options see enum HttpAddressOptions
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
#define GNUNET_memcpy(dst, src, n)
void * addr
Address following.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
uint32_t urlen
Length of URL located after struct.
static char * address
GNS address for this phone.
HTTP addresses including a full URI.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ http_common_address_from_socket()

struct HttpAddress* http_common_address_from_socket ( const char *  protocol,
const struct sockaddr *  addr,
socklen_t  addrlen 
)

Create a HTTP address from a socketaddr.

Parameters
protocolprotocol
addrsockaddr * address
addrlenlength of the address
Returns
the HttpAddress

Definition at line 723 of file plugin_transport_http_common.c.

References address, GNUNET_a2s(), GNUNET_asprintf(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, HTTP_OPTIONS_NONE, len, HttpAddress::options, res, and HttpAddress::urlen.

Referenced by server_add_address(), server_lookup_connection(), and server_remove_address().

726 {
727  struct HttpAddress *address = NULL;
728  char *res;
729  size_t len;
730 
731  GNUNET_asprintf (&res,
732  "%s://%s",
733  protocol,
734  GNUNET_a2s (addr,
735  addrlen));
736  len = strlen (res) + 1;
737  address = GNUNET_malloc (sizeof (struct HttpAddress) + len);
738  address->options = htonl (HTTP_OPTIONS_NONE);
739  address->urlen = htonl (len);
740  GNUNET_memcpy (&address[1], res, len);
741  GNUNET_free(res);
742  return address;
743 }
uint32_t options
Address options see enum HttpAddressOptions
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
#define GNUNET_memcpy(dst, src, n)
void * addr
Address following.
const char * GNUNET_a2s(const struct sockaddr *addr, socklen_t addrlen)
Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string (for printing debug messages)...
static int res
uint32_t urlen
Length of URL located after struct.
static char * address
GNS address for this phone.
HTTP addresses including a full URI.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_socket_from_address()

struct sockaddr* http_common_socket_from_address ( const void *  addr,
size_t  addrlen,
int *  res 
)

Create a socketaddr from a HTTP address.

Parameters
addra sockaddr * address
addrlenlength of the addr
resthe result: GNUNET_SYSERR, invalid input, GNUNET_YES: could convert to ip, GNUNET_NO: valid input but could not convert to ip (hostname?)
Returns
the string

Definition at line 758 of file plugin_transport_http_common.c.

References GNUNET_asprintf(), GNUNET_break, GNUNET_free, GNUNET_new, GNUNET_NO, GNUNET_STRINGS_to_address_ip(), GNUNET_SYSERR, GNUNET_YES, SplittedHTTPAddress::host, http_clean_splitted(), http_split_address(), SplittedHTTPAddress::port, and HttpAddress::urlen.

Referenced by http_client_plugin_get_session(), http_common_get_network_for_address(), and http_common_plugin_address_pretty_printer().

761 {
762  const struct HttpAddress *ha;
763  struct SplittedHTTPAddress * spa;
764  struct sockaddr_storage *s;
765  char * to_conv;
766  size_t urlen;
767 
768  (*res) = GNUNET_SYSERR;
769  ha = (const struct HttpAddress *) addr;
770  if (NULL == addr)
771  {
772  GNUNET_break (0);
773  return NULL;
774  }
775  if (0 == addrlen)
776  {
777  GNUNET_break (0);
778  return NULL;
779  }
780  if (addrlen < sizeof(struct HttpAddress))
781  {
782  GNUNET_break (0);
783  return NULL;
784  }
785  urlen = ntohl (ha->urlen);
786  if (sizeof(struct HttpAddress) + urlen != addrlen)
787  {
788  /* This is a legacy addresses */
789  return NULL;
790  }
791  if (addrlen < sizeof(struct HttpAddress) + urlen)
792  {
793  /* This is a legacy addresses */
794  return NULL;
795  }
796  if (((char *) addr)[addrlen - 1] != '\0')
797  {
798  GNUNET_break (0);
799  return NULL;
800  }
801  spa = http_split_address ((const char *) &ha[1]);
802  if (NULL == spa)
803  {
804  (*res) = GNUNET_SYSERR;
805  return NULL;
806  }
807 
808  s = GNUNET_new (struct sockaddr_storage);
809  GNUNET_asprintf (&to_conv, "%s:%u", spa->host, spa->port);
810  if (GNUNET_SYSERR
811  == GNUNET_STRINGS_to_address_ip (to_conv, strlen (to_conv), s))
812  {
813  /* could be a hostname */
814  GNUNET_free(s);
815  (*res) = GNUNET_NO;
816  s = NULL;
817  }
818  else if ((AF_INET != s->ss_family) && (AF_INET6 != s->ss_family))
819  {
820  GNUNET_free (s);
821  (*res) = GNUNET_SYSERR;
822  s = NULL;
823  }
824  else
825  {
826  (*res) = GNUNET_YES;
827  }
828  http_clean_splitted (spa);
829  GNUNET_free (to_conv);
830  return (struct sockaddr *) s;
831 }
struct SplittedHTTPAddress * http_split_address(const char *addr)
Split an HTTP address into protocol, hostname, port and path components.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
Representation of HTTP URL split into its components.
void * addr
Address following.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
uint32_t urlen
Length of URL located after struct.
#define GNUNET_YES
Definition: gnunet_common.h:80
HTTP addresses including a full URI.
int GNUNET_STRINGS_to_address_ip(const char *addr, uint16_t addrlen, struct sockaddr_storage *r_buf)
Tries to convert addr string to an IP (v4 or v6) address.
Definition: strings.c:1409
#define GNUNET_free(ptr)
Wrapper around free.
static void http_clean_splitted(struct SplittedHTTPAddress *spa)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_common_address_get_size()

size_t http_common_address_get_size ( const struct HttpAddress addr)

Get the length of an address.

Parameters
addraddress
Returns
the size

Definition at line 841 of file plugin_transport_http_common.c.

Referenced by http_common_plugin_address_pretty_printer(), http_common_plugin_address_to_string(), http_common_plugin_address_to_url(), server_add_address(), server_lookup_connection(), and server_remove_address().

842 {
843  return sizeof(struct HttpAddress) + ntohl (addr->urlen);
844 }
uint32_t urlen
Length of URL located after struct.
HTTP addresses including a full URI.
Here is the caller graph for this function:

◆ http_common_cmp_addresses()

size_t http_common_cmp_addresses ( const void *  addr1,
size_t  addrlen1,
const void *  addr2,
size_t  addrlen2 
)

Compare addr1 to addr2.

Parameters
addr1address1
addrlen1address 1 length
addr2address2
addrlen2address 2 length
Returns
GNUNET_YES if equal, GNUNET_NO if not, GNUNET_SYSERR on error

Definition at line 857 of file plugin_transport_http_common.c.

References GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, and HttpAddress::urlen.

Referenced by http_server_plugin_address_suggested(), and server_remove_address().

861 {
862  const char *a1 = addr1;
863  const char *a2 = addr2;
864  const struct HttpAddress *ha1;
865  const struct HttpAddress *ha2;
866  ha1 = (const struct HttpAddress *) a1;
867  ha2 = (const struct HttpAddress *) a2;
868 
869  if (NULL == a1)
870  return GNUNET_SYSERR;
871  if (0 == addrlen1)
872  return GNUNET_SYSERR;
873  if (a1[addrlen1 - 1] != '\0')
874  return GNUNET_SYSERR;
875 
876  if (NULL == a2)
877  return GNUNET_SYSERR;
878  if (0 == addrlen2)
879  return GNUNET_SYSERR;
880  if (a2[addrlen2 - 1] != '\0')
881  return GNUNET_SYSERR;
882 
883  if (addrlen1 != addrlen2)
884  return GNUNET_NO;
885  if (ha1->urlen != ha2->urlen)
886  return GNUNET_NO;
887 
888  if (0 == strcmp ((const char *) &ha1[1], (const char *) &ha2[1]))
889  return GNUNET_YES;
890  return GNUNET_NO;
891 }
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
uint32_t urlen
Length of URL located after struct.
#define GNUNET_YES
Definition: gnunet_common.h:80
HTTP addresses including a full URI.
Here is the caller graph for this function:

◆ http_common_get_network_for_address()

enum GNUNET_NetworkType http_common_get_network_for_address ( struct GNUNET_TRANSPORT_PluginEnvironment env,
const struct GNUNET_HELLO_Address address 
)

Function obtain the network type for an address.

Parameters
envthe environment
addressthe address
Returns
the network type

Definition at line 902 of file plugin_transport_http_common.c.

References GNUNET_HELLO_Address::address, GNUNET_HELLO_Address::address_length, GNUNET_TRANSPORT_PluginEnvironment::cls, GNUNET_TRANSPORT_PluginEnvironment::get_address_type, GNUNET_assert, GNUNET_free, GNUNET_NT_UNSPECIFIED, GNUNET_SYSERR, GNUNET_YES, http_common_socket_from_address(), and res.

Referenced by http_client_plugin_get_network_for_address(), and http_server_plugin_get_network_for_address().

904 {
905 
906  struct sockaddr *sa;
907  enum GNUNET_NetworkType net_type;
908  size_t salen = 0;
909  int res;
910 
911  net_type = GNUNET_NT_UNSPECIFIED;
913  address->address_length,
914  &res);
915  if (GNUNET_SYSERR == res)
916  return net_type;
917  if (GNUNET_YES == res)
918  {
919  GNUNET_assert (NULL != sa);
920  if (AF_INET == sa->sa_family)
921  {
922  salen = sizeof (struct sockaddr_in);
923  }
924  else if (AF_INET6 == sa->sa_family)
925  {
926  salen = sizeof (struct sockaddr_in6);
927  }
928  net_type = env->get_address_type (env->cls,
929  sa,
930  salen);
931  GNUNET_free (sa);
932  }
933  return net_type;
934 }
size_t address_length
Number of bytes in address.
const void * address
Binary representation of the address (plugin-specific).
GNUNET_TRANSPORT_AddressToType get_address_type
Function that will be called to figure if an address is an loopback, LAN, WAN etc.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:35
void * cls
Closure for the various callbacks.
static int res
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
struct sockaddr * http_common_socket_from_address(const void *addr, size_t addrlen, int *res)
Create a socketaddr from a HTTP address.
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_free(ptr)
Wrapper around free.
Category of last resort.
Definition: gnunet_nt_lib.h:40
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dll_ppc_head

struct PrettyPrinterContext* dll_ppc_head
static

Head of PPC list.

Definition at line 234 of file plugin_transport_http_common.c.

◆ dll_ppc_tail

struct PrettyPrinterContext* dll_ppc_tail
static

Tail of PPC list.

Definition at line 239 of file plugin_transport_http_common.c.