45 #define PDU_MEM_SIZE 1000
46 #define ISCSI_PROTOCOL 2
47 #define ISNS_ESI_PORT 5001
48 #define ISNS_ESI_INTERVAL 360
50 #define ISNS_VERSION 0x0001
52 #define ISNS_TRANSACTION_ID_1 0xdead
53 #define ISNS_TRANSACTION_ID_2 0xbeef
55 #define ISNS_STARTING_SEQ_ID 0x0000
58 #define ISNS_FUNC_DEV_ATTR_REG 0x0001
59 #define ISNS_FUNC_DEV_ATTR_QRY 0x0002
60 #define ISNS_FUNC_DEV_ATTR_DEREG 0x0004
62 #define ISNS_FLAG_FIRST (1 << 10)
63 #define ISNS_FLAG_LAST (1 << 11)
64 #define ISNS_FLAG_REPLACE (1 << 12)
65 #define ISNS_FLAG_AUTEHNT_BLOCK (1 << 13)
66 #define ISNS_FLAG_SERVER (1 << 14)
67 #define ISNS_FLAG_CLIENT (1 << 15)
70 #define ISNS_ENABLE_ESI 1
73 #define ISNS_KEEP_ALIVE_TIMER_PERIOD 30
76 #define ISNS_TAG_DELIMITER 0
77 #define ISNS_TAG_ENTITY_IDENTIFIER 1
78 #define ISNS_TAG_ENTITY_PROTOCOL 2
79 #define ISNS_TAG_MGMT_IP_ADDRESS 3
80 #define ISNS_TAG_TIMIMESTAMP 4
81 #define ISNS_TAG_PROTOCOL_RANGE 5
82 #define ISNS_TAG_REG_PERIOD 6
83 #define ISNS_TAG_ENTITY_INDEX 7
84 #define ISNS_TAG_ENTITY_NEXT_INDEX 8
85 #define ISNS_TAG_PORTAL_IP_ADDRESS 16
86 #define ISNS_TAG_PORTAL_TCP_PORT 17
87 #define ISNS_TAG_ESI_INTERVAL 19
88 #define ISNS_TAG_ESI_PORT 20
89 #define ISNS_TAG_PORTAL_INDEX 22
90 #define ISNS_TAG_SCN_PORT 23
91 #define ISNS_TAG_ISCSI_NAME 32
92 #define ISNS_TAG_ISCSI_NODE_TYPE 33
93 #define ISNS_TAG_ISCSI_ALIAS 34
96 #define ISNS_ERROR_UNKNOWN 1
97 #define ISNS_ERROR_MSG_FORMAT 2
98 #define ISNS_ERROR_INVALID_REG 3
99 #define ISNS_ERROR_RESERVED 4
100 #define ISNS_ERROR_INVALID_QUERY 5
101 #define ISNS_ERROR_SOURCE_UNKNOWN 6
102 #define ISNS_ERROR_SOURCE_ABSENT 7
103 #define ISNS_ERROR_SOURCE_UNATHORIZED 8
104 #define ISNS_ERROR_NO_SUCH_ENTRY 9
105 #define ISNS_ERROR_VERSION_NOT_SUPPORTED 10
106 #define ISNS_ERROR_INTERNAL_ERROR 11
107 #define ISNS_ERROR_BUSY 12
108 #define ISNS_ERROR_OPTION_NOT_UNDERSTOOD 13
109 #define ISNS_ERROR_INVALID_UPDATE 14
110 #define ISNS_ERROR_FUNC_ID 15
111 #define ISNS_ERROR_SCN_EVENT_REJ 16
112 #define ISNS_ERROR_SCN_REG_REJ 17
113 #define ISNS_ERROR_NOT_IMPL 18
114 #define ISNS_ERROR_DOMAIN_ID_UNAVAILABLE 19
115 #define ISNS_ERROR_UNALLCATED_DOMAIN_ID 20
116 #define ISNS_ERROR_ESI_UNAVAILABLE 21
117 #define ISNS_ERROR_INVALID_DEREG 22
118 #define ISNS_ERROR_REG_FEATURE_UNSUPPORTED 23
121 typedef struct isns_hdr_s {
122 #if BYTE_ORDER == LITTLE_ENDIAN
131 #error big endian version not defined
135 typedef struct ocs_isns_ip_port_s {
140 typedef struct ocs_isns_node_s {
166 #define ocs_isns_log(os, fmt, ...) \
168 if (ocs_debug_is_enabled(OCS_DEBUG_ENABLE_ISNS_LOG)) \
169 ocs_log_info(os, fmt, ##__VA_ARGS__); \
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.
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.
char * ocs_get_iscsi_name(ocs_iscsi_t *iscsi, void *p, uint16_t index)
Gets the iscsi name of a given node.
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.
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.
int32_t ocs_isns_initialize(ocs_iscsi_t *iscsi)
Initialize the iSNS module.
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.
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.
int32_t ocs_isns_teardown(ocs_iscsi_t *iscsi)
Shutdown the iSNS module.
structure wrapping an IP address together with it's type.
int8_t ocs_isns_deregister(ocs_t *ocs, ocs_ip_address_t *isns_ip, char *eid)
Sends the DevDereg message to the iSNS server.