implemented the RFC 5792 PA-TNC protocol and an example IMC/IMV pair
[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
26 #include "ietf_attr.h"
27 #include "pa_tnc/pa_tnc_attr.h"
28
29
30 /**
31 * IETF Standard PA-TNC Error Codes as defined in section 4.2.8 of RFC 5792
32 */
33 enum pa_tnc_error_code_t {
34 PA_ERROR_RESERVED = 0,
35 PA_ERROR_INVALID_PARAMETER = 1,
36 PA_ERROR_VERSION_NOT_SUPPORTED = 2,
37 PA_ERROR_ATTR_TYPE_NOT_SUPPORTED = 3,
38 };
39
40 /**
41 * enum name for pa_tnc_error_code_t.
42 */
43 extern enum_name_t *pa_tnc_error_code_names;
44
45 /**
46 * Class implementing the IETF PA-TNC Error attribute.
47 *
48 */
49 struct ietf_attr_pa_tnc_error_t {
50
51 /**
52 * Public PA-TNC attribute interface
53 */
54 pa_tnc_attr_t pa_tnc_attribute;
55
56 /**
57 * Get PA-TNC error code vendor ID
58 *
59 * @return error code vendor ID
60 */
61 pen_t (*get_vendor_id)(ietf_attr_pa_tnc_error_t *this);
62
63 /**
64 * Get PA-TNC error code
65 *
66 * @return error code
67 */
68 pen_t (*get_error_code)(ietf_attr_pa_tnc_error_t *this);
69 };
70
71 /**
72 * Creates an ietf_attr_pa_tnc_error_t object from an error code
73 *
74 * @param vendor_id PA-TNC error code vendor ID
75 * @param error_code PA-TNC error code
76 *
77 */
78 pa_tnc_attr_t* ietf_attr_pa_tnc_error_create(pen_t vendor_id,
79 u_int32_t error_code);
80
81 /**
82 * Creates an ietf_attr_pa_tnc_error_t object from received data
83 *
84 * @param value unparsed attribute value
85 */
86 pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_from_data(chunk_t value);
87
88 #endif /** IETF_ATTR_PA_TNC_ERROR_H_ @}*/