xref: /openbsd/usr.sbin/iscsictl/iscsictl.h (revision d9ff5473)
1 /*	$OpenBSD: iscsictl.h,v 1.4 2014/04/21 17:44:47 claudio Exp $ */
2 
3 /*
4  * Copyright (c) 2009 David Gwynne <dlg@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 #define ISCSID_OPT_NOACTION	0x01
20 
21 struct iscsi_config {
22 	SIMPLEQ_HEAD(, session_ctlcfg)	sessions;
23 	struct initiator_config		initiator;
24 };
25 
26 struct session_ctlcfg {
27 	struct session_config		session;
28 	SIMPLEQ_ENTRY(session_ctlcfg)	entry;
29 };
30 
31 enum actions {
32 	NONE,
33 	LOG_VERBOSE,
34 	LOG_BRIEF,
35 	SHOW_SUM,
36 	SHOW_SESS,
37 	SHOW_VSCSI_STATS,
38 	RELOAD,
39 	DISCOVERY
40 };
41 
42 struct parse_result {
43 	struct sockaddr_storage	addr;
44 	char			name[32];
45 	int			flags;
46 	enum actions		action;
47 	u_int8_t		prefixlen;
48 };
49 
50 /* parse.y */
51 struct iscsi_config *	parse_config(char *);
52 int			cmdline_symset(char *);
53 
54 /* parser.c */
55 struct parse_result	*parse(int, char *[]);
56 const struct token	*match_token(const char *, const struct token *);
57 void			 show_valid_args(const struct token *);
58 int			 parse_addr(const char *, struct sockaddr_storage *);
59