Implement second exchange in IKEv1 main mode
[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 IKEv2 ID payload.
34 *
35 * The ID payload format is described in RFC section 3.5.
36 */
37 struct id_payload_t {
38
39 /**
40 * The payload_t interface.
41 */
42 payload_t payload_interface;
43
44 /**
45 * Creates an identification object of this id payload.
46 *
47 * @return identification_t object
48 */
49 identification_t *(*get_identification) (id_payload_t *this);
50
51 /**
52 * Destroys an id_payload_t object.
53 */
54 void (*destroy) (id_payload_t *this);
55 };
56
57 /**
58 * Creates an empty id_payload_t object.
59 *
60 * @param payload_type one of ID_INITIATOR, ID_RESPONDER
61 * @return id_payload_t object
62 */
63 id_payload_t *id_payload_create(payload_type_t payload_type);
64
65 /**
66 * Creates an id_payload_t from an existing identification_t object.
67 *
68 * @param payload_type one of ID_INITIATOR, ID_RESPONDER
69 * @param identification identification_t object
70 * @return id_payload_t object
71 */
72 id_payload_t *id_payload_create_from_identification(payload_type_t payload_type,
73 identification_t *identification);
74
75 #endif /** ID_PAYLOAD_H_ @}*/