Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
iSCSI iSNS utilities

Functions

int32_t ocs_isns_initialize (ocs_iscsi_t *iscsi)
 Initialize the iSNS module. More...
 
int32_t ocs_isns_teardown (ocs_iscsi_t *iscsi)
 Shutdown the iSNS module. More...
 
static int ocs_binary_attr (int tag)
 Determines whether a given isns attribute is a numeric (binary) one. More...
 
static void ocs_print_nl (ocs_iscsi_t *iscsi, uint32_t ctr)
 Prints a number of empty lines. More...
 
static char * ocs_get_tag_name (uint32_t tag)
 Gets the name of the given isns tag. More...
 
static char * ocs_get_error_name (uint32_t error_number)
 Gets the name of the given isns error. More...
 
static int8_t ocs_create_node (ocs_iscsi_t *iscsi, void *ptr, uint16_t num)
 Creates an empty isns node. More...
 
char * ocs_get_iscsi_name (ocs_iscsi_t *iscsi, void *p, uint16_t index)
 Gets the iscsi name of a given node. More...
 
uint16_t ocs_get_iscsi_ipp_count (ocs_iscsi_t *iscsi, void *p, uint16_t index)
 Gets the count of the ip_port structs in a given node. More...
 
void ocs_str_to_ip_struct (ocs_iscsi_t *iscsi, char *ip, ocs_ip_address_t *ip_struct)
 Converts a string ip into an ip struct. More...
 
char * ocs_get_ip (ocs_iscsi_t *iscsi, void *p, uint16_t index, uint16_t ip_index)
 Gets the ip address of a given isns node. More...
 
uint16_t ocs_get_port (ocs_iscsi_t *iscsi, void *p, uint16_t index, uint16_t ip_index)
 Gets the port of a given isns node. More...
 
static int8_t ocs_create_nodes (ocs_iscsi_t *iscsi, void *rsp_ptr, int16_t bytes_left, void *ret)
 Creates an isns node. More...
 
static void ocs_fill_nodes_values (ocs_iscsi_t *iscsi, void *rsp_ptr, int16_t bytes_left, void *ret)
 Fills the attributes of the isns node. More...
 
static int ocs_build_hdr_dev_attr_reg (void *curr, uint16_t len)
 Builds the header of the DevAttrReg message. More...
 
static int ocs_build_hdr_dev_dereg (void *curr, uint16_t len)
 Builds the header of the DevAttrDereg message. More...
 
static int ocs_build_hdr_dev_attr_qry (void *curr, uint16_t len)
 Builds the header of the DevAttrQry message. More...
 
static int ocs_add_delimiter (void *curr, int remaining)
 Create a delimiter attribute. More...
 
static int ocs_add_tlv (ocs_iscsi_t *iscsi, void *curr, uint32_t tag, uint32_t len, void *value, int remaining)
 Create a tag-length-value attribute. More...
 
static void ocs_get_ipv6_string (ocs_iscsi_t *iscsi, ocs_ip_address_t *addr, uint8_t *ret_addr)
 Forms an v6-format ip string. More...
 
static void ocs_parse_flags (ocs_iscsi_t *iscsi, uint16_t flags)
 Parses the flags of the response of an isns message. More...
 
static void ocs_parse_rsp_hdr (ocs_iscsi_t *iscsi, void *rsp)
 Parses the header of the response of an isns message. More...
 
static void * ocs_parse_qry_rsp (ocs_iscsi_t *iscsi, void *rsp_ptr, uint16_t rsp_len, uint16_t *ret_nodes_count)
 Parses the response of the DevAttrQry message. More...
 
void * ocs_isns_qry_tgts (ocs_iscsi_t *iscsi, ocs_ip_address_t *isns_ip, uint16_t *ret_nodes_count)
 Sends the DevAttrReg message to the iSNS server. More...
 
static int8_t ocs_parse_msg_rsp (ocs_iscsi_t *iscsi, const char *original_func_name, void *rsp_ptr, uint16_t rsp_len, uint32_t *reg_period, char *eid)
 Parses the response of an isns message. More...
 
static void * ocs_isns_qry_attr (ocs_iscsi_t *iscsi, ocs_ip_address_t *isns_ip)
 Sends the DevAttrReg message to the iSNS server. More...
 
