Libtrap: Internal development docs  1.16.1
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Macros for verbose and debug listings

Data Structures

struct  hello_msg_header_s
 

Macros

#define MSG(level, format, args...)   if (trap_debug >= level) {snprintf(trap_err_msg, 4095, format, ##args); debug_msg(level,trap_err_msg);}
 Debug message macro if DEBUG macro is defined. More...
 
#define MSG_NONL(level, format, args...)   if (trap_debug >= level) {snprintf(trap_err_msg, 4095, format, ##args); debug_msg_nonl(trap_err_msg);}
 Debug message macro if DEBUG macro is defined - without new line. More...
 
#define LINE()   {fprintf(stderr, "file: %s, line: %i\n", __FILE__, __LINE__); fflush(stderr);}
 
#define INLINE
 
#define VERBOSE(level, format, args...)
 
#define DEBUG_IFC(X)
 
#define DEBUG_BUF(X)
 

Typedefs

typedef struct trap_ctx_priv_s trap_ctx_priv_t
 
typedef struct hello_msg_header_s hello_msg_header_t
 
typedef enum trap_verbose_level trap_verbose_level_t
 VERBOSE/MSG levels. More...
 

Enumerations

enum  trap_verbose_level {
  CL_ERROR = -3, CL_WARNING = -2, CL_VERBOSE_OFF = -1, CL_VERBOSE_BASIC,
  CL_VERBOSE_ADVANCED, CL_VERBOSE_LIBRARY
}
 VERBOSE/MSG levels. More...
 

Functions

void trap_verbose_msg (int level, char *string)
 send verbose message to stderr More...
 

Variables

int trap_debug
 
int trap_verbose
 
char trap_err_msg []
 
trap_ctx_priv_ttrap_glob_ctx
 

Timeouts handling

#define TRAP_NO_IFC_SLEEP   4
 seconds to sleep, when autoflushing is not active More...
 
#define TRAP_IFC_TIMEOUT   2000000
 size of default timeout on output interfaces in microseconds More...
 

Detailed Description

Macro Definition Documentation

◆ DEBUG_BUF

#define DEBUG_BUF (   X)
Value:
if (TRAP_DEBUG_BUFFERING) { \
X; \
}

Definition at line 187 of file trap_internal.h.

◆ DEBUG_IFC

#define DEBUG_IFC (   X)
Value:
if (TRAP_DEBUG_IFC) { \
X; \
}

Definition at line 183 of file trap_internal.h.

◆ INLINE

#define INLINE

Definition at line 150 of file trap_internal.h.

◆ LINE

#define LINE ( )    {fprintf(stderr, "file: %s, line: %i\n", __FILE__, __LINE__); fflush(stderr);}

Prints line in source file if DEBUG macro is defined

Definition at line 148 of file trap_internal.h.

◆ MSG

#define MSG (   level,
  format,
  args... 
)    if (trap_debug >= level) {snprintf(trap_err_msg, 4095, format, ##args); debug_msg(level,trap_err_msg);}

Debug message macro if DEBUG macro is defined.

now 3 known DEBUG LEVELS

  • 0 normal debug messages
  • 1 extended debug (messages on enter and before exit important functions)
  • 2 flood developer with debug messages :-) (don't use)

BE VERBOSE AND DEBUG ARE DIFFERENT OPTIONS !!!

Definition at line 142 of file trap_internal.h.

◆ MSG_NONL

#define MSG_NONL (   level,
  format,
  args... 
)    if (trap_debug >= level) {snprintf(trap_err_msg, 4095, format, ##args); debug_msg_nonl(trap_err_msg);}

Debug message macro if DEBUG macro is defined - without new line.

Definition at line 146 of file trap_internal.h.

◆ TRAP_IFC_TIMEOUT

#define TRAP_IFC_TIMEOUT   2000000

size of default timeout on output interfaces in microseconds

Definition at line 129 of file trap_internal.h.

◆ TRAP_NO_IFC_SLEEP

#define TRAP_NO_IFC_SLEEP   4

seconds to sleep, when autoflushing is not active

Definition at line 128 of file trap_internal.h.

◆ VERBOSE

#define VERBOSE (   level,
  format,
  args... 
)
Value:
if (trap_verbose>=level) { \
snprintf(trap_err_msg,4095,"%s:%d "format,__FILE__, __LINE__, ##args); \
trap_verbose_msg(level,trap_err_msg); \
}
char trap_err_msg[]
Definition: trap_internal.c:58
int trap_verbose
Definition: trap_internal.c:57

Macro for verbose message

Definition at line 171 of file trap_internal.h.

Typedef Documentation

◆ hello_msg_header_t

Hello message header structure (used during the output and input interface negotiation). Contains data format and data specifier size of the output interface which is making the negotiation.

◆ trap_ctx_priv_t

Definition at line 99 of file trap_internal.h.

◆ trap_verbose_level_t

VERBOSE/MSG levels.

Enumeration Type Documentation

◆ trap_verbose_level

VERBOSE/MSG levels.

Enumerator
CL_ERROR 

Inforamtion about error

CL_WARNING 
CL_VERBOSE_OFF 

Verbose off / print even if VERBOSE is off

CL_VERBOSE_BASIC 

Basic verbose information

CL_VERBOSE_ADVANCED 

Advanced verbose information

CL_VERBOSE_LIBRARY 

Used for library functions verbose

Definition at line 116 of file trap_internal.h.

Function Documentation

◆ trap_verbose_msg()

void trap_verbose_msg ( int  level,
char *  string 
)

send verbose message to stderr

send verbose message to stderr. may change in future. don't use it directly

Parameters
levelimportance level
stringformat string, like printf function

Definition at line 107 of file trap_internal.c.

Variable Documentation

◆ trap_debug

int trap_debug

control debug level

Verbose level storage

Definition at line 56 of file trap_internal.c.

◆ trap_err_msg

char trap_err_msg[]

buffer for verbose and debug messages

Definition at line 58 of file trap_internal.c.

◆ trap_glob_ctx

trap_ctx_priv_t* trap_glob_ctx

Definition at line 120 of file trap.c.

◆ trap_verbose

int trap_verbose

control verbose level

Definition at line 57 of file trap_internal.c.