2 * Copyright (c) 2012 The FreeBSD Foundation
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #include <sys/queue.h>
39 #define DEFAULT_CONFIG_PATH "/etc/iscsi.conf"
40 #define DEFAULT_IQN "iqn.1994-09.org.freebsd:"
42 #define MAX_NAME_LEN 223
43 #define MAX_DATA_SEGMENT_LENGTH 65536
45 #define AUTH_METHOD_UNSPECIFIED 0
46 #define AUTH_METHOD_NONE 1
47 #define AUTH_METHOD_CHAP 2
49 #define DIGEST_UNSPECIFIED 0
51 #define DIGEST_CRC32C 2
53 #define SESSION_TYPE_UNSPECIFIED 0
54 #define SESSION_TYPE_NORMAL 1
55 #define SESSION_TYPE_DISCOVERY 2
57 #define PROTOCOL_UNSPECIFIED 0
58 #define PROTOCOL_ISCSI 1
59 #define PROTOCOL_ISER 2
62 TAILQ_ENTRY(target) t_next;
67 char *t_initiator_name;
68 char *t_initiator_address;
69 char *t_initiator_alias;
78 char *t_mutual_secret;
82 TAILQ_HEAD(, target) conf_targets;
85 #define CONN_SESSION_TYPE_NONE 0
86 #define CONN_SESSION_TYPE_DISCOVERY 1
87 #define CONN_SESSION_TYPE_NORMAL 2
90 struct target *conn_target;
92 int conn_session_type;
95 size_t conn_max_data_segment_length;
96 size_t conn_max_burst_length;
97 size_t conn_max_outstanding_r2t;
98 int conn_header_digest;
102 struct conf *conf_new(void);
103 struct conf *conf_new_from_file(const char *path);
104 void conf_delete(struct conf *conf);
105 void conf_verify(struct conf *conf);
107 struct target *target_new(struct conf *conf);
108 struct target *target_find(struct conf *conf, const char *nickname);
109 void target_delete(struct target *ic);
111 void print_periphs(int session_id);
113 char *checked_strdup(const char *);
114 bool valid_iscsi_name(const char *name);
116 #endif /* !ISCSICTL_H */