int8_t ocs_isns_register (ocs_iscsi_t *iscsi, uint8_t reg_tgts, uint8_t reg_ini, ocs_ip_address_t *isns_ip, char *eid)
 Sends the DevAttrReg message to the iSNS server. More...
 
int8_t ocs_isns_deregister (ocs_t *ocs, ocs_ip_address_t *isns_ip, char *eid)
 Sends the DevDereg message to the iSNS server. More...
 

Function Details

static int ocs_add_delimiter ( void *  curr,
int  remaining 
)
static

Create a delimiter attribute.

This function will form a delimiter attribute (0-length and 0-tag attribute) for the isns messages

Parameters
currPointer to the start of the attribute
remainingthe number of bytes left in the memory allocated for this msg
Returns
returns the number of bytes allocated for this attribute

Definition at line 552 of file ocs_isns.c.

static int ocs_add_tlv ( ocs_iscsi_t *  iscsi,
void *  curr,
uint32_t  tag,
uint32_t  len,
void *  value,
int  remaining 
)
static

Create a tag-length-value attribute.

This function will form a tag-length-value-attribute for the isns messages

Parameters
iscsiPointer to the iSCSI structure that represents this device
currPointer to the start of the attribute
tagthe tag of the attribute
lenthe length of the attribute
valuePointer to the value part of the attribute
remainingthe number of bytes left in the memory allocated for this msg
Returns
returns the number of bytes allocated for this attribute

Definition at line 576 of file ocs_isns.c.

static int ocs_binary_attr ( int  tag)
static

Determines whether a given isns attribute is a numeric (binary) one.

Parameters
tagThe tag of the isns attribute in query
Returns
0 if success

Definition at line 88 of file ocs_isns.c.

static int ocs_build_hdr_dev_attr_qry ( void *  curr,
uint16_t  len 
)
static

Builds the header of the DevAttrQry message.

Parameters
currPointer to the start of the attribute
lenthe length of the PDU of that message
Returns
returns the number of bytes allocated for this attribute

Definition at line 528 of file ocs_isns.c.

static int ocs_build_hdr_dev_attr_reg ( void *  curr,
uint16_t  len 
)
static

Builds the header of the DevAttrReg message.

Parameters
currPointer to the start of the attribute
lenthe length of the PDU of that message
Returns
returns the number of bytes allocated for this attribute

Definition at line 483 of file ocs_isns.c.

static int ocs_build_hdr_dev_dereg ( void *  curr,
uint16_t  len 
)
static

Builds the header of the DevAttrDereg message.

Parameters
currPointer to the start of the attribute
lenthe length of the PDU of that message
Returns
returns the number of bytes allocated for this attribute

Definition at line 506 of file ocs_isns.c.

static int8_t ocs_create_node ( ocs_iscsi_t *  iscsi,
void *  ptr,
uint16_t  num 
)
static

Creates an empty isns node.

This function will create an empty isns node and allocates memory for the given number of ip_port structs

Parameters
iscsiPointer to the iSCSI structure that represents this device
ptrPointer that determines where to create this node
numThe number of ip-port structs in that node
Returns
returns 0 if successful, negative otherwise.

Definition at line 196 of file ocs_isns.c.

static int8_t ocs_create_nodes ( ocs_iscsi_t *  iscsi,
void *  rsp_ptr,
int16_t  bytes_left,
void *  ret 
)
static

Creates an isns node.

This function will create an isns node by parsing the response message

Parameters
iscsiPointer to the iSCSI structure that represents this device
rsp_ptrPointer to the start of the nodes in the operating attributes
bytes_leftNumber of bytes left in the response message
retPointer to the node to be created
Returns
returns 0 if successful, negative otherwise.

Definition at line 351 of file ocs_isns.c.

static void ocs_fill_nodes_values ( ocs_iscsi_t *  iscsi,
void *  rsp_ptr,
int16_t  bytes_left,
void *  ret 
)
static

Fills the attributes of the isns node.

This function will fills the ip and port attributes of the given node by parsing the response message

