The introduced SHA1_NOFINAL hasher was not sufficient for EAP-AKA,
[strongswan.git] / src / libstrongswan / printf_hook.c
1 /*
2 * Copyright (C) 2006-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 * $Id$
16 */
17
18 #include "printf_hook.h"
19
20 #include <utils.h>
21
22 typedef struct private_printf_hook_t private_printf_hook_t;
23
24 /**
25 * private data of printf_hook
26 */
27 struct private_printf_hook_t {
28
29 /**
30 * public functions
31 */
32 printf_hook_t public;
33 };
34
35 /**
36 * Implementation of printf_hook_t.add_handler.
37 */
38 static void add_handler(private_printf_hook_t *this, char spec,
39 printf_hook_functions_t hook)
40 {
41 register_printf_function(spec, hook.print, hook.arginfo);
42 }
43
44 /**
45 * Implementation of printf_hook_t.destroy
46 */
47 static void destroy(private_printf_hook_t *this)
48 {
49 free(this);
50 }
51
52 /*
53 * see header file
54 */
55 printf_hook_t *printf_hook_create()
56 {
57 private_printf_hook_t *this = malloc_thing(private_printf_hook_t);
58
59 this->public.add_handler = (void(*)(printf_hook_t*, char, printf_hook_functions_t))add_handler;
60 this->public.destroy = (void(*)(printf_hook_t*))destroy;
61
62
63 return &this->public;
64 }
65