Annotation of embedaddon/strongswan/src/libimcv/ietf/ietf_attr_pa_tnc_error.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2011-2018 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
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: * IETF Standard PA-TNC Error Codes
32: */
33: enum pa_tnc_error_code_t {
34:
35: /* RFC 5792 PA-TNC */
36: PA_ERROR_RESERVED = 0,
37: PA_ERROR_INVALID_PARAMETER = 1,
38: PA_ERROR_VERSION_NOT_SUPPORTED = 2,
39: PA_ERROR_ATTR_TYPE_NOT_SUPPORTED = 3,
40: PA_ERROR_PA_TNC_MSG_ROOF = 3,
41:
42: /* RFC 8412 SWIMA */
43: PA_ERROR_SWIMA = 4,
44: PA_ERROR_SWIMA_SUBSCRIPTION_DENIED = 5,
45: PA_ERROR_SWIMA_RESPONSE_TOO_LARGE = 6,
46: PA_ERROR_SWIMA_SUBSCRIPTION_FULFILLMENT = 7,
47: PA_ERROR_SWIMA_SUBSCRIPTION_ID_REUSE = 8
48: };
49:
50: /**
51: * enum name for pa_tnc_error_code_t.
52: */
53: extern enum_name_t *pa_tnc_error_code_names;
54:
55: /**
56: * Class implementing the IETF PA-TNC Error attribute.
57: *
58: */
59: struct ietf_attr_pa_tnc_error_t {
60:
61: /**
62: * Public PA-TNC attribute interface
63: */
64: pa_tnc_attr_t pa_tnc_attribute;
65:
66: /**
67: * Get Vendor-specific PA-TNC error code
68: *
69: * @return error code
70: */
71: pen_type_t (*get_error_code)(ietf_attr_pa_tnc_error_t *this);
72:
73: /**
74: * Get first 8 bytes of erroneous PA-TNC message
75: *
76: * @return PA-TNC message info
77: */
78: chunk_t (*get_msg_info)(ietf_attr_pa_tnc_error_t *this);
79:
80: /**
81: * Get flags, vendor ID and type of unsupported PA-TNC attribute
82: *
83: * @param flags PA-TNC attribute flags
84: * @return PA-TNC attribute vendor ID and type
85: */
86: pen_type_t (*get_unsupported_attr)(ietf_attr_pa_tnc_error_t *this,
87: uint8_t *flags);
88:
89: /**
90: * Set flags, vendor ID and type of unsupported PA-TNC attribute
91: *
92: * @param flags PA-TNC attribute flags
93: * @param attr_info PA-TNC attribute vendor ID and type
94: */
95: void (*set_unsupported_attr)(ietf_attr_pa_tnc_error_t *this, uint8_t flags,
96: pen_type_t type);
97:
98: /**
99: * Get the PA-TNC error offset
100: *
101: * @return PA-TNC error offset
102: */
103: uint32_t (*get_offset)(ietf_attr_pa_tnc_error_t *this);
104:
105: };
106:
107: /**
108: * Creates an ietf_attr_pa_tnc_error_t object from an error code
109: *
110: * @param error_code Vendor-specific PA-TNC error code
111: * @param header PA-TNC message header (first 8 bytes)
112: *
113: */
114: pa_tnc_attr_t* ietf_attr_pa_tnc_error_create(pen_type_t error_code,
115: chunk_t header);
116:
117: /**
118: * Creates an ietf_attr_pa_tnc_error_t object from an error code with offset
119: *
120: * @param error_code Vendor-specific PA-TNC error code
121: * @param header PA-TNC message header (first 8 bytes)
122: * @param error_offset PA-TNC error offset in bytes
123: *
124: */
125: pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_with_offset(pen_type_t error_code,
126: chunk_t header,
127: uint32_t error_offset);
128:
129: /**
130: * Creates an ietf_attr_pa_tnc_error_t object from received data
131: *
132: * @param length Total length of attribute value
133: * @param value Unparsed attribute value (might be a segment)
134: */
135: pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_from_data(size_t length,
136: chunk_t value);
137:
138: #endif /** IETF_ATTR_PA_TNC_ERROR_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>