Home | History | Annotate | Line # | Download | only in iscsid
iscsid_globals.h revision 1.2
      1  1.2  christos /*	$NetBSD: iscsid_globals.h,v 1.2 2011/10/29 16:54:49 christos Exp $	*/
      2  1.1       agc 
      3  1.1       agc /*-
      4  1.1       agc  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
      5  1.1       agc  * All rights reserved.
      6  1.1       agc  *
      7  1.1       agc  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1       agc  * by Wasabi Systems, Inc.
      9  1.1       agc  *
     10  1.1       agc  * Redistribution and use in source and binary forms, with or without
     11  1.1       agc  * modification, are permitted provided that the following conditions
     12  1.1       agc  * are met:
     13  1.1       agc  * 1. Redistributions of source code must retain the above copyright
     14  1.1       agc  *    notice, this list of conditions and the following disclaimer.
     15  1.1       agc  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1       agc  *    notice, this list of conditions and the following disclaimer in the
     17  1.1       agc  *    documentation and/or other materials provided with the distribution.
     18  1.1       agc  *
     19  1.1       agc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.1       agc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.1       agc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.1       agc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.1       agc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.1       agc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.1       agc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.1       agc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.1       agc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.1       agc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.1       agc  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1       agc  */
     31  1.1       agc 
     32  1.1       agc #ifndef _ISCSID_GLOBALS_H
     33  1.1       agc #define _ISCSID_GLOBALS_H
     34  1.1       agc 
     35  1.1       agc #ifndef _THREAD_SAFE
     36  1.1       agc #define _THREAD_SAFE 1
     37  1.1       agc #endif
     38  1.1       agc 
     39  1.1       agc #include <sys/queue.h>
     40  1.1       agc #include <sys/scsiio.h>
     41  1.1       agc #include <sys/param.h>
     42  1.1       agc 
     43  1.1       agc #include <uvm/uvm_param.h>
     44  1.1       agc 
     45  1.1       agc #include <stdio.h>
     46  1.1       agc #include <stdlib.h>
     47  1.1       agc #include <string.h>
     48  1.1       agc #include <unistd.h>
     49  1.1       agc #include <errno.h>
     50  1.1       agc 
     51  1.1       agc #ifndef ISCSI_NOTHREAD
     52  1.1       agc #include <pthread.h>
     53  1.1       agc #endif
     54  1.1       agc 
     55  1.1       agc #include <iscsi.h>
     56  1.1       agc #include <iscsi_ioctl.h>
     57  1.1       agc 
     58  1.1       agc #include "iscsid.h"
     59  1.1       agc 
     60  1.1       agc /* -------------------------  Global Constants  ----------------------------- */
     61  1.1       agc 
     62  1.1       agc /* Version information */
     63  1.1       agc 
     64  1.1       agc #define INTERFACE_VERSION	2
     65  1.1       agc #define VERSION_MAJOR		3
     66  1.1       agc #define VERSION_MINOR		1
     67  1.1       agc #define VERSION_STRING		"NetBSD iSCSI Software Initiator Daemon 20110407 "
     68  1.1       agc 
     69  1.1       agc /* Sizes for the static request and response buffers. */
     70  1.1       agc /* 8k should be more than enough for both. */
     71  1.1       agc #define REQ_BUFFER_SIZE    8192
     72  1.1       agc #define RSP_BUFFER_SIZE    8192
     73  1.1       agc 
     74  1.1       agc #define ISCSI_DEFAULT_PORT 3260
     75  1.1       agc #define ISCSI_DEFAULT_ISNS_PORT 3205
     76  1.1       agc 
     77  1.1       agc /* ---------------------------  Global Types  ------------------------------- */
     78  1.1       agc 
     79  1.1       agc #ifndef TRUE
     80  1.1       agc typedef int boolean_t;
     81  1.1       agc #define	TRUE	1
     82  1.1       agc #define	FALSE	0
     83  1.1       agc #endif
     84  1.1       agc 
     85  1.1       agc 
     86  1.1       agc /*
     87  1.1       agc  * The generic list entry.
     88  1.1       agc  * Almost all lists in the daemon use this structure as the base for
     89  1.1       agc  * list processing. It contains both a numeric ID and a symbolic name.
     90  1.1       agc  * Using the same structure for all lists greatly simplifies processing.
     91  1.1       agc  *
     92  1.1       agc  * All structures that will be linked into searchable lists have to define
     93  1.1       agc  * their first structure field as "generic_entry_t entry".
     94  1.1       agc */
     95  1.1       agc 
     96  1.1       agc struct generic_entry_s
     97  1.1       agc {
     98  1.1       agc 	TAILQ_ENTRY(generic_entry_s) link;	/* the list link */
     99  1.1       agc 	iscsid_sym_id_t sid;		/* the entry ID and name */
    100  1.1       agc };
    101  1.1       agc 
    102  1.1       agc typedef struct generic_entry_s generic_entry_t;
    103  1.1       agc TAILQ_HEAD(generic_list_s, generic_entry_s);
    104  1.1       agc typedef struct generic_list_s generic_list_t;
    105  1.1       agc 
    106  1.1       agc /*
    107  1.1       agc  * The iSNS list structure.
    108  1.1       agc  * This structure contains the list of iSNS servers that have been added
    109  1.1       agc  */
    110  1.1       agc 
    111  1.1       agc struct isns_s
    112  1.1       agc {
    113  1.1       agc 	generic_entry_t entry;		/* global list link */
    114  1.1       agc 
    115  1.1       agc 	uint8_t address[ISCSI_ADDRESS_LENGTH];	/* iSNS Server Address */
    116  1.1       agc 	uint16_t port;				/* Port (0 = default) */
    117  1.1       agc 
    118  1.1       agc 	int sock;					/* socket if registered, else -1 */
    119  1.1       agc 	/* following fields only valid if sock >= 0 */
    120  1.1       agc 	uint8_t reg_iscsi_name[ISCSI_STRING_LENGTH];	/* Registered ISCSI Name */
    121  1.1       agc 	uint8_t reg_entity_id[ISCSI_STRING_LENGTH];	/* Registered Entity Identifier */
    122  1.1       agc 	uint8_t reg_ip_addr[16];	/* registered IP address */
    123  1.1       agc 	uint32_t reg_ip_port;		/* registered IP port */
    124  1.1       agc };
    125  1.1       agc 
    126  1.1       agc 
    127  1.1       agc TAILQ_HEAD(isns_list_s, isns_s);
    128  1.1       agc typedef struct isns_s isns_t;
    129  1.1       agc typedef struct isns_list_s isns_list_t;
    130  1.1       agc 
    131  1.1       agc 
    132  1.1       agc /*
    133  1.1       agc  *  The initiator portal list structure.
    134  1.1       agc  */
    135  1.1       agc 
    136  1.1       agc typedef struct initiator_s initiator_t;
    137  1.1       agc 
    138  1.1       agc struct initiator_s
    139  1.1       agc {
    140  1.1       agc 	generic_entry_t entry;		/* global list link */
    141  1.1       agc 
    142  1.1       agc 	uint8_t address[ISCSI_ADDRESS_LENGTH];	/* address */
    143  1.1       agc 	uint32_t active_connections;	/* connection count */
    144  1.1       agc };
    145  1.1       agc 
    146  1.1       agc TAILQ_HEAD(initiator_list_s, initiator_s);
    147  1.1       agc typedef struct initiator_list_s initiator_list_t;
    148  1.1       agc 
    149  1.1       agc 
    150  1.1       agc /*
    151  1.1       agc  * The portal structure.
    152  1.1       agc  * This structure is linked into two lists - a global portal list (this list
    153  1.1       agc  * is used for searches and to verify unique IDs) and a portal group list
    154  1.1       agc  * attached to the owning target.
    155  1.1       agc  */
    156  1.1       agc 
    157  1.1       agc typedef enum
    158  1.1       agc {
    159  1.1       agc 	PORTAL_TYPE_STATIC = 0,
    160  1.1       agc 	PORTAL_TYPE_SENDTARGET = 1,
    161  1.1       agc 	PORTAL_TYPE_ISNS = 2,
    162  1.1       agc 	PORTAL_TYPE_REFRESHING = 99
    163  1.1       agc } iscsi_portal_types_t;
    164  1.1       agc /*
    165  1.1       agc    PORTAL_TYPE_STATIC
    166  1.1       agc       Indicates that target was statically added
    167  1.1       agc    PORTAL_TYPE_SENDTARGET
    168  1.1       agc       Indicates that target was added as result of SendTargets discovery
    169  1.1       agc    PORTAL_TYPE_ISNS
    170  1.1       agc       Indicates that target was added as result of iSNS discovery
    171  1.1       agc    PORTAL_TYPE_REFRESHING
    172  1.1       agc       Discovered portals are set to this when we are refreshing
    173  1.1       agc       (via REFRESH_TARGETS). As a portal is discovered, its type is reset to
    174  1.1       agc       SENDTARGET or ISNS, so any portals which remain set to REFRESHING were not
    175  1.1       agc       discovered and thus can be removed.
    176  1.1       agc */
    177  1.1       agc 
    178  1.1       agc typedef struct portal_s portal_t;
    179  1.1       agc typedef struct portal_group_s portal_group_t;
    180  1.1       agc typedef struct target_s target_t;
    181  1.1       agc typedef struct send_target_s send_target_t;
    182  1.1       agc 
    183  1.1       agc struct portal_s
    184  1.1       agc {
    185  1.1       agc 	generic_entry_t entry;		/* global list link */
    186  1.1       agc 
    187  1.1       agc 	  TAILQ_ENTRY(portal_s) group_list;	/* group list link */
    188  1.1       agc 
    189  1.1       agc 	iscsi_portal_address_t addr;	/* address */
    190  1.1       agc 	iscsid_portal_options_t options; /* portal options (override target options) */
    191  1.1       agc 	target_t *target;			/* back pointer to target */
    192  1.1       agc 	portal_group_t *group;		/* back pointer to group head */
    193  1.1       agc 	iscsi_portal_types_t portaltype;   /* Type of portal (how it was discovered) */
    194  1.1       agc 	uint32_t discoveryid;		/* ID of sendtargets or isnsserver */
    195  1.1       agc 	uint32_t active_connections; /* Number of connections active on this portal */
    196  1.1       agc };
    197  1.1       agc 
    198  1.1       agc TAILQ_HEAD(portal_list_s, portal_s);
    199  1.1       agc typedef struct portal_list_s portal_list_t;
    200  1.1       agc 
    201  1.1       agc 
    202  1.1       agc /*
    203  1.1       agc  * The portal group structure.
    204  1.1       agc  * This structure is not searchable, and has no generic list entry field.
    205  1.1       agc  * It links all portals with the same group tag to the owning target.
    206  1.1       agc */
    207  1.1       agc 
    208  1.1       agc struct portal_group_s
    209  1.1       agc {
    210  1.1       agc 	TAILQ_ENTRY(portal_group_s) groups;	/* link to next group */
    211  1.1       agc 
    212  1.1       agc 	portal_list_t portals;		/* the list of portals for this tag */
    213  1.1       agc 
    214  1.1       agc 	uint32_t tag;				/* the group tag */
    215  1.1       agc 	u_short num_portals;		/* the number of portals in this list */
    216  1.1       agc };
    217  1.1       agc 
    218  1.1       agc TAILQ_HEAD(portal_group_list_s, portal_group_s);
    219  1.1       agc typedef struct portal_group_list_s portal_group_list_t;
    220  1.1       agc 
    221  1.1       agc 
    222  1.1       agc /*
    223  1.1       agc  * The target structure.
    224  1.1       agc  * Contains target information including connection and authentication options.
    225  1.1       agc  *****************************************************************************
    226  1.1       agc  * WARNING: This structure is used interchangeably with a send_target structure
    227  1.1       agc  *          in many routines dealing with targets to avoid duplicating code.
    228  1.1       agc  *          The first fields in both structures up to and including
    229  1.1       agc  *          the authentication options MUST match for this to work.
    230  1.1       agc  *          If you change one, you MUST change the other accordingly.
    231  1.1       agc  *****************************************************************************
    232  1.1       agc */
    233  1.1       agc 
    234  1.1       agc struct target_s
    235  1.1       agc {
    236  1.1       agc 	generic_entry_t entry;		/* global list link */
    237  1.1       agc 
    238  1.1       agc 	uint8_t TargetName[ISCSI_STRING_LENGTH];	/* TargetName */
    239  1.1       agc 	uint8_t TargetAlias[ISCSI_STRING_LENGTH];	/* TargetAlias */
    240  1.1       agc 
    241  1.1       agc 	u_short num_portals;		/* the number of portals */
    242  1.1       agc 	u_short num_groups;			/* the number of groups */
    243  1.1       agc 
    244  1.1       agc 	iscsid_get_set_target_options_t options;	/* connection options */
    245  1.1       agc 	iscsid_set_target_authentication_req_t auth;	/* authentication options */
    246  1.1       agc 
    247  1.1       agc 	portal_group_list_t group_list;	/* the list of portal groups */
    248  1.1       agc };
    249  1.1       agc 
    250  1.1       agc TAILQ_HEAD(target_list_s, target_s);
    251  1.1       agc typedef struct target_list_s target_list_t;
    252  1.1       agc 
    253  1.1       agc 
    254  1.1       agc /*
    255  1.1       agc  * The Send Target structure.
    256  1.1       agc  * Contains target information including connection and authentication options
    257  1.1       agc  * plus a single portal.
    258  1.1       agc  *****************************************************************************
    259  1.1       agc  * WARNING: This structure is used interchangeably with a target structure
    260  1.1       agc  *          in many routines dealing with targets to avoid duplicating code.
    261  1.1       agc  *          The first fields in both structures up to and including
    262  1.1       agc  *          the authentication options MUST match for this to work.
    263  1.1       agc  *          If you change one, you MUST change the other accordingly.
    264  1.1       agc  *****************************************************************************
    265  1.1       agc  */
    266  1.1       agc 
    267  1.1       agc struct send_target_s
    268  1.1       agc {
    269  1.1       agc 	generic_entry_t entry;		/* global list link */
    270  1.1       agc 
    271  1.1       agc 	uint8_t TargetName[ISCSI_STRING_LENGTH];	/* TargetName */
    272  1.1       agc 	uint8_t TargetAlias[ISCSI_STRING_LENGTH];	/* TargetAlias */
    273  1.1       agc 
    274  1.1       agc 	u_short num_portals;		/* the number of portals */
    275  1.1       agc 	u_short num_groups;			/* the number of groups */
    276  1.1       agc 	/* */
    277  1.1       agc 	iscsid_get_set_target_options_t options;	/* connection options */
    278  1.1       agc 	iscsid_set_target_authentication_req_t auth;	/* authentication options */
    279  1.1       agc 
    280  1.1       agc 	iscsi_portal_address_t addr;	/* address */
    281  1.1       agc };
    282  1.1       agc 
    283  1.1       agc TAILQ_HEAD(send_target_list_s, send_target_s);
    284  1.1       agc typedef struct send_target_list_s send_target_list_t;
    285  1.1       agc 
    286  1.1       agc /*
    287  1.1       agc    Target and Portal information maintained in the connection structure.
    288  1.1       agc */
    289  1.1       agc 
    290  1.1       agc struct target_info_s
    291  1.1       agc {
    292  1.1       agc 	iscsid_sym_id_t sid;		/* the entry ID and name */
    293  1.1       agc 	uint8_t TargetName[ISCSI_STRING_LENGTH];	/* TargetName */
    294  1.1       agc 	uint8_t TargetAlias[ISCSI_STRING_LENGTH];	/* TargetAlias */
    295  1.1       agc 	iscsid_get_set_target_options_t options;	/* connection options */
    296  1.1       agc 	iscsid_set_target_authentication_req_t auth;	/* authentication options */
    297  1.1       agc };
    298  1.1       agc typedef struct target_info_s target_info_t;
    299  1.1       agc 
    300  1.1       agc 
    301  1.1       agc struct portal_info_s
    302  1.1       agc {
    303  1.1       agc 	iscsid_sym_id_t sid;		/* the entry ID and name */
    304  1.1       agc 	iscsi_portal_address_t addr;	/* address */
    305  1.1       agc };
    306  1.1       agc typedef struct portal_info_s portal_info_t;
    307  1.1       agc 
    308  1.1       agc /*
    309  1.1       agc    Per connection data: the connection structure.
    310  1.1       agc */
    311  1.1       agc 
    312  1.1       agc typedef struct connection_s connection_t;
    313  1.1       agc typedef struct session_s session_t;
    314  1.1       agc 
    315  1.1       agc 
    316  1.1       agc struct connection_s
    317  1.1       agc {
    318  1.1       agc 	generic_entry_t entry;		/* connection list link */
    319  1.1       agc 
    320  1.1       agc 	session_t *session;			/* back pointer to the owning session */
    321  1.1       agc 	target_info_t target;		/* connected target */
    322  1.1       agc 	portal_info_t portal;		/* connected portal */
    323  1.1       agc 	uint32_t initiator_id;		/* connected initiator portal */
    324  1.1       agc 
    325  1.1       agc 	iscsi_login_parameters_t loginp;	/* Login parameters for recovery */
    326  1.1       agc };
    327  1.1       agc 
    328  1.1       agc 
    329  1.1       agc /*
    330  1.1       agc    Per session data: the session structure
    331  1.1       agc */
    332  1.1       agc 
    333  1.1       agc struct session_s
    334  1.1       agc {
    335  1.1       agc 	generic_entry_t entry;		/* global list link */
    336  1.1       agc 
    337  1.1       agc 	target_info_t target;		/* connected target */
    338  1.1       agc 	iscsi_login_session_type_t login_type;	/* session type */
    339  1.1       agc 
    340  1.1       agc 	uint32_t max_connections;	/* maximum connections */
    341  1.1       agc 	uint32_t num_connections;	/* currently active connections */
    342  1.1       agc 	generic_list_t connections;	/* the list of connections */
    343  1.1       agc };
    344  1.1       agc 
    345  1.1       agc /* the session list type */
    346  1.1       agc 
    347  1.1       agc TAILQ_HEAD(session_list_s, session_s);
    348  1.1       agc typedef struct session_list_s session_list_t;
    349  1.1       agc 
    350  1.1       agc 
    351  1.1       agc /* list head with entry count */
    352  1.1       agc 
    353  1.1       agc typedef struct
    354  1.1       agc {
    355  1.1       agc 	generic_list_t list;
    356  1.1       agc 	int num_entries;
    357  1.1       agc } list_head_t;
    358  1.1       agc 
    359  1.1       agc /* -------------------------  Global Variables  ----------------------------- */
    360  1.1       agc 
    361  1.1       agc /* In iscsid_main.c */
    362  1.1       agc 
    363  1.1       agc int driver;						/* the driver's file desc */
    364  1.1       agc int client_sock;				/* the client communication socket */
    365  1.1       agc 
    366  1.1       agc list_head_t list[NUM_DAEMON_LISTS];	/* the lists this daemon keeps */
    367  1.1       agc 
    368  1.1       agc #ifndef ISCSI_NOTHREAD
    369  1.1       agc pthread_t event_thread;			/* event handler thread ID */
    370  1.1       agc pthread_mutex_t sesslist_lock;	/* session list lock */
    371  1.1       agc #endif
    372  1.1       agc 
    373  1.1       agc /* in iscsid_discover.c */
    374  1.1       agc 
    375  1.1       agc iscsid_set_node_name_req_t node_name;
    376  1.1       agc 
    377  1.1       agc 
    378  1.1       agc /* -------------------------  Global Functions  ----------------------------- */
    379  1.1       agc 
    380  1.1       agc /* Debugging stuff */
    381  1.1       agc 
    382  1.1       agc #ifdef ISCSI_DEBUG
    383  1.1       agc 
    384  1.1       agc int debug_level;				/* How much info to display */
    385  1.1       agc 
    386  1.1       agc #define DEBOUT(x) printf x
    387  1.1       agc #define DEB(lev,x) {if (debug_level >= lev) printf x ;}
    388  1.1       agc 
    389  1.1       agc #define STATIC static
    390  1.1       agc 
    391  1.1       agc #else
    392  1.1       agc 
    393  1.1       agc #define DEBOUT(x)
    394  1.1       agc #define DEB(lev,x)
    395  1.1       agc 
    396  1.1       agc #define STATIC static
    397  1.1       agc 
    398  1.1       agc #endif
    399  1.1       agc 
    400  1.1       agc /* Session list protection shortcuts */
    401  1.1       agc 
    402  1.1       agc #if 0
    403  1.1       agc #define LOCK_SESSIONS   verify_sessions()
    404  1.1       agc #define UNLOCK_SESSIONS
    405  1.1       agc #endif
    406  1.1       agc #ifdef ISCSI_NOTHREAD
    407  1.1       agc #define LOCK_SESSIONS   event_handler(NULL)
    408  1.1       agc #define UNLOCK_SESSIONS
    409  1.1       agc #else
    410  1.1       agc #define LOCK_SESSIONS   pthread_mutex_lock(&sesslist_lock)
    411  1.1       agc #define UNLOCK_SESSIONS pthread_mutex_unlock(&sesslist_lock)
    412  1.1       agc #endif
    413  1.1       agc 
    414  1.1       agc /* Check whether ID is present */
    415  1.1       agc 
    416  1.1       agc #define NO_ID(sid) (!(sid)->id && !(sid)->name[0])
    417  1.1       agc 
    418  1.1       agc /* iscsid_main.c */
    419  1.1       agc 
    420  1.2  christos iscsid_response_t *make_rsp(size_t, iscsid_response_t **, int *);
    421  1.1       agc void exit_daemon(void);
    422  1.1       agc 
    423  1.1       agc /* iscsid_lists.c */
    424  1.1       agc 
    425  1.1       agc generic_entry_t *find_id(generic_list_t *, uint32_t);
    426  1.1       agc generic_entry_t *find_name(generic_list_t *, uint8_t *);
    427  1.1       agc generic_entry_t *find_sym_id(generic_list_t *, iscsid_sym_id_t *);
    428  1.1       agc uint32_t get_id(generic_list_t *, iscsid_sym_id_t *);
    429  1.1       agc target_t *find_target(iscsid_list_kind_t, iscsid_sym_id_t *);
    430  1.1       agc target_t *find_TargetName(iscsid_list_kind_t, uint8_t *);
    431  1.1       agc portal_t *find_portal_by_addr(target_t *, iscsi_portal_address_t *);
    432  1.1       agc send_target_t *find_send_target_by_addr(iscsi_portal_address_t *);
    433  1.1       agc 
    434  1.2  christos #define find_isns_id(id) \
    435  1.2  christos    (isns_t *)(void *)find_id(&list [ISNS_LIST].list, id)
    436  1.2  christos #define find_session_id(id) \
    437  1.2  christos    (session_t *)(void *)find_id(&list [SESSION_LIST].list, id)
    438  1.1       agc #define find_connection_id(session, id) \
    439  1.2  christos    (connection_t *)(void *)find_id(&session->connections, id)
    440  1.1       agc #define find_portal_id(id) \
    441  1.2  christos    (portal_t *)(void *)find_id(&list [PORTAL_LIST].list, id)
    442  1.2  christos #define find_target_id(lst, id) \
    443  1.2  christos    (target_t *)(void *)find_id(&list [lst].list, id)
    444  1.1       agc #define find_send_target_id(id) \
    445  1.2  christos    (send_target_t *)(void *)find_id(&list [SEND_TARGETS_LIST].list, id)
    446  1.1       agc #define find_initiator_id(id) \
    447  1.2  christos    (initiator_t *)(void *)find_id(&list [INITIATOR_LIST].list, id)
    448  1.2  christos #define find_isns_name(name) \
    449  1.2  christos    (isns_t *)(void *)find_name(&list [ISNS_LIST].list, name)
    450  1.1       agc #define find_session_name(name) \
    451  1.2  christos    (session_t *)(void *)find_name(&list [SESSION_LIST].list, name)
    452  1.1       agc #define find_connection_name(session, name) \
    453  1.2  christos    (connection_t *)(void *)find_name(&session->connections, name)
    454  1.1       agc #define find_portal_name(name) \
    455  1.2  christos    (portal_t *)(void *)find_name(&list [PORTAL_LIST].list, name)
    456  1.1       agc #define find_target_symname(lst, name) \
    457  1.2  christos    (target_t *)(void *)find_name(&list [lst].list, name)
    458  1.1       agc #define find_initiator_name(name) \
    459  1.2  christos    (initiator_t *)(void *)find_name(&list [INITIATOR_LIST].list, name)
    460  1.2  christos #define find_isns(sid) \
    461  1.2  christos    (isns_t *)(void *)find_sym_id(&list [ISNS_LIST].list, sid)
    462  1.1       agc #define find_session(sid) \
    463  1.2  christos    (session_t *)(void *)find_sym_id(&list [SESSION_LIST].list, sid)
    464  1.1       agc #define find_connection(session, sid) \
    465  1.2  christos    (connection_t *)(void *)find_sym_id(&session->connections, sid)
    466  1.2  christos #define find_portal(sid) \
    467  1.2  christos    (portal_t *)(void *)find_sym_id(&list [PORTAL_LIST].list, sid)
    468  1.1       agc #define find_initiator(sid) \
    469  1.2  christos    (initiator_t *)(void *)find_sym_id(&list [INITIATOR_LIST].list, sid)
    470  1.1       agc 
    471  1.1       agc void get_list(iscsid_get_list_req_t *, iscsid_response_t **, int *);
    472  1.1       agc void search_list(iscsid_search_list_req_t *, iscsid_response_t **, int *);
    473  1.1       agc 
    474  1.1       agc void get_session_list(iscsid_response_t **, int *);
    475  1.1       agc void get_connection_info(iscsid_get_connection_info_req_t *,
    476  1.1       agc 						 iscsid_response_t **, int *);
    477  1.1       agc void get_connection_list(iscsid_sym_id_t *, iscsid_response_t **, int *);
    478  1.1       agc 
    479  1.1       agc void add_initiator_portal(iscsid_add_initiator_req_t *, iscsid_response_t **,
    480  1.1       agc 						  int *);
    481  1.1       agc uint32_t remove_initiator_portal(iscsid_sym_id_t *);
    482  1.1       agc void get_initiator_portal(iscsid_sym_id_t *, iscsid_response_t **, int *);
    483  1.1       agc initiator_t *select_initiator(void);
    484  1.1       agc 
    485  1.1       agc void event_kill_session(uint32_t);
    486  1.1       agc void event_kill_connection(uint32_t, uint32_t);
    487  1.1       agc 
    488  1.1       agc /* iscsid_targets.c */
    489  1.1       agc 
    490  1.1       agc void add_target(iscsid_add_target_req_t *, iscsid_response_t **, int *);
    491  1.1       agc uint32_t set_target_options(iscsid_get_set_target_options_t *);
    492  1.1       agc uint32_t set_target_auth(iscsid_set_target_authentication_req_t *);
    493  1.1       agc void add_portal(iscsid_add_portal_req_t *, iscsid_response_t **, int *);
    494  1.1       agc void delete_portal(portal_t *, boolean_t);
    495  1.1       agc 
    496  1.1       agc void get_target_info(iscsid_list_id_t *, iscsid_response_t **, int *);
    497  1.1       agc void get_portal_info(iscsid_list_id_t *, iscsid_response_t **, int *);
    498  1.1       agc uint32_t remove_target(iscsid_list_id_t *);
    499  1.1       agc uint32_t refresh_targets(iscsid_refresh_req_t *);
    500  1.1       agc target_t *add_discovered_target(uint8_t *, iscsi_portal_address_t *,
    501  1.1       agc 								iscsi_portal_types_t, uint32_t);
    502  1.1       agc 
    503  1.1       agc /* iscsid_driverif.c */
    504  1.1       agc 
    505  1.1       agc boolean_t register_event_handler(void);
    506  1.1       agc void deregister_event_handler(void);
    507  1.1       agc void *event_handler(void *);
    508  1.1       agc 
    509  1.1       agc uint32_t set_node_name(iscsid_set_node_name_req_t *);
    510  1.1       agc void login(iscsid_login_req_t *, iscsid_response_t *);
    511  1.1       agc void add_connection(iscsid_login_req_t *, iscsid_response_t *);
    512  1.1       agc uint32_t send_targets(uint32_t, uint8_t **, uint32_t *);
    513  1.1       agc uint32_t logout(iscsid_sym_id_t *);
    514  1.1       agc uint32_t remove_connection(iscsid_remove_connection_req_t *);
    515  1.1       agc void get_version(iscsid_response_t **, int *);
    516  1.1       agc 
    517  1.1       agc /* iscsid_discover.c */
    518  1.1       agc 
    519  1.1       agc #ifndef ISCSI_MINIMAL
    520  1.1       agc void add_isns_server(iscsid_add_isns_server_req_t *, iscsid_response_t **,
    521  1.1       agc 					 int *);
    522  1.1       agc void get_isns_server(iscsid_sym_id_t *, iscsid_response_t **, int *);
    523  1.1       agc uint32_t refresh_isns_server(uint32_t);
    524  1.1       agc uint32_t remove_isns_server(iscsid_sym_id_t *);
    525  1.1       agc void dereg_all_isns_servers(void);
    526  1.1       agc #endif
    527  1.1       agc 
    528  1.1       agc #endif /* !_ISCSID_GLOBALS_H */
    529