stroke now uses constant size string buffer
[strongswan.git] / src / stroke / stroke.h
1 /**
2 * @file stroke.h
3 *
4 * @brief Definition of stroke_msg_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 /**
27 * Socket which is used to communicate between charon and stroke
28 */
29 #define STROKE_SOCKET "/var/run/charon.ctl"
30
31 #define STROKE_BUF_LEN 2048
32
33 typedef struct stroke_msg_t stroke_msg_t;
34
35 /**
36 * @brief A stroke message sent over the unix socket.
37 */
38 struct stroke_msg_t {
39 /* length of this message with all strings */
40 u_int length;
41
42 /* type of the message */
43 enum {
44 /* initiate a connection */
45 STR_INITIATE,
46 /* install SPD entries for a connection */
47 STR_INSTALL,
48 /* add a connection */
49 STR_ADD_CONN,
50 /* delete a connection */
51 STR_DEL_CONN,
52 /* terminate connection */
53 STR_TERMINATE,
54 /* show connection status */
55 STR_STATUS,
56 /* show verbose connection status */
57 STR_STATUS_ALL,
58 /* set a log type to log/not log */
59 STR_LOGTYPE,
60 /* set the verbosity of a logging context */
61 STR_LOGLEVEL,
62 /* show list of locally loaded certificates */
63 STR_LIST_CERTS
64 /* more to come */
65 } type;
66
67 union {
68 /* data for STR_INITIATE, STR_INSTALL, STR_UP, STR_DOWN */
69 struct {
70 char *name;
71 } initiate, install, terminate, status;
72
73 /* data for STR_ADD_CONN */
74 struct {
75 char *name;
76 /* is this connection handled by charon? */
77 int ikev2;
78 struct {
79 char *id;
80 char *cert;
81 char *address;
82 char *subnet;
83 int subnet_mask;
84 } me, other;
85 } add_conn;
86
87 struct {
88 char *context;
89 char *type;
90 int enable;
91 } logtype;
92
93 struct {
94 char *context;
95 int level;
96 } loglevel;
97 };
98 char buffer[STROKE_BUF_LEN];
99 };
100
101 #endif /* STROKE_H_ */