Annotation of embedaddon/strongswan/src/libcharon/encoding/payloads/ts_payload.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2005-2006 Martin Willi
3: * Copyright (C) 2005 Jan Hutter
4: * HSR Hochschule fuer Technik Rapperswil
5: *
6: * This program is free software; you can redistribute it and/or modify it
7: * under the terms of the GNU General Public License as published by the
8: * Free Software Foundation; either version 2 of the License, or (at your
9: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * for more details.
15: */
16:
17: /**
18: * @defgroup ts_payload ts_payload
19: * @{ @ingroup payloads
20: */
21:
22: #ifndef TS_PAYLOAD_H_
23: #define TS_PAYLOAD_H_
24:
25: typedef struct ts_payload_t ts_payload_t;
26:
27: #include <library.h>
28: #include <collections/linked_list.h>
29: #include <selectors/traffic_selector.h>
30: #include <encoding/payloads/payload.h>
31: #include <encoding/payloads/traffic_selector_substructure.h>
32:
33: /**
34: * Class representing an IKEv2 TS payload.
35: *
36: * The TS payload format is described in RFC section 3.13.
37: */
38: struct ts_payload_t {
39:
40: /**
41: * The payload_t interface.
42: */
43: payload_t payload_interface;
44:
45: /**
46: * Get the type of TSpayload (TSi or TSr).
47: *
48: * @return
49: * - TRUE if this payload is of type TSi
50: * - FALSE if this payload is of type TSr
51: */
52: bool (*get_initiator) (ts_payload_t *this);
53:
54: /**
55: * Set the type of TS payload (TSi or TSr).
56: *
57: * @param is_initiator
58: * - TRUE if this payload is of type TSi
59: * - FALSE if this payload is of type TSr
60: */
61: void (*set_initiator) (ts_payload_t *this,bool is_initiator);
62:
63: /**
64: * Get a list of nested traffic selectors as traffic_selector_t.
65: *
66: * Resulting list and its traffic selectors must be destroyed after usage
67: *
68: * @return list of traffic selectors
69: */
70: linked_list_t *(*get_traffic_selectors) (ts_payload_t *this);
71:
72: /**
73: * Destroys an ts_payload_t object.
74: */
75: void (*destroy) (ts_payload_t *this);
76: };
77:
78: /**
79: * Creates an empty ts_payload_t object.
80: *
81: * @param is_initiator TRUE for TSi, FALSE for TSr payload type
82: * @return ts_payload_t object
83: */
84: ts_payload_t *ts_payload_create(bool is_initiator);
85:
86: /**
87: * Creates ts_payload with a list of traffic_selector_t
88: *
89: * @param is_initiator TRUE for TSi, FALSE for TSr payload type
90: * @param traffic_selectors list of traffic selectors to include
91: * @return ts_payload_t object
92: */
93: ts_payload_t *ts_payload_create_from_traffic_selectors(bool is_initiator,
94: linked_list_t *traffic_selectors);
95:
96: #endif /** TS_PAYLOAD_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>