Annotation of embedaddon/strongswan/src/libimcv/ietf/ietf_attr.c, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2011-2018 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_installed_packages.h"
21: #include "ietf/ietf_attr_numeric_version.h"
22: #include "ietf/ietf_attr_op_status.h"
23: #include "ietf/ietf_attr_pa_tnc_error.h"
24: #include "ietf/ietf_attr_port_filter.h"
25: #include "ietf/ietf_attr_product_info.h"
26: #include "ietf/ietf_attr_remediation_instr.h"
27: #include "ietf/ietf_attr_string_version.h"
28: #include "ietf/swima/ietf_swima_attr_req.h"
29: #include "ietf/swima/ietf_swima_attr_sw_inv.h"
30: #include "ietf/swima/ietf_swima_attr_sw_ev.h"
31: #include "generic/generic_attr_bool.h"
32:
33: ENUM(ietf_attr_names, IETF_ATTR_TESTING, IETF_ATTR_SRC_METADATA_RESP,
34: "Testing",
35: "Attribute Request",
36: "Product Information",
37: "Numeric Version",
38: "String Version",
39: "Operational Status",
40: "Port Filter",
41: "Installed Packages",
42: "PA-TNC Error",
43: "Assessment Result",
44: "Remediation Instructions",
45: "Forwarding Enabled",
46: "Factory Default Password Enabled",
47: "SWIMA Request",
48: "SW Identifier Inventory",
49: "SW Identifier Events",
50: "SW Inventory",
51: "SW Events",
52: "SW Subscription Status Request",
53: "SW Subscription Status Response",
54: "SW Source Metadata Request",
55: "SW Source Metadata Response",
56: );
57:
58: /**
59: * See header
60: */
61: pa_tnc_attr_t* ietf_attr_create_from_data(uint32_t type, size_t length,
62: chunk_t value)
63: {
64: switch (type)
65: {
66: case IETF_ATTR_ATTRIBUTE_REQUEST:
67: return ietf_attr_attr_request_create_from_data(length, value);
68: case IETF_ATTR_PRODUCT_INFORMATION:
69: return ietf_attr_product_info_create_from_data(length, value);
70: case IETF_ATTR_NUMERIC_VERSION:
71: return ietf_attr_numeric_version_create_from_data(length, value);
72: case IETF_ATTR_STRING_VERSION:
73: return ietf_attr_string_version_create_from_data(length, value);
74: case IETF_ATTR_OPERATIONAL_STATUS:
75: return ietf_attr_op_status_create_from_data(length, value);
76: case IETF_ATTR_PORT_FILTER:
77: return ietf_attr_port_filter_create_from_data(length, value,
78: pen_type_create(PEN_IETF, type));
79: case IETF_ATTR_INSTALLED_PACKAGES:
80: return ietf_attr_installed_packages_create_from_data(length, value);
81: case IETF_ATTR_PA_TNC_ERROR:
82: return ietf_attr_pa_tnc_error_create_from_data(length, value);
83: case IETF_ATTR_ASSESSMENT_RESULT:
84: return ietf_attr_assess_result_create_from_data(length, value);
85: case IETF_ATTR_REMEDIATION_INSTRUCTIONS:
86: return ietf_attr_remediation_instr_create_from_data(length, value);
87: case IETF_ATTR_FORWARDING_ENABLED:
88: return ietf_attr_fwd_enabled_create_from_data(length, value,
89: pen_type_create(PEN_IETF, type));
90: case IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED:
91: return generic_attr_bool_create_from_data(length, value,
92: pen_type_create(PEN_IETF, type));
93: case IETF_ATTR_SWIMA_REQUEST:
94: return ietf_swima_attr_req_create_from_data(length, value);
95: case IETF_ATTR_SW_ID_INVENTORY:
96: return ietf_swima_attr_sw_inv_create_from_data(length, value, TRUE);
97: case IETF_ATTR_SW_INVENTORY:
98: return ietf_swima_attr_sw_inv_create_from_data(length, value, FALSE);
99: case IETF_ATTR_SW_ID_EVENTS:
100: return ietf_swima_attr_sw_ev_create_from_data(length, value, TRUE);
101: case IETF_ATTR_SW_EVENTS:
102: return ietf_swima_attr_sw_ev_create_from_data(length, value, FALSE);
103: case IETF_ATTR_TESTING:
104: case IETF_ATTR_RESERVED:
105: /* unsupported IETF/SWIMA attributes */
106: case IETF_ATTR_SUBSCRIPTION_STATUS_REQ:
107: case IETF_ATTR_SUBSCRIPTION_STATUS_RESP:
108: case IETF_ATTR_SRC_METADATA_REQ:
109: case IETF_ATTR_SRC_METADATA_RESP:
110: default:
111: return NULL;
112: }
113: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>