Version bump to 5.9.3dr1
[strongswan.git] / src / libimcv / pa_tnc / pa_tnc_attr.h
1 /*
2 * Copyright (C) 2011-2014 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 pa_tnc
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 #define PA_TNC_ATTR_INFO_SIZE 8
30 #define PA_TNC_ATTR_HEADER_SIZE 12
31
32 #define PA_TNC_ATTR_FLAG_NONE 0x00
33 #define PA_TNC_ATTR_FLAG_NOSKIP (1<<7)
34
35 /**
36 * Interface for an RFC 5792 PA-TNC Posture Attribute.
37 *
38 */
39 struct pa_tnc_attr_t {
40
41 /**
42 * Get the vendor ID/type of an PA-TNC attribute
43 *
44 * @return vendor-specific attribute type
45 */
46 pen_type_t (*get_type)(pa_tnc_attr_t *this);
47
48 /**
49 * Get the value of an PA-TNC attribute
50 *
51 * @return attribute value
52 */
53 chunk_t (*get_value)(pa_tnc_attr_t *this);
54
55 /**
56 * Get the noskip flag
57 *
58 * @return TRUE if the noskip flag is set
59 */
60 bool (*get_noskip_flag)(pa_tnc_attr_t *this);
61
62 /**
63 * Set the noskip flag
64 *
65 * @param noskip_flag TRUE if the noskip flag is to be set
66 */
67 void (*set_noskip_flag)(pa_tnc_attr_t *this, bool noskip);
68
69 /**
70 * Build value of an PA-TNC attribute from its parameters
71 */
72 void (*build)(pa_tnc_attr_t *this);
73
74 /**
75 * Process the value of an PA-TNC attribute to extract its parameters
76 *
77 * @param offset relative error offset within attribute body
78 * @return result status
79 */
80 status_t (*process)(pa_tnc_attr_t *this, uint32_t *offset);
81
82 /**
83 * Add a data segment to an attribute allowing incremental processing
84 *
85 * @param segment data segment to be appended
86 */
87 void (*add_segment)(pa_tnc_attr_t *this, chunk_t segment);
88
89 /**
90 * Get a new reference to the PA-TNC attribute
91 *
92 * @return this, with an increased refcount
93 */
94 pa_tnc_attr_t* (*get_ref)(pa_tnc_attr_t *this);
95
96 /**
97 * Destroys a pa_tnc_attr_t object.
98 */
99 void (*destroy)(pa_tnc_attr_t *this);
100 };
101
102 #endif /** PA_TNC_ATTR_H_ @}*/