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,...)
 
static const char * openvpn_strerror (int err, bool crt_error, struct gc_arena *gc)
 
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)
 
int get_orig_stderr ()
 
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 int 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 208 of file error.c.

Function Documentation

◆ assert_failed()

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

Definition at line 442 of file error.c.

◆ close_syslog()

void close_syslog ( void  )

Definition at line 491 of file error.c.

References use_syslog.

Referenced by openvpn_exit().

◆ dont_mute()

bool dont_mute ( unsigned int  flags)

Check muting filter.

Definition at line 407 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 185 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 137 of file error.c.

Referenced by man_dispatch_command().

◆ get_mute_cutoff()

int get_mute_cutoff ( void  )

Definition at line 143 of file error.c.

References mute_cutoff.

Referenced by man_dispatch_command().

◆ get_orig_stderr()

int get_orig_stderr ( )

Definition at line 508 of file error.c.

References orig_stderr.

Referenced by get_console_input_win32().

◆ msg_flags_string()

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

Definition at line 783 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 99 of file error.c.

References forked.

◆ msg_fp()

FILE* msg_fp ( const unsigned int  flags)

◆ open_syslog()

void open_syslog ( const char *  pgmname,
bool  stdio_to_null 
)

Definition at line 467 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().

◆ openvpn_exit()

void openvpn_exit ( const int  status)

◆ openvpn_strerror()

static const char* openvpn_strerror ( int  err,
bool  crt_error,
struct gc_arena gc 
)
static

Definition at line 222 of file error.c.

References env_set::gc, and strerror_win32().

Referenced by x_check_status(), and x_msg_va().

◆ out_of_memory()

void out_of_memory ( void  )

Definition at line 460 of file error.c.

Referenced by check_malloc_return().

◆ redirect_stdout_stderr()

void redirect_stdout_stderr ( const char *  file,
bool  append 
)

Definition at line 515 of file error.c.

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

Referenced by add_option().

◆ reset_check_status()

void reset_check_status ( void  )

Definition at line 630 of file error.c.

References x_cs_info_level, and x_cs_verbose_level.

Referenced by init_static().

◆ set_check_status()

void set_check_status ( unsigned int  info_level,
unsigned int  verbose_level 
)

Definition at line 637 of file error.c.

References x_cs_info_level, and x_cs_verbose_level.

Referenced by init_verb_mute().

◆ set_debug_level()

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

Definition at line 105 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 155 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 123 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 149 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 213 of file error.c.

◆ x_msg_va()

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

Definition at line 234 of file error.c.

Referenced by plugin_vlog(), and x_msg().

Variable Documentation

◆ default_err

FILE* default_err
static

Definition at line 96 of file error.c.

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

◆ default_out

FILE* default_out
static

Definition at line 95 of file error.c.

Referenced by error_reset(), and msg_fp().

◆ forked

bool forked
static

Definition at line 92 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 78 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 89 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 57 of file error.c.

Referenced by dont_mute(), and error_reset().

◆ mute_count

int mute_count
static

Definition at line 56 of file error.c.

Referenced by dont_mute(), and error_reset().

◆ mute_cutoff

int mute_cutoff
static

Definition at line 55 of file error.c.

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

◆ orig_stderr

int orig_stderr
static

Definition at line 505 of file error.c.

Referenced by get_console_input_win32(), get_orig_stderr(), and redirect_stdout_stderr().

◆ std_redir

bool std_redir
static

Definition at line 71 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 81 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 74 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 627 of file error.c.

Referenced by set_check_status_error_delay(), and x_check_status().

◆ x_cs_info_level

unsigned int x_cs_info_level

Definition at line 625 of file error.c.

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

◆ x_cs_verbose_level

unsigned int x_cs_verbose_level

Definition at line 626 of file error.c.

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

◆ x_debug_level

unsigned int x_debug_level

Definition at line 52 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 210 of file error.c.

Referenced by x_msg_va().

◆ x_msg_prefix

const char* x_msg_prefix

Definition at line 722 of file error.c.

Referenced by msg_get_prefix(), and msg_set_prefix().

◆ x_msg_virtual_output

const struct virtual_output* x_msg_virtual_output

Definition at line 728 of file error.c.

Referenced by msg_get_virtual_output(), and msg_set_virtual_output().