Parameters
iscsiPointer to the iSCSI structure that represents this device
rsp_ptrPointer to the start of the nodes in the operating attributes
bytes_leftNumber of bytes left in the response message
retPointer to the node to be filled

Definition at line 420 of file ocs_isns.c.

static char* ocs_get_error_name ( uint32_t  error_number)
static

Gets the name of the given isns error.

Parameters
error_numberThe number of the error
Returns
returns the error name

Definition at line 153 of file ocs_isns.c.

char* ocs_get_ip ( ocs_iscsi_t *  iscsi,
void *  p,
uint16_t  index,
uint16_t  ip_index 
)

Gets the ip address of a given isns node.

Parameters
iscsiPointer to the iSCSI structure that represents this device
pPointer to the start of the nodes table
indexdetermines the index of the node in query
ip_indexdetermines which ip-port structure to be selected
Returns
returns the ip string of this node

Definition at line 301 of file ocs_isns.c.

static void ocs_get_ipv6_string ( ocs_iscsi_t *  iscsi,
ocs_ip_address_t *  addr,
uint8_t *  ret_addr 
)
static

Forms an v6-format ip string.

This function will convert an ip address into an ipv6-formatted string

Parameters
iscsiPointer to the iSCSI structure that represents this device
addrPointer to the input ip address
ret_addrPointer to the return string
Returns
none

Definition at line 646 of file ocs_isns.c.

uint16_t ocs_get_iscsi_ipp_count ( ocs_iscsi_t *  iscsi,
void *  p,
uint16_t  index 
)

Gets the count of the ip_port structs in a given node.

Parameters
iscsiPointer to the iSCSI structure that represents this device
pPointer to the start of the nodes table
indexdetermines the index of the node in query
Returns
returns the number of the ip_port structs in this node

Definition at line 240 of file ocs_isns.c.

char* ocs_get_iscsi_name ( ocs_iscsi_t *  iscsi,
void *  p,
uint16_t  index 
)

Gets the iscsi name of a given node.

Parameters
iscsiPointer to the iSCSI structure that represents this device
pPointer to the start of the nodes table
indexdetermines the index of the node in query
Returns
returns the iscsi name of that node

Definition at line 223 of file ocs_isns.c.

uint16_t ocs_get_port ( ocs_iscsi_t *  iscsi,
void *  p,
uint16_t  index,
uint16_t  ip_index 
)

Gets the port of a given isns node.

Parameters
iscsiPointer to the iSCSI structure that represents this device
pPointer to the start of the nodes table
indexdetermines the index of the node in query
ip_indexdetermines which ip-port structure to be selected
Returns
returns the port of this node

Definition at line 325 of file ocs_isns.c.

static char* ocs_get_tag_name ( uint32_t  tag)
static

Gets the name of the given isns tag.

Parameters
tagThe number of the tag
Returns
returns the tag name

Definition at line 126 of file ocs_isns.c.

int8_t ocs_isns_deregister ( ocs_t *  ocs,
ocs_ip_address_t *  isns_ip,
char *  eid 
)

Sends the DevDereg message to the iSNS server.

This function will de-register all targets in this iSCSI device with within the same entity in the isns server.

Parameters
ocsPointer to the ocs structure that represents this device
isns_ipto the IP addresses of the iSNS server
eidThe entity ID assigned by the iSNS server during registration
Returns
returns zero if successful, negative otherwise

Definition at line 1806 of file ocs_isns.c.

int32_t ocs_isns_initialize ( ocs_iscsi_t *  iscsi)

Initialize the iSNS module.

This function will initialize any iSNS required structures

Parameters
iscsipointer to the iSCSI structure that represents this device
Returns
0 if success

Definition at line 58 of file ocs_isns.c.

static void* ocs_isns_qry_attr ( ocs_iscsi_t *  iscsi,
ocs_ip_address_t *  isns_ip 
)
static

Sends the DevAttrReg message to the iSNS server.

This function will query the iSCSI device with the isns server to get all the registered targets

Parameters
iscsiPointer to the iSCSI structure that represents this device
isns_ipPointer to the IP address of the iSNS server
Returns
Pointer to the table of the discovered registered targets

Definition at line 1236 of file ocs_isns.c.

