library to access the VPN service and tell it how to redirect traffic More...
Go to the source code of this file.
Data Structures | |
struct | GNUNET_VPN_Handle |
Opaque VPN handle. More... | |
struct | GNUNET_VPN_RedirectionRequest |
Opaque redirection request handle. More... | |
Functions | |
static void | reconnect (struct GNUNET_VPN_Handle *vh) |
Disconnect from the service (communication error) and reconnect later. More... | |
static int | check_use_ip (void *cls, const struct RedirectToIpResponseMessage *rm) |
Check a GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP message from the VPN service. More... | |
static void | handle_use_ip (void *cls, const struct RedirectToIpResponseMessage *rm) |
Handle a GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP message from the VPN service. More... | |
static void | send_request (struct GNUNET_VPN_RedirectionRequest *rr) |
Add a request to our request queue and transmit it. More... | |
static void | mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More... | |
static void | connect_task (void *cls) |
Connect to the VPN service and start again to transmit our requests. More... | |
void | GNUNET_VPN_cancel_request (struct GNUNET_VPN_RedirectionRequest *rr) |
Cancel redirection request with the service. More... | |
struct GNUNET_VPN_RedirectionRequest * | GNUNET_VPN_redirect_to_peer (struct GNUNET_VPN_Handle *vh, int result_af, uint8_t protocol, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HashCode *serv, struct GNUNET_TIME_Absolute expiration_time, GNUNET_VPN_AllocationCallback cb, void *cb_cls) |
Tell the VPN that a forwarding to a particular peer offering a particular service is requested. More... | |
struct GNUNET_VPN_RedirectionRequest * | GNUNET_VPN_redirect_to_ip (struct GNUNET_VPN_Handle *vh, int result_af, int addr_af, const void *addr, struct GNUNET_TIME_Absolute expiration_time, GNUNET_VPN_AllocationCallback cb, void *cb_cls) |
Tell the VPN that forwarding to the Internet via some exit node is requested. More... | |
struct GNUNET_VPN_Handle * | GNUNET_VPN_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Connect to the VPN service. More... | |
void | GNUNET_VPN_disconnect (struct GNUNET_VPN_Handle *vh) |
Disconnect from the VPN service. More... | |
library to access the VPN service and tell it how to redirect traffic
Definition in file vpn_api.c.
|
static |
Disconnect from the service (communication error) and reconnect later.
vh | handle to reconnect. |
Definition at line 348 of file vpn_api.c.
References GNUNET_VPN_Handle::backoff, connect_task(), GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_relative_max(), GNUNET_TIME_relative_min(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_relative_saturating_multiply(), GNUNET_TIME_UNIT_MILLISECONDS, GNUNET_TIME_UNIT_SECONDS, GNUNET_VPN_Handle::mq, GNUNET_VPN_RedirectionRequest::next, GNUNET_VPN_RedirectionRequest::request_id, GNUNET_VPN_Handle::request_id_gen, GNUNET_VPN_Handle::rr_head, GNUNET_VPN_Handle::rt, and GNUNET_VPN_RedirectionRequest::vh.
Referenced by mq_error_handler().
|
static |
Check a GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP message from the VPN service.
cls | the struct GNUNET_VPN_Handle |
rm | message received |
Definition at line 164 of file vpn_api.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, RedirectToIpResponseMessage::header, consensus-simulation::int, RedirectToIpResponseMessage::request_id, RedirectToIpResponseMessage::result_af, and GNUNET_MessageHeader::size.
|
static |
Handle a GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP message from the VPN service.
cls | the struct GNUNET_VPN_Handle |
rm | message received |
Definition at line 207 of file vpn_api.c.
References GNUNET_VPN_RedirectionRequest::cb, GNUNET_VPN_RedirectionRequest::cb_cls, GNUNET_CONTAINER_DLL_remove, GNUNET_free, consensus-simulation::int, GNUNET_VPN_RedirectionRequest::next, RedirectToIpResponseMessage::request_id, GNUNET_VPN_RedirectionRequest::request_id, RedirectToIpResponseMessage::result_af, GNUNET_VPN_Handle::rr_head, GNUNET_VPN_Handle::rr_tail, and GNUNET_VPN_RedirectionRequest::vh.
|
static |
Add a request to our request queue and transmit it.
rr | request to queue and transmit. |
Definition at line 238 of file vpn_api.c.
References GNUNET_VPN_RedirectionRequest::addr, RedirectToIpRequestMessage::addr_af, GNUNET_VPN_RedirectionRequest::addr_af, env, RedirectToIpRequestMessage::expiration_time, RedirectToServiceRequestMessage::expiration_time, GNUNET_VPN_RedirectionRequest::expiration_time, GNUNET_assert, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP, GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE, GNUNET_MQ_msg, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TIME_absolute_hton(), GNUNET_VPN_Handle::mq, GNUNET_VPN_RedirectionRequest::peer, RedirectToServiceRequestMessage::protocol, GNUNET_VPN_RedirectionRequest::protocol, RedirectToIpRequestMessage::request_id, RedirectToServiceRequestMessage::request_id, GNUNET_VPN_RedirectionRequest::request_id, GNUNET_VPN_Handle::request_id_gen, RedirectToIpRequestMessage::reserved, RedirectToServiceRequestMessage::reserved, RedirectToIpRequestMessage::result_af, RedirectToServiceRequestMessage::result_af, GNUNET_VPN_RedirectionRequest::result_af, GNUNET_VPN_RedirectionRequest::serv, RedirectToServiceRequestMessage::service_descriptor, RedirectToServiceRequestMessage::target, and GNUNET_VPN_RedirectionRequest::vh.
Referenced by connect_task(), GNUNET_VPN_redirect_to_ip(), and GNUNET_VPN_redirect_to_peer().
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure with the struct GNUNET_VPN_Handle * |
error | error code |
Definition at line 302 of file vpn_api.c.
References reconnect().
Referenced by connect_task().
|
static |
Connect to the VPN service and start again to transmit our requests.
cls | the struct GNUNET_VPN_Handle * |
Definition at line 317 of file vpn_api.c.
References GNUNET_VPN_Handle::cfg, GNUNET_MQ_MessageHandler::cls, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_VPN_CLIENT_USE_IP, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, handlers, GNUNET_VPN_Handle::mq, mq_error_handler(), GNUNET_VPN_RedirectionRequest::next, GNUNET_VPN_Handle::rr_head, GNUNET_VPN_Handle::rt, send_request(), and GNUNET_VPN_RedirectionRequest::vh.
Referenced by GNUNET_VPN_connect(), and reconnect().