d20d9a5b30448507dabc08d46449d2b750898ba5
[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 "ita/ita_attr_command.h"
21
22 /**
23 * See header
24 */
25 pa_tnc_attr_t* pa_tnc_attr_create_from_data(pen_t vendor_id, u_int32_t type,
26 chunk_t value)
27 {
28 switch (vendor_id)
29 {
30 case PEN_IETF:
31 switch (type)
32 {
33 case IETF_ATTR_PORT_FILTER:
34 return ietf_attr_port_filter_create_from_data(value);
35 case IETF_ATTR_PA_TNC_ERROR:
36 return ietf_attr_pa_tnc_error_create_from_data(value);
37 case IETF_ATTR_TESTING:
38 case IETF_ATTR_ATTRIBUTE_REQUEST:
39 case IETF_ATTR_PRODUCT_INFORMATION:
40 case IETF_ATTR_NUMERIC_VERSION:
41 case IETF_ATTR_STRING_VERSION:
42 case IETF_ATTR_OPERATIONAL_STATUS:
43 case IETF_ATTR_INSTALLED_PACKAGES:
44 case IETF_ATTR_ASSESSMENT_RESULT:
45 case IETF_ATTR_REMEDIATION_INSTRUCTIONS:
46 case IETF_ATTR_FORWARDING_ENABLED:
47 case IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED:
48 case IETF_ATTR_RESERVED:
49 default:
50 break;
51 }
52 break;
53 case PEN_ITA:
54 switch (type)
55 {
56 case ITA_ATTR_COMMAND:
57 return ita_attr_command_create_from_data(value);
58 default:
59 break;
60 }
61 break;
62 default:
63 break;
64 }
65 return NULL;
66 }