introduced sending of standard IETF Assessment Result PA-TNC attribute by IMVs
[strongswan.git] / src / libimcv / ietf / ietf_attr.c
1 /*
2 * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15 #include "ietf_attr.h"
16 #include "ietf/ietf_attr_pa_tnc_error.h"
17 #include "ietf/ietf_attr_port_filter.h"
18 #include "ietf/ietf_attr_product_info.h"
19 #include "ietf/ietf_attr_attr_request.h"
20 #include "ietf/ietf_attr_assess_result.h"
21
22 ENUM(ietf_attr_names, IETF_ATTR_TESTING, IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED,
23 "Testing",
24 "Attribute Request",
25 "Product Information",
26 "Numeric Version",
27 "String Version",
28 "Operational Status",
29 "Port Filter",
30 "Installed Packages",
31 "PA-TNC Error",
32 "Assessment Result",
33 "Remediation Instructions",
34 "Forwarding Enabled",
35 "Factory Default Password Enabled",
36 );
37
38 /**
39 * See header
40 */
41 pa_tnc_attr_t* ietf_attr_create_from_data(u_int32_t type, chunk_t value)
42 {
43 switch (type)
44 {
45 case IETF_ATTR_ATTRIBUTE_REQUEST:
46 return ietf_attr_attr_request_create_from_data(value);
47 case IETF_ATTR_PRODUCT_INFORMATION:
48 return ietf_attr_product_info_create_from_data(value);
49 case IETF_ATTR_PORT_FILTER:
50 return ietf_attr_port_filter_create_from_data(value);
51 case IETF_ATTR_PA_TNC_ERROR:
52 return ietf_attr_pa_tnc_error_create_from_data(value);
53 case IETF_ATTR_ASSESSMENT_RESULT:
54 return ietf_attr_assess_result_create_from_data(value);
55 case IETF_ATTR_TESTING:
56 case IETF_ATTR_NUMERIC_VERSION:
57 case IETF_ATTR_STRING_VERSION:
58 case IETF_ATTR_OPERATIONAL_STATUS:
59 case IETF_ATTR_INSTALLED_PACKAGES:
60 case IETF_ATTR_REMEDIATION_INSTRUCTIONS:
61 case IETF_ATTR_FORWARDING_ENABLED:
62 case IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED:
63 case IETF_ATTR_RESERVED:
64 default:
65 return NULL;
66 }
67 }