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