]>
Commit | Line | Data |
---|---|---|
c81eb6e7 JH |
1 | /** |
2 | * @file eap_payload.h | |
3 | * | |
4 | * @brief Interface of eap_payload_t. | |
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 | ||
16b9a73c MW |
23 | #ifndef EAP_PAYLOAD_H_ |
24 | #define EAP_PAYLOAD_H_ | |
c81eb6e7 JH |
25 | |
26 | #include <types.h> | |
27 | #include <encoding/payloads/payload.h> | |
28 | ||
29 | /** | |
30 | * Length of a EAP payload without the EAP Message in bytes. | |
31 | * | |
32 | * @ingroup payloads | |
33 | */ | |
34 | #define EAP_PAYLOAD_HEADER_LENGTH 4 | |
35 | ||
36 | ||
37 | typedef struct eap_payload_t eap_payload_t; | |
38 | ||
39 | /** | |
c3dc864e | 40 | * @brief Class representing an IKEv2 EAP payload. |
c81eb6e7 | 41 | * |
8a491129 | 42 | * The EAP payload format is described in RFC section 3.16. |
c81eb6e7 | 43 | * |
c3dc864e MW |
44 | * @b Constructors: |
45 | * - eap_payload_create() | |
c81eb6e7 | 46 | * |
2b547481 MW |
47 | * @todo Implement functionality for this payload |
48 | * | |
c3dc864e | 49 | * @ingroup payloads |
c81eb6e7 JH |
50 | */ |
51 | struct eap_payload_t { | |
52 | /** | |
53 | * The payload_t interface. | |
54 | */ | |
55 | payload_t payload_interface; | |
56 | ||
57 | /** | |
58 | * @brief Set the EAP Message. | |
59 | * | |
60 | * Data are getting cloned. | |
61 | * | |
62 | * @param this calling eap_payload_t object | |
63 | * @param message EAP message as chunk_t | |
64 | */ | |
65 | void (*set_message) (eap_payload_t *this, chunk_t message); | |
66 | ||
67 | /** | |
68 | * @brief Get the EAP message. | |
69 | * | |
70 | * Returned data are a copy of the internal one. | |
71 | * | |
72 | * @param this calling eap_payload_t object | |
73 | * @return EAP message as chunk_t | |
74 | */ | |
75 | chunk_t (*get_message_clone) (eap_payload_t *this); | |
76 | ||
77 | /** | |
78 | * @brief Get the EAP message. | |
79 | * | |
80 | * Returned data are NOT copied. | |
81 | * | |
82 | * @param this calling eap_payload_t object | |
83 | * @return EAP message as chunk_t | |
84 | */ | |
85 | chunk_t (*get_message) (eap_payload_t *this); | |
86 | ||
87 | /** | |
88 | * @brief Destroys an eap_payload_t object. | |
89 | * | |
90 | * @param this eap_payload_t object to destroy | |
91 | */ | |
92 | void (*destroy) (eap_payload_t *this); | |
93 | }; | |
94 | ||
95 | /** | |
96 | * @brief Creates an empty eap_payload_t object. | |
97 | * | |
c3dc864e | 98 | * @return eap_payload_t object |
c81eb6e7 JH |
99 | * |
100 | * @ingroup payloads | |
101 | */ | |
102 | eap_payload_t *eap_payload_create(); | |
103 | ||
104 | ||
16b9a73c | 105 | #endif /* EAP_PAYLOAD_H_ */ |