1*7836SJohn.Forte@Sun.COM /* 2*7836SJohn.Forte@Sun.COM * CDDL HEADER START 3*7836SJohn.Forte@Sun.COM * 4*7836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the 5*7836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License"). 6*7836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License. 7*7836SJohn.Forte@Sun.COM * 8*7836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*7836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*7836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions 11*7836SJohn.Forte@Sun.COM * and limitations under the License. 12*7836SJohn.Forte@Sun.COM * 13*7836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*7836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*7836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*7836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*7836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*7836SJohn.Forte@Sun.COM * 19*7836SJohn.Forte@Sun.COM * CDDL HEADER END 20*7836SJohn.Forte@Sun.COM */ 21*7836SJohn.Forte@Sun.COM /* 22*7836SJohn.Forte@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*7836SJohn.Forte@Sun.COM * Use is subject to license terms. 24*7836SJohn.Forte@Sun.COM */ 25*7836SJohn.Forte@Sun.COM 26*7836SJohn.Forte@Sun.COM #ifndef _ISNS_CLIENT_H 27*7836SJohn.Forte@Sun.COM #define _ISNS_CLIENT_H 28*7836SJohn.Forte@Sun.COM 29*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 30*7836SJohn.Forte@Sun.COM extern "C" { 31*7836SJohn.Forte@Sun.COM #endif 32*7836SJohn.Forte@Sun.COM 33*7836SJohn.Forte@Sun.COM #include <sys/types.h> 34*7836SJohn.Forte@Sun.COM #include <sys/scsi/adapters/iscsi_if.h> 35*7836SJohn.Forte@Sun.COM 36*7836SJohn.Forte@Sun.COM #define ISNS_DEFAULT_ESI_SCN_PORT 32046 37*7836SJohn.Forte@Sun.COM #define ISNS_DEFAULT_PORTAL_GROUP_TAG 1 38*7836SJohn.Forte@Sun.COM 39*7836SJohn.Forte@Sun.COM typedef enum isns_status { 40*7836SJohn.Forte@Sun.COM isns_ok, 41*7836SJohn.Forte@Sun.COM isns_no_svr_found, 42*7836SJohn.Forte@Sun.COM isns_internal_err, 43*7836SJohn.Forte@Sun.COM isns_create_msg_err, 44*7836SJohn.Forte@Sun.COM isns_open_conn_err, 45*7836SJohn.Forte@Sun.COM isns_send_msg_err, 46*7836SJohn.Forte@Sun.COM isns_rcv_msg_err, 47*7836SJohn.Forte@Sun.COM isns_no_rsp_rcvd, 48*7836SJohn.Forte@Sun.COM isns_op_failed, 49*7836SJohn.Forte@Sun.COM isns_op_partially_failed, 50*7836SJohn.Forte@Sun.COM isns_no_transport_found 51*7836SJohn.Forte@Sun.COM } isns_status_t; 52*7836SJohn.Forte@Sun.COM 53*7836SJohn.Forte@Sun.COM #define ISNSP_MULT_PAYLOAD_HEADER_SIZE 8 54*7836SJohn.Forte@Sun.COM /* 55*7836SJohn.Forte@Sun.COM * when we concatenate payloads from multiple pdus, we need 56*7836SJohn.Forte@Sun.COM * a larger payload_len then what is defined in isns_protocol.h 57*7836SJohn.Forte@Sun.COM * 58*7836SJohn.Forte@Sun.COM * for each payload that comes in, we need to save off the payload_len 59*7836SJohn.Forte@Sun.COM * and the payload 60*7836SJohn.Forte@Sun.COM */ 61*7836SJohn.Forte@Sun.COM typedef struct isns_pdu_mult_payload { 62*7836SJohn.Forte@Sun.COM size_t payload_len; 63*7836SJohn.Forte@Sun.COM uint8_t payload[1]; 64*7836SJohn.Forte@Sun.COM } isns_pdu_mult_payload_t; 65*7836SJohn.Forte@Sun.COM 66*7836SJohn.Forte@Sun.COM typedef struct isns_scn_callback_arg { 67*7836SJohn.Forte@Sun.COM uint32_t scn_type; 68*7836SJohn.Forte@Sun.COM uint8_t source_key_attr[ISCSI_MAX_NAME_LEN]; 69*7836SJohn.Forte@Sun.COM } isns_scn_callback_arg_t; 70*7836SJohn.Forte@Sun.COM 71*7836SJohn.Forte@Sun.COM /* 72*7836SJohn.Forte@Sun.COM * To initialize the iSNS Client module. 73*7836SJohn.Forte@Sun.COM */ 74*7836SJohn.Forte@Sun.COM void 75*7836SJohn.Forte@Sun.COM isns_client_init(void); 76*7836SJohn.Forte@Sun.COM 77*7836SJohn.Forte@Sun.COM /* 78*7836SJohn.Forte@Sun.COM * To clean up the resources associated with the iSNS Client module. 79*7836SJohn.Forte@Sun.COM */ 80*7836SJohn.Forte@Sun.COM void 81*7836SJohn.Forte@Sun.COM isns_client_cleanup(void); 82*7836SJohn.Forte@Sun.COM 83*7836SJohn.Forte@Sun.COM /* 84*7836SJohn.Forte@Sun.COM * To register a network entity against the iSNS server(s) visible to the 85*7836SJohn.Forte@Sun.COM * specified LHBA. 86*7836SJohn.Forte@Sun.COM */ 87*7836SJohn.Forte@Sun.COM isns_status_t 88*7836SJohn.Forte@Sun.COM isns_reg(uint8_t *lhba_handle, 89*7836SJohn.Forte@Sun.COM uint8_t *node_name, 90*7836SJohn.Forte@Sun.COM size_t node_name_len, 91*7836SJohn.Forte@Sun.COM uint8_t *node_alias, 92*7836SJohn.Forte@Sun.COM size_t node_alias_len, 93*7836SJohn.Forte@Sun.COM uint32_t node_type, 94*7836SJohn.Forte@Sun.COM void (*scn_callback)(void *)); 95*7836SJohn.Forte@Sun.COM 96*7836SJohn.Forte@Sun.COM /* 97*7836SJohn.Forte@Sun.COM * To register a network entity against the specified iSNS server. 98*7836SJohn.Forte@Sun.COM */ 99*7836SJohn.Forte@Sun.COM isns_status_t 100*7836SJohn.Forte@Sun.COM isns_reg_one_server(entry_t *isns_server, 101*7836SJohn.Forte@Sun.COM uint8_t *lhba_handle, 102*7836SJohn.Forte@Sun.COM uint8_t *node_name, 103*7836SJohn.Forte@Sun.COM size_t node_name_len, 104*7836SJohn.Forte@Sun.COM uint8_t *node_alias, 105*7836SJohn.Forte@Sun.COM size_t node_alias_len, 106*7836SJohn.Forte@Sun.COM uint32_t node_type, 107*7836SJohn.Forte@Sun.COM void (*scn_callback)(void *)); 108*7836SJohn.Forte@Sun.COM 109*7836SJohn.Forte@Sun.COM /* 110*7836SJohn.Forte@Sun.COM * To deregister a network entity from the all iSNS server(s) visible to the 111*7836SJohn.Forte@Sun.COM * specified LHBA. 112*7836SJohn.Forte@Sun.COM */ 113*7836SJohn.Forte@Sun.COM isns_status_t 114*7836SJohn.Forte@Sun.COM isns_dereg(uint8_t *lhba_handle, uint8_t *node_name); 115*7836SJohn.Forte@Sun.COM 116*7836SJohn.Forte@Sun.COM /* 117*7836SJohn.Forte@Sun.COM * To deregister a network entity from the specified iSNS server. 118*7836SJohn.Forte@Sun.COM */ 119*7836SJohn.Forte@Sun.COM isns_status_t 120*7836SJohn.Forte@Sun.COM isns_dereg_one_server(entry_t *isns_server, uint8_t *node_name, 121*7836SJohn.Forte@Sun.COM boolean_t is_last_isns_server); 122*7836SJohn.Forte@Sun.COM 123*7836SJohn.Forte@Sun.COM /* 124*7836SJohn.Forte@Sun.COM * To query all portal group objects that are visible to the specified LHBA 125*7836SJohn.Forte@Sun.COM * registered through all iSNS servers this LHBA discovered. 126*7836SJohn.Forte@Sun.COM * pg_list is NULL if no portal group object is found. 127*7836SJohn.Forte@Sun.COM */ 128*7836SJohn.Forte@Sun.COM isns_status_t 129*7836SJohn.Forte@Sun.COM isns_query(uint8_t *lhba_handle, 130*7836SJohn.Forte@Sun.COM uint8_t *node_name, 131*7836SJohn.Forte@Sun.COM uint8_t *node_alias, 132*7836SJohn.Forte@Sun.COM uint32_t node_type, 133*7836SJohn.Forte@Sun.COM isns_portal_group_list_t **pg_list); 134*7836SJohn.Forte@Sun.COM 135*7836SJohn.Forte@Sun.COM /* 136*7836SJohn.Forte@Sun.COM * To query all portal group objects registered through the specified iSNS 137*7836SJohn.Forte@Sun.COM * server registered through the specified iSNS server. pg_list is NULL if 138*7836SJohn.Forte@Sun.COM * no portal group object is found. 139*7836SJohn.Forte@Sun.COM */ 140*7836SJohn.Forte@Sun.COM isns_status_t 141*7836SJohn.Forte@Sun.COM isns_query_one_server(iscsi_addr_t *isns_server_addr, 142*7836SJohn.Forte@Sun.COM uint8_t *lhba_handle, 143*7836SJohn.Forte@Sun.COM uint8_t *node_name, 144*7836SJohn.Forte@Sun.COM uint8_t *node_alias, 145*7836SJohn.Forte@Sun.COM uint32_t node_type, 146*7836SJohn.Forte@Sun.COM isns_portal_group_list_t **pg_list); 147*7836SJohn.Forte@Sun.COM 148*7836SJohn.Forte@Sun.COM /* 149*7836SJohn.Forte@Sun.COM * To query the portal group objects associated with the specified storage 150*7836SJohn.Forte@Sun.COM * node through all iSNS servers this LHBA discovered. pg_list is NULL if 151*7836SJohn.Forte@Sun.COM * no portal group object is found. 152*7836SJohn.Forte@Sun.COM */ 153*7836SJohn.Forte@Sun.COM isns_status_t 154*7836SJohn.Forte@Sun.COM isns_query_one_node(uint8_t *target_node_name, 155*7836SJohn.Forte@Sun.COM uint8_t *lhba_handle, 156*7836SJohn.Forte@Sun.COM uint8_t *source_node_name, 157*7836SJohn.Forte@Sun.COM uint8_t *source_node_alias, 158*7836SJohn.Forte@Sun.COM uint32_t source_node_type, 159*7836SJohn.Forte@Sun.COM isns_portal_group_list_t **pg_list); 160*7836SJohn.Forte@Sun.COM 161*7836SJohn.Forte@Sun.COM /* 162*7836SJohn.Forte@Sun.COM * To query the portal group objects associated with the specified storage 163*7836SJohn.Forte@Sun.COM * node registered through the specified iSNS server. pg_list is NULL if 164*7836SJohn.Forte@Sun.COM * no portal group object is found. 165*7836SJohn.Forte@Sun.COM */ 166*7836SJohn.Forte@Sun.COM isns_status_t 167*7836SJohn.Forte@Sun.COM isns_query_one_server_one_node(iscsi_addr_t *isns_server_addr, 168*7836SJohn.Forte@Sun.COM uint8_t *target_node_name, 169*7836SJohn.Forte@Sun.COM uint8_t *lhba_handle, 170*7836SJohn.Forte@Sun.COM uint8_t *source_node_name, 171*7836SJohn.Forte@Sun.COM uint8_t *source_node_alias, 172*7836SJohn.Forte@Sun.COM uint32_t source_node_type, 173*7836SJohn.Forte@Sun.COM isns_portal_group_list_t **pg_list); 174*7836SJohn.Forte@Sun.COM 175*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 176*7836SJohn.Forte@Sun.COM } 177*7836SJohn.Forte@Sun.COM #endif 178*7836SJohn.Forte@Sun.COM 179*7836SJohn.Forte@Sun.COM #endif /* _ISNS_CLIENT_H */ 180