OpenVPN
|
Go to the source code of this file.
Data Structures | |
struct | ta_iow_flags |
Macros | |
#define | TA_UNDEF 0 |
#define | TA_SOCKET_READ 1 |
#define | TA_SOCKET_READ_RESIDUAL 2 |
#define | TA_SOCKET_WRITE 3 |
#define | TA_SOCKET_WRITE_READY 4 |
#define | TA_SOCKET_WRITE_DEFERRED 5 |
#define | TA_TUN_READ 6 |
#define | TA_TUN_WRITE 7 |
#define | TA_INITIAL 8 |
#define | TA_TIMEOUT 9 |
#define | TA_TUN_WRITE_TIMEOUT 10 |
#define | MTCP_SOCKET ((void *)1) |
#define | MTCP_TUN ((void *)2) |
#define | MTCP_SIG ((void *)3) /* Only on Windows */ |
#define | MTCP_MANAGEMENT ((void *)4) |
#define | MTCP_FILE_CLOSE_WRITE ((void *)5) |
#define | MTCP_DCO ((void *)6) |
#define | MTCP_N ((void *)16) /* upper bound on MTCP_x */ |
#define | MTP_NONE 0 |
#define | MTP_TUN_OUT (1<<0) |
#define | MTP_LINK_OUT (1<<1) |
Functions | |
static struct multi_instance * | multi_create_instance_tcp (struct multi_context *m) |
bool | multi_tcp_instance_specific_init (struct multi_context *m, struct multi_instance *mi) |
void | multi_tcp_instance_specific_free (struct multi_instance *mi) |
struct multi_tcp * | multi_tcp_init (int maxevents, int *maxclients) |
void | multi_tcp_delete_event (struct multi_tcp *mtcp, event_t event) |
void | multi_tcp_free (struct multi_tcp *mtcp) |
void | multi_tcp_dereference_instance (struct multi_tcp *mtcp, struct multi_instance *mi) |
static void | multi_tcp_set_global_rw_flags (struct multi_context *m, struct multi_instance *mi) |
static int | multi_tcp_wait (const struct context *c, struct multi_tcp *mtcp) |
static struct context * | multi_tcp_context (struct multi_context *m, struct multi_instance *mi) |
static bool | multi_tcp_process_outgoing_link_ready (struct multi_context *m, struct multi_instance *mi, const unsigned int mpp_flags) |
static bool | multi_tcp_process_outgoing_link (struct multi_context *m, bool defer, const unsigned int mpp_flags) |
static int | multi_tcp_wait_lite (struct multi_context *m, struct multi_instance *mi, const int action, bool *tun_input_pending) |
static struct multi_instance * | multi_tcp_dispatch (struct multi_context *m, struct multi_instance *mi, const int action) |
static int | multi_tcp_post (struct multi_context *m, struct multi_instance *mi, const int action) |
static void | multi_tcp_action (struct multi_context *m, struct multi_instance *mi, int action, bool poll) |
static void | multi_tcp_process_io (struct multi_context *m) |
void | tunnel_server_tcp (struct context *top) |
Main event loop for OpenVPN in TCP server mode. More... | |
#define MTP_LINK_OUT (1<<1) |
#define MTP_NONE 0 |
#define MTP_TUN_OUT (1<<0) |
|
static |
Definition at line 120 of file mtcp.c.
References ASSERT, D_MULTI_DEBUG, D_MULTI_LOW, multi_instance::did_real_hash, dmsg, multi_instance::gc, gc_free(), gc_new(), multi_instance::halt, multi_context::hash, hash_add_fast(), hash_bucket(), hash_lookup_fast(), hash_value(), hash_element::key, mroute_addr_print(), msg, multi_assign_peer_id(), multi_close_instance(), multi_create_instance(), multi_instance::real, and hash_element::value.
Referenced by multi_tcp_process_io().
|
static |
Definition at line 599 of file mtcp.c.
References multi_instance::context, D_MULTI_DEBUG, dmsg, IS_SIG, M_FATAL, msg, multi_close_instance_on_signal(), multi_tcp_dispatch(), multi_tcp_post(), multi_tcp_wait_lite(), multi_context::pending, TA_SOCKET_READ_RESIDUAL, TA_TUN_READ, and TA_UNDEF.
Referenced by multi_tcp_process_io(), and tunnel_server_tcp().
|
inlinestatic |
Definition at line 311 of file mtcp.c.
References multi_instance::context, and multi_context::top.
Referenced by multi_tcp_post(), and multi_tcp_wait_lite().
Definition at line 216 of file mtcp.c.
References multi_tcp::es, and event_del().
Referenced by management_delete_event().
void multi_tcp_dereference_instance | ( | struct multi_tcp * | mtcp, |
struct multi_instance * | mi | ||
) |
Definition at line 236 of file mtcp.c.
References context::c2, multi_instance::context, multi_tcp::es, event_del(), context_2::link_socket, multi_tcp::n_esr, socket_event_handle(), and multi_instance::socket_set_called.
Referenced by multi_close_instance().
|
static |
Definition at line 462 of file mtcp.c.
References ASSERT, clear_prefix(), D_MULTI_DEBUG, dmsg, IS_SIG, M_FATAL, MPP_PRE_SELECT, MPP_RECORD_TOUCH, multi_context::mpp_touched, msg, multi_process_drop_outgoing_tun(), multi_process_incoming_link(), multi_process_incoming_tun(), multi_process_outgoing_tun(), multi_process_post(), multi_process_timeout(), multi_tcp_process_outgoing_link(), multi_tcp_process_outgoing_link_ready(), multi_tcp_set_global_rw_flags(), ptr_format, read_incoming_link(), read_incoming_tun(), set_prefix(), stream_buf_read_setup(), TA_INITIAL, TA_SOCKET_READ, TA_SOCKET_READ_RESIDUAL, TA_SOCKET_WRITE, TA_SOCKET_WRITE_DEFERRED, TA_SOCKET_WRITE_READY, TA_TIMEOUT, TA_TUN_READ, TA_TUN_WRITE, TA_TUN_WRITE_TIMEOUT, and multi_context::top.
Referenced by multi_tcp_action().
void multi_tcp_free | ( | struct multi_tcp * | mtcp | ) |
Definition at line 225 of file mtcp.c.
References multi_tcp::es, multi_tcp::esr, and event_free().
Referenced by multi_uninit().
struct multi_tcp* multi_tcp_init | ( | int | maxevents, |
int * | maxclients | ||
) |
Definition at line 197 of file mtcp.c.
References ALLOC_ARRAY, ALLOC_OBJ_CLEAR, ASSERT, BASE_N_EVENTS, D_MULTI_LOW, multi_tcp::es, multi_tcp::esr, event_set_init(), max_int(), multi_tcp::maxevents, min_int(), msg, MTCP_SIG, and wait_signal().
Referenced by multi_init().
void multi_tcp_instance_specific_free | ( | struct multi_instance * | mi | ) |
Definition at line 191 of file mtcp.c.
References mbuf_free(), and multi_instance::tcp_link_out_deferred.
Referenced by multi_close_instance().
bool multi_tcp_instance_specific_init | ( | struct multi_context * | m, |
struct multi_instance * | mi | ||
) |
Definition at line 171 of file mtcp.c.
References link_socket_addr::actual, openvpn_sockaddr::addr, ASSERT, context::c2, multi_instance::context, D_MULTI_ERRORS, link_socket_actual::dest, link_socket::info, context_2::link_socket, LS_MODE_TCP_ACCEPT_FROM, link_socket_info::lsa, mbuf_init(), link_socket::mode, mroute_extract_openvpn_sockaddr(), msg, options::n_bcast_buf, context::options, multi_instance::real, openvpn_sockaddr::sa, multi_instance::tcp_link_out_deferred, and multi_context::top.
Referenced by multi_create_instance().
|
static |
Definition at line 539 of file mtcp.c.
References context::c2, D_MULTI_DEBUG, dmsg, gc_free(), gc_new(), LINK_OUT, context_2::link_socket, M_FATAL, msg, MTP_LINK_OUT, MTP_NONE, MTP_TUN_OUT, multi_instance_string(), multi_tcp_context(), multi_tcp_set_global_rw_flags(), socket_read_residual(), TA_SOCKET_READ_RESIDUAL, TA_SOCKET_WRITE, TA_TUN_WRITE, TA_UNDEF, and TUN_OUT.
Referenced by multi_tcp_action().
|
static |
Definition at line 687 of file mtcp.c.
References event_set_return::arg, ASSERT, context::c2, multi_tcp::esr, EVENT_READ, EVENT_WRITE, get_signal(), IS_SIG, context_2::link_socket, management_io(), multi_context::mbuf, mbuf_peek(), MPP_PRE_SELECT, MPP_RECORD_TOUCH, multi_context::mtcp, MTCP_DCO, MTCP_FILE_CLOSE_WRITE, MTCP_MANAGEMENT, MTCP_N, MTCP_SIG, MTCP_SOCKET, MTCP_TUN, multi_create_instance_tcp(), multi_process_incoming_dco(), multi_tcp_action(), multi_tcp::n_esr, event_set_return::rwflags, context::sig, signal_info::signal_received, socket_reset_listen_persistent(), TA_INITIAL, TA_SOCKET_READ, TA_SOCKET_WRITE, TA_SOCKET_WRITE_READY, TA_TUN_READ, TA_TUN_WRITE, and multi_context::top.
Referenced by tunnel_server_tcp().
|
static |
Definition at line 348 of file mtcp.c.
References BLEN, mbuf_buffer::buf, buf_reset(), mbuf_item::buffer, context::c2, clear_prefix(), multi_instance::context, D_MULTI_TCP, dmsg, mbuf_item::instance, mbuf_add_item(), mbuf_alloc_buf(), mbuf_defined(), mbuf_free_buf(), multi_process_outgoing_link_dowork(), multi_process_outgoing_link_pre(), multi_process_post(), set_prefix(), multi_instance::tcp_link_out_deferred, and context_2::to_link.
Referenced by multi_tcp_dispatch().
|
static |
Definition at line 324 of file mtcp.c.
References ASSERT, mbuf_buffer::buf, mbuf_item::buffer, context::c2, multi_instance::context, D_MULTI_TCP, dmsg, mbuf_item::instance, mbuf_extract_item(), mbuf_free_buf(), multi_process_outgoing_link_dowork(), multi_instance::tcp_link_out_deferred, and context_2::to_link.
Referenced by multi_tcp_dispatch().
|
inlinestatic |
Definition at line 248 of file mtcp.c.
References context::c2, multi_instance::context, multi_tcp::es, EVENT_READ, EVENT_WRITE, context_2::link_socket, mbuf_defined(), multi_context::mtcp, socket_set(), multi_instance::socket_set_called, multi_instance::tcp_link_out_deferred, and multi_instance::tcp_rwflags.
Referenced by multi_tcp_dispatch(), and multi_tcp_post().
Definition at line 262 of file mtcp.c.
References event_set_return::arg, context::c1, context::c2, tuntap::dco, dco_event_set(), multi_tcp::es, multi_tcp::esr, event_ctl(), EVENT_READ, event_wait(), context_2::link_socket, multi_tcp::management_persist_flags, management_socket_set(), multi_tcp::maxevents, MTCP_DCO, MTCP_FILE_CLOSE_WRITE, MTCP_MANAGEMENT, MTCP_SOCKET, MTCP_TUN, multi_tcp::n_esr, event_set_return::rwflags, socket_set_listen_persistent(), status, context_2::timeval, multi_tcp::tun_rwflags, tun_set(), context_1::tuntap, tuntap_is_wintun(), tuntap_ring_empty(), and update_time().
Referenced by tunnel_server_tcp().
|
static |
Definition at line 392 of file mtcp.c.
References context::c2, D_MULTI_DEBUG, dmsg, context_2::event_set_status, io_wait(), IOW_READ_LINK, IOW_READ_TUN, IOW_READ_TUN_FORCE, IOW_TO_LINK, IOW_TO_TUN, M_FATAL, msg, multi_tcp_context(), perf_pop(), PERF_PROC_OUT_TUN_MTCP, perf_push(), ptr_format, SOCKET_READ, SOCKET_WRITE, TA_SOCKET_READ, TA_SOCKET_WRITE, TA_SOCKET_WRITE_DEFERRED, TA_TUN_READ, TA_TUN_WRITE, TA_TUN_WRITE_TIMEOUT, TA_UNDEF, context_2::timeval, TUN_READ, TUN_WRITE, and tv_clear().
Referenced by multi_tcp_action().