Support of HCD Firewall Setting PA-TNC attribute
[strongswan.git] / src / libimcv / pwg / pwg_attr.c
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 #include "pwg_attr.h"
17
18 #include "generic/generic_attr_bool.h"
19 #include "ietf/ietf_attr_port_filter.h"
20
21
22 ENUM_BEGIN(pwg_attr_names, PWG_HCD_ATTRS_NATURAL_LANG,
23 PWG_HCD_VENDOR_SMI_CODE,
24 "HCD AttributesNaturalLanguage",
25 "HCD MachineTypeModel",
26 "HCD VendorName",
27 "HCD VendorSMICode");
28 ENUM_NEXT(pwg_attr_names, PWG_HCD_DEFAULT_PWD_ENABLED,
29 PWG_HCD_FORWARDING_ENABLED,
30 PWG_HCD_VENDOR_SMI_CODE,
31 "HCD DefaultPasswordEnabled",
32 "HCD FirewallSetting",
33 "HCD ForwardingEnabled");
34 ENUM_NEXT(pwg_attr_names, PWG_HCD_PSTN_FAX_ENABLED,
35 PWG_HCD_PSTN_FAX_ENABLED,
36 PWG_HCD_FORWARDING_ENABLED,
37 "HCD PSTNFaxEnabled");
38 ENUM_NEXT(pwg_attr_names, PWG_HCD_TIME_SOURCE,
39 PWG_HCD_TIME_SOURCE,
40 PWG_HCD_PSTN_FAX_ENABLED,
41 "HCD TimeSource");
42 ENUM_NEXT(pwg_attr_names, PWG_HCD_FIRMWARE_NAME,
43 PWG_HCD_FIRMWARE_VERSION,
44 PWG_HCD_TIME_SOURCE,
45 "HCD FirmwareName",
46 "HCD FirmwarePatches",
47 "HCD FirmwareStringVersion",
48 "HCD FirmwareVersion");
49 ENUM_NEXT(pwg_attr_names, PWG_HCD_RESIDENT_APP_NAME,
50 PWG_HCD_RESIDENT_APP_VERSION,
51 PWG_HCD_FIRMWARE_VERSION,
52 "HCD ResidentApplicationName",
53 "HCD ResidentApplicationPatches",
54 "HCD ResidentApplicationStringVersion",
55 "HCD ResidentApplicationVersion");
56 ENUM_NEXT(pwg_attr_names, PWG_HCD_USER_APP_NAME,
57 PWG_HCD_USER_APP_PERSIST_ENABLED,
58 PWG_HCD_RESIDENT_APP_VERSION,
59 "HCD UserApplicationName",
60 "HCD UserApplicationPatches",
61 "HCD UserApplicationStringVersion",
62 "HCD UserApplicationVersion",
63 "HCD UserApplicationEnabled",
64 "HCD UserApplicationPersistenceEnabled");
65 ENUM_NEXT(pwg_attr_names, PWG_HCD_CERTIFICATION_STATE,
66 PWG_HCD_CONFIGURATION_STATE,
67 PWG_HCD_USER_APP_PERSIST_ENABLED,
68 "HCD CertificationState",
69 "HCD ConfigurationState");
70 ENUM_END(pwg_attr_names, PWG_HCD_CONFIGURATION_STATE);
71
72 /**
73 * See header
74 */
75 pa_tnc_attr_t* pwg_attr_create_from_data(u_int32_t type, size_t length, chunk_t value)
76 {
77 switch (type)
78 {
79 case PWG_HCD_DEFAULT_PWD_ENABLED:
80 case PWG_HCD_FORWARDING_ENABLED:
81 case PWG_HCD_USER_APP_ENABLED:
82 case PWG_HCD_USER_APP_PERSIST_ENABLED:
83 case PWG_HCD_PSTN_FAX_ENABLED:
84 return generic_attr_bool_create_from_data(length, value,
85 pen_type_create(PEN_PWG, type));
86 case PWG_HCD_FIREWALL_SETTING:
87 return ietf_attr_port_filter_create_from_data(length, value,
88 pen_type_create(PEN_PWG, type));
89 case PWG_HCD_ATTRS_NATURAL_LANG:
90 case PWG_HCD_MACHINE_TYPE_MODEL:
91 case PWG_HCD_VENDOR_NAME:
92 case PWG_HCD_VENDOR_SMI_CODE:
93 case PWG_HCD_TIME_SOURCE:
94 case PWG_HCD_FIRMWARE_NAME:
95 case PWG_HCD_FIRMWARE_PATCHES:
96 case PWG_HCD_FIRMWARE_STRING_VERSION:
97 case PWG_HCD_FIRMWARE_VERSION:
98 case PWG_HCD_RESIDENT_APP_NAME:
99 case PWG_HCD_RESIDENT_APP_PATCHES:
100 case PWG_HCD_RESIDENT_APP_STRING_VERSION:
101 case PWG_HCD_RESIDENT_APP_VERSION:
102 case PWG_HCD_USER_APP_NAME:
103 case PWG_HCD_USER_APP_PATCHES:
104 case PWG_HCD_USER_APP_STRING_VERSION:
105 case PWG_HCD_USER_APP_VERSION:
106 case PWG_HCD_CERTIFICATION_STATE:
107 case PWG_HCD_CONFIGURATION_STATE:
108 default:
109 return NULL;
110 }
111 }