implemented rereadcrls rereadcacerts
[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 /**
34 * Definition of the LIST flags
35 */
36 #define LIST_NONE 0x0000 /* don't list anything */
37 #define LIST_CERTS 0x0001 /* list all host/user certs */
38 #define LIST_CACERTS 0x0002 /* list all ca certs */
39 #define LIST_CRLS 0x0004 /* list all crls */
40 #define LIST_ALL 0x0007 /* all list options */
41
42 /**
43 * Definition of the REREAD flags
44 */
45 #define REREAD_NONE 0x0000 /* don't reread anything */
46 #define REREAD_CACERTS 0x0001 /* reread all ca certs */
47 #define REREAD_CRLS 0x0002 /* reread all crls */
48 #define REREAD_ALL 0x0003 /* all reread options */
49
50 typedef struct stroke_end_t stroke_end_t;
51
52 struct stroke_end_t {
53 char *id;
54 char *cert;
55 char *ca;
56 char *address;
57 char *subnet;
58 int subnet_mask;
59 certpolicy_t sendcert;
60 };
61
62 typedef struct stroke_msg_t stroke_msg_t;
63
64 /**
65 * @brief A stroke message sent over the unix socket.
66 */
67 struct stroke_msg_t {
68 /* length of this message with all strings */
69 u_int length;
70
71 /* type of the message */
72 enum {
73 /* initiate a connection */
74 STR_INITIATE,
75 /* install SPD entries for a connection */
76 STR_INSTALL,
77 /* add a connection */
78 STR_ADD_CONN,
79 /* delete a connection */
80 STR_DEL_CONN,
81 /* terminate connection */
82 STR_TERMINATE,
83 /* show connection status */
84 STR_STATUS,
85 /* show verbose connection status */
86 STR_STATUS_ALL,
87 /* set a log type to log/not log */
88 STR_LOGTYPE,
89 /* set the verbosity of a logging context */
90 STR_LOGLEVEL,
91 /* list various objects */
92 STR_LIST,
93 /* reread various objects */
94 STR_REREAD
95 /* more to come */
96 } type;
97
98 union {
99 /* data for STR_INITIATE, STR_INSTALL, STR_UP, STR_DOWN, ... */
100 struct {
101 char *name;
102 } initiate, install, terminate, status, del_conn;
103
104 /* data for STR_ADD_CONN */
105 struct {
106 char *name;
107 bool ikev2;
108 struct {
109 char *ike;
110 char *esp;
111 } algorithms;
112 struct {
113 time_t ipsec_lifetime;
114 time_t ike_lifetime;
115 time_t margin;
116 unsigned long tries;
117 unsigned long fuzz;
118 } rekey;
119 stroke_end_t me, other;
120 } add_conn;
121
122 /* data for STR_LOGTYPE */
123 struct {
124 char *context;
125 char *type;
126 int enable;
127 } logtype;
128
129 /* data for STR_LOGLEVEL */
130 struct {
131 char *context;
132 int level;
133 } loglevel;
134
135 /* data for STR_LIST */
136 struct {
137 u_int flags;
138 bool utc;
139 } list;
140
141 /* data for STR_REREAD */
142 struct {
143 u_int flags;
144 } reread;
145
146 };
147 char buffer[STROKE_BUF_LEN];
148 };
149
150 #endif /* STROKE_H_ */