]>
Commit | Line | Data |
---|---|---|
3dbbbf3e MW |
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 | ||
aed58dcc MW |
26 | #include <sys/types.h> |
27 | ||
fcfeb322 MW |
28 | /** |
29 | * Socket which is used to communicate between charon and stroke | |
30 | */ | |
3dbbbf3e MW |
31 | #define STROKE_SOCKET "/var/run/charon.ctl" |
32 | ||
ecadab2b | 33 | #define STROKE_BUF_LEN 2048 |
fcfeb322 | 34 | |
aed58dcc MW |
35 | typedef enum list_flag_t list_flag_t; |
36 | ||
53472332 | 37 | /** |
aed58dcc MW |
38 | * Definition of the LIST flags, used for |
39 | * the various stroke list* commands. | |
40 | */ | |
41 | enum list_flag_t { | |
42 | /** don't list anything */ | |
43 | LIST_NONE = 0x0000, | |
44 | /** list all host/user certs */ | |
45 | LIST_CERTS = 0x0001, | |
46 | /** list all ca certs */ | |
47 | LIST_CACERTS = 0x0002, | |
48 | /** list all crls */ | |
49 | LIST_CRLS = 0x0004, | |
50 | /** all list options */ | |
51 | LIST_ALL = 0x0007, | |
52 | }; | |
53 | ||
54 | typedef enum reread_flag_t reread_flag_t; | |
53472332 | 55 | |
76dafed7 | 56 | /** |
aed58dcc MW |
57 | * Definition of the REREAD flags, used for |
58 | * the various stroke reread* commands. | |
59 | */ | |
60 | enum reread_flag_t { | |
61 | /** don't reread anything */ | |
62 | REREAD_NONE = 0x0000, | |
63 | /** reread all ca certs */ | |
64 | REREAD_CACERTS = 0x0001, | |
65 | /** reread all crls */ | |
66 | REREAD_CRLS = 0x0002, | |
67 | /** all reread options */ | |
68 | REREAD_ALL = 0x0003, | |
69 | }; | |
76dafed7 | 70 | |
b7f9ca58 AS |
71 | typedef struct stroke_end_t stroke_end_t; |
72 | ||
aed58dcc MW |
73 | /** |
74 | * definition of a peer in a stroke message | |
75 | */ | |
b7f9ca58 AS |
76 | struct stroke_end_t { |
77 | char *id; | |
78 | char *cert; | |
79 | char *ca; | |
e5382ce7 | 80 | char *updown; |
b7f9ca58 AS |
81 | char *address; |
82 | char *subnet; | |
83 | int subnet_mask; | |
aed58dcc | 84 | int sendcert; |
db7ef624 | 85 | int hostaccess; |
d109b489 MW |
86 | u_int8_t protocol; |
87 | u_int16_t port; | |
b7f9ca58 AS |
88 | }; |
89 | ||
fcfeb322 MW |
90 | typedef struct stroke_msg_t stroke_msg_t; |
91 | ||
3dbbbf3e MW |
92 | /** |
93 | * @brief A stroke message sent over the unix socket. | |
3dbbbf3e | 94 | */ |
3dbbbf3e MW |
95 | struct stroke_msg_t { |
96 | /* length of this message with all strings */ | |
aed58dcc | 97 | u_int16_t length; |
86a7937b | 98 | |
3dbbbf3e MW |
99 | /* type of the message */ |
100 | enum { | |
101 | /* initiate a connection */ | |
102 | STR_INITIATE, | |
45f76a7d MW |
103 | /* install SPD entries for a policy */ |
104 | STR_ROUTE, | |
105 | /* uninstall SPD entries for a policy */ | |
106 | STR_UNROUTE, | |
3dbbbf3e MW |
107 | /* add a connection */ |
108 | STR_ADD_CONN, | |
109 | /* delete a connection */ | |
110 | STR_DEL_CONN, | |
111 | /* terminate connection */ | |
112 | STR_TERMINATE, | |
113 | /* show connection status */ | |
114 | STR_STATUS, | |
e168ee17 MW |
115 | /* show verbose connection status */ |
116 | STR_STATUS_ALL, | |
3dbbbf3e | 117 | /* set a log type to log/not log */ |
3dbbbf3e | 118 | STR_LOGLEVEL, |
76dafed7 AS |
119 | /* list various objects */ |
120 | STR_LIST, | |
121 | /* reread various objects */ | |
122 | STR_REREAD | |
3dbbbf3e MW |
123 | /* more to come */ |
124 | } type; | |
5c4cc9a4 MW |
125 | |
126 | /* verbosity of output returned from charon (-from -1=silent to 4=private)*/ | |
127 | int output_verbosity; | |
86a7937b | 128 | |
3dbbbf3e | 129 | union { |
45f76a7d | 130 | /* data for STR_INITIATE, STR_ROUTE, STR_UP, STR_DOWN, ... */ |
3dbbbf3e MW |
131 | struct { |
132 | char *name; | |
45f76a7d | 133 | } initiate, route, unroute, terminate, status, del_conn; |
ecadab2b | 134 | |
3dbbbf3e MW |
135 | /* data for STR_ADD_CONN */ |
136 | struct { | |
137 | char *name; | |
db7ef624 | 138 | int ikev2; |
5b321e11 | 139 | int auth_method; |
c095388f MW |
140 | struct { |
141 | char *ike; | |
142 | char *esp; | |
143 | } algorithms; | |
a2a3fb3e | 144 | struct { |
6fe03b0a | 145 | int reauth; |
a2a3fb3e MW |
146 | time_t ipsec_lifetime; |
147 | time_t ike_lifetime; | |
148 | time_t margin; | |
149 | unsigned long tries; | |
150 | unsigned long fuzz; | |
151 | } rekey; | |
a655f5c0 MW |
152 | struct { |
153 | time_t delay; | |
1239c6f4 | 154 | int action; |
a655f5c0 | 155 | } dpd; |
b7f9ca58 | 156 | stroke_end_t me, other; |
3dbbbf3e | 157 | } add_conn; |
ecadab2b | 158 | |
53472332 | 159 | /* data for STR_LOGLEVEL */ |
3dbbbf3e | 160 | struct { |
0ae1deb8 | 161 | char *type; |
7ba69503 | 162 | int level; |
3dbbbf3e | 163 | } loglevel; |
53472332 AS |
164 | |
165 | /* data for STR_LIST */ | |
166 | struct { | |
aed58dcc | 167 | list_flag_t flags; |
db7ef624 | 168 | int utc; |
53472332 | 169 | } list; |
76dafed7 AS |
170 | |
171 | /* data for STR_REREAD */ | |
172 | struct { | |
aed58dcc | 173 | reread_flag_t flags; |
76dafed7 AS |
174 | } reread; |
175 | ||
3dbbbf3e | 176 | }; |
ecadab2b | 177 | char buffer[STROKE_BUF_LEN]; |
3dbbbf3e MW |
178 | }; |
179 | ||
180 | #endif /* STROKE_H_ */ |