merged the modularization branch (credentials) back to trunk

This commit is contained in:
Martin Willi
2008-03-13 14:14:44 +00:00
parent 2df655134c
commit 552cc11b1f
495 changed files with 30378 additions and 23843 deletions
+49 -35
View File
@@ -1,12 +1,5 @@
/**
* @file printf_hook.h
*
* @brief Printf hook definitions and arginfo functions.
*
*/
/*
* Copyright (C) 2006 Martin Willi
* Copyright (C) 2006-2008 Martin Willi
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -18,44 +11,65 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* $Id$
*/
/**
* @defgroup printf_hook printf_hook
* @{ @ingroup libstrongswan
*/
#ifndef PRINTF_HOOK_H_
#define PRINTF_HOOK_H_
typedef struct printf_hook_t printf_hook_t;
typedef struct printf_hook_functions_t printf_hook_functions_t;
#include <printf.h>
/**
* Printf() hook characters.
* We define all characters here to have them on a central place.
* Printf hook function set.
*
* A printf hook has two functions, one to print the string, one to read
* in the number of arguments. See <printf.h>.
*/
struct printf_hook_functions_t {
/** 2 arguments: u_char *buffer, int size */
#define PRINTF_BYTES 'b'
/** 1 argument: chunk_t *chunk; use #-modifier to print inline */
#define PRINTF_CHUNK 'B'
/** 1 argument: identification_t *id */
#define PRINTF_IDENTIFICATION 'D'
/** 1 argumnet: host_t *host; use #-modifier to include port number */
#define PRINTF_HOST 'H'
/** 1 argument: ike_sa_t *ike_sa */
#define PRINTF_ENUM 'N'
/** 1 argument: child_sa_t *child_sa */
#define PRINTF_TRAFFIC_SELECTOR 'R'
/** 1 argument: time_t *time; with #-modifier 2 arguments: time_t *time, bool utc */
#define PRINTF_TIME 'T'
/** 1 argument: time_t *delta; with #-modifier 2 arguments: time_t *begin, time_t *end */
#define PRINTF_TIME_DELTA 'V'
/**
* Printf hook print function
*/
printf_function *print;
/**
* Printf hook arginfo function
*/
printf_arginfo_function *arginfo;
};
/**
* Generic arginfo handlers for printf() hooks
* Printf handler management.
*/
int arginfo_ptr(const struct printf_info *info, size_t n, int *argtypes);
int arginfo_ptr_ptr(const struct printf_info *info, size_t n, int *argtypes);
int arginfo_ptr_int(const struct printf_info *info, size_t n, int *argtypes);
int arginfo_int_int(const struct printf_info *info, size_t n, int *argtypes);
int arginfo_ptr_alt_ptr_int(const struct printf_info *info, size_t n, int *argtypes);
int arginfo_ptr_alt_ptr_ptr(const struct printf_info *info, size_t n, int *argtypes);
int arginfo_int_alt_int_int(const struct printf_info *info, size_t n, int *argtypes);
struct printf_hook_t {
/**
* Register a printf handler.
*
* @param spec printf hook format character
* @param hook hook functions
*/
void (*add_handler)(printf_hook_t *this, char spec,
printf_hook_functions_t hook);
/**
* Destroy a printf_hook instance.
*/
void (*destroy)(printf_hook_t *this);
};
#endif /* PRINTF_HOOK_H_ */
/**
* Create a printf_hook instance.
*/
printf_hook_t *printf_hook_create();
#endif /* PRINTF_HOOK_H_ @}*/