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