]> git.ipfire.org Git - people/ms/strongswan.git/blob - programs/charon/charon/encoding/payloads/unknown_payload.h
- import of strongswan-2.7.0
[people/ms/strongswan.git] / programs / charon / charon / encoding / payloads / unknown_payload.h
1 /**
2 * @file unknown_payload.h
3 *
4 * @brief Interface of unknown_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
23 #ifndef UNKNOWN_PAYLOAD_H_
24 #define UNKNOWN_PAYLOAD_H_
25
26 #include <types.h>
27 #include <encoding/payloads/payload.h>
28
29 /**
30 * Header length of the unknown payload.
31 *
32 * @ingroup payloads
33 */
34 #define UNKNOWN_PAYLOAD_HEADER_LENGTH 4
35
36
37 typedef struct unknown_payload_t unknown_payload_t;
38
39 /**
40 * @brief Payload which can't be processed further.
41 *
42 * When the parser finds an unknown payload, he builds an instance of
43 * this class. This allows further processing of this payload, such as
44 * a check for the critical bit in the header.
45 *
46 * @b Constructors:
47 * - unknown_payload_create()
48 *
49 * @ingroup payloads
50 */
51 struct unknown_payload_t {
52
53 /**
54 * The payload_t interface.
55 */
56 payload_t payload_interface;
57
58 /**
59 * @brief Get the raw data of this payload, without
60 * the generic payload header.
61 *
62 * Returned data are NOT copied and must not be freed.
63 *
64 * @param this calling unknown_payload_t object
65 * @return data as chunk_t
66 */
67 chunk_t (*get_data) (unknown_payload_t *this);
68
69 /**
70 * @brief Get the critical flag.
71 *
72 * @param this calling unknown_payload_t object
73 * @return TRUE if payload is critical, FALSE if not
74 */
75 bool (*is_critical) (unknown_payload_t *this);
76
77 /**
78 * @brief Destroys an unknown_payload_t object.
79 *
80 * @param this unknown_payload_t object to destroy
81 */
82 void (*destroy) (unknown_payload_t *this);
83 };
84
85 /**
86 * @brief Creates an empty unknown_payload_t object.
87 *
88 * @return unknown_payload_t object
89 *
90 * @ingroup payloads
91 */
92 unknown_payload_t *unknown_payload_create();
93
94
95 #endif /* UNKNOWN_PAYLOAD_H_ */