OpenVPN
Data Structures | Macros | Functions
mtcp.c File Reference
#include "syshead.h"
#include "multi.h"
#include "forward.h"
#include "memdbg.h"
Include dependency graph for mtcp.c:

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_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 const char * pract (int action)
 
static struct multi_instancemulti_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_tcpmulti_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 contextmulti_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_instancemulti_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...
 

Macro Definition Documentation

◆ MTCP_MANAGEMENT

#define MTCP_MANAGEMENT   ((void *)4)

Definition at line 65 of file mtcp.c.

Referenced by multi_tcp_process_io(), and multi_tcp_wait().

◆ MTCP_N

#define MTCP_N   ((void *)16) /* upper bound on MTCP_x */

Definition at line 72 of file mtcp.c.

Referenced by multi_tcp_process_io().

◆ MTCP_SIG

#define MTCP_SIG   ((void *)3) /* Only on Windows */

Definition at line 63 of file mtcp.c.

Referenced by multi_tcp_init(), and multi_tcp_process_io().

◆ MTCP_SOCKET

#define MTCP_SOCKET   ((void *)1)

Definition at line 61 of file mtcp.c.

Referenced by multi_tcp_process_io(), and multi_tcp_wait().

◆ MTCP_TUN

#define MTCP_TUN   ((void *)2)

Definition at line 62 of file mtcp.c.

Referenced by multi_tcp_process_io(), and multi_tcp_wait().

◆ MTP_LINK_OUT

#define MTP_LINK_OUT   (1<<1)

Referenced by multi_tcp_post().

◆ MTP_NONE

#define MTP_NONE   0

Referenced by multi_tcp_post().

◆ MTP_TUN_OUT

#define MTP_TUN_OUT   (1<<0)

Referenced by multi_tcp_post().

◆ TA_INITIAL

#define TA_INITIAL   8

Definition at line 54 of file mtcp.c.

Referenced by multi_tcp_dispatch(), multi_tcp_process_io(), and pract().

◆ TA_SOCKET_READ

#define TA_SOCKET_READ   1

Definition at line 47 of file mtcp.c.

Referenced by multi_tcp_dispatch(), multi_tcp_process_io(), multi_tcp_wait_lite(), and pract().

◆ TA_SOCKET_READ_RESIDUAL

#define TA_SOCKET_READ_RESIDUAL   2

Definition at line 48 of file mtcp.c.

Referenced by multi_tcp_action(), multi_tcp_dispatch(), multi_tcp_post(), and pract().

◆ TA_SOCKET_WRITE

#define TA_SOCKET_WRITE   3

◆ TA_SOCKET_WRITE_DEFERRED

#define TA_SOCKET_WRITE_DEFERRED   5

Definition at line 51 of file mtcp.c.

Referenced by multi_tcp_dispatch(), multi_tcp_wait_lite(), and pract().

◆ TA_SOCKET_WRITE_READY

#define TA_SOCKET_WRITE_READY   4

Definition at line 50 of file mtcp.c.

Referenced by multi_tcp_dispatch(), multi_tcp_process_io(), and pract().

◆ TA_TIMEOUT

#define TA_TIMEOUT   9

Definition at line 55 of file mtcp.c.

Referenced by multi_tcp_dispatch(), pract(), and tunnel_server_tcp().

◆ TA_TUN_READ

#define TA_TUN_READ   6

◆ TA_TUN_WRITE

#define TA_TUN_WRITE   7

◆ TA_TUN_WRITE_TIMEOUT

#define TA_TUN_WRITE_TIMEOUT   10

Definition at line 56 of file mtcp.c.

Referenced by multi_tcp_dispatch(), multi_tcp_wait_lite(), and pract().

◆ TA_UNDEF

#define TA_UNDEF   0

Definition at line 46 of file mtcp.c.

Referenced by multi_tcp_action(), multi_tcp_post(), multi_tcp_wait_lite(), and pract().

Function Documentation

◆ multi_create_instance_tcp()

static struct multi_instance* multi_create_instance_tcp ( struct multi_context m)
static

◆ multi_tcp_action()

static void multi_tcp_action ( struct multi_context m,
struct multi_instance mi,
int  action,
bool  poll 
)
static

◆ multi_tcp_context()

static struct context* multi_tcp_context ( struct multi_context m,
struct multi_instance mi 
)
static

Definition at line 297 of file mtcp.c.

References multi_instance::context, and multi_context::top.

Referenced by multi_tcp_post(), and multi_tcp_wait_lite().

◆ multi_tcp_delete_event()

void multi_tcp_delete_event ( struct multi_tcp mtcp,
event_t  event 
)

Definition at line 220 of file mtcp.c.

References multi_tcp::es, and event_del().

Referenced by management_delete_event().

◆ multi_tcp_dereference_instance()

void multi_tcp_dereference_instance ( struct multi_tcp mtcp,
struct multi_instance mi 
)

◆ multi_tcp_dispatch()

static struct multi_instance* multi_tcp_dispatch ( struct multi_context m,
struct multi_instance mi,
const int  action 
)
static

◆ multi_tcp_free()

void multi_tcp_free ( struct multi_tcp mtcp)

Definition at line 229 of file mtcp.c.

References multi_tcp::es, multi_tcp::esr, event_free(), and free.

Referenced by multi_uninit().

◆ multi_tcp_init()

struct multi_tcp* multi_tcp_init ( int  maxevents,
int *  maxclients 
)

◆ multi_tcp_instance_specific_free()

void multi_tcp_instance_specific_free ( struct multi_instance mi)

Definition at line 195 of file mtcp.c.

References mbuf_free(), and multi_instance::tcp_link_out_deferred.

Referenced by multi_close_instance().

◆ multi_tcp_instance_specific_init()

bool multi_tcp_instance_specific_init ( struct multi_context m,
struct multi_instance mi 
)

◆ multi_tcp_post()

static int multi_tcp_post ( struct multi_context m,
struct multi_instance mi,
const int  action 
)
static

◆ multi_tcp_process_io()

static void multi_tcp_process_io ( struct multi_context m)
static

◆ multi_tcp_process_outgoing_link()

static bool multi_tcp_process_outgoing_link ( struct multi_context m,
bool  defer,
const unsigned int  mpp_flags 
)
static

◆ multi_tcp_process_outgoing_link_ready()

static bool multi_tcp_process_outgoing_link_ready ( struct multi_context m,
struct multi_instance mi,
const unsigned int  mpp_flags 
)
static

◆ multi_tcp_set_global_rw_flags()

static void multi_tcp_set_global_rw_flags ( struct multi_context m,
struct multi_instance mi 
)
inlinestatic

◆ multi_tcp_wait()

static int multi_tcp_wait ( const struct context c,
struct multi_tcp mtcp 
)
inlinestatic

◆ multi_tcp_wait_lite()

static int multi_tcp_wait_lite ( struct multi_context m,
struct multi_instance mi,
const int  action,
bool tun_input_pending 
)
static

◆ pract()

static const char* pract ( int  action)
static