]>
Commit | Line | Data |
---|---|---|
34852cae JH |
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 | /** | |
668f9fcb | 30 | * Header length of the unknown payload. |
34852cae JH |
31 | * |
32 | * @ingroup payloads | |
33 | */ | |
668f9fcb | 34 | #define UNKNOWN_PAYLOAD_HEADER_LENGTH 4 |
34852cae JH |
35 | |
36 | ||
37 | typedef struct unknown_payload_t unknown_payload_t; | |
38 | ||
39 | /** | |
668f9fcb | 40 | * @brief Payload which can't be processed further. |
34852cae | 41 | * |
668f9fcb MW |
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() | |
34852cae | 48 | * |
668f9fcb | 49 | * @ingroup payloads |
34852cae JH |
50 | */ |
51 | struct unknown_payload_t { | |
668f9fcb | 52 | |
34852cae JH |
53 | /** |
54 | * The payload_t interface. | |
55 | */ | |
56 | payload_t payload_interface; | |
57 | ||
58 | /** | |
668f9fcb MW |
59 | * @brief Get the raw data of this payload, without |
60 | * the generic payload header. | |
34852cae | 61 | * |
668f9fcb | 62 | * Returned data are NOT copied and must not be freed. |
34852cae JH |
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); | |
34852cae JH |
68 | |
69 | /** | |
668f9fcb | 70 | * @brief Get the critical flag. |
34852cae | 71 | * |
668f9fcb MW |
72 | * @param this calling unknown_payload_t object |
73 | * @return TRUE if payload is critical, FALSE if not | |
34852cae | 74 | */ |
668f9fcb | 75 | bool (*is_critical) (unknown_payload_t *this); |
34852cae JH |
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 created unknown_payload_t object | |
89 | * | |
90 | * @ingroup payloads | |
91 | */ | |
92 | unknown_payload_t *unknown_payload_create(); | |
93 | ||
94 | ||
95 | #endif //_UNKNOWN_PAYLOAD_H_ |