xref: /freebsd/usr.sbin/ctld/conf.h (revision 4b15965daa99044daf184221b7c283bf7f2d7e66)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2012 The FreeBSD Foundation
5  *
6  * This software was developed by Edward Tomasz Napierala under sponsorship
7  * from the FreeBSD Foundation.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 
31 #ifndef __CONF_H__
32 #define	__CONF_H__
33 
34 /*
35  * This file defines the interface between parse.y and the rest of
36  * ctld.
37  */
38 
39 __BEGIN_DECLS
40 
41 bool	auth_group_start(const char *name);
42 void	auth_group_finish(void);
43 bool	auth_group_add_chap(const char *user, const char *secret);
44 bool	auth_group_add_chap_mutual(const char *user, const char *secret,
45 	    const char *user2, const char *secret2);
46 bool	auth_group_add_host_address(const char *portal);
47 bool	auth_group_add_host_nqn(const char *name);
48 bool	auth_group_add_initiator_name(const char *name);
49 bool	auth_group_add_initiator_portal(const char *portal);
50 bool	auth_group_set_type(const char *type);
51 
52 void	conf_set_debug(int debug);
53 void	conf_set_isns_period(int period);
54 void	conf_set_isns_timeout(int timeout);
55 void	conf_set_maxproc(int maxproc);
56 bool	conf_set_pidfile_path(const char *path);
57 void	conf_set_timeout(int timeout);
58 
59 bool	isns_add_server(const char *addr);
60 
61 bool	portal_group_start(const char *name);
62 void	portal_group_finish(void);
63 bool	portal_group_add_listen(const char *listen, bool iser);
64 bool	portal_group_add_option(const char *name, const char *value);
65 bool	portal_group_set_discovery_auth_group(const char *name);
66 bool	portal_group_set_dscp(u_int dscp);
67 bool	portal_group_set_filter(const char *filter);
68 void	portal_group_set_foreign(void);
69 bool	portal_group_set_offload(const char *offload);
70 bool	portal_group_set_pcp(u_int pcp);
71 bool	portal_group_set_redirection(const char *addr);
72 void	portal_group_set_tag(uint16_t tag);
73 
74 bool	transport_group_start(const char *name);
75 bool	transport_group_add_listen_discovery_tcp(const char *listen);
76 bool	transport_group_add_listen_tcp(const char *listen);
77 
78 bool	target_start(const char *name);
79 void	target_finish(void);
80 bool	target_add_chap(const char *user, const char *secret);
81 bool	target_add_chap_mutual(const char *user, const char *secret,
82 	    const char *user2, const char *secret2);
83 bool	target_add_initiator_name(const char *name);
84 bool	target_add_initiator_portal(const char *addr);
85 bool	target_add_lun(u_int id, const char *name);
86 bool	target_add_portal_group(const char *pg_name, const char *ag_name);
87 bool	target_set_alias(const char *alias);
88 bool	target_set_auth_group(const char *name);
89 bool	target_set_auth_type(const char *type);
90 bool	target_set_physical_port(const char *pport);
91 bool	target_set_redirection(const char *addr);
92 bool	target_start_lun(u_int id);
93 
94 bool	controller_start(const char *name);
95 bool	controller_add_host_address(const char *addr);
96 bool	controller_add_host_nqn(const char *name);
97 bool	controller_add_namespace(u_int id, const char *name);
98 bool	controller_start_namespace(u_int id);
99 
100 bool	lun_start(const char *name);
101 void	lun_finish(void);
102 bool	lun_add_option(const char *name, const char *value);
103 bool	lun_set_backend(const char *value);
104 bool	lun_set_blocksize(size_t value);
105 bool	lun_set_ctl_lun(uint32_t value);
106 bool	lun_set_device_id(const char *value);
107 bool	lun_set_device_type(const char *value);
108 bool	lun_set_path(const char *value);
109 bool	lun_set_serial(const char *value);
110 bool	lun_set_size(uint64_t value);
111 
112 bool	yyparse_conf(FILE *fp);
113 
114 __END_DECLS
115 
116 #endif /* !__CONF_H__ */
117