7f0e0a90a8e1d6b37e3d4d7c8fc1c79a1a681b3b
[strongswan.git] / src / libimcv / ietf / ietf_attr_pa_tnc_error.h
1 /*
2 * Copyright (C) 2011 Andreas Steffen
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 ietf_attr_pa_tnc_errort ietf_attr_pa_tnc_error
18 * @{ @ingroup ietf_attr_pa_tnc_error
19 */
20
21 #ifndef IETF_ATTR_PA_TNC_ERROR_H_
22 #define IETF_ATTR_PA_TNC_ERROR_H_
23
24 typedef struct ietf_attr_pa_tnc_error_t ietf_attr_pa_tnc_error_t;
25 typedef enum pa_tnc_error_code_t pa_tnc_error_code_t;
26
27 #include "ietf_attr.h"
28 #include "pa_tnc/pa_tnc_attr.h"
29
30
31 /**
32 * IETF Standard PA-TNC Error Codes as defined in section 4.2.8 of RFC 5792
33 */
34 enum pa_tnc_error_code_t {
35 PA_ERROR_RESERVED = 0,
36 PA_ERROR_INVALID_PARAMETER = 1,
37 PA_ERROR_VERSION_NOT_SUPPORTED = 2,
38 PA_ERROR_ATTR_TYPE_NOT_SUPPORTED = 3,
39 };
40
41 /**
42 * enum name for pa_tnc_error_code_t.
43 */
44 extern enum_name_t *pa_tnc_error_code_names;
45
46 /**
47 * Class implementing the IETF PA-TNC Error attribute.
48 *
49 */
50 struct ietf_attr_pa_tnc_error_t {
51
52 /**
53 * Public PA-TNC attribute interface
54 */
55 pa_tnc_attr_t pa_tnc_attribute;
56
57 /**
58 * Get PA-TNC error code vendor ID
59 *
60 * @return error code vendor ID
61 */
62 pen_t (*get_vendor_id)(ietf_attr_pa_tnc_error_t *this);
63
64 /**
65 * Get PA-TNC error code
66 *
67 * @return error code
68 */
69 pa_tnc_error_code_t (*get_error_code)(ietf_attr_pa_tnc_error_t *this);
70
71 /**
72 * Get first 8 bytes of erroneous PA-TNC message
73 *
74 * @return PA-TNC message info
75 */
76 chunk_t (*get_msg_info)(ietf_attr_pa_tnc_error_t *this);
77
78 /**
79 * Get first 8 bytes of unsupported PA-TNC attribute
80 *
81 * @return PA-TNC attribute info
82 */
83 chunk_t (*get_attr_info)(ietf_attr_pa_tnc_error_t *this);
84
85 /**
86 * Set first 8 bytes of unsupported PA-TNC attribute
87 *
88 * @param attr_info PA-TNC message info
89 */
90 void (*set_attr_info)(ietf_attr_pa_tnc_error_t *this, chunk_t attr_info);
91 };
92
93 /**
94 * Creates an ietf_attr_pa_tnc_error_t object from an error code
95 *
96 * @param vendor_id PA-TNC error code vendor ID
97 * @param error_code PA-TNC error code
98 * @param header PA-TNC message header (first 8 bytes)
99 *
100 */
101 pa_tnc_attr_t* ietf_attr_pa_tnc_error_create(pen_t vendor_id,
102 u_int32_t error_code,
103 chunk_t header);
104
105 /**
106 * Creates an ietf_attr_pa_tnc_error_t object from received data
107 *
108 * @param value unparsed attribute value
109 */
110 pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_from_data(chunk_t value);
111
112 #endif /** IETF_ATTR_PA_TNC_ERROR_H_ @}*/