embedded IPsec source code documentation


debug.h File Reference


Detailed Description

Collection of common debug routines and macros.

Author:
Christian Scheurer <http://www.christianscheurer.ch>

Niklaus Schild <n.schild@gmx.ch>

This document is part of embedded IPsec
Copyright (c) 2003 Niklaus Schild and Christian Scheurer, HTI Biel/Bienne
All rights reserved.

Definition in file debug.h.

#include <stdio.h>
#include "ipsec/util.h"

Go to the source code of this file.

Defines

#define IPSEC_ERROR
 If IPSEC_ERROR is defined, severe configuration errors and not manageable states such as running out of memory are logged. It is recommended to have this feature enabled by default.

#define IPSEC_MESSAGE
 If less critical errors should also be logged, this feature must be enabled. The produced additional output can be a supplement to the error messages logged under IPSEC_ERROR. This feature controls informative messages. They are particularly helpful to have a "lightweight trace" of the program execution.

#define IPSEC_AUDIT
 If in-depth information with details of all passed and returned parameters is needed, IPSEC_TRACE must be defined. Since this feature produces a vast amount of information, it is recommended to disable it by default. If defined, auditable events according to the IPsec RFC's are logged.

#define IPSEC_TEST
 This feature is only used inside the test routines and prints log messages in an uniform style.

#define IPSEC_TABLES
 Printing a HEX-dump of large memory buffers can be very time consuming. Only if defined, dumping of buffers is enabled. Some information is printed in tables. To avoid this time consuming operation, this feature must be disabled.

#define IPSEC_LOG_MESSAGE_SIZE   (128)
 This macro defines a standard log message size, which can be used for concatenation of log messages (sprintf(), etc).

#define IPSEC_LOG_ERR(__function_name__, __code__, __message__)
#define IPSEC_LOG_DBG(__function_name__, __code__, __message__)
#define IPSEC_LOG_MSG(__function_name__, __message__)
#define IPSEC_LOG_AUD(__function_name__, __code__, __message__)
#define IPSEC_LOG_TST(__function_name__, __code__, __message__)
#define IPSEC_LOG_TST_NOMSG(__function_name__, __code__)   printf("TST %-28s: %9s : ", __function_name__, __code__)
#define IPSEC_LOG_TRC(__action__, __function_name__, __message__)
#define IPSEC_DUMP_BUFFER(__prefix__, __buffer__, __offset__, __length__)


Define Documentation

#define IPSEC_AUDIT
 

If in-depth information with details of all passed and returned parameters is needed, IPSEC_TRACE must be defined. Since this feature produces a vast amount of information, it is recommended to disable it by default. If defined, auditable events according to the IPsec RFC's are logged.

turns on audit messages according RFC 2401

Definition at line 68 of file debug.h.

#define IPSEC_DUMP_BUFFER __prefix__,
__buffer__,
__offset__,
__length__   ) 
 

Definition at line 179 of file debug.h.

#define IPSEC_ERROR
 

If IPSEC_ERROR is defined, severe configuration errors and not manageable states such as running out of memory are logged. It is recommended to have this feature enabled by default.

turns on error logging

Definition at line 51 of file debug.h.

#define IPSEC_LOG_AUD __function_name__,
__code__,
__message__   ) 
 

Value:

{ \
                                printf("AUD %-28s: %9d : ", __function_name__, __code__); \
                                printf __message__ ;  \
                                printf("\n"); \
                        }

Definition at line 121 of file debug.h.

#define IPSEC_LOG_DBG __function_name__,
__code__,
__message__   ) 
 

Definition at line 105 of file debug.h.

#define IPSEC_LOG_ERR __function_name__,
__code__,
__message__   ) 
 

Value:

{ \
                                printf("ERR %-28s: %9d : ", __function_name__, __code__); \
                                printf __message__ ;  \
                                printf("\n"); \
                        }

Definition at line 87 of file debug.h.

#define IPSEC_LOG_MESSAGE_SIZE   (128)
 

This macro defines a standard log message size, which can be used for concatenation of log messages (sprintf(), etc).

Definition at line 82 of file debug.h.

#define IPSEC_LOG_MSG __function_name__,
__message__   ) 
 

Value:

{ \
                                printf("MSG %-28s: ", __function_name__); \
                                printf __message__ ;  \
                                printf("\n"); \
                        }

Definition at line 110 of file debug.h.

#define IPSEC_LOG_TRC __action__,
__function_name__,
__message__   ) 
 

Definition at line 172 of file debug.h.

#define IPSEC_LOG_TST __function_name__,
__code__,
__message__   ) 
 

Value:

{ \
                                printf("TST %-28s: %9s : ", __function_name__, __code__); \
                                printf __message__ ;  \
                                printf("\n"); \
                        }

Definition at line 132 of file debug.h.

#define IPSEC_LOG_TST_NOMSG __function_name__,
__code__   )     printf("TST %-28s: %9s : ", __function_name__, __code__)
 

Definition at line 137 of file debug.h.

#define IPSEC_MESSAGE
 

If less critical errors should also be logged, this feature must be enabled. The produced additional output can be a supplement to the error messages logged under IPSEC_ERROR. This feature controls informative messages. They are particularly helpful to have a "lightweight trace" of the program execution.

turns on informative message logging

Definition at line 60 of file debug.h.

#define IPSEC_TABLES
 

Printing a HEX-dump of large memory buffers can be very time consuming. Only if defined, dumping of buffers is enabled. Some information is printed in tables. To avoid this time consuming operation, this feature must be disabled.

turns on logging for any kind of tables

Definition at line 77 of file debug.h.

#define IPSEC_TEST
 

This feature is only used inside the test routines and prints log messages in an uniform style.

turns on test messages for ipsec testing

Definition at line 71 of file debug.h.


Copyright 2003 by Christian Scheurer and Niklaus Schild