summaryrefslogtreecommitdiff
path: root/src/libstrongswan/printf_hook.h
blob: 45184a8f065a5f0a9093fa1d89b11f65cc91ed44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
 * @file printf_hook.h
 *
 * @brief Printf hook definitions and arginfo functions.
 *
 */

/*
 * Copyright (C) 2006 Martin Willi
 * Hochschule fuer Technik Rapperswil
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 *
 * This program is distributed in the hope that it will be useful, but
 * 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.
 */

#ifndef PRINTF_HOOK_H_
#define PRINTF_HOOK_H_

#include <printf.h>

/**
 * Printf() hook characters.
 * We define all characters here to have them on a central place.
 */

/** 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_id_t *id */
#define PRINTF_IKE_SA_ID		'J'
/** 1 argument: ike_sa_t *ike_sa */
#define PRINTF_IKE_SA			'K'
/** 1 argument: message_t *message */
#define PRINTF_MESSAGE			'M'
/** 2 arguments: enum_name_t *name, long value */
#define PRINTF_ENUM				'N'
/** 1 argument: child_sa_t *child_sa */
#define PRINTF_CHILD_SA			'P'
/** 1 argument: traffic_selector_t *ts */
#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: x509_t *cert; with #-modifier 2 arguments: x509_t *cert, bool utc */
#define PRINTF_X509				'Q'
/** 1 argument: crl_t *crl; with #-modifier 2 arguments: crl_t *crl, bool utc */
#define PRINTF_CRL				'U'
/** 2 arguments: time_t *begin, time_t *end */
#define PRINTF_TIME_DELTA		'V'
/** 1 argument: ca_info_t *ca_info; with #-modifier 2 arguments: ca_info_t *ca_info, bool utc */
#define PRINTF_CAINFO			'W'
/** 1 argument: certinfo_t *certinfo; with #-modifier 2 arguments: certinfo_t *certinfo, bool utc */
#define PRINTF_CERTINFO			'Y'

/**
 * Generic arginfo handlers for printf() hooks
 */
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_int_alt_int_int(const struct printf_info *info, size_t n, int *argtypes);

#endif /* PRINTF_HOOK_H_ */