11638Srgrimes/*-
21638Srgrimes * SPDX-License-Identifier: BSD-2-Clause
31638Srgrimes *
41638Srgrimes * Copyright (c) 2012 The FreeBSD Foundation
51638Srgrimes *
61638Srgrimes * This software was developed by Edward Tomasz Napierala under sponsorship
71638Srgrimes * from the FreeBSD Foundation.
81638Srgrimes *
91638Srgrimes * Redistribution and use in source and binary forms, with or without
101638Srgrimes * modification, are permitted provided that the following conditions
111638Srgrimes * are met:
121638Srgrimes * 1. Redistributions of source code must retain the above copyright
131638Srgrimes *    notice, this list of conditions and the following disclaimer.
141638Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
151638Srgrimes *    notice, this list of conditions and the following disclaimer in the
161638Srgrimes *    documentation and/or other materials provided with the distribution.
171638Srgrimes *
181638Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
191638Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
201638Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
211638Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
221638Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
231638Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
241638Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
251638Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
261638Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
271638Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
281638Srgrimes * SUCH DAMAGE.
291638Srgrimes */
301638Srgrimes
311638Srgrimes#ifndef ISCSID_H
321638Srgrimes#define	ISCSID_H
331638Srgrimes
341638Srgrimes#include <stdbool.h>
351638Srgrimes#include <stdint.h>
361638Srgrimes
371638Srgrimes#include <iscsi_ioctl.h>
381638Srgrimes#include <libiscsiutil.h>
391638Srgrimes
401638Srgrimes#define	DEFAULT_PIDFILE			"/var/run/iscsid.pid"
411638Srgrimes
421638Srgrimes#define	CONN_MUTUAL_CHALLENGE_LEN	1024
431638Srgrimes#define	SOCKBUF_SIZE			1048576
441638Srgrimes
451638Srgrimesstruct iscsid_connection {
461638Srgrimes	struct connection	conn;
471638Srgrimes	int			conn_iscsi_fd;
481638Srgrimes	unsigned int		conn_session_id;
491638Srgrimes	struct iscsi_session_conf	conn_conf;
501638Srgrimes	struct iscsi_session_limits	conn_limits;
511638Srgrimes	char			conn_target_alias[ISCSI_ADDR_LEN];
521638Srgrimes	int			conn_protocol_level;
531638Srgrimes	bool			conn_initial_r2t;
541638Srgrimes	struct chap		*conn_mutual_chap;
551638Srgrimes};
561638Srgrimes
571638Srgrimesvoid			login(struct iscsid_connection *ic);
581638Srgrimes
591638Srgrimesvoid			discovery(struct iscsid_connection *ic);
601638Srgrimes
611638Srgrimesvoid			fail(const struct connection *, const char *);
621638Srgrimes
631638Srgrimes#endif /* !ISCSID_H */
641638Srgrimes