8aa05c186e27322d060b034a219056e97ff38687
[strongswan.git] / src / libimcv / ietf / ietf_attr.c
1 /*
2 * Copyright (C) 2011-2012 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 #include "ietf_attr.h"
17 #include "ietf/ietf_attr_assess_result.h"
18 #include "ietf/ietf_attr_attr_request.h"
19 #include "ietf/ietf_attr_fwd_enabled.h"
20 #include "ietf/ietf_attr_default_pwd_enabled.h"
21 #include "ietf/ietf_attr_installed_packages.h"
22 #include "ietf/ietf_attr_pa_tnc_error.h"
23 #include "ietf/ietf_attr_port_filter.h"
24 #include "ietf/ietf_attr_product_info.h"
25 #include "ietf/ietf_attr_string_version.h"
26
27
28 ENUM(ietf_attr_names, IETF_ATTR_TESTING, IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED,
29 "Testing",
30 "Attribute Request",
31 "Product Information",
32 "Numeric Version",
33 "String Version",
34 "Operational Status",
35 "Port Filter",
36 "Installed Packages",
37 "PA-TNC Error",
38 "Assessment Result",
39 "Remediation Instructions",
40 "Forwarding Enabled",
41 "Factory Default Password Enabled",
42 );
43
44 /**
45 * See header
46 */
47 pa_tnc_attr_t* ietf_attr_create_from_data(u_int32_t type, chunk_t value)
48 {
49 switch (type)
50 {
51 case IETF_ATTR_ATTRIBUTE_REQUEST:
52 return ietf_attr_attr_request_create_from_data(value);
53 case IETF_ATTR_PRODUCT_INFORMATION:
54 return ietf_attr_product_info_create_from_data(value);
55 case IETF_ATTR_STRING_VERSION:
56 return ietf_attr_string_version_create_from_data(value);
57 case IETF_ATTR_PORT_FILTER:
58 return ietf_attr_port_filter_create_from_data(value);
59 case IETF_ATTR_INSTALLED_PACKAGES:
60 return ietf_attr_installed_packages_create_from_data(value);
61 case IETF_ATTR_PA_TNC_ERROR:
62 return ietf_attr_pa_tnc_error_create_from_data(value);
63 case IETF_ATTR_ASSESSMENT_RESULT:
64 return ietf_attr_assess_result_create_from_data(value);
65 case IETF_ATTR_FORWARDING_ENABLED:
66 return ietf_attr_fwd_enabled_create_from_data(value);
67 case IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED:
68 return ietf_attr_default_pwd_enabled_create_from_data(value);
69 case IETF_ATTR_TESTING:
70 case IETF_ATTR_NUMERIC_VERSION:
71 case IETF_ATTR_OPERATIONAL_STATUS:
72 case IETF_ATTR_REMEDIATION_INSTRUCTIONS:
73 case IETF_ATTR_RESERVED:
74 default:
75 return NULL;
76 }
77 }