OpenVPN
Macros | Functions | Variables
error.c File Reference
#include "syshead.h"
#include "error.h"
#include "buffer.h"
#include "init.h"
#include "misc.h"
#include "win32.h"
#include "socket.h"
#include "tun.h"
#include "otime.h"
#include "perf.h"
#include "status.h"
#include "integer.h"
#include "ps.h"
#include "mstats.h"
Include dependency graph for error.c:

Go to the source code of this file.

Macros

#define SWAP   { tmp = m1; m1 = m2; m2 = tmp; }
 

Functions

void msg_forked (void)
 
bool set_debug_level (const int level, const unsigned int flags)
 
bool set_mute_cutoff (const int cutoff)
 
int get_debug_level (void)
 
int get_mute_cutoff (void)
 
void set_suppress_timestamps (bool suppressed)
 
void set_machine_readable_output (bool parsable)
 
void error_reset (void)
 
void errors_to_stderr (void)
 
FILE * msg_fp (const unsigned int flags)
 
void x_msg (const unsigned int flags, const char *format,...)
 
void x_msg_va (const unsigned int flags, const char *format, va_list arglist)
 
bool dont_mute (unsigned int flags)
 Check muting filter. More...
 
void assert_failed (const char *filename, int line, const char *condition)
 
void out_of_memory (void)
 
void open_syslog (const char *pgmname, bool stdio_to_null)
 
void close_syslog (void)
 
HANDLE get_orig_stderr (void)
 
void redirect_stdout_stderr (const char *file, bool append)
 
void reset_check_status (void)
 
void set_check_status (unsigned int info_level, unsigned int verbose_level)
 
void x_check_status (int status, const char *description, struct link_socket *sock, struct tuntap *tt)
 
void openvpn_exit (const int status)
 
const char * msg_flags_string (const unsigned int flags, struct gc_arena *gc)
 
const char * strerror_win32 (DWORD errnum, struct gc_arena *gc)
 

Variables

unsigned int x_debug_level
 
static int mute_cutoff
 
static int mute_count
 
static int mute_category
 
static bool std_redir
 
static bool use_syslog
 
static bool machine_readable_output
 
static bool suppress_timestamps
 
static FILE * msgfp
 
static bool forked
 
static FILE * default_out
 
static FILE * default_err
 
int x_msg_line_num
 
static HANDLE orig_stderr
 
unsigned int x_cs_info_level
 
unsigned int x_cs_verbose_level
 
unsigned int x_cs_err_delay_ms
 
const char * x_msg_prefix
 
const struct virtual_outputx_msg_virtual_output
 

Macro Definition Documentation

◆ SWAP

#define SWAP   { tmp = m1; m1 = m2; m2 = tmp; }

Definition at line 210 of file error.c.

Referenced by x_msg_va().

Function Documentation

◆ assert_failed()

void assert_failed ( const char *  filename,
int  line,
const char *  condition 
)

Definition at line 435 of file error.c.

◆ close_syslog()

void close_syslog ( void  )

Definition at line 484 of file error.c.

References free, and use_syslog.

Referenced by msg_test(), and openvpn_exit().

◆ dont_mute()

bool dont_mute ( unsigned int  flags)

Check muting filter.

Definition at line 400 of file error.c.

Referenced by x_msg_va().

◆ error_reset()

void error_reset ( void  )

◆ errors_to_stderr()

void errors_to_stderr ( void  )

Definition at line 187 of file error.c.

References default_err, and OPENVPN_ERROR_FP.

Referenced by add_option().

◆ get_debug_level()

int get_debug_level ( void  )

Definition at line 139 of file error.c.

References x_debug_level.

Referenced by man_dispatch_command().

◆ get_mute_cutoff()

int get_mute_cutoff ( void  )

Definition at line 145 of file error.c.

References mute_cutoff.

Referenced by man_dispatch_command().

◆ get_orig_stderr()

HANDLE get_orig_stderr ( void  )

Definition at line 505 of file error.c.

References orig_stderr.

Referenced by get_console_input_win32(), and msg_test().

◆ msg_flags_string()

const char* msg_flags_string ( const unsigned int  flags,
struct gc_arena gc 
)

Definition at line 785 of file error.c.

References alloc_buf_gc(), BSTR, buf_printf(), M_DEBUG, M_FATAL, M_INFO, M_NONFATAL, and M_WARN.

Referenced by log_entry_print().

◆ msg_forked()

void msg_forked ( void  )

Definition at line 101 of file error.c.

References forked.

Referenced by msg_test().

◆ msg_fp()

FILE* msg_fp ( const unsigned int  flags)

◆ open_syslog()

void open_syslog ( const char *  pgmname,
bool  stdio_to_null 
)

Definition at line 460 of file error.c.

References M_WARN, msg, msgfp, PACKAGE, set_std_files_to_null(), std_redir, string_alloc(), and use_syslog.

Referenced by add_option(), and msg_test().

◆ openvpn_exit()

void openvpn_exit ( const int  status)

◆ out_of_memory()

void out_of_memory ( void  )

Definition at line 453 of file error.c.

Referenced by check_malloc_return().

◆ redirect_stdout_stderr()

void redirect_stdout_stderr ( const char *  file,
bool  append 
)

Definition at line 520 of file error.c.

