All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions | Variables
clixon_err.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <syslog.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include "clixon_log.h"
#include "clixon_queue.h"
#include "clixon_chunk.h"
#include "clixon_err.h"


static char * clicon_strerror1 (int err, struct errvec vec[])
int clicon_err_reset (void)
int clicon_err_fn (const char *fn, const int line, int category, int suberr, char *reason,...)
char * clicon_strerror (int err)
void * clicon_err_save (void)
int clicon_err_restore (void *handle)


int clicon_errno = 0
int clicon_suberrno = 0
char clicon_err_reason [ERR_STRLEN] = {0, }
static struct errvec EV []

Function Documentation

int clicon_err_fn ( const char *  fn,
const int  line,
int  category,
int  suberr,
char *  reason,

Report an error.

Library routines should call this function when an error occurs. The function does he following:

  • Logs to syslog with LOG_ERR
  • Set global error variable name clicon_errno
  • Set global reason string clicon_err_reason
    : err direction (syslog and/or stderr) controlled by clicon_log_init()
    fnInline function name (when called from clicon_err() macro)
    lineInline file line number (when called from clicon_err() macro)
    errError number, typically errno
    suberrSub-error number
    reasonError string, format with argv
int clicon_err_reset ( void  )

Clear error state and continue.

Clear error state and get on with it, typically non-fatal error and you wish to continue.

int clicon_err_restore ( void *  handle)

Pop an error state, if recursive error handling

void* clicon_err_save ( void  )

Push an error state, if recursive error handling

char* clicon_strerror ( int  err)

Translate from numeric error to string representation

static char* clicon_strerror1 ( int  err,
struct errvec  vec[] 

Variable Documentation

char clicon_err_reason[ERR_STRLEN] = {0, }
int clicon_errno = 0
int clicon_suberrno = 0
struct errvec EV[]
Initial value:
= {
{"Database error", OE_DB},
{"Demon error", OE_DEMON},
{"Event error", OE_EVENTS},
{"Config error", OE_CFG},
{"Protocol error", OE_PROTO},
{"Regexp error", OE_REGEX},
{"UNIX error", OE_UNIX},
{"Syslog error", OE_SYSLOG},
{"Routing demon error", OE_ROUTING},
{"XML error", OE_XML},
{"Plugins", OE_PLUGIN},
{"Yang error", OE_YANG},
{"Undefined", OE_UNDEF},
{NULL, -1}
input_stmt NULL
Definition: clixon_yang_parse.y:899