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_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_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_DCO

#define MTCP_DCO   ((void *)6)

Definition at line 62 of file mtcp.c.

◆ MTCP_FILE_CLOSE_WRITE

#define MTCP_FILE_CLOSE_WRITE   ((void *)5)

Definition at line 61 of file mtcp.c.

◆ MTCP_MANAGEMENT

#define MTCP_MANAGEMENT   ((void *)4)

Definition at line 60 of file mtcp.c.

◆ MTCP_N

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

Definition at line 64 of file mtcp.c.

◆ MTCP_SIG

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

Definition at line 59 of file mtcp.c.

◆ MTCP_SOCKET

#define MTCP_SOCKET   ((void *)1)

Definition at line 57 of file mtcp.c.

◆ MTCP_TUN

#define MTCP_TUN   ((void *)2)

Definition at line 58 of file mtcp.c.

◆ MTP_LINK_OUT

#define MTP_LINK_OUT   (1<<1)

◆ MTP_NONE

#define MTP_NONE   0

◆ MTP_TUN_OUT

#define MTP_TUN_OUT   (1<<0)

◆ TA_INITIAL

#define TA_INITIAL   8

Definition at line 50 of file mtcp.c.

◆ TA_SOCKET_READ

#define TA_SOCKET_READ   1

Definition at line 43 of file mtcp.c.

◆ TA_SOCKET_READ_RESIDUAL

#define TA_SOCKET_READ_RESIDUAL   2

Definition at line 44 of file mtcp.c.

◆ TA_SOCKET_WRITE

#define TA_SOCKET_WRITE   3

Definition at line 45 of file mtcp.c.

◆ TA_SOCKET_WRITE_DEFERRED

#define TA_SOCKET_WRITE_DEFERRED   5

Definition at line 47 of file mtcp.c.

◆ TA_SOCKET_WRITE_READY

#define TA_SOCKET_WRITE_READY   4

Definition at line 46 of file mtcp.c.

◆ TA_TIMEOUT

#define TA_TIMEOUT   9

Definition at line 51 of file mtcp.c.

◆ TA_TUN_READ

#define TA_TUN_READ   6

Definition at line 48 of file mtcp.c.

◆ TA_TUN_WRITE

#define TA_TUN_WRITE   7

Definition at line 49 of file mtcp.c.

◆ TA_TUN_WRITE_TIMEOUT

#define TA_TUN_WRITE_TIMEOUT   10

Definition at line 52 of file mtcp.c.

◆ TA_UNDEF

#define TA_UNDEF   0

Definition at line 42 of file mtcp.c.

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 
)
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().

◆ multi_tcp_delete_event()

void multi_tcp_delete_event ( struct multi_tcp mtcp,
event_t  event 
)

Definition at line 216 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 225 of file mtcp.c.

References multi_tcp::es, multi_tcp::esr, and event_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 191 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