blob: d28c524aa9b06a1cc02a020873160d9e226d88c5 (
plain)
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
|
/*
* Copyright (C) 2011-2012 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_pa_tnc_error
*/
#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 {
PA_ERROR_RESERVED = 0,
PA_ERROR_INVALID_PARAMETER = 1,
PA_ERROR_VERSION_NOT_SUPPORTED = 2,
PA_ERROR_ATTR_TYPE_NOT_SUPPORTED = 3,
};
/**
* 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 PA-TNC error code vendor ID
*
* @return error code vendor ID
*/
pen_t (*get_vendor_id)(ietf_attr_pa_tnc_error_t *this);
/**
* 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 first 8 bytes of unsupported PA-TNC attribute
*
* @return PA-TNC attribute info
*/
chunk_t (*get_attr_info)(ietf_attr_pa_tnc_error_t *this);
/**
* Set first 8 bytes of unsupported PA-TNC attribute
*
* @param attr_info PA-TNC message info
*/
void (*set_attr_info)(ietf_attr_pa_tnc_error_t *this, chunk_t attr_info);
/**
* Get the PA-TNC error offset
*
* @return PA-TNC error offset
*/
u_int32_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,
u_int32_t error_offset);
/**
* Creates an ietf_attr_pa_tnc_error_t object from received data
*
* @param value unparsed attribute value
*/
pa_tnc_attr_t* ietf_attr_pa_tnc_error_create_from_data(chunk_t value);
#endif /** IETF_ATTR_PA_TNC_ERROR_H_ @}*/
|