void* ocs_isns_qry_tgts ( ocs_iscsi_t *  iscsi,
ocs_ip_address_t *  isns_ip,
uint16_t *  ret_nodes_count 
)

Sends the DevAttrReg message to the iSNS server.

This function will query the iSCSI device with the isns server to get all the registered targets

Parameters
iscsiPointer to the iSCSI structure that represents this device
isns_ipPointer to the IP address of the iSNS server
ret_nodes_countPointer to the number of nodes registered
Returns
Pointer to the table of the discovered registered targets

Definition at line 925 of file ocs_isns.c.

int8_t ocs_isns_register ( ocs_iscsi_t *  iscsi,
uint8_t  reg_tgts,
uint8_t  reg_ini,
ocs_ip_address_t *  isns_ip,
char *  eid 
)

Sends the DevAttrReg message to the iSNS server.

This function will register all targets in this iSCSI device with the isns server.

Parameters
iscsiPointer to the iSCSI structure that represents this device
reg_tgtsto determine whether to register targets or not
reg_inito determine whether to register initiators or not
isns_ipPointer to the IP address of the iSNS server
eidThe entity ID assigned by the iSNS server during registration
Returns
returns zero if successful, negative otherwise

Definition at line 1420 of file ocs_isns.c.

int32_t ocs_isns_teardown ( ocs_iscsi_t *  iscsi)

Shutdown the iSNS module.

This function will free any iSNS resources prior to driver shutdown

Parameters
iscsipointer to the iSCSI structure that represents this device
Returns
0 if success

Definition at line 74 of file ocs_isns.c.

static void ocs_parse_flags ( ocs_iscsi_t *  iscsi,
uint16_t  flags 
)
static

Parses the flags of the response of an isns message.

Parameters
iscsiPointer to the iSCSI structure that represents this device
flagsThe flags of that message

Definition at line 672 of file ocs_isns.c.

static int8_t ocs_parse_msg_rsp ( ocs_iscsi_t *  iscsi,
const char *  original_func_name,
void *  rsp_ptr,
uint16_t  rsp_len,
uint32_t *  reg_period,
char *  eid 
)
static

Parses the response of an isns message.

This function will create an empty isns node and allocates memory for the given number of ip_port structs

Parameters
iscsiPointer to the iSCSI structure that represents this device
original_func_namePointer to the name of the source message
rsp_ptrPointer to the response
rsp_lenThe length of that response
reg_periodPointer to the registration period variable
eidThe entity ID assigned by the iSNS server during registration
Returns
returns 0 if successful, negative otherwise

Definition at line 1102 of file ocs_isns.c.

static void* ocs_parse_qry_rsp ( ocs_iscsi_t *  iscsi,
void *  rsp_ptr,
uint16_t  rsp_len,
uint16_t *  ret_nodes_count 
)
static

Parses the response of the DevAttrQry message.

Parameters
iscsiPointer to the iSCSI structure that represents this device
rsp_ptrPointer to the start of the response
rsp_lenthe length of the response
ret_nodes_countPointer to the number of discovered targets
Returns
returns Pointer to the table of the discovered registered targets, NULL if error

Definition at line 763 of file ocs_isns.c.

static void ocs_parse_rsp_hdr ( ocs_iscsi_t *  iscsi,
void *  rsp 
)
static

Parses the header of the response of an isns message.

Parameters
iscsiPointer to the iSCSI structure that represents this device
rspPointer to the header of the response message

Definition at line 717 of file ocs_isns.c.

static void ocs_print_nl ( ocs_iscsi_t *  iscsi,
uint32_t  ctr 
)
static

Prints a number of empty lines.

Parameters
iscsiPointer to the iSCSI structure that represents this device
ctrthe number of empty lines to be printed

Definition at line 110 of file ocs_isns.c.

void ocs_str_to_ip_struct ( ocs_iscsi_t *  iscsi,
char *  ip,
ocs_ip_address_t *  ip_struct 
)

Converts a string ip into an ip struct.

Parameters
iscsiPointer to the iSCSI structure that represents this device
*ipPointer to the ip string
*ip_structPointer to the ip_struct to contain the given string ip

Definition at line 256 of file ocs_isns.c.