e4617f54e150d517497836541d5b0e44e6b6caff
[strongswan.git] / src / libimcv / pa_tnc / pa_tnc_attr.c
1 /*
2 * Copyright (C) 2011 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 "pa_tnc_attr.h"
17 #include "ietf/ietf_attr.h"
18 #include "ietf/ietf_attr_pa_tnc_error.h"
19 #include "ietf/ietf_attr_port_filter.h"
20 #include "tcg/tcg_attr.h"
21 #include "ita/ita_attr_command.h"
22
23 /**
24 * See header
25 */
26 pa_tnc_attr_t* pa_tnc_attr_create_from_data(pen_t vendor_id, u_int32_t type,
27 chunk_t value)
28 {
29 switch (vendor_id)
30 {
31 case PEN_IETF:
32 switch (type)
33 {
34 case IETF_ATTR_PORT_FILTER:
35 return ietf_attr_port_filter_create_from_data(value);
36 case IETF_ATTR_PA_TNC_ERROR:
37 return ietf_attr_pa_tnc_error_create_from_data(value);
38 case IETF_ATTR_TESTING:
39 case IETF_ATTR_ATTRIBUTE_REQUEST:
40 case IETF_ATTR_PRODUCT_INFORMATION:
41 case IETF_ATTR_NUMERIC_VERSION:
42 case IETF_ATTR_STRING_VERSION:
43 case IETF_ATTR_OPERATIONAL_STATUS:
44 case IETF_ATTR_INSTALLED_PACKAGES:
45 case IETF_ATTR_ASSESSMENT_RESULT:
46 case IETF_ATTR_REMEDIATION_INSTRUCTIONS:
47 case IETF_ATTR_FORWARDING_ENABLED:
48 case IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED:
49 case IETF_ATTR_RESERVED:
50 default:
51 break;
52 }
53 break;
54 case PEN_TCG:
55 switch (type)
56 {
57 case TCG_PTS_REQ_PROTO_CAPS:
58 case TCG_PTS_PROTO_CAPS:
59 case TCG_PTS_DH_NONCE_PARAMS_REQ:
60 case TCG_PTS_DH_NONCE_PARAMS_RESP:
61 case TCG_PTS_DH_NONCE_FINISH:
62 case TCG_PTS_MEAS_ALGO:
63 case TCG_PTS_MEAS_ALGO_SELECTION:
64 case TCG_PTS_GET_TPM_VERSION_INFO:
65 case TCG_PTS_TPM_VERSION_INFO:
66 case TCG_PTS_REQ_TEMPL_REF_MANI_SET_META:
67 case TCG_PTS_TEMPL_REF_MANI_SET_META:
68 case TCG_PTS_UPDATE_TEMPL_REF_MANI:
69 case TCG_PTS_GET_AIK:
70 case TCG_PTS_AIK:
71 case TCG_PTS_REQ_FUNCT_COMP_EVID:
72 case TCG_PTS_GEN_ATTEST_EVID:
73 case TCG_PTS_SIMPLE_COMP_EVID:
74 case TCG_PTS_SIMPLE_EVID_FINAL:
75 case TCG_PTS_VERIFICATION_RESULT:
76 case TCG_PTS_INTEG_REPORT:
77 case TCG_PTS_REQ_FILE_META:
78 case TCG_PTS_WIN_FILE_META:
79 case TCG_PTS_UNIX_FILE_META:
80 case TCG_PTS_REQ_REGISTRY_VALUE:
81 case TCG_PTS_REGISTRY_VALUE:
82 case TCG_PTS_REQ_FILE_MEAS:
83 case TCG_PTS_FILE_MEAS:
84 case TCG_PTS_REQ_INTEG_MEAS_LOG:
85 case TCG_PTS_INTEG_MEAS_LOG:
86 default:
87 break;
88 }
89 break;
90 case PEN_ITA:
91 switch (type)
92 {
93 case ITA_ATTR_COMMAND:
94 return ita_attr_command_create_from_data(value);
95 default:
96 break;
97 }
98 break;
99 default:
100 break;
101 }
102 return NULL;
103 }