xref: /freebsd/usr.sbin/iscsid/iscsid.h (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1009ea47eSEdward Tomasz Napierala /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
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 
31009ea47eSEdward Tomasz Napierala #ifndef ISCSID_H
32009ea47eSEdward Tomasz Napierala #define	ISCSID_H
33009ea47eSEdward Tomasz Napierala 
34009ea47eSEdward Tomasz Napierala #include <stdbool.h>
35009ea47eSEdward Tomasz Napierala #include <stdint.h>
36009ea47eSEdward Tomasz Napierala 
37009ea47eSEdward Tomasz Napierala #include <iscsi_ioctl.h>
3863783933SJohn Baldwin #include <libiscsiutil.h>
39009ea47eSEdward Tomasz Napierala 
40009ea47eSEdward Tomasz Napierala #define	DEFAULT_PIDFILE			"/var/run/iscsid.pid"
41009ea47eSEdward Tomasz Napierala 
42009ea47eSEdward Tomasz Napierala #define	CONN_MUTUAL_CHALLENGE_LEN	1024
438b94b583SAlexander Motin #define	SOCKBUF_SIZE			1048576
44009ea47eSEdward Tomasz Napierala 
4563783933SJohn Baldwin struct iscsid_connection {
4663783933SJohn Baldwin 	struct connection	conn;
47009ea47eSEdward Tomasz Napierala 	int			conn_iscsi_fd;
48009ea47eSEdward Tomasz Napierala 	unsigned int		conn_session_id;
49009ea47eSEdward Tomasz Napierala 	struct iscsi_session_conf	conn_conf;
5082babffbSEdward Tomasz Napierala 	struct iscsi_session_limits	conn_limits;
51009ea47eSEdward Tomasz Napierala 	char			conn_target_alias[ISCSI_ADDR_LEN];
527dbbd1aeSAlexander Motin 	int			conn_protocol_level;
53009ea47eSEdward Tomasz Napierala 	bool			conn_initial_r2t;
5445078155SEdward Tomasz Napierala 	struct chap		*conn_mutual_chap;
55009ea47eSEdward Tomasz Napierala };
56009ea47eSEdward Tomasz Napierala 
5763783933SJohn Baldwin void			login(struct iscsid_connection *ic);
58009ea47eSEdward Tomasz Napierala 
5963783933SJohn Baldwin void			discovery(struct iscsid_connection *ic);
60009ea47eSEdward Tomasz Napierala 
61009ea47eSEdward Tomasz Napierala void			fail(const struct connection *, const char *);
62009ea47eSEdward Tomasz Napierala 
63009ea47eSEdward Tomasz Napierala #endif /* !ISCSID_H */
64