xref: /freebsd/usr.sbin/iscsid/iscsid.h (revision 6378393308bc6bd81fb871dacf6b03cf1a390d8b)
1009ea47eSEdward Tomasz Napierala /*-
21de7b4b8SPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
31de7b4b8SPedro F. Giffuni  *
4009ea47eSEdward Tomasz Napierala  * Copyright (c) 2012 The FreeBSD Foundation
5009ea47eSEdward Tomasz Napierala  *
6009ea47eSEdward Tomasz Napierala  * This software was developed by Edward Tomasz Napierala under sponsorship
7009ea47eSEdward Tomasz Napierala  * from the FreeBSD Foundation.
8009ea47eSEdward Tomasz Napierala  *
9009ea47eSEdward Tomasz Napierala  * Redistribution and use in source and binary forms, with or without
10009ea47eSEdward Tomasz Napierala  * modification, are permitted provided that the following conditions
11009ea47eSEdward Tomasz Napierala  * are met:
12009ea47eSEdward Tomasz Napierala  * 1. Redistributions of source code must retain the above copyright
13009ea47eSEdward Tomasz Napierala  *    notice, this list of conditions and the following disclaimer.
14009ea47eSEdward Tomasz Napierala  * 2. Redistributions in binary form must reproduce the above copyright
15009ea47eSEdward Tomasz Napierala  *    notice, this list of conditions and the following disclaimer in the
16009ea47eSEdward Tomasz Napierala  *    documentation and/or other materials provided with the distribution.
17009ea47eSEdward Tomasz Napierala  *
18009ea47eSEdward Tomasz Napierala  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19009ea47eSEdward Tomasz Napierala  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20009ea47eSEdward Tomasz Napierala  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21009ea47eSEdward Tomasz Napierala  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22009ea47eSEdward Tomasz Napierala  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23009ea47eSEdward Tomasz Napierala  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24009ea47eSEdward Tomasz Napierala  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25009ea47eSEdward Tomasz Napierala  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26009ea47eSEdward Tomasz Napierala  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27009ea47eSEdward Tomasz Napierala  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28009ea47eSEdward Tomasz Napierala  * SUCH DAMAGE.
29009ea47eSEdward Tomasz Napierala  *
30009ea47eSEdward Tomasz Napierala  * $FreeBSD$
31009ea47eSEdward Tomasz Napierala  */
32009ea47eSEdward Tomasz Napierala 
33009ea47eSEdward Tomasz Napierala #ifndef ISCSID_H
34009ea47eSEdward Tomasz Napierala #define	ISCSID_H
35009ea47eSEdward Tomasz Napierala 
36009ea47eSEdward Tomasz Napierala #include <stdbool.h>
37009ea47eSEdward Tomasz Napierala #include <stdint.h>
38009ea47eSEdward Tomasz Napierala 
39009ea47eSEdward Tomasz Napierala #include <iscsi_ioctl.h>
40*63783933SJohn Baldwin #include <libiscsiutil.h>
41009ea47eSEdward Tomasz Napierala 
42009ea47eSEdward Tomasz Napierala #define	DEFAULT_PIDFILE			"/var/run/iscsid.pid"
43009ea47eSEdward Tomasz Napierala 
44009ea47eSEdward Tomasz Napierala #define	CONN_MUTUAL_CHALLENGE_LEN	1024
458b94b583SAlexander Motin #define	SOCKBUF_SIZE			1048576
46009ea47eSEdward Tomasz Napierala 
47*63783933SJohn Baldwin struct iscsid_connection {
48*63783933SJohn Baldwin 	struct connection	conn;
49009ea47eSEdward Tomasz Napierala 	int			conn_iscsi_fd;
50009ea47eSEdward Tomasz Napierala 	unsigned int		conn_session_id;
51009ea47eSEdward Tomasz Napierala 	struct iscsi_session_conf	conn_conf;
5282babffbSEdward Tomasz Napierala 	struct iscsi_session_limits	conn_limits;
53009ea47eSEdward Tomasz Napierala 	char			conn_target_alias[ISCSI_ADDR_LEN];
547dbbd1aeSAlexander Motin 	int			conn_protocol_level;
55009ea47eSEdward Tomasz Napierala 	bool			conn_initial_r2t;
5645078155SEdward Tomasz Napierala 	struct chap		*conn_mutual_chap;
57009ea47eSEdward Tomasz Napierala };
58009ea47eSEdward Tomasz Napierala 
59*63783933SJohn Baldwin void			login(struct iscsid_connection *ic);
60009ea47eSEdward Tomasz Napierala 
61*63783933SJohn Baldwin void			discovery(struct iscsid_connection *ic);
62009ea47eSEdward Tomasz Napierala 
63009ea47eSEdward Tomasz Napierala void			fail(const struct connection *, const char *);
64009ea47eSEdward Tomasz Napierala 
65009ea47eSEdward Tomasz Napierala #endif /* !ISCSID_H */
66