1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
/*
* Copyright (C) 2011-2017 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup ietf_attr_pa_tnc_errort ietf_attr_pa_tnc_error
* @{ @ingroup ietf_attr
*/
#ifndef IETF_ATTR_PA_TNC_ERROR_H_
#define IETF_ATTR_PA_TNC_ERROR_H_
typedef struct ietf_attr_pa_tnc_error_t ietf_attr_pa_tnc_error_t;
typedef enum pa_tnc_error_code_t pa_tnc_error_code_t;
#include "ietf_attr.h"
#include "pa_tnc/pa_tnc_attr.h"
/**
* IETF Standard PA-TNC Error Codes as defined in section 4.2.8 of RFC 5792
*/
enum pa_tnc_error_code_t {
/* RFC 5792 PA-TNC */
PA_ERROR_RESERVED = 0,
PA_ERROR_INVALID_PARAMETER = 1,
PA_ERROR_VERSION_NOT_SUPPORTED = 2,
PA_ERROR_ATTR_TYPE_NOT_SUPPORTED = 3,
PA_ERROR_PA_TNC_MSG_ROOF = 3,
/* draft-ietf-sacm-nea-swid-patnc (SWIMA) */
PA_ERROR_SW = 32,
PA_ERROR_SW_SUBSCRIPTION_DENIED = 33,
PA_ERROR_SW_RESPONSE_TOO_LARGE = 34,
PA_ERROR_SW_SUBSCRIPTION_FULFILLMENT = 35,
PA_ERROR_SW_SUBSCRIPTION_ID_REUSE = 36
};
/**
* enum name for pa_tnc_error_code_t.
*/
extern enum_name_t *pa_tnc_error_code_names;
/**
* Class implementing the IETF PA-TNC Error attribute.
*
*/
struct ietf_attr_pa_tnc_error_t {
/**
* Public PA-TNC attribute interface
*/
pa_tnc_attr_t pa_tnc_attribute;
/**
* Get Vendor-specific PA-TNC error code
*
* @return error code
*/
pen_type_t (*get_error_code)(ietf_attr_pa_tnc_error_t *this);
/**
* Get first 8 bytes of erroneous PA-TNC message
*
* @return PA-TNC message info
*/
chunk_t (*get_msg_info)(ietf_attr_pa_tnc_error_t *this);
/**
* Get flags, vendor ID and type of unsupported PA-TNC attribute
*
* @param flags PA-TNC attribute flags
* @return PA-TNC attribute vendor ID and type
*/
pen_type_t (*get_unsupported_attr)(ietf_attr_pa_tnc_error_t *this,
uint8_t *flags);
/**
* Set flags, vendor ID and type of unsupported PA-TNC attribute
*
* @param flags PA-TNC attribute flags
* @param attr_info PA-TNC attribute vendor ID and type
*/
void (*set_unsupported_attr)(ietf_attr_pa_tnc_error_t *this, uint8_t flags,
pen_type_t type);
/**
* Get the PA-TNC error offset
*
* @return PA-TNC error offset
*/
uint32_t (*get_offset)(ietf_attr_pa_tnc_error_t *this);
};
/**
* Creates an ietf_attr_pa_tnc_error_t object from an error code
*
* @param error_code Vendor-specific PA-TNC error code
* @param header PA-TNC message header (first 8 bytes)
*
*/
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create(pen_type_t error_code,
chunk_t header);
/**
* Creates an ietf_attr_pa_tnc_error_t object from an error code with offset
*
* @param error_code Vendor-specifica PA-TNC error code
* @param header PA-TNC message header (first 8 bytes)
* @param error_offset PA-TNC error offset in bytes
*
*/
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_with_offset(pen_type_t error_code,
chunk_t header,
uint32_t error_offset);
/**
* Creates an ietf_attr_pa_tnc_error_t object from received data
*
* @param length Total length of attribute value
* @param value Unparsed attribute value (might be a segment)
*/
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_from_data(size_t length,
chunk_t value);
#endif /** IETF_ATTR_PA_TNC_ERROR_H_ @}*/
|