- first attempt for connection loading and starting via "stroke"
[strongswan.git] / Source / charon / config / stroke_configuration.h
1 /**
2 * @file stroke_configuration_t.h
3 *
4 * @brief Interface of stroke_configuration_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef STROKE_CONFIGURATION_H
24 #define STROKE_CONFIGURATION_H
25
26 #include <config/configuration.h>
27
28 /**
29 * @brief A message sent over the unix socket.
30 *
31 */
32 typedef struct stroke_msg_t stroke_msg_t;
33
34 struct stroke_msg_t {
35 /* length of this message with all strings */
36 u_int16_t length;
37 /* type of the message */
38 enum {
39 /* initiate a connection */
40 STR_INITIATE,
41 /* install SPD entries for a connection */
42 STR_INSTALL,
43 /* add a connection */
44 STR_ADD_CONN,
45 /* delete a connection */
46 STR_DEL_CONN,
47 /* more to come */
48 } type;
49 union {
50 /* data for STR_INITIATE, STR_INSTALL */
51 struct {
52 char *name;
53 } initiate, install;
54 /* data for STR_ADD_CONN */
55 struct {
56 char *name;
57 struct {
58 union {
59 u_int16_t family;
60 struct sockaddr saddr;
61 struct sockaddr_in v4;
62 struct sockaddr_in6 v6;
63 } address;
64 char *id;
65 union {
66 u_int16_t family;
67 struct sockaddr saddr;
68 struct sockaddr_in v4;
69 struct sockaddr_in6 v6;
70 } subnet;
71 u_int8_t subnet_netbits;
72 } me, other;
73 } add_conn;
74 };
75 u_int8_t buffer[];
76 };
77
78
79 typedef struct stroke_configuration_t stroke_configuration_t;
80
81 /**
82 * @brief A config backend which uses a unix socket.
83 *
84 * Allows config manipulation (as whack in pluto). This config
85 * is used by the ipsec_starter utility. This configuration
86 * implementation opens a socket at /var/run/charon.ctl and
87 * waits for input from ipsec starter.
88 *
89 * @b Constructors:
90 * - stroke_configuration_create()
91 *
92 * @ingroup config
93 */
94 struct stroke_configuration_t {
95
96 /**
97 * Implements configuration_t interface
98 */
99 configuration_t configuration_interface;
100 };
101
102 /**
103 * @brief Creates an configuration with a unix socket interface.
104 *
105 * @return stroke_configuration_t object
106 *
107 * @ingroup config
108 */
109 stroke_configuration_t *stroke_configuration_create();
110
111 #endif /*STROKE_CONFIGURATION_H*/