DA: Add exception check for time logic
[platform/upstream/connman.git] / vpn / plugins / vici-client.h
1 /*
2  *
3  *  ConnMan VPN daemon
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License version 2 as
7  *  published by the Free Software Foundation.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  */
19
20 #ifndef __VICI_CLIENT_H
21 #define __VICI_CLIENT_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /* strongswan VICI plugin client part*/
28 struct _VICIClient;
29 typedef struct _VICIClient VICIClient;
30
31 struct _VICISection;
32 typedef struct _VICISection VICISection;
33
34 typedef enum {
35         VICI_CMD_LOAD_CONN,
36         VICI_CMD_LOAD_SHARED,
37         VICI_CMD_LOAD_CERT,
38         VICI_CMD_LOAD_AUTH,
39         VICI_CMD_UNLOAD_AUTH,
40         VICI_CMD_LOAD_KEY,
41         VICI_CMD_INITIATE,
42         VICI_CMD_TERMINATE,
43         VICI_CMD_REGISTER_CHILD_UPDOWN,
44         VICI_CMD_MAX,
45 } VICIClientCmd;
46
47 typedef enum {
48         VICI_EVENT_CHILD_UP,
49         VICI_EVENT_CHILD_DOWN,
50         VICI_EVENT_MAX,
51 } VICIClientEvent;
52 #define VICI_DEFAULT_URI "/var/run/charon.vici"
53
54 typedef int (*vici_add_element)(VICISection *sect, const char *key,
55                 const char *value, const char *subsection);
56
57 typedef void (*vici_request_reply_cb)(int err, void *user_data);
58 typedef void (*vici_event_cb)(VICIClientEvent event, void *user_data);
59
60 VICISection* vici_create_section(const char *name);
61 int add_subsection(const char* name, VICISection* child, VICISection* section);
62 void vici_destroy_section(VICISection *sect);
63 int vici_add_kv(VICISection *sect, const char *key,
64                 const char *value, const char *subsection);
65 int vici_add_kvl(VICISection *sect, const char *key,
66                 const char *value, const char *subsection);
67 int vici_add_list(VICISection* section, char *key,
68                 GSList *list, const char* subsection);
69 int vici_add_cert_kv(VICISection *section, const char *key,
70                 const char *value, const char *subsection);
71 int vici_add_cert_kvl(VICISection *section, const char *key,
72                 const char *value, const char *subsection);
73
74 int vici_initialize(VICIClient **vici_client);
75 int vici_deinitialize(VICIClient *vici_client);
76 void vici_set_request_reply_cb(VICIClient *vici_client, vici_request_reply_cb reply_cb, gpointer user_data);
77 int vici_send_request(VICIClient *vici_client, VICIClientCmd cmd, VICISection *root);
78 int vici_set_event_cb(VICIClient *vici_client, vici_event_cb cb, gpointer user_data);
79
80 #ifdef __cplusplus
81 }
82 #endif
83
84 #endif /* __VICI_CLIENT_H */