OpenVPN
Macros | Functions | Variables
forward.h File Reference

Interface functions to the internal and external multiplexers. More...

#include "openvpn.h"
#include "occ.h"
#include "ping.h"
Include dependency graph for forward.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TUN_OUT(c)   (BLEN(&(c)->c2.to_tun) > 0)
 
#define LINK_OUT(c)   (BLEN(&(c)->c2.to_link) > 0)
 
#define ANY_OUT(c)   (TUN_OUT(c) || LINK_OUT(c))
 
#define TO_LINK_FRAG(c)   ((c)->c2.fragment && fragment_outgoing_defined((c)->c2.fragment))
 
#define TO_LINK_DEF(c)   (LINK_OUT(c) || TO_LINK_FRAG(c))
 
#define IOW_TO_TUN   (1<<0)
 
#define IOW_TO_LINK   (1<<1)
 
#define IOW_READ_TUN   (1<<2)
 
#define IOW_READ_LINK   (1<<3)
 
#define IOW_SHAPER   (1<<4)
 
#define IOW_CHECK_RESIDUAL   (1<<5)
 
#define IOW_FRAG   (1<<6)
 
#define IOW_MBUF   (1<<7)
 
#define IOW_READ_TUN_FORCE   (1<<8)
 
#define IOW_WAIT_SIGNAL   (1<<9)
 
#define IOW_READ   (IOW_READ_TUN|IOW_READ_LINK)
 
#define PIPV4_PASSTOS   (1<<0)
 
#define PIP_MSSFIX   (1<<1) /* v4 and v6 */
 
#define PIP_OUTGOING   (1<<2)
 
#define PIPV4_EXTRACT_DHCP_ROUTER   (1<<3)
 
#define PIPV4_CLIENT_NAT   (1<<4)
 
#define PIPV6_IMCP_NOHOST_CLIENT   (1<<5)
 
#define PIPV6_IMCP_NOHOST_SERVER   (1<<6)
 

Functions

void io_wait_dowork (struct context *c, const unsigned int flags)
 
void pre_select (struct context *c)
 
void process_io (struct context *c)
 
void encrypt_sign (struct context *c, bool comp_frag)
 Process a data channel packet that will be sent through a VPN tunnel. More...
 
int get_server_poll_remaining_time (struct event_timeout *server_poll_timeout)
 
void read_incoming_link (struct context *c)
 Read a packet from the external network interface. More...
 
bool process_incoming_link_part1 (struct context *c, struct link_socket_info *lsi, bool floated)
 Starts processing a packet read from the external network interface. More...
 
void process_incoming_link_part2 (struct context *c, struct link_socket_info *lsi, const uint8_t *orig_buf)
 Continues processing a packet read from the external network interface. More...
 
void process_outgoing_link (struct context *c)
 Write a packet to the external network interface. More...
 
void read_incoming_tun (struct context *c)
 Read a packet from the virtual tun/tap network interface. More...
 
void process_incoming_tun (struct context *c)
 Process a packet read from the virtual tun/tap network interface. More...
 
void process_outgoing_tun (struct context *c)
 Write a packet to the virtual tun/tap network interface. More...
 
bool send_control_channel_string (struct context *c, const char *str, int msglevel)
 
bool send_control_channel_string_dowork (struct tls_multi *multi, const char *str, int msglevel)
 
void reschedule_multi_process (struct context *c)
 Reschedule tls_multi_process. More...
 
void process_ip_header (struct context *c, unsigned int flags, struct buffer *buf)
 
void schedule_exit (struct context *c, const int n_seconds, const int signal)
 
static struct link_socket_infoget_link_socket_info (struct context *c)
 
static void register_activity (struct context *c, const int size)
 
static unsigned int p2p_iow_flags (const struct context *c)
 
static void io_wait (struct context *c, const unsigned int flags)
 
static bool connection_established (struct context *c)
 

Variables

counter_type link_read_bytes_global
 
counter_type link_write_bytes_global
 

Detailed Description

Interface functions to the internal and external multiplexers.

Definition in file forward.h.

Macro Definition Documentation

◆ ANY_OUT

#define ANY_OUT (   c)    (TUN_OUT(c) || LINK_OUT(c))

Definition at line 40 of file forward.h.

Referenced by multi_process_post().

◆ IOW_CHECK_RESIDUAL

#define IOW_CHECK_RESIDUAL   (1<<5)

Definition at line 59 of file forward.h.

Referenced by io_wait_dowork(), and p2p_iow_flags().

◆ IOW_FRAG

#define IOW_FRAG   (1<<6)

Definition at line 60 of file forward.h.

Referenced by io_wait_dowork(), and p2p_iow_flags().

◆ IOW_MBUF

#define IOW_MBUF   (1<<7)

Definition at line 61 of file forward.h.

Referenced by io_wait(), io_wait_dowork(), and p2mp_iow_flags().

◆ IOW_READ

#define IOW_READ   (IOW_READ_TUN|IOW_READ_LINK)

Definition at line 65 of file forward.h.

Referenced by p2mp_iow_flags(), and p2p_iow_flags().

◆ IOW_READ_LINK

#define IOW_READ_LINK   (1<<3)

Definition at line 57 of file forward.h.

Referenced by io_wait_dowork(), and multi_tcp_wait_lite().

◆ IOW_READ_TUN

#define IOW_READ_TUN   (1<<2)

Definition at line 56 of file forward.h.

Referenced by io_wait(), io_wait_dowork(), multi_tcp_wait_lite(), p2mp_iow_flags(), and p2p_iow_flags().

◆ IOW_READ_TUN_FORCE

#define IOW_READ_TUN_FORCE   (1<<8)

