updated Doxyfile
[strongswan.git] / src / libstrongswan / utils / backtrace.h
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup backtrace backtrace
18 * @{ @ingroup utils
19 */
20
21 #ifndef BACKTRACE_H_
22 #define BACKTRACE_H_
23
24 #include <stdio.h>
25
26 #include <library.h>
27
28 typedef struct backtrace_t backtrace_t;
29
30 /**
31 * A backtrace registers the frames on the stack during creation.
32 */
33 struct backtrace_t {
34
35 /**
36 * Log the backtrace to a FILE stream.
37 */
38 void (*log)(backtrace_t *this, FILE *file);
39
40 /**
41 * Check if the backtrace contains a frame in a specific function.
42 *
43 * @param function name
44 * @return TRUE if function is in the stack
45 */
46 bool (*contains_function)(backtrace_t *this, char *function);
47
48 /**
49 * Destroy a backtrace instance.
50 */
51 void (*destroy)(backtrace_t *this);
52 };
53
54 /**
55 * Create a backtrace of the current stack.
56 *
57 * @param skip how many of the innerst frames to skip
58 * @return backtrace
59 */
60 backtrace_t *backtrace_create(int skip);
61
62 #endif /** BACKTRACE_H_ @}*/