created libpts
[strongswan.git] / src / libimcv / pa_tnc / pa_tnc_attr.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 pa_tnc_attr pa_tnc_attr
18 * @{ @ingroup libimcv
19 */
20
21 #ifndef PA_TNC_ATTR_H_
22 #define PA_TNC_ATTR_H_
23
24 typedef struct pa_tnc_attr_t pa_tnc_attr_t;
25
26 #include <library.h>
27 #include <pen/pen.h>
28
29 /**
30 * Return the PA-TNC attribute names for a given PEN
31 *
32 * @param pen Private Enterprise Number (PEN)
33 * @return pa_attr_names if found, NULL else
34 */
35 extern enum_name_t *get_pa_attr_names(pen_t pen);
36
37 /**
38 * Interface for an RFC 5792 PA-TNC Posture Attribute.
39 *
40 */
41 struct pa_tnc_attr_t {
42
43 /**
44 * Get the vendor ID of an PA-TNC attribute
45 *
46 * @return attribute vendor ID
47 */
48 u_int32_t (*get_vendor_id)(pa_tnc_attr_t *this);
49
50 /**
51 * Get the type of an PA-TNC attribute
52 *
53 * @return attribute type
54 */
55 u_int32_t (*get_type)(pa_tnc_attr_t *this);
56
57 /**
58 * Get the value of an PA-TNC attribute
59 *
60 * @return attribute value
61 */
62 chunk_t (*get_value)(pa_tnc_attr_t *this);
63
64 /**
65 * Get the noskip flag
66 *
67 * @return TRUE if the noskip flag is set
68 */
69 bool (*get_noskip_flag)(pa_tnc_attr_t *this);
70
71 /**
72 * Set the noskip flag
73 *
74 * @param noskip_flag TRUE if the noskip flag is to be set
75 */
76 void (*set_noskip_flag)(pa_tnc_attr_t *this, bool noskip);
77
78 /**
79 * Build value of an PA-TNC attribute from its parameters
80 */
81 void (*build)(pa_tnc_attr_t *this);
82
83 /**
84 * Process the value of an PA-TNC attribute to extract its parameters
85 *
86 * @param relative error offset within attribute body
87 * @return result status
88 */
89 status_t (*process)(pa_tnc_attr_t *this, u_int32_t *offset);
90
91 /**
92 * Get a new reference to the PA-TNC attribute
93 *
94 * @return this, with an increased refcount
95 */
96 pa_tnc_attr_t* (*get_ref)(pa_tnc_attr_t *this);
97
98 /**
99 * Destroys a pa_tnc_attr_t object.
100 */
101 void (*destroy)(pa_tnc_attr_t *this);
102 };
103
104 /**
105 * Create a PA-TNC attribute from data
106 *
107 * @param vendor_id attribute vendor ID
108 * @param type attribute type
109 * @param value attribute value
110 *
111 */
112 pa_tnc_attr_t* pa_tnc_attr_create_from_data(pen_t vendor_id, u_int32_t type,
113 chunk_t value);
114
115 #endif /** PA_TNC_ATTR_H_ @}*/