Add license description
[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_MAX,
43 } VICIClientCmd;
44
45 #define VICI_DEFAULT_URI "/var/run/charon.vici"
46
47 typedef int (*vici_add_element)(VICISection *sect, const char *key,
48                 const char *value, const char *subsection);
49
50 typedef void (*vici_connect_reply_cb)(int err, void *user_data);
51
52 VICISection* vici_create_section(const char *name);
53 int add_subsection(const char* name, VICISection* child, VICISection* section);
54 void vici_destroy_section(VICISection *sect);
55 int vici_add_kv(VICISection *sect, const char *key,
56                 const char *value, const char *subsection);
57 int vici_add_kvl(VICISection *sect, const char *key,
58                 const char *value, const char *subsection);
59 int vici_add_list(VICISection* section, char *key,
60                 GSList *list, const char* subsection);
61 int vici_add_cert_kv(VICISection *section, const char *key,
62                 const char *value, const char *subsection);
63 int vici_add_cert_kvl(VICISection *section, const char *key,
64                 const char *value, const char *subsection);
65
66 int vici_initialize(VICIClient **vici_client);
67 int vici_deinitialize(VICIClient *vici_client);
68 void vici_set_connect_reply_cb(VICIClient *vici_client, vici_connect_reply_cb reply_cb, gpointer user_data);
69 int vici_send_request(VICIClient *vici_client, VICIClientCmd cmd, VICISection *root);
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif /* __VICI_CLIENT_H */