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