Add a return value to simaka_message_t.generate()
[strongswan.git] / src / libsimaka / simaka_hooks.h
1 /*
2 * Copyright (C) 2008-2011 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 simaka_hooks simaka_hooks
18 * @{ @ingroup libsimaka
19 */
20
21 #ifndef SIMAKA_HOOKS_H_
22 #define SIMAKA_HOOKS_H_
23
24 typedef struct simaka_hooks_t simaka_hooks_t;
25
26 #include "simaka_message.h"
27
28 /**
29 * Additional hooks invoked during EAP-SIM/AKA message processing.
30 */
31 struct simaka_hooks_t {
32
33 /**
34 * SIM/AKA message parsing.
35 *
36 * As a SIM/AKA optionally contains encrypted attributes, the hook
37 * might get invoked twice, once before and once after decryption.
38 *
39 * @param message SIM/AKA message
40 * @param inbound TRUE for incoming messages, FALSE for outgoing
41 * @param decrypted TRUE if AT_ENCR_DATA has been decrypted
42 */
43 void (*message)(simaka_hooks_t *this, simaka_message_t *message,
44 bool inbound, bool decrypted);
45
46 /**
47 * SIM/AKA encryption/authentication key hooks.
48 *
49 * @param k_encr derived SIM/AKA encryption key k_encr
50 * @param k_auth derived SIM/AKA authentication key k_auth
51 */
52 void (*keys)(simaka_hooks_t *this, chunk_t k_encr, chunk_t k_auth);
53 };
54
55 #endif /** SIMAKA_HOOKS_H_ @}*/