144b890ba406a80089e3c806922185e059b01c96
[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
21 ENUM(ietf_attr_names, IETF_ATTR_TESTING, IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED,
22 "Testing",
23 "Attribute Request",
24 "Product Information",
25 "Numeric Version",
26 "String Version",
27 "Operational Status",
28 "Port Filter",
29 "Installed Packages",
30 "PA-TNC Error",
31 "Assessment Result",
32 "Remediation Instructions",
33 "Forwarding Enabled",
34 "Factory Default Password Enabled",
35 );
36
37 /**
38 * See header
39 */
40 pa_tnc_attr_t* ietf_attr_create_from_data(u_int32_t type, chunk_t value)
41 {
42 switch (type)
43 {
44 case IETF_ATTR_ATTRIBUTE_REQUEST:
45 return ietf_attr_attr_request_create_from_data(value);
46 case IETF_ATTR_PRODUCT_INFORMATION:
47 return ietf_attr_product_info_create_from_data(value);
48 case IETF_ATTR_PORT_FILTER:
49 return ietf_attr_port_filter_create_from_data(value);
50 case IETF_ATTR_PA_TNC_ERROR:
51 return ietf_attr_pa_tnc_error_create_from_data(value);
52 case IETF_ATTR_TESTING:
53 case IETF_ATTR_NUMERIC_VERSION:
54 case IETF_ATTR_STRING_VERSION:
55 case IETF_ATTR_OPERATIONAL_STATUS:
56 case IETF_ATTR_INSTALLED_PACKAGES:
57 case IETF_ATTR_ASSESSMENT_RESULT:
58 case IETF_ATTR_REMEDIATION_INSTRUCTIONS:
59 case IETF_ATTR_FORWARDING_ENABLED:
60 case IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED:
61 case IETF_ATTR_RESERVED:
62 default:
63 return NULL;
64 }
65 }