]> git.ipfire.org Git - people/ms/strongswan.git/blame - Source/charon/threads/stroke.h
- rewrote a lot of RSA stuff
[people/ms/strongswan.git] / Source / charon / threads / stroke.h
CommitLineData
e8d25806
MW
1/**
2 * @file stroke.h
3 *
4 * @brief Interface of stroke_t.
5 *
6 */
7
8/*
9 * Copyright (C) 2006 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_H_
24#define STROKE_H_
25
26#include <config/policy_store.h>
27#include <config/connection_store.h>
28#include <config/credential_store.h>
29
30
31#define STROKE_SOCKET "/var/run/charon.ctl"
efadbf79
MW
32#define IPSEC_DIR "/etc/ipsec.d/"
33#define PRIVATE_KEY_DIR IPSEC_DIR "private/"
34#define CERTIFICATE_DIR IPSEC_DIR "certs/"
e8d25806
MW
35
36/**
37 * @brief A stroke message sent over the unix socket.
38 *
39 */
40typedef struct stroke_msg_t stroke_msg_t;
41
42struct stroke_msg_t {
43 /* length of this message with all strings */
44 u_int16_t length;
45 /* type of the message */
46 enum {
47 /* initiate a connection */
48 STR_INITIATE,
49 /* install SPD entries for a connection */
50 STR_INSTALL,
51 /* add a connection */
52 STR_ADD_CONN,
53 /* delete a connection */
54 STR_DEL_CONN,
55 /* more to come */
56 } type;
57 union {
58 /* data for STR_INITIATE, STR_INSTALL */
59 struct {
60 char *name;
61 } initiate, install;
62 /* data for STR_ADD_CONN */
63 struct {
64 char *name;
65 struct {
e8d25806 66 char *id;
efadbf79 67 char *cert;
87a217f9
MW
68 char *address;
69 char *subnet;
70 u_int8_t subnet_mask;
e8d25806
MW
71 } me, other;
72 } add_conn;
73 };
74 u_int8_t buffer[];
75};
76
77
78typedef struct stroke_t stroke_t;
79
80/**
81 * @brief Stroke is a configuration and control interface which
82 * allows other processes to modify charons behavior.
83 *
84 * stroke_t allows config manipulation (as whack in pluto).
85 * Messages of type stroke_msg_t's are sent over a unix socket
86 * (/var/run/charon.ctl). stroke_t implements the connections_t
87 * and the policies_t interface, which means it acts as a
88 * configuration backend for those too. stroke_t uses an own
89 * thread to read from the socket.
90 *
91 * @warning DO NOT cast stroke_t to any of the implemented interfaces!
92 * stroke_t implements multiple interfaces, so you must use
93 * stroke_t.interface_xy to access the specific interface! You have
94 * been warned...
95 *
87a217f9
MW
96 * @todo Add clean thread cancellation
97 *
e8d25806
MW
98 * @b Constructors:
99 * - stroke_create()
100 *
87a217f9 101 * @ingroup threads
e8d25806
MW
102 */
103struct stroke_t {
104
105 /**
106 * Implements connection_store_t interface
107 */
108 connection_store_t connections;
109
110 /**
111 * Implements policy_store_t interface
112 */
113 policy_store_t policies;
114
115 /**
116 * Implements credential_store_t interfacce
117 */
118 credential_store_t credentials;
119
120 /**
121 * @brief Destroy a stroke_t instance.
122 *
123 * @param this stroke_t objec to destroy
124 */
125 void (*destroy) (stroke_t *this);
126};
127
128
129/**
130 * @brief Create the stroke interface and listen on the socket.
131 *
132 * @return stroke_t object
133 *
87a217f9 134 * @ingroup threads
e8d25806
MW
135 */
136stroke_t *stroke_create();
137
138#endif /* STROKE_H_ */