Go to the source code of this file.
Data Structures | |
struct | HttpAddress |
HTTP addresses including a full URI. More... | |
struct | SplittedHTTPAddress |
Representation of HTTP URL split into its components. More... | |
Macros | |
#define | TESTING GNUNET_NO |
Timeout values for testing. More... | |
#define | PROTOCOL "http" |
#define | HTTP_SERVER_NOT_VALIDATED_TIMEOUT |
#define | HTTP_CLIENT_NOT_VALIDATED_TIMEOUT |
#define | HTTP_CLIENT_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT |
#define | HTTP_SERVER_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT |
#define | TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG |
#define | HTTP_DEFAULT_PORT 80 |
#define | HTTPS_DEFAULT_PORT 443 |
Enumerations | |
enum | HttpAddressOptions { HTTP_OPTIONS_NONE = 0 , HTTP_OPTIONS_VERIFY_CERTIFICATE = 1 , HTTP_OPTIONS_TCP_STEALTH = 2 } |
Bits in the options field of HTTP addresses. More... | |
Functions | |
struct SplittedHTTPAddress * | http_split_address (const char *addr) |
Split an HTTP address into protocol, hostname, port and path components. More... | |
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_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 HttpAddress * | http_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... | |
const char * | http_common_plugin_address_to_url (void *cls, const void *addr, size_t addrlen) |
FIXME. 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... | |
#define TESTING GNUNET_NO |
Timeout values for testing.
Definition at line 33 of file plugin_transport_http_common.h.
#define PROTOCOL "http" |
Definition at line 51 of file plugin_transport_http_common.h.
#define HTTP_SERVER_NOT_VALIDATED_TIMEOUT |
Definition at line 54 of file plugin_transport_http_common.h.
#define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT |
Definition at line 56 of file plugin_transport_http_common.h.
#define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT |
Definition at line 58 of file plugin_transport_http_common.h.
#define HTTP_SERVER_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT |
Definition at line 59 of file plugin_transport_http_common.h.
#define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG |
Definition at line 60 of file plugin_transport_http_common.h.
#define HTTP_DEFAULT_PORT 80 |
Definition at line 64 of file plugin_transport_http_common.h.
#define HTTPS_DEFAULT_PORT 443 |
Definition at line 65 of file plugin_transport_http_common.h.
enum HttpAddressOptions |
Bits in the options
field of HTTP addresses.
Definition at line 70 of file plugin_transport_http_common.h.
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().
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.
cls | closure |
type | name of the transport that generated the address |
addr | one of the addresses of the host, NULL for the last address the specific address format depends on the transport |
addrlen | length of addr |
numeric | should (IP) addresses be displayed in numeric form? |
timeout | after how long should we give up? |
asc | function to call on each string |
asc_cls | closure for asc |
Definition at line 411 of file plugin_transport_http_common.c.
References HttpAddress::addr, address, GNUNET_break, GNUNET_free, 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(), numeric, res, ret, timeout, and type.
Referenced by libgnunet_plugin_transport_http_client_init().
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.
plugin | name of the plugin |
addr | binary address |
addrlen | length of addr |
Definition at line 587 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(), plugin, and res.
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_client_done(), server_access_cb(), server_add_address(), server_disconnect_cb(), server_lookup_connection(), server_receive_mst_cb(), and server_remove_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.
cls | closure (struct Plugin* ) |
addr | string address |
addrlen | length of addr |
buf | location to store the buffer If the function returns GNUNET_SYSERR, its contents are undefined. |
added | length of created address |
Definition at line 621 of file plugin_transport_http_common.c.
References HttpAddress::addr, address, GNUNET_break, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, options, HttpAddress::options, plugin, and HttpAddress::urlen.
Referenced by libgnunet_plugin_transport_http_client_init().
struct HttpAddress* http_common_address_from_socket | ( | const char * | protocol, |
const struct sockaddr * | addr, | ||
socklen_t | addrlen | ||
) |
Create a HTTP address from a socketaddr.
protocol | protocol |
addr | sockaddr * address |
addrlen | length of the addr |
struct HttpAddress
derived from addr Definition at line 688 of file plugin_transport_http_common.c.
References HttpAddress::addr, address, GNUNET_a2s(), GNUNET_asprintf(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, HTTP_OPTIONS_NONE, len, and res.
Referenced by server_add_address(), server_lookup_connection(), and server_remove_address().
struct sockaddr* http_common_socket_from_address | ( | const void * | addr, |
size_t | addrlen, | ||
int * | res | ||
) |
Create a socketaddr from a HTTP address.
addr | a sockaddr * address |
addrlen | length of the addr |
res | the result: GNUNET_SYSERR, invalid input, GNUNET_YES: could convert to ip, GNUNET_NO: valid input but could not convert to ip (hostname?) |
Definition at line 723 of file plugin_transport_http_common.c.
References HttpAddress::addr, 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(), and http_common_plugin_address_pretty_printer().
const char* http_common_plugin_address_to_url | ( | void * | cls, |
const void * | addr, | ||
size_t | addrlen | ||
) |
FIXME.
Definition at line 552 of file plugin_transport_http_common.c.
References HttpAddress::addr, address, GNUNET_break, GNUNET_memcpy, and http_common_address_get_size().
Referenced by client_connect().
size_t http_common_address_get_size | ( | const struct HttpAddress * | addr | ) |
Get the length of an address.
addr | address |
Definition at line 806 of file plugin_transport_http_common.c.
References HttpAddress::addr, and HttpAddress::urlen.
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().
size_t http_common_cmp_addresses | ( | const void * | addr1, |
size_t | addrlen1, | ||
const void * | addr2, | ||
size_t | addrlen2 | ||
) |
Compare addr1 to addr2.
addr1 | address1 |
addrlen1 | length of address1 |
addr2 | address2 |
addrlen2 | length of address2 |
addr1 | address1 |
addrlen1 | address 1 length |
addr2 | address2 |
addrlen2 | address 2 length |
Definition at line 822 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().
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.
env | the environment |
address | the address |
Definition at line 822 of file plugin_transport_http_common.c.