Completed implementation of PWG HCD attributes
[strongswan.git] / src / libimcv / generic / generic_attr_string.h
1 /*
2 * Copyright (C) 2015 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 generic_attr_string generic_attr_string
18 * @{ @ingroup generic_attr
19 */
20
21 #ifndef GENERIC_ATTR_STRING_H_
22 #define GENERIC_ATTR_STRING_H_
23
24 typedef struct generic_attr_string_t generic_attr_string_t;
25
26 #include <pen/pen.h>
27 #include "pa_tnc/pa_tnc_attr.h"
28
29 /**
30 * Class implementing a generic PA-TNC attribute containing a non-nul
31 * terminated printable string
32 */
33 struct generic_attr_string_t {
34
35 /**
36 * Public PA-TNC attribute interface
37 */
38 pa_tnc_attr_t pa_tnc_attribute;
39 };
40
41 /**
42 * Creates a generic_attr_string_t object
43 *
44 * @param string Non-nul terminated string
45 * @param type Vendor ID / Attribute Type
46 */
47 pa_tnc_attr_t* generic_attr_string_create(chunk_t string, pen_type_t type);
48
49 /**
50 * Creates an generic_attr_string_t object from received data
51 *
52 * @param length Total length of attribute value
53 * @param value Unparsed attribute value (might be a segment)
54 * @param type Vendor ID / Attribute Type
55 */
56 pa_tnc_attr_t* generic_attr_string_create_from_data(size_t length,
57 chunk_t value, pen_type_t type);
58
59 #endif /** GENERIC_ATTR_STRING_H_ @}*/