added ITA Echo PA-TNC Subtype and ITA Echo Attribute type
[strongswan.git] / src / libimcv / ita / ita_attr.c
1 /*
2 * Copyright (C) 2011-2012 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
23 ENUM(ita_attr_names, ITA_ATTR_COMMAND, ITA_ATTR_ECHO,
24 "Command",
25 "Dummy",
26 "Get Settings",
27 "Settings",
28 "Start Angel",
29 "Stop Angel",
30 "Echo"
31 );
32
33 /**
34 * See header
35 */
36 pa_tnc_attr_t* ita_attr_create_from_data(u_int32_t type, chunk_t value)
37 {
38 switch (type)
39 {
40 case ITA_ATTR_COMMAND:
41 return ita_attr_command_create_from_data(value);
42 case ITA_ATTR_DUMMY:
43 return ita_attr_dummy_create_from_data(value);
44 case ITA_ATTR_GET_SETTINGS:
45 return ita_attr_get_settings_create_from_data(value);
46 case ITA_ATTR_SETTINGS:
47 return ita_attr_settings_create_from_data(value);
48 case ITA_ATTR_START_ANGEL:
49 return ita_attr_angel_create_from_data(TRUE, value);
50 case ITA_ATTR_STOP_ANGEL:
51 return ita_attr_angel_create_from_data(FALSE, value);
52 default:
53 return NULL;
54 }
55 }