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)
 
#define CONNECTION_ESTABLISHED(c)   (get_link_socket_info(c)->connection_established)
 

Functions

void check_tls_dowork (struct context *c)
 
void check_tls_errors_co (struct context *c)
 
void check_tls_errors_nco (struct context *c)
 
void check_incoming_control_channel_dowork (struct context *c)
 
void check_scheduled_exit_dowork (struct context *c)
 
void check_push_request_dowork (struct context *c)
 
void check_fragment_dowork (struct context *c)
 
void check_connection_established_dowork (struct context *c)
 
void check_add_routes_dowork (struct context *c)
 
void check_inactivity_timeout_dowork (struct context *c)
 
void check_server_poll_timeout_dowork (struct context *c)
 
void check_status_file_dowork (struct context *c)
 
void io_wait_dowork (struct context *c, const unsigned int flags)
 
void pre_select (struct context *c)
 
void process_io (struct context *c)
 
const char * wait_status_string (struct context *c, struct gc_arena *gc)
 
void show_wait_status (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 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)
 

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

◆ CONNECTION_ESTABLISHED

#define CONNECTION_ESTABLISHED (   c)    (get_link_socket_info(c)->connection_established)

◆ 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_dowork(), and multi_tcp_wait_lite().

◆ 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 322 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 324 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 323 of file forward.h.

Referenced by process_ip_header(), and process_outgoing_tun().

◆ PIPV4_PASSTOS

#define PIPV4_PASSTOS   (1<<0)

Definition at line 320 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 325 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 326 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

◆ check_add_routes_dowork()

void check_add_routes_dowork ( struct context c)

◆ check_connection_established_dowork()

void check_connection_established_dowork ( struct context c)

◆ check_fragment_dowork()

void check_fragment_dowork ( struct context c)

◆ check_inactivity_timeout_dowork()

void check_inactivity_timeout_dowork ( struct context c)

Definition at line 560 of file forward.c.

References M_INFO, msg, register_signal(), and SIGTERM.

Referenced by check_inactivity_timeout().

◆ check_incoming_control_channel_dowork()

void check_incoming_control_channel_dowork ( struct context c)

◆ check_push_request_dowork()

void check_push_request_dowork ( struct context c)

◆ check_scheduled_exit_dowork()

void check_scheduled_exit_dowork ( struct context c)

Definition at line 606 of file forward.c.

References context::c2, register_signal(), and context_2::scheduled_exit_signal.

Referenced by check_scheduled_exit().

◆ check_server_poll_timeout_dowork()

void check_server_poll_timeout_dowork ( struct context c)

◆ check_status_file_dowork()

void check_status_file_dowork ( struct context c)

Definition at line 617 of file forward.c.

References context::c1, print_status(), and context_1::status_output.

Referenced by check_status_file().

◆ check_tls_dowork()

void check_tls_dowork ( struct context c)

◆ check_tls_errors_co()

void check_tls_errors_co ( struct context c)

Definition at line 348 of file forward.c.

References context::c2, D_STREAM_ERRORS, msg, register_signal(), and context_2::tls_exit_signal.

Referenced by check_tls_errors().

◆ check_tls_errors_nco()

void check_tls_errors_nco ( struct context c)

Definition at line 355 of file forward.c.

References context::c2, register_signal(), and context_2::tls_exit_signal.

Referenced by check_tls_errors().

◆ 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

◆ 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 
)

◆ show_wait_status()

void show_wait_status ( struct context c)

Referenced by io_wait_dowork().

◆ wait_status_string()

const char* wait_status_string ( struct context c,
struct gc_arena gc 
)

Variable Documentation

◆ link_read_bytes_global

counter_type link_read_bytes_global

Definition at line 50 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 51 of file forward.c.

Referenced by man_load_stats(), and process_outgoing_link().