/src/strongswan/src/libimcv/ita/ita_attr.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) 2011-2020 Andreas Steffen |
3 | | * |
4 | | * Copyright (C) secunet Security Networks AG |
5 | | * |
6 | | * This program is free software; you can redistribute it and/or modify it |
7 | | * under the terms of the GNU General Public License as published by the |
8 | | * Free Software Foundation; either version 2 of the License, or (at your |
9 | | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. |
10 | | * |
11 | | * This program is distributed in the hope that it will be useful, but |
12 | | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
13 | | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 | | * for more details. |
15 | | */ |
16 | | |
17 | | #include "ita_attr.h" |
18 | | #include "ita/ita_attr_command.h" |
19 | | #include "ita/ita_attr_dummy.h" |
20 | | #include "ita/ita_attr_get_settings.h" |
21 | | #include "ita/ita_attr_settings.h" |
22 | | #include "ita/ita_attr_angel.h" |
23 | | #include "ita/ita_attr_symlinks.h" |
24 | | #include "generic/generic_attr_string.h" |
25 | | |
26 | | ENUM(ita_attr_names, ITA_ATTR_COMMAND, ITA_ATTR_SYMLINKS, |
27 | | "Command", |
28 | | "Dummy", |
29 | | "Get Settings", |
30 | | "Settings", |
31 | | "Start Angel", |
32 | | "Stop Angel", |
33 | | "Echo", |
34 | | "Device ID", |
35 | | "Get Symlinks", |
36 | | "Symlinks" |
37 | | ); |
38 | | |
39 | | /** |
40 | | * See header |
41 | | */ |
42 | | pa_tnc_attr_t* ita_attr_create_from_data(uint32_t type, size_t length, |
43 | | chunk_t value) |
44 | 4.47k | { |
45 | 4.47k | switch (type) |
46 | 4.47k | { |
47 | 585 | case ITA_ATTR_COMMAND: |
48 | 585 | return ita_attr_command_create_from_data(length, value); |
49 | 459 | case ITA_ATTR_DUMMY: |
50 | 459 | return ita_attr_dummy_create_from_data(length, value); |
51 | 715 | case ITA_ATTR_GET_SETTINGS: |
52 | 715 | return ita_attr_get_settings_create_from_data(length, value); |
53 | 652 | case ITA_ATTR_SETTINGS: |
54 | 652 | return ita_attr_settings_create_from_data(length, value); |
55 | 219 | case ITA_ATTR_START_ANGEL: |
56 | 219 | return ita_attr_angel_create_from_data(TRUE); |
57 | 295 | case ITA_ATTR_STOP_ANGEL: |
58 | 295 | return ita_attr_angel_create_from_data(FALSE); |
59 | 195 | case ITA_ATTR_DEVICE_ID: |
60 | 195 | return generic_attr_string_create_from_data(length, value, |
61 | 195 | pen_type_create(PEN_ITA, type)); |
62 | 249 | case ITA_ATTR_GET_SYMLINKS: |
63 | 249 | return generic_attr_string_create_from_data(length, value, |
64 | 249 | pen_type_create(PEN_ITA, type)); |
65 | 638 | case ITA_ATTR_SYMLINKS: |
66 | 638 | return ita_attr_symlinks_create_from_data(length, value); |
67 | 464 | default: |
68 | | return NULL; |
69 | 4.47k | } |
70 | 4.47k | } |