moved auth_method to policy
[strongswan.git] / src / charon / encoding / payloads / auth_payload.h
1 /**
2 * @file auth_payload.h
3 *
4 * @brief Interface of auth_payload_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005-2006 Martin Willi
10 * Copyright (C) 2005 Jan Hutter
11 * Hochschule fuer Technik Rapperswil
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
22 */
23
24
25 #ifndef AUTH_PAYLOAD_H_
26 #define AUTH_PAYLOAD_H_
27
28 #include <types.h>
29 #include <encoding/payloads/payload.h>
30 #include <config/policies/policy.h>
31
32 /**
33 * Length of a auth payload without the auth data in bytes.
34 *
35 * @ingroup payloads
36 */
37 #define AUTH_PAYLOAD_HEADER_LENGTH 8
38
39
40 typedef struct auth_payload_t auth_payload_t;
41
42 /**
43 * @brief Class representing an IKEv2 AUTH payload.
44 *
45 * The AUTH payload format is described in RFC section 3.8.
46 *
47 * @b Constructors:
48 * - auth_payload_create()
49 *
50 * @ingroup payloads
51 */
52 struct auth_payload_t {
53
54 /**
55 * The payload_t interface.
56 */
57 payload_t payload_interface;
58
59 /**
60 * @brief Set the AUTH method.
61 *
62 * @param this calling auth_payload_t object
63 * @param method auth_method_t to use
64 */
65 void (*set_auth_method) (auth_payload_t *this, auth_method_t method);
66
67 /**
68 * @brief Get the AUTH method.
69 *
70 * @param this calling auth_payload_t object
71 * @return auth_method_t used
72 */
73 auth_method_t (*get_auth_method) (auth_payload_t *this);
74
75 /**
76 * @brief Set the AUTH data.
77 *
78 * Data are getting cloned.
79 *
80 * @param this calling auth_payload_t object
81 * @param data AUTH data as chunk_t
82 */
83 void (*set_data) (auth_payload_t *this, chunk_t data);
84
85 /**
86 * @brief Get the AUTH data.
87 *
88 * Returned data are a copy of the internal one.
89 *
90 * @param this calling auth_payload_t object
91 * @return AUTH data as chunk_t
92 */
93 chunk_t (*get_data_clone) (auth_payload_t *this);
94
95 /**
96 * @brief Get the AUTH data.
97 *
98 * Returned data are NOT copied
99 *
100 * @param this calling auth_payload_t object
101 * @return AUTH data as chunk_t
102 */
103 chunk_t (*get_data) (auth_payload_t *this);
104
105 /**
106 * @brief Destroys an auth_payload_t object.
107 *
108 * @param this auth_payload_t object to destroy
109 */
110 void (*destroy) (auth_payload_t *this);
111 };
112
113 /**
114 * @brief Creates an empty auth_payload_t object.
115 *
116 * @return auth_payload_t object
117 *
118 * @ingroup payloads
119 */
120 auth_payload_t *auth_payload_create(void);
121
122
123 #endif /* AUTH_PAYLOAD_H_ */