gperf creates optimum hash table for stroke keywords
[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_end_t stroke_end_t;
34
35 struct stroke_end_t {
36 char *id;
37 char *cert;
38 char *ca;
39 char *address;
40 char *subnet;
41 int subnet_mask;
42 certpolicy_t sendcert;
43 };
44
45 typedef struct stroke_msg_t stroke_msg_t;
46
47 /**
48 * @brief A stroke message sent over the unix socket.
49 */
50 struct stroke_msg_t {
51 /* length of this message with all strings */
52 u_int length;
53
54 /* type of the message */
55 enum {
56 /* initiate a connection */
57 STR_INITIATE,
58 /* install SPD entries for a connection */
59 STR_INSTALL,
60 /* add a connection */
61 STR_ADD_CONN,
62 /* delete a connection */
63 STR_DEL_CONN,
64 /* terminate connection */
65 STR_TERMINATE,
66 /* show connection status */
67 STR_STATUS,
68 /* show verbose connection status */
69 STR_STATUS_ALL,
70 /* set a log type to log/not log */
71 STR_LOGTYPE,
72 /* set the verbosity of a logging context */
73 STR_LOGLEVEL,
74 /* show list of locally loaded certificates */
75 STR_LIST_CERTS
76 /* more to come */
77 } type;
78
79 union {
80 /* data for STR_INITIATE, STR_INSTALL, STR_UP, STR_DOWN, ... */
81 struct {
82 char *name;
83 } initiate, install, terminate, status, del_conn;
84
85 /* data for STR_ADD_CONN */
86 struct {
87 char *name;
88 bool ikev2;
89 struct {
90 time_t ipsec_lifetime;
91 time_t ike_lifetime;
92 time_t margin;
93 unsigned long tries;
94 unsigned long fuzz;
95 } rekey;
96 stroke_end_t me, other;
97 } add_conn;
98
99 struct {
100 char *context;
101 char *type;
102 int enable;
103 } logtype;
104
105 struct {
106 char *context;
107 int level;
108 } loglevel;
109 };
110 char buffer[STROKE_BUF_LEN];
111 };
112
113 #endif /* STROKE_H_ */