28b9db136919f550336a1a00c8594fdbda0b5e29
[strongswan.git] / Source / charon / sa / authenticator.h
1 /**
2 * @file authenticator.h
3 *
4 * @brief Interface of authenticator.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23
24 #ifndef _AUTHENTICATOR_H_
25 #define _AUTHENTICATOR_H_
26
27
28 #include <types.h>
29 #include <encoding/payloads/auth_payload.h>
30 #include <encoding/payloads/id_payload.h>
31 #include <network/packet.h>
32 #include <sa/ike_sa.h>
33
34
35 typedef struct authenticator_t authenticator_t;
36
37
38 /**
39 * @brief Class authenticator_t. Used to authenticate a peer.
40 *
41 * Currently only preshared secret as auth_method supported!
42 *
43 * @ingroup sa
44 */
45 struct authenticator_t {
46
47 /**
48 * @brief Verifying of given authentication data.
49 *
50 * TODO
51 * @param this authenticator_t object
52 * @return
53 * - NOT_SUPPORTED if auth_method is not supported
54 */
55 status_t (*verify_auth_data) (authenticator_t *this,auth_payload_t *auth_payload, chunk_t last_received_packet,chunk_t my_nonce,id_payload_t *other_id_payload, bool initiator,bool *verified);
56
57 /**
58 * @brief Verifying of given authentication data.
59 *
60 * TODO
61 * @param this authenticator_t object
62 * @return
63 * - NOT_SUPPORTED if auth_method is not supported
64 */
65 status_t (*compute_auth_data) (authenticator_t *this,auth_payload_t **auth_payload, chunk_t last_sent_packet,chunk_t other_nonce,id_payload_t *my_id_payload, bool initiator);
66 /**
67 * @brief Destroys a authenticator_t object.
68 *
69 * @param this authenticator_t object
70 */
71 void (*destroy) (authenticator_t *this);
72 };
73
74 authenticator_t *authenticator_create(protected_ike_sa_t *ike_sa);
75
76 #endif //_AUTHENTICATOR_H_