Definition at line 62 of file forward.h.

Referenced by io_wait_dowork(), and multi_tcp_wait_lite().

◆ IOW_SHAPER

#define IOW_SHAPER   (1<<4)

Definition at line 58 of file forward.h.

Referenced by io_wait_dowork(), and p2p_iow_flags().

◆ IOW_TO_LINK

#define IOW_TO_LINK   (1<<1)

Definition at line 55 of file forward.h.

Referenced by io_wait(), io_wait_dowork(), multi_tcp_wait_lite(), p2mp_iow_flags(), and p2p_iow_flags().

◆ IOW_TO_TUN

#define IOW_TO_TUN   (1<<0)

Definition at line 54 of file forward.h.

Referenced by io_wait(), io_wait_dowork(), multi_tcp_wait_lite(), p2mp_iow_flags(), and p2p_iow_flags().

◆ IOW_WAIT_SIGNAL

#define IOW_WAIT_SIGNAL   (1<<9)

Definition at line 63 of file forward.h.

Referenced by io_wait_dowork(), p2mp_iow_flags(), and p2p_iow_flags().

◆ LINK_OUT

#define LINK_OUT (   c)    (BLEN(&(c)->c2.to_link) > 0)

Definition at line 39 of file forward.h.

Referenced by multi_tcp_post(), and p2mp_iow_flags().

◆ PIP_MSSFIX

#define PIP_MSSFIX   (1<<1) /* v4 and v6 */

◆ PIP_OUTGOING

#define PIP_OUTGOING   (1<<2)

Definition at line 296 of file forward.h.

Referenced by process_ip_header(), and process_outgoing_tun().

◆ PIPV4_CLIENT_NAT

#define PIPV4_CLIENT_NAT   (1<<4)

Definition at line 298 of file forward.h.

Referenced by process_incoming_tun(), process_ip_header(), and process_outgoing_tun().

◆ PIPV4_EXTRACT_DHCP_ROUTER

#define PIPV4_EXTRACT_DHCP_ROUTER   (1<<3)

Definition at line 297 of file forward.h.

Referenced by process_ip_header(), and process_outgoing_tun().

◆ PIPV4_PASSTOS

#define PIPV4_PASSTOS   (1<<0)

Definition at line 294 of file forward.h.

Referenced by multi_get_queue(), process_incoming_tun(), and process_ip_header().

◆ PIPV6_IMCP_NOHOST_CLIENT

#define PIPV6_IMCP_NOHOST_CLIENT   (1<<5)

Definition at line 299 of file forward.h.

Referenced by process_incoming_tun(), and process_ip_header().

◆ PIPV6_IMCP_NOHOST_SERVER

#define PIPV6_IMCP_NOHOST_SERVER   (1<<6)

Definition at line 300 of file forward.h.

Referenced by multi_get_queue(), and process_ip_header().

◆ TO_LINK_DEF

#define TO_LINK_DEF (   c)    (LINK_OUT(c) || TO_LINK_FRAG(c))

◆ TO_LINK_FRAG

#define TO_LINK_FRAG (   c)    ((c)->c2.fragment && fragment_outgoing_defined((c)->c2.fragment))

Definition at line 43 of file forward.h.

Referenced by io_wait_dowork().

◆ TUN_OUT

#define TUN_OUT (   c)    (BLEN(&(c)->c2.to_tun) > 0)

Definition at line 38 of file forward.h.

Referenced by multi_tcp_post(), and p2mp_iow_flags().

Function Documentation

◆ connection_established()

static bool connection_established ( struct context c)
inlinestatic

◆ get_link_socket_info()

static struct link_socket_info* get_link_socket_info ( struct context c)
static

◆ get_server_poll_remaining_time()

int get_server_poll_remaining_time ( struct event_timeout server_poll_timeout)

◆ io_wait()

static void io_wait ( struct context c,
const unsigned int  flags 
)
inlinestatic

◆ io_wait_dowork()

void io_wait_dowork ( struct context c,
const unsigned int  flags 
)

◆ p2p_iow_flags()

static unsigned int p2p_iow_flags ( const struct context c)
inlinestatic

◆ pre_select()

void pre_select ( struct context c)

◆ process_io()

void process_io ( struct context c)

◆ process_ip_header()

void process_ip_header ( struct context c,
unsigned int  flags,
struct buffer buf 
)

◆ register_activity()

static void register_activity ( struct context c,
const int  size 
)
inlinestatic

◆ reschedule_multi_process()

void reschedule_multi_process ( struct context c)

Reschedule tls_multi_process.

NOTE: in multi-client mode, usually calling the function is insufficient to reschedule the client instance object unless multi_schedule_context_wakeup(m, mi) is also called.

Definition at line 338 of file forward.c.

References context::c2, context_immediate_reschedule(), interval_action(), and context_2::tmp_int.

Referenced by management_client_pending_auth(), and send_control_channel_string().

◆ schedule_exit()

void schedule_exit ( struct context c,
const int  n_seconds,
const int  signal 
)

◆ send_control_channel_string()

bool send_control_channel_string ( struct context c,
const char *  str,
int  msglevel 
)

◆ send_control_channel_string_dowork()

bool send_control_channel_string_dowork ( struct tls_multi multi,
const char *  str,
int  msglevel 
)

Variable Documentation

◆ link_read_bytes_global

counter_type link_read_bytes_global

Definition at line 49 of file forward.c.

Referenced by man_load_stats(), and process_incoming_link_part1().

◆ link_write_bytes_global

counter_type link_write_bytes_global

Definition at line 50 of file forward.c.

Referenced by man_load_stats(), and process_outgoing_link().