1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 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. 16 * 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 27 * SUCH DAMAGE. 28 *
| 1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 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. 16 * 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 27 * SUCH DAMAGE. 28 *
|
29 * $FreeBSD: stable/10/usr.sbin/ctld/ctld.h 279006 2015-02-19 14:52:01Z mav $
| 29 * $FreeBSD: stable/10/usr.sbin/ctld/ctld.h 279055 2015-02-20 17:09:49Z mav $
|
30 */ 31 32#ifndef CTLD_H 33#define CTLD_H 34 35#include <sys/queue.h> 36#ifdef ICL_KERNEL_PROXY 37#include <sys/types.h> 38#endif 39#include <sys/socket.h> 40#include <stdbool.h> 41#include <libutil.h> 42#include <openssl/md5.h> 43 44#define DEFAULT_CONFIG_PATH "/etc/ctl.conf" 45#define DEFAULT_PIDFILE "/var/run/ctld.pid" 46#define DEFAULT_BLOCKSIZE 512 47 48#define MAX_LUNS 1024 49#define MAX_NAME_LEN 223 50#define MAX_DATA_SEGMENT_LENGTH (128 * 1024) 51#define MAX_BURST_LENGTH 16776192 52#define SOCKBUF_SIZE 1048576 53 54struct auth { 55 TAILQ_ENTRY(auth) a_next; 56 struct auth_group *a_auth_group; 57 char *a_user; 58 char *a_secret; 59 char *a_mutual_user; 60 char *a_mutual_secret; 61}; 62 63struct auth_name { 64 TAILQ_ENTRY(auth_name) an_next; 65 struct auth_group *an_auth_group; 66 char *an_initator_name; 67}; 68 69struct auth_portal { 70 TAILQ_ENTRY(auth_portal) ap_next; 71 struct auth_group *ap_auth_group; 72 char *ap_initator_portal; 73 struct sockaddr_storage ap_sa; 74 int ap_mask; 75}; 76 77#define AG_TYPE_UNKNOWN 0 78#define AG_TYPE_DENY 1 79#define AG_TYPE_NO_AUTHENTICATION 2 80#define AG_TYPE_CHAP 3 81#define AG_TYPE_CHAP_MUTUAL 4 82 83struct auth_group { 84 TAILQ_ENTRY(auth_group) ag_next; 85 struct conf *ag_conf; 86 char *ag_name; 87 struct target *ag_target; 88 int ag_type; 89 TAILQ_HEAD(, auth) ag_auths; 90 TAILQ_HEAD(, auth_name) ag_names; 91 TAILQ_HEAD(, auth_portal) ag_portals; 92}; 93 94struct portal { 95 TAILQ_ENTRY(portal) p_next; 96 struct portal_group *p_portal_group; 97 bool p_iser; 98 char *p_listen; 99 struct addrinfo *p_ai; 100#ifdef ICL_KERNEL_PROXY 101 int p_id; 102#endif 103 104 TAILQ_HEAD(, target) p_targets; 105 int p_socket; 106}; 107 108#define PG_FILTER_UNKNOWN 0 109#define PG_FILTER_NONE 1 110#define PG_FILTER_PORTAL 2 111#define PG_FILTER_PORTAL_NAME 3 112#define PG_FILTER_PORTAL_NAME_AUTH 4 113 114struct portal_group { 115 TAILQ_ENTRY(portal_group) pg_next; 116 struct conf *pg_conf; 117 char *pg_name; 118 struct auth_group *pg_discovery_auth_group; 119 int pg_discovery_filter; 120 bool pg_unassigned; 121 TAILQ_HEAD(, portal) pg_portals; 122 TAILQ_HEAD(, port) pg_ports; 123 char *pg_redirection; 124 125 uint16_t pg_tag; 126}; 127
| 30 */ 31 32#ifndef CTLD_H 33#define CTLD_H 34 35#include <sys/queue.h> 36#ifdef ICL_KERNEL_PROXY 37#include <sys/types.h> 38#endif 39#include <sys/socket.h> 40#include <stdbool.h> 41#include <libutil.h> 42#include <openssl/md5.h> 43 44#define DEFAULT_CONFIG_PATH "/etc/ctl.conf" 45#define DEFAULT_PIDFILE "/var/run/ctld.pid" 46#define DEFAULT_BLOCKSIZE 512 47 48#define MAX_LUNS 1024 49#define MAX_NAME_LEN 223 50#define MAX_DATA_SEGMENT_LENGTH (128 * 1024) 51#define MAX_BURST_LENGTH 16776192 52#define SOCKBUF_SIZE 1048576 53 54struct auth { 55 TAILQ_ENTRY(auth) a_next; 56 struct auth_group *a_auth_group; 57 char *a_user; 58 char *a_secret; 59 char *a_mutual_user; 60 char *a_mutual_secret; 61}; 62 63struct auth_name { 64 TAILQ_ENTRY(auth_name) an_next; 65 struct auth_group *an_auth_group; 66 char *an_initator_name; 67}; 68 69struct auth_portal { 70 TAILQ_ENTRY(auth_portal) ap_next; 71 struct auth_group *ap_auth_group; 72 char *ap_initator_portal; 73 struct sockaddr_storage ap_sa; 74 int ap_mask; 75}; 76 77#define AG_TYPE_UNKNOWN 0 78#define AG_TYPE_DENY 1 79#define AG_TYPE_NO_AUTHENTICATION 2 80#define AG_TYPE_CHAP 3 81#define AG_TYPE_CHAP_MUTUAL 4 82 83struct auth_group { 84 TAILQ_ENTRY(auth_group) ag_next; 85 struct conf *ag_conf; 86 char *ag_name; 87 struct target *ag_target; 88 int ag_type; 89 TAILQ_HEAD(, auth) ag_auths; 90 TAILQ_HEAD(, auth_name) ag_names; 91 TAILQ_HEAD(, auth_portal) ag_portals; 92}; 93 94struct portal { 95 TAILQ_ENTRY(portal) p_next; 96 struct portal_group *p_portal_group; 97 bool p_iser; 98 char *p_listen; 99 struct addrinfo *p_ai; 100#ifdef ICL_KERNEL_PROXY 101 int p_id; 102#endif 103 104 TAILQ_HEAD(, target) p_targets; 105 int p_socket; 106}; 107 108#define PG_FILTER_UNKNOWN 0 109#define PG_FILTER_NONE 1 110#define PG_FILTER_PORTAL 2 111#define PG_FILTER_PORTAL_NAME 3 112#define PG_FILTER_PORTAL_NAME_AUTH 4 113 114struct portal_group { 115 TAILQ_ENTRY(portal_group) pg_next; 116 struct conf *pg_conf; 117 char *pg_name; 118 struct auth_group *pg_discovery_auth_group; 119 int pg_discovery_filter; 120 bool pg_unassigned; 121 TAILQ_HEAD(, portal) pg_portals; 122 TAILQ_HEAD(, port) pg_ports; 123 char *pg_redirection; 124 125 uint16_t pg_tag; 126}; 127
|
| 128struct pport { 129 TAILQ_ENTRY(pport) pp_next; 130 TAILQ_HEAD(, port) pp_ports; 131 struct conf *pp_conf; 132 char *pp_name; 133 134 uint32_t pp_ctl_port; 135}; 136
|
128struct port { 129 TAILQ_ENTRY(port) p_next; 130 TAILQ_ENTRY(port) p_pgs;
| 137struct port { 138 TAILQ_ENTRY(port) p_next; 139 TAILQ_ENTRY(port) p_pgs;
|
| 140 TAILQ_ENTRY(port) p_pps;
|
131 TAILQ_ENTRY(port) p_ts; 132 struct conf *p_conf; 133 char *p_name; 134 struct auth_group *p_auth_group; 135 struct portal_group *p_portal_group;
| 141 TAILQ_ENTRY(port) p_ts; 142 struct conf *p_conf; 143 char *p_name; 144 struct auth_group *p_auth_group; 145 struct portal_group *p_portal_group;
|
| 146 struct pport *p_pport;
|
136 struct target *p_target; 137 138 uint32_t p_ctl_port; 139}; 140 141struct lun_option { 142 TAILQ_ENTRY(lun_option) lo_next; 143 struct lun *lo_lun; 144 char *lo_name; 145 char *lo_value; 146}; 147 148struct lun { 149 TAILQ_ENTRY(lun) l_next; 150 struct conf *l_conf; 151 TAILQ_HEAD(, lun_option) l_options; 152 char *l_name; 153 char *l_backend; 154 int l_blocksize; 155 char *l_device_id; 156 char *l_path; 157 char *l_scsiname; 158 char *l_serial; 159 int64_t l_size; 160 161 int l_ctl_lun; 162}; 163 164struct target { 165 TAILQ_ENTRY(target) t_next; 166 struct conf *t_conf; 167 struct lun *t_luns[MAX_LUNS]; 168 struct auth_group *t_auth_group; 169 TAILQ_HEAD(, port) t_ports; 170 char *t_name; 171 char *t_alias; 172 char *t_redirection; 173}; 174 175struct isns { 176 TAILQ_ENTRY(isns) i_next; 177 struct conf *i_conf; 178 char *i_addr; 179 struct addrinfo *i_ai; 180}; 181 182struct conf { 183 char *conf_pidfile_path; 184 TAILQ_HEAD(, lun) conf_luns; 185 TAILQ_HEAD(, target) conf_targets; 186 TAILQ_HEAD(, auth_group) conf_auth_groups; 187 TAILQ_HEAD(, port) conf_ports; 188 TAILQ_HEAD(, portal_group) conf_portal_groups;
| 147 struct target *p_target; 148 149 uint32_t p_ctl_port; 150}; 151 152struct lun_option { 153 TAILQ_ENTRY(lun_option) lo_next; 154 struct lun *lo_lun; 155 char *lo_name; 156 char *lo_value; 157}; 158 159struct lun { 160 TAILQ_ENTRY(lun) l_next; 161 struct conf *l_conf; 162 TAILQ_HEAD(, lun_option) l_options; 163 char *l_name; 164 char *l_backend; 165 int l_blocksize; 166 char *l_device_id; 167 char *l_path; 168 char *l_scsiname; 169 char *l_serial; 170 int64_t l_size; 171 172 int l_ctl_lun; 173}; 174 175struct target { 176 TAILQ_ENTRY(target) t_next; 177 struct conf *t_conf; 178 struct lun *t_luns[MAX_LUNS]; 179 struct auth_group *t_auth_group; 180 TAILQ_HEAD(, port) t_ports; 181 char *t_name; 182 char *t_alias; 183 char *t_redirection; 184}; 185 186struct isns { 187 TAILQ_ENTRY(isns) i_next; 188 struct conf *i_conf; 189 char *i_addr; 190 struct addrinfo *i_ai; 191}; 192 193struct conf { 194 char *conf_pidfile_path; 195 TAILQ_HEAD(, lun) conf_luns; 196 TAILQ_HEAD(, target) conf_targets; 197 TAILQ_HEAD(, auth_group) conf_auth_groups; 198 TAILQ_HEAD(, port) conf_ports; 199 TAILQ_HEAD(, portal_group) conf_portal_groups;
|
| 200 TAILQ_HEAD(, pport) conf_pports;
|
189 TAILQ_HEAD(, isns) conf_isns; 190 int conf_isns_period; 191 int conf_isns_timeout; 192 int conf_debug; 193 int conf_timeout; 194 int conf_maxproc; 195 196#ifdef ICL_KERNEL_PROXY 197 int conf_portal_id; 198#endif 199 struct pidfh *conf_pidfh; 200 201 bool conf_default_pg_defined; 202 bool conf_default_ag_defined; 203 bool conf_kernel_port_on; 204}; 205 206#define CONN_SESSION_TYPE_NONE 0 207#define CONN_SESSION_TYPE_DISCOVERY 1 208#define CONN_SESSION_TYPE_NORMAL 2 209 210#define CONN_DIGEST_NONE 0 211#define CONN_DIGEST_CRC32C 1 212 213struct connection { 214 struct portal *conn_portal; 215 struct port *conn_port; 216 struct target *conn_target; 217 int conn_socket; 218 int conn_session_type; 219 char *conn_initiator_name; 220 char *conn_initiator_addr; 221 char *conn_initiator_alias; 222 uint8_t conn_initiator_isid[6]; 223 struct sockaddr_storage conn_initiator_sa; 224 uint32_t conn_cmdsn; 225 uint32_t conn_statsn; 226 size_t conn_max_data_segment_length; 227 size_t conn_max_burst_length; 228 int conn_immediate_data; 229 int conn_header_digest; 230 int conn_data_digest; 231 const char *conn_user; 232 struct chap *conn_chap; 233}; 234 235struct pdu { 236 struct connection *pdu_connection; 237 struct iscsi_bhs *pdu_bhs; 238 char *pdu_data; 239 size_t pdu_data_len; 240}; 241 242#define KEYS_MAX 1024 243 244struct keys { 245 char *keys_names[KEYS_MAX]; 246 char *keys_values[KEYS_MAX]; 247 char *keys_data; 248 size_t keys_data_len; 249}; 250 251#define CHAP_CHALLENGE_LEN 1024 252 253struct chap { 254 unsigned char chap_id; 255 char chap_challenge[CHAP_CHALLENGE_LEN]; 256 char chap_response[MD5_DIGEST_LENGTH]; 257}; 258 259struct rchap { 260 char *rchap_secret; 261 unsigned char rchap_id; 262 void *rchap_challenge; 263 size_t rchap_challenge_len; 264}; 265 266struct chap *chap_new(void); 267char *chap_get_id(const struct chap *chap); 268char *chap_get_challenge(const struct chap *chap); 269int chap_receive(struct chap *chap, const char *response); 270int chap_authenticate(struct chap *chap, 271 const char *secret); 272void chap_delete(struct chap *chap); 273 274struct rchap *rchap_new(const char *secret); 275int rchap_receive(struct rchap *rchap, 276 const char *id, const char *challenge); 277char *rchap_get_response(struct rchap *rchap); 278void rchap_delete(struct rchap *rchap); 279 280struct conf *conf_new(void);
| 201 TAILQ_HEAD(, isns) conf_isns; 202 int conf_isns_period; 203 int conf_isns_timeout; 204 int conf_debug; 205 int conf_timeout; 206 int conf_maxproc; 207 208#ifdef ICL_KERNEL_PROXY 209 int conf_portal_id; 210#endif 211 struct pidfh *conf_pidfh; 212 213 bool conf_default_pg_defined; 214 bool conf_default_ag_defined; 215 bool conf_kernel_port_on; 216}; 217 218#define CONN_SESSION_TYPE_NONE 0 219#define CONN_SESSION_TYPE_DISCOVERY 1 220#define CONN_SESSION_TYPE_NORMAL 2 221 222#define CONN_DIGEST_NONE 0 223#define CONN_DIGEST_CRC32C 1 224 225struct connection { 226 struct portal *conn_portal; 227 struct port *conn_port; 228 struct target *conn_target; 229 int conn_socket; 230 int conn_session_type; 231 char *conn_initiator_name; 232 char *conn_initiator_addr; 233 char *conn_initiator_alias; 234 uint8_t conn_initiator_isid[6]; 235 struct sockaddr_storage conn_initiator_sa; 236 uint32_t conn_cmdsn; 237 uint32_t conn_statsn; 238 size_t conn_max_data_segment_length; 239 size_t conn_max_burst_length; 240 int conn_immediate_data; 241 int conn_header_digest; 242 int conn_data_digest; 243 const char *conn_user; 244 struct chap *conn_chap; 245}; 246 247struct pdu { 248 struct connection *pdu_connection; 249 struct iscsi_bhs *pdu_bhs; 250 char *pdu_data; 251 size_t pdu_data_len; 252}; 253 254#define KEYS_MAX 1024 255 256struct keys { 257 char *keys_names[KEYS_MAX]; 258 char *keys_values[KEYS_MAX]; 259 char *keys_data; 260 size_t keys_data_len; 261}; 262 263#define CHAP_CHALLENGE_LEN 1024 264 265struct chap { 266 unsigned char chap_id; 267 char chap_challenge[CHAP_CHALLENGE_LEN]; 268 char chap_response[MD5_DIGEST_LENGTH]; 269}; 270 271struct rchap { 272 char *rchap_secret; 273 unsigned char rchap_id; 274 void *rchap_challenge; 275 size_t rchap_challenge_len; 276}; 277 278struct chap *chap_new(void); 279char *chap_get_id(const struct chap *chap); 280char *chap_get_challenge(const struct chap *chap); 281int chap_receive(struct chap *chap, const char *response); 282int chap_authenticate(struct chap *chap, 283 const char *secret); 284void chap_delete(struct chap *chap); 285 286struct rchap *rchap_new(const char *secret); 287int rchap_receive(struct rchap *rchap, 288 const char *id, const char *challenge); 289char *rchap_get_response(struct rchap *rchap); 290void rchap_delete(struct rchap *rchap); 291 292struct conf *conf_new(void);
|
281struct conf *conf_new_from_file(const char *path);
| 293struct conf *conf_new_from_file(const char *path, struct conf *old);
|
282struct conf *conf_new_from_kernel(void); 283void conf_delete(struct conf *conf); 284int conf_verify(struct conf *conf); 285 286struct auth_group *auth_group_new(struct conf *conf, const char *name); 287void auth_group_delete(struct auth_group *ag); 288struct auth_group *auth_group_find(const struct conf *conf, 289 const char *name); 290int auth_group_set_type(struct auth_group *ag, 291 const char *type); 292 293const struct auth *auth_new_chap(struct auth_group *ag, 294 const char *user, const char *secret); 295const struct auth *auth_new_chap_mutual(struct auth_group *ag, 296 const char *user, const char *secret, 297 const char *user2, const char *secret2); 298const struct auth *auth_find(const struct auth_group *ag, 299 const char *user); 300 301const struct auth_name *auth_name_new(struct auth_group *ag, 302 const char *initiator_name); 303bool auth_name_defined(const struct auth_group *ag); 304const struct auth_name *auth_name_find(const struct auth_group *ag, 305 const char *initiator_name); 306int auth_name_check(const struct auth_group *ag, 307 const char *initiator_name); 308 309const struct auth_portal *auth_portal_new(struct auth_group *ag, 310 const char *initiator_portal); 311bool auth_portal_defined(const struct auth_group *ag); 312const struct auth_portal *auth_portal_find(const struct auth_group *ag, 313 const struct sockaddr_storage *sa); 314int auth_portal_check(const struct auth_group *ag, 315 const struct sockaddr_storage *sa); 316 317struct portal_group *portal_group_new(struct conf *conf, const char *name); 318void portal_group_delete(struct portal_group *pg); 319struct portal_group *portal_group_find(const struct conf *conf, 320 const char *name); 321int portal_group_add_listen(struct portal_group *pg, 322 const char *listen, bool iser); 323int portal_group_set_filter(struct portal_group *pg, 324 const char *filter); 325int portal_group_set_redirection(struct portal_group *pg, 326 const char *addr); 327 328int isns_new(struct conf *conf, const char *addr); 329void isns_delete(struct isns *is); 330void isns_register(struct isns *isns, struct isns *oldisns); 331void isns_check(struct isns *isns); 332void isns_deregister(struct isns *isns); 333
| 294struct conf *conf_new_from_kernel(void); 295void conf_delete(struct conf *conf); 296int conf_verify(struct conf *conf); 297 298struct auth_group *auth_group_new(struct conf *conf, const char *name); 299void auth_group_delete(struct auth_group *ag); 300struct auth_group *auth_group_find(const struct conf *conf, 301 const char *name); 302int auth_group_set_type(struct auth_group *ag, 303 const char *type); 304 305const struct auth *auth_new_chap(struct auth_group *ag, 306 const char *user, const char *secret); 307const struct auth *auth_new_chap_mutual(struct auth_group *ag, 308 const char *user, const char *secret, 309 const char *user2, const char *secret2); 310const struct auth *auth_find(const struct auth_group *ag, 311 const char *user); 312 313const struct auth_name *auth_name_new(struct auth_group *ag, 314 const char *initiator_name); 315bool auth_name_defined(const struct auth_group *ag); 316const struct auth_name *auth_name_find(const struct auth_group *ag, 317 const char *initiator_name); 318int auth_name_check(const struct auth_group *ag, 319 const char *initiator_name); 320 321const struct auth_portal *auth_portal_new(struct auth_group *ag, 322 const char *initiator_portal); 323bool auth_portal_defined(const struct auth_group *ag); 324const struct auth_portal *auth_portal_find(const struct auth_group *ag, 325 const struct sockaddr_storage *sa); 326int auth_portal_check(const struct auth_group *ag, 327 const struct sockaddr_storage *sa); 328 329struct portal_group *portal_group_new(struct conf *conf, const char *name); 330void portal_group_delete(struct portal_group *pg); 331struct portal_group *portal_group_find(const struct conf *conf, 332 const char *name); 333int portal_group_add_listen(struct portal_group *pg, 334 const char *listen, bool iser); 335int portal_group_set_filter(struct portal_group *pg, 336 const char *filter); 337int portal_group_set_redirection(struct portal_group *pg, 338 const char *addr); 339 340int isns_new(struct conf *conf, const char *addr); 341void isns_delete(struct isns *is); 342void isns_register(struct isns *isns, struct isns *oldisns); 343void isns_check(struct isns *isns); 344void isns_deregister(struct isns *isns); 345
|
| 346struct pport *pport_new(struct conf *conf, const char *name, 347 uint32_t ctl_port); 348struct pport *pport_find(const struct conf *conf, const char *name); 349struct pport *pport_copy(struct pport *pport, struct conf *conf); 350void pport_delete(struct pport *pport); 351
|
334struct port *port_new(struct conf *conf, struct target *target, 335 struct portal_group *pg);
| 352struct port *port_new(struct conf *conf, struct target *target, 353 struct portal_group *pg);
|
| 354struct port *port_new_pp(struct conf *conf, struct target *target, 355 struct pport *pp);
|
336struct port *port_find(const struct conf *conf, const char *name); 337struct port *port_find_in_pg(const struct portal_group *pg, 338 const char *target); 339void port_delete(struct port *port); 340 341struct target *target_new(struct conf *conf, const char *name); 342void target_delete(struct target *target); 343struct target *target_find(struct conf *conf, 344 const char *name); 345int target_set_redirection(struct target *target, 346 const char *addr); 347 348struct lun *lun_new(struct conf *conf, const char *name); 349void lun_delete(struct lun *lun); 350struct lun *lun_find(const struct conf *conf, const char *name); 351void lun_set_backend(struct lun *lun, const char *value); 352void lun_set_blocksize(struct lun *lun, size_t value); 353void lun_set_device_id(struct lun *lun, const char *value); 354void lun_set_path(struct lun *lun, const char *value); 355void lun_set_scsiname(struct lun *lun, const char *value); 356void lun_set_serial(struct lun *lun, const char *value); 357void lun_set_size(struct lun *lun, size_t value); 358void lun_set_ctl_lun(struct lun *lun, uint32_t value); 359 360struct lun_option *lun_option_new(struct lun *lun, 361 const char *name, const char *value); 362void lun_option_delete(struct lun_option *clo); 363struct lun_option *lun_option_find(const struct lun *lun, 364 const char *name); 365void lun_option_set(struct lun_option *clo, 366 const char *value); 367 368void kernel_init(void); 369int kernel_lun_add(struct lun *lun); 370int kernel_lun_resize(struct lun *lun); 371int kernel_lun_remove(struct lun *lun); 372void kernel_handoff(struct connection *conn); 373int kernel_port_add(struct port *port); 374int kernel_port_update(struct port *port); 375int kernel_port_remove(struct port *port); 376void kernel_capsicate(void); 377 378#ifdef ICL_KERNEL_PROXY 379void kernel_listen(struct addrinfo *ai, bool iser, 380 int portal_id); 381void kernel_accept(int *connection_id, int *portal_id, 382 struct sockaddr *client_sa, 383 socklen_t *client_salen); 384void kernel_send(struct pdu *pdu); 385void kernel_receive(struct pdu *pdu); 386#endif 387 388struct keys *keys_new(void); 389void keys_delete(struct keys *keys); 390void keys_load(struct keys *keys, const struct pdu *pdu); 391void keys_save(struct keys *keys, struct pdu *pdu); 392const char *keys_find(struct keys *keys, const char *name); 393int keys_find_int(struct keys *keys, const char *name); 394void keys_add(struct keys *keys, 395 const char *name, const char *value); 396void keys_add_int(struct keys *keys, 397 const char *name, int value); 398 399struct pdu *pdu_new(struct connection *conn); 400struct pdu *pdu_new_response(struct pdu *request); 401void pdu_delete(struct pdu *pdu); 402void pdu_receive(struct pdu *request); 403void pdu_send(struct pdu *response); 404 405void login(struct connection *conn); 406 407void discovery(struct connection *conn); 408 409void log_init(int level); 410void log_set_peer_name(const char *name); 411void log_set_peer_addr(const char *addr); 412void log_err(int, const char *, ...) 413 __dead2 __printflike(2, 3); 414void log_errx(int, const char *, ...) 415 __dead2 __printflike(2, 3); 416void log_warn(const char *, ...) __printflike(1, 2); 417void log_warnx(const char *, ...) __printflike(1, 2); 418void log_debugx(const char *, ...) __printflike(1, 2); 419 420char *checked_strdup(const char *); 421bool valid_iscsi_name(const char *name); 422void set_timeout(int timeout, int fatal); 423bool timed_out(void); 424 425#endif /* !CTLD_H */
| 356struct port *port_find(const struct conf *conf, const char *name); 357struct port *port_find_in_pg(const struct portal_group *pg, 358 const char *target); 359void port_delete(struct port *port); 360 361struct target *target_new(struct conf *conf, const char *name); 362void target_delete(struct target *target); 363struct target *target_find(struct conf *conf, 364 const char *name); 365int target_set_redirection(struct target *target, 366 const char *addr); 367 368struct lun *lun_new(struct conf *conf, const char *name); 369void lun_delete(struct lun *lun); 370struct lun *lun_find(const struct conf *conf, const char *name); 371void lun_set_backend(struct lun *lun, const char *value); 372void lun_set_blocksize(struct lun *lun, size_t value); 373void lun_set_device_id(struct lun *lun, const char *value); 374void lun_set_path(struct lun *lun, const char *value); 375void lun_set_scsiname(struct lun *lun, const char *value); 376void lun_set_serial(struct lun *lun, const char *value); 377void lun_set_size(struct lun *lun, size_t value); 378void lun_set_ctl_lun(struct lun *lun, uint32_t value); 379 380struct lun_option *lun_option_new(struct lun *lun, 381 const char *name, const char *value); 382void lun_option_delete(struct lun_option *clo); 383struct lun_option *lun_option_find(const struct lun *lun, 384 const char *name); 385void lun_option_set(struct lun_option *clo, 386 const char *value); 387 388void kernel_init(void); 389int kernel_lun_add(struct lun *lun); 390int kernel_lun_resize(struct lun *lun); 391int kernel_lun_remove(struct lun *lun); 392void kernel_handoff(struct connection *conn); 393int kernel_port_add(struct port *port); 394int kernel_port_update(struct port *port); 395int kernel_port_remove(struct port *port); 396void kernel_capsicate(void); 397 398#ifdef ICL_KERNEL_PROXY 399void kernel_listen(struct addrinfo *ai, bool iser, 400 int portal_id); 401void kernel_accept(int *connection_id, int *portal_id, 402 struct sockaddr *client_sa, 403 socklen_t *client_salen); 404void kernel_send(struct pdu *pdu); 405void kernel_receive(struct pdu *pdu); 406#endif 407 408struct keys *keys_new(void); 409void keys_delete(struct keys *keys); 410void keys_load(struct keys *keys, const struct pdu *pdu); 411void keys_save(struct keys *keys, struct pdu *pdu); 412const char *keys_find(struct keys *keys, const char *name); 413int keys_find_int(struct keys *keys, const char *name); 414void keys_add(struct keys *keys, 415 const char *name, const char *value); 416void keys_add_int(struct keys *keys, 417 const char *name, int value); 418 419struct pdu *pdu_new(struct connection *conn); 420struct pdu *pdu_new_response(struct pdu *request); 421void pdu_delete(struct pdu *pdu); 422void pdu_receive(struct pdu *request); 423void pdu_send(struct pdu *response); 424 425void login(struct connection *conn); 426 427void discovery(struct connection *conn); 428 429void log_init(int level); 430void log_set_peer_name(const char *name); 431void log_set_peer_addr(const char *addr); 432void log_err(int, const char *, ...) 433 __dead2 __printflike(2, 3); 434void log_errx(int, const char *, ...) 435 __dead2 __printflike(2, 3); 436void log_warn(const char *, ...) __printflike(1, 2); 437void log_warnx(const char *, ...) __printflike(1, 2); 438void log_debugx(const char *, ...) __printflike(1, 2); 439 440char *checked_strdup(const char *); 441bool valid_iscsi_name(const char *name); 442void set_timeout(int timeout, int fatal); 443bool timed_out(void); 444 445#endif /* !CTLD_H */
|