libimcv: Implemented IETF SW PA-TNC attributes
[strongswan.git] / src / libimcv / ietf / swima / ietf_swima_attr_req.h
1 /*
2 * Copyright (C) 2017 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_swima_attr_req ietf_swima_attr_req
18 * @{ @ingroup ietf_attr
19 */
20
21 #ifndef IETF_SWIMA_ATTR_REQ_H_
22 #define IETF_SWIMA_ATTR_REQ_H_
23
24 #define IETF_SWIMA_REQ_MIN_SIZE 12
25
26 typedef struct ietf_swima_attr_req_t ietf_swima_attr_req_t;
27 typedef enum ietf_swima_attr_req_flag_t ietf_swima_attr_req_flag_t;
28
29 enum ietf_swima_attr_req_flag_t {
30 IETF_SWIMA_ATTR_REQ_FLAG_NONE = 0,
31 IETF_SWIMA_ATTR_REQ_FLAG_C = (1 << 7),
32 IETF_SWIMA_ATTR_REQ_FLAG_S = (1 << 6),
33 IETF_SWIMA_ATTR_REQ_FLAG_R = (1 << 5)
34 };
35
36 #include "swima/swima_inventory.h"
37 #include "ietf/ietf_attr.h"
38 #include "pa_tnc/pa_tnc_attr.h"
39
40 /**
41 * Class implementing the IETF SW Request attribute
42 */
43 struct ietf_swima_attr_req_t {
44
45 /**
46 * Public PA-TNC attribute interface
47 */
48 pa_tnc_attr_t pa_tnc_attribute;
49
50 /**
51 * Get SW request flags
52 *
53 * @return Flags
54 */
55 uint8_t (*get_flags)(ietf_swima_attr_req_t *this);
56
57 /**
58 * Get Request ID
59 *
60 * @return Request ID
61 */
62 uint32_t (*get_request_id)(ietf_swima_attr_req_t *this);
63
64 /**
65 * Set Software Identity targets
66 *
67 * @param targets SW ID inventory containing targets (not cloned)
68 */
69 void (*set_targets)(ietf_swima_attr_req_t *this, swima_inventory_t *targets);
70
71 /**
72 * Get Software Identity targets
73 *
74 * @return SW ID inventory containing targets
75 */
76 swima_inventory_t* (*get_targets)(ietf_swima_attr_req_t *this);
77
78 };
79
80 /**
81 * Creates an ietf_swima_attr_req_t object
82 *
83 * @param flags Sets the C|S|R flags
84 * @param request_id Request ID
85 */
86 pa_tnc_attr_t* ietf_swima_attr_req_create(uint8_t flags, uint32_t request_id);
87
88 /**
89 * Creates an ietf_swima_attr_req_t object from received data
90 *
91 * @param length Total length of attribute value
92 * @param value Unparsed attribute value (might be a segment)
93 */
94 pa_tnc_attr_t* ietf_swima_attr_req_create_from_data(size_t length, chunk_t value);
95
96 #endif /** IETF_SWIMA_ATTR_REQ_H_ @}*/