b6a7d911ea2c438737a898db4d15afb6a3b6edea
[strongswan.git] / src / libcharon / plugins / tnccs_20 / messages / pb_error_message.h
1 /*
2 * Copyright (C) 2010 Sansar Choinyambuu
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup pb_error_message pb_error_message
18 * @{ @ingroup tnccs_20
19 */
20
21 #ifndef PB_ERROR_MESSAGE_H_
22 #define PB_ERROR_MESSAGE_H_
23
24 #include "pb_tnc_message.h"
25
26 typedef struct pb_error_message_t pb_error_message_t;
27
28 /**
29 * Classs representing the PB-Error message type.
30 */
31 struct pb_error_message_t {
32
33 /**
34 * PB-TNC Message interface
35 */
36 pb_tnc_message_t pb_interface;
37
38 /**
39 * Get PB Error code Vendor ID
40 *
41 * @return PB Error code Vendor ID
42 */
43 u_int32_t (*get_vendor_id)(pb_error_message_t *this);
44
45 /**
46 * Get PB Error Code
47 *
48 * @return PB Error Code
49 */
50 u_int16_t (*get_error_code)(pb_error_message_t *this);
51
52 /**
53 * Get the PB Error Parameters
54 *
55 * @return PB Error Parameter
56 */
57 u_int32_t (*get_parameters)(pb_error_message_t *this);
58
59 /**
60 * Get the fatal flag
61 *
62 * @return fatal flag
63 */
64 bool (*get_fatal_flag)(pb_error_message_t *this);
65
66 /**
67 * Set the fatal flag
68 *
69 * @param excl fatal flag
70 */
71 void (*set_fatal_flag)(pb_error_message_t *this, bool is_fatal);
72 };
73
74 /**
75 * Create a PB-Error message from parameters
76 *
77 * @param vendor_id Error Code Vendor ID
78 * @param error_code Error Code
79 */
80 pb_tnc_message_t* pb_error_message_create(u_int32_t vendor_id,
81 pb_tnc_error_code_t error_code);
82 /**
83 * Create a PB-Error message from parameters
84 *
85 * @param vendor_id Error Code Vendor ID
86 * @param error_code Error Code
87 * @param error_parameters Error parameters
88 */
89 pb_tnc_message_t* pb_error_message_create_with_parameter(u_int32_t vendor_id,
90 pb_tnc_error_code_t error_code,
91 u_int32_t error_parameters);
92 /**
93 * Create an unprocessed PB-Error message from raw data
94 *
95 * @param data PB-Error message data
96 */
97 pb_tnc_message_t* pb_error_message_create_from_data(chunk_t data);
98
99 #endif /** PB_PA_MESSAGE_H_ @}*/