605f192855f6386c5a4512e34dfc8b5ad94a8021
[strongswan.git] / src / charon / encoding / payloads / unknown_payload.h
1 /*
2 * Copyright (C) 2005-2006 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * 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 * $Id$
17 */
18
19 /**
20 * @defgroup unknown_payload unknown_payload
21 * @{ @ingroup payloads
22 */
23
24 #ifndef UNKNOWN_PAYLOAD_H_
25 #define UNKNOWN_PAYLOAD_H_
26
27 typedef struct unknown_payload_t unknown_payload_t;
28
29 #include <library.h>
30 #include <encoding/payloads/payload.h>
31
32 /**
33 * Header length of the unknown payload.
34 */
35 #define UNKNOWN_PAYLOAD_HEADER_LENGTH 4
36
37 /**
38 * Payload which can't be processed further.
39 *
40 * When the parser finds an unknown payload, he builds an instance of
41 * this class. This allows further processing of this payload, such as
42 * a check for the critical bit in the header.
43 */
44 struct unknown_payload_t {
45
46 /**
47 * The payload_t interface.
48 */
49 payload_t payload_interface;
50
51 /**
52 * Get the raw data of this payload, without
53 * the generic payload header.
54 *
55 * Returned data are NOT copied and must not be freed.
56 *
57 * @return data as chunk_t
58 */
59 chunk_t (*get_data) (unknown_payload_t *this);
60
61 /**
62 * Get the critical flag.
63 *
64 * @return TRUE if payload is critical, FALSE if not
65 */
66 bool (*is_critical) (unknown_payload_t *this);
67
68 /**
69 * Destroys an unknown_payload_t object.
70 */
71 void (*destroy) (unknown_payload_t *this);
72 };
73
74 /**
75 * Creates an empty unknown_payload_t object.
76 *
77 * @return unknown_payload_t object
78 */
79 unknown_payload_t *unknown_payload_create(void);
80
81 #endif /* UNKNOWN_PAYLOAD_H_ @} */