Added add_segment() method to TCG/SEG attributes
[strongswan.git] / src / libimcv / ita / ita_attr.c
1 /*
2 * Copyright (C) 2011-2014 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 "ita_attr.h"
17 #include "ita/ita_attr_command.h"
18 #include "ita/ita_attr_dummy.h"
19 #include "ita/ita_attr_get_settings.h"
20 #include "ita/ita_attr_settings.h"
21 #include "ita/ita_attr_angel.h"
22 #include "ita/ita_attr_device_id.h"
23
24 ENUM(ita_attr_names, ITA_ATTR_COMMAND, ITA_ATTR_DEVICE_ID,
25 "Command",
26 "Dummy",
27 "Get Settings",
28 "Settings",
29 "Start Angel",
30 "Stop Angel",
31 "Echo",
32 "Device ID"
33 );
34
35 /**
36 * See header
37 */
38 pa_tnc_attr_t* ita_attr_create_from_data(u_int32_t type, size_t length,
39 chunk_t value)
40 {
41 switch (type)
42 {
43 case ITA_ATTR_COMMAND:
44 return ita_attr_command_create_from_data(length, value);
45 case ITA_ATTR_DUMMY:
46 return ita_attr_dummy_create_from_data(length, value);
47 case ITA_ATTR_GET_SETTINGS:
48 return ita_attr_get_settings_create_from_data(length, value);
49 case ITA_ATTR_SETTINGS:
50 return ita_attr_settings_create_from_data(length, value);
51 case ITA_ATTR_START_ANGEL:
52 return ita_attr_angel_create_from_data(TRUE);
53 case ITA_ATTR_STOP_ANGEL:
54 return ita_attr_angel_create_from_data(FALSE);
55 case ITA_ATTR_DEVICE_ID:
56 return ita_attr_device_id_create_from_data(length, value);
57 default:
58 return NULL;
59 }
60 }