xref: /openbsd-src/usr.sbin/ikectl/parser.h (revision 5a38ef86d0b61900239c7913d24a05e7b88a58f0)
1 /*	$OpenBSD: parser.h,v 1.17 2021/11/21 22:44:08 tobhe Exp $	*/
2 
3 /*
4  * Copyright (c) 2007-2013 Reyk Floeter <reyk@openbsd.org>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef IKECTL_PARSER_H
20 #define IKECTL_PARSER_H
21 
22 enum actions {
23 	NONE,
24 	LOAD,
25 	RELOAD,
26 	MONITOR,
27 	LOG_VERBOSE,
28 	LOG_BRIEF,
29 	COUPLE,
30 	DECOUPLE,
31 	ACTIVE,
32 	PASSIVE,
33 	RESETALL,
34 	RESETCA,
35 	RESETPOLICY,
36 	RESETSA,
37 	RESETUSER,
38 	CA,
39 	CA_CREATE,
40 	CA_DELETE,
41 	CA_INSTALL,
42 	CA_EXPORT,
43 	CA_CERTIFICATE,
44 	CA_CERT_CREATE,
45 	CA_SERVER,
46 	CA_CLIENT,
47 	CA_OCSP,
48 	CA_CERT_DELETE,
49 	CA_CERT_INSTALL,
50 	CA_CERT_EXPORT,
51 	CA_CERT_REVOKE,
52 	CA_KEY_CREATE,
53 	CA_KEY_DELETE,
54 	CA_KEY_INSTALL,
55 	CA_KEY_IMPORT,
56 	SHOW_CA,
57 	SHOW_CA_CERTIFICATES,
58 	SHOW_SA,
59 	RESET_ID,
60 	SHOW_CERTSTORE
61 };
62 
63 struct parse_result {
64 	enum actions	 action;
65 	struct imsgbuf	*ibuf;
66 	char		*path;
67 	char		*caname;
68 	char		*pass;
69 	char		*host;
70 	char		*peer;
71 	char		*id;
72 	int		 htype;
73 	int		 quiet;
74 };
75 
76 #define HOST_IPADDR	1
77 #define HOST_FQDN	2
78 
79 struct parse_result	*parse(int, char *[]);
80 
81 struct ca	*ca_setup(char *, int, int, char *);
82 int		 ca_create(struct ca *);
83 int		 ca_certificate(struct ca *, char *, int, int);
84 int		 ca_export(struct ca *, char *, char *, char *);
85 int		 ca_revoke(struct ca *, char *);
86 int		 ca_delete(struct ca *);
87 int		 ca_delkey(struct ca *, char *);
88 int		 ca_install(struct ca *, char *);
89 int		 ca_cert_install(struct ca *, char *, char *);
90 int		 ca_show_certs(struct ca *, char *);
91 int		 ca_key_create(struct ca *, char *);
92 int		 ca_key_delete(struct ca *, char *);
93 int		 ca_key_install(struct ca *, char *, char *);
94 int		 ca_key_import(struct ca *, char *, char *);
95 
96 #endif /* IKECTL_PARSER_H */
97