Extended ID payload for (non-TS) IKEv1 use
[strongswan.git] / src / libcharon / encoding / payloads / id_payload.h
1 /*
2 * Copyright (C) 2007 Tobias Brunner
3 * Copyright (C) 2005-2006 Martin Willi
4 * Copyright (C) 2005 Jan Hutter
5 * Hochschule fuer Technik Rapperswil
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 /**
19 * @defgroup id_payload id_payload
20 * @{ @ingroup payloads
21 */
22
23 #ifndef ID_PAYLOAD_H_
24 #define ID_PAYLOAD_H_
25
26 typedef struct id_payload_t id_payload_t;
27
28 #include <library.h>
29 #include <utils/identification.h>
30 #include <encoding/payloads/payload.h>
31
32 /**
33 * Object representing an IKEv1 or an IKEv2 ID payload.
34 */
35 struct id_payload_t {
36
37 /**
38 * The payload_t interface.
39 */
40 payload_t payload_interface;
41
42 /**
43 * Creates an identification object of this id payload.
44 *
45 * @return identification_t object
46 */
47 identification_t *(*get_identification) (id_payload_t *this);
48
49 /**
50 * Destroys an id_payload_t object.
51 */
52 void (*destroy) (id_payload_t *this);
53 };
54
55 /**
56 * Creates an empty id_payload_t object.
57 *
58 * @param type one of ID_INITIATOR, ID_RESPONDER and ID_V1
59 * @return id_payload_t object
60 */
61 id_payload_t *id_payload_create(payload_type_t payload_type);
62
63 /**
64 * Creates an id_payload_t from an existing identification_t object.
65 *
66 * @param type one of ID_INITIATOR, ID_RESPONDER and ID_V1
67 * @param id identification_t object
68 * @return id_payload_t object
69 */
70 id_payload_t *id_payload_create_from_identification(payload_type_t type,
71 identification_t *id);
72
73 #endif /** ID_PAYLOAD_H_ @}*/