References ASSERT, gc_free(), gc_new(), M_ERR, M_ERRNO, M_WARN, msg, msgfp, orig_stderr, S_IRUSR, S_IWUSR, std_redir, and wide_string().

Referenced by add_option(), and msg_test().

◆ reset_check_status()

void reset_check_status ( void  )

Definition at line 639 of file error.c.

References x_cs_info_level, and x_cs_verbose_level.

Referenced by init_static(), and msg_test().

◆ set_check_status()

void set_check_status ( unsigned int  info_level,
unsigned int  verbose_level 
)

Definition at line 646 of file error.c.

References x_cs_info_level, and x_cs_verbose_level.

Referenced by init_verb_mute(), and msg_test().

◆ set_debug_level()

bool set_debug_level ( const int  level,
const unsigned int  flags 
)

Definition at line 107 of file error.c.

References constrain_int(), SDL_CONSTRAIN, and x_debug_level.

Referenced by add_option(), init_verb_mute(), and man_dispatch_command().

◆ set_machine_readable_output()

void set_machine_readable_output ( bool  parsable)

Definition at line 157 of file error.c.

References machine_readable_output.

Referenced by add_option().

◆ set_mute_cutoff()

bool set_mute_cutoff ( const int  cutoff)

Definition at line 125 of file error.c.

References mute_cutoff.

Referenced by init_verb_mute(), and man_dispatch_command().

◆ set_suppress_timestamps()

void set_suppress_timestamps ( bool  suppressed)

Definition at line 151 of file error.c.

References suppress_timestamps.

Referenced by add_option().

◆ strerror_win32()

const char* strerror_win32 ( DWORD  errnum,
struct gc_arena gc 
)

◆ x_check_status()

void x_check_status ( int  status,
const char *  description,
struct link_socket sock,
struct tuntap tt 
)

◆ x_msg()

void x_msg ( const unsigned int  flags,
const char *  format,
  ... 
)

Definition at line 215 of file error.c.

◆ x_msg_va()

void x_msg_va ( const unsigned int  flags,
const char *  format,
va_list  arglist 
)

Definition at line 224 of file error.c.

Referenced by plugin_vlog(), and x_msg().

Variable Documentation

◆ default_err

FILE* default_err
static

Definition at line 98 of file error.c.

Referenced by error_reset(), errors_to_stderr(), and msg_fp().

◆ default_out

FILE* default_out
static

Definition at line 97 of file error.c.

Referenced by error_reset(), and msg_fp().

◆ forked

bool forked
static

Definition at line 94 of file error.c.

Referenced by msg_forked(), openvpn_exit(), and x_msg_va().

◆ machine_readable_output

bool machine_readable_output
static

Definition at line 80 of file error.c.

Referenced by error_reset(), set_machine_readable_output(), show_settings(), and x_msg_va().

◆ msgfp

FILE* msgfp
static

Definition at line 91 of file error.c.

Referenced by error_reset(), msg_fp(), open_syslog(), and redirect_stdout_stderr().

◆ mute_category

int mute_category
static

Definition at line 59 of file error.c.

Referenced by dont_mute(), and error_reset().

◆ mute_count

int mute_count
static

Definition at line 58 of file error.c.

Referenced by dont_mute(), and error_reset().

◆ mute_cutoff

int mute_cutoff
static

Definition at line 57 of file error.c.

Referenced by dont_mute(), error_reset(), get_mute_cutoff(), and set_mute_cutoff().

◆ orig_stderr

HANDLE orig_stderr
static

Definition at line 502 of file error.c.

Referenced by get_orig_stderr(), and redirect_stdout_stderr().

◆ std_redir

bool std_redir
static

Definition at line 73 of file error.c.

Referenced by error_reset(), open_syslog(), redirect_stdout_stderr(), and x_msg_va().

◆ suppress_timestamps

bool suppress_timestamps
static

Definition at line 83 of file error.c.

Referenced by error_reset(), set_suppress_timestamps(), show_settings(), and x_msg_va().

◆ use_syslog

bool use_syslog
static

Definition at line 76 of file error.c.

Referenced by close_syslog(), error_reset(), open_syslog(), and x_msg_va().

◆ x_cs_err_delay_ms

unsigned int x_cs_err_delay_ms

Definition at line 636 of file error.c.

Referenced by msg_test(), and x_check_status().

◆ x_cs_info_level

unsigned int x_cs_info_level

Definition at line 634 of file error.c.

Referenced by msg_test(), reset_check_status(), set_check_status(), and x_check_status().

◆ x_cs_verbose_level

unsigned int x_cs_verbose_level

Definition at line 635 of file error.c.

Referenced by msg_test(), reset_check_status(), set_check_status(), and x_check_status().

◆ x_debug_level

unsigned int x_debug_level

Definition at line 54 of file error.c.

Referenced by error_reset(), get_debug_level(), and set_debug_level().

◆ x_msg_line_num

int x_msg_line_num

Definition at line 212 of file error.c.

Referenced by x_msg_va().

◆ x_msg_prefix

const char* x_msg_prefix

Definition at line 724 of file error.c.

Referenced by msg_get_prefix(), and set_check_status_error_delay().

◆ x_msg_virtual_output

const struct virtual_output* x_msg_virtual_output

Definition at line 730 of file error.c.

Referenced by msg_get_prefix(), and msg_get_virtual_output().