You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(23) |
Dec
(85) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(19) |
Feb
(13) |
Mar
(7) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(31) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Robert W. <wrw...@us...> - 2006-12-15 18:17:23
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11562/src Modified Files: iSNSList.c iSNSdb.c iSNSdereg.c iSNSesi.c iSNSparse.c iSNSquery.c iSNSreg.c Log Message: Adding support for Portal Groups Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSquery.c 15 Dec 2006 01:13:29 -0000 1.10 --- iSNSquery.c 15 Dec 2006 18:17:19 -0000 1.11 *************** *** 240,244 **** SOIP_Portal *p_portal; SOIP_Ifcp *p_port; ! SOIP_DB_Portal db_portal; ISNS_Key read_key; int rval; --- 240,244 ---- SOIP_Portal *p_portal; SOIP_Ifcp *p_port; ! SOIP_Portal_Key db_portal; ISNS_Key read_key; int rval; *************** *** 300,308 **** while (entityKeyFlag != -1) { /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); /* Fetch entity from hash */ ! if (ISNS_NO_ERR != SNSdbFetchEntity ((char *)&key->val, &p_entity, &entry)) { return (ISNS_INVALID_QUERY_ERR); --- 300,313 ---- while (entityKeyFlag != -1) { + SOIP_Entity_Id db_entity_id; + /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); + memset(db_entity_id.id,0,sizeof(SOIP_Entity_Id)); + memcpy(db_entity_id.id,&key->val,key->len); + /* Fetch entity from hash */ ! if (ISNS_NO_ERR != SNSdbFetchEntity (db_entity_id.id, &p_entity, &entry)) { return (ISNS_INVALID_QUERY_ERR); *************** *** 376,380 **** read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 381,385 ---- read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 986,990 **** SOIP_Entity *p_entity; SOIP_Ifcp *p_port; ! SOIP_DB_Portal db_portal; int entityKeyFlag; int portalIpKeyFlag; --- 991,995 ---- SOIP_Entity *p_entity; SOIP_Ifcp *p_port; ! SOIP_Portal_Key db_portal; int entityKeyFlag; int portalIpKeyFlag; *************** *** 1057,1061 **** ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1062,1066 ---- ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1096,1100 **** ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1101,1105 ---- ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1124,1128 **** ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1129,1133 ---- ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1237,1241 **** key2.tag = PORTAL_ID_KEY; ! key2.len = sizeof (SOIP_DB_Portal); while (SNSdbGetNextOfKey (&key2) == SUCCESS) --- 1242,1246 ---- key2.tag = PORTAL_ID_KEY; ! key2.len = sizeof (SOIP_Portal_Key); while (SNSdbGetNextOfKey (&key2) == SUCCESS) *************** *** 1243,1247 **** ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&key2.val,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1248,1252 ---- ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&key2.val,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1280,1284 **** SOIP_Entity *p_entity; SOIP_Portal *p_portal; ! SOIP_DB_Portal db_portal; int entityKeyFlag; int portKeyFlag; --- 1285,1289 ---- SOIP_Entity *p_entity; SOIP_Portal *p_portal; ! SOIP_Portal_Key db_portal; int entityKeyFlag; int portKeyFlag; *************** *** 1457,1461 **** ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1462,1466 ---- ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1720,1724 **** else if (portalPortKeyIndex != -1 || portalIpKeyIndex != -1) { ! SOIP_DB_Portal db_portal; SOIP_Portal * p_portal; --- 1725,1729 ---- else if (portalPortKeyIndex != -1 || portalIpKeyIndex != -1) { ! SOIP_Portal_Key db_portal; SOIP_Portal * p_portal; *************** *** 1742,1746 **** ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) --- 1747,1751 ---- ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) *************** *** 2199,2203 **** { SOIP_Portal * p_portal; ! SOIP_DB_Portal db_portal; memset(&db_portal, 0, sizeof(db_portal)); --- 2204,2208 ---- { SOIP_Portal * p_portal; ! SOIP_Portal_Key db_portal; memset(&db_portal, 0, sizeof(db_portal)); *************** *** 2228,2232 **** } memcpy (&qkey.val, ptr, sizeof(db_portal)); ! qkey.len = sizeof(SOIP_DB_Portal); } } --- 2233,2237 ---- } memcpy (&qkey.val, ptr, sizeof(db_portal)); ! qkey.len = sizeof(SOIP_Portal_Key); } } *************** *** 2241,2245 **** qkey.len += key->len; ! memcpy(&qkey.val, (char *)&db_portal, sizeof (SOIP_DB_Portal)); } --- 2246,2250 ---- qkey.len += key->len; ! memcpy(&qkey.val, (char *)&db_portal, sizeof (SOIP_Portal_Key)); } *************** *** 2813,2817 **** ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry5); if (rval != SUCCESS ) --- 2818,2822 ---- ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry5); if (rval != SUCCESS ) *************** *** 2823,2827 **** { q_attr = (ISNS_Attr *) attr_indx[jj]; ! DEBUG_1 (isns_query_debug &1, process attribute for portal object (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) --- 2828,2832 ---- { q_attr = (ISNS_Attr *) attr_indx[jj]; ! DEBUG_1 (isns_query_debug &1, process attribute for portal objects (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) *************** *** 2872,2875 **** --- 2877,2914 ---- } + /* Process Portal Groups */ + for (jj = 0; (jj < SNS_MAX_ATTRS) && (attr_indx[jj]); jj++) + { + q_attr = (ISNS_Attr *) attr_indx[jj]; + DEBUG_1 (isns_query_debug &1, process attribute for portal group objects (%s),isnsTagText(q_attr->tag)); + + switch ( q_attr->tag ) + { + /* Located in the Portal object */ + case ISNS_PORTAL_GROUP_PORT: + DEBUG_1 (isns_query_debug &1,ISNS_PORTAL_GROUP_PORT:%i,p_portal->ip_port); + ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_GROUP_PORT_SIZE, + NULL, p_portal->ip_port); + break; + case ISNS_PORTAL_GROUP_IP: + DEBUG_0 (isns_query_debug &1,Add ISNS_PORTAL_GROUP_IP); + ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_GROUP_IP_SIZE, + p_portal->ip_addr.v, 0); + break; + case ISNS_PORTAL_GROUP_ISCSI_NAME: + ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_ISCSI_NAME, + PAD4 (strlen (p_node->id.v)), + p_node->id.v, 0); + break; + case ISNS_PORTAL_GROUP_TAG: + ISNSAppendAttr (p_msg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, + NULL, 1); // hard code group 1 for now + break; + default: + break; + } /* end for */ + } + + return ( SUCCESS ); } Index: iSNSList.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSList.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSList.c 14 Dec 2006 23:04:27 -0000 1.9 --- iSNSList.c 15 Dec 2006 18:17:18 -0000 1.10 *************** *** 183,187 **** ISNS_LIST_NODE *curr_node; int rval; ! ISNS_Key key; SOIP_DB_Entry entry; int next_index; --- 183,187 ---- ISNS_LIST_NODE *curr_node; int rval; ! ISNS_DBKey key; SOIP_DB_Entry entry; int next_index; *************** *** 226,230 **** /* read current node */ ! memset(&key,0,sizeof(ISNS_Key)); key.tag = LIST_KEY; key.val.list.list_id = plist->list_id; --- 226,230 ---- /* read current node */ ! memset(&key,0,sizeof(ISNS_DBKey)); key.tag = LIST_KEY; key.val.list.list_id = plist->list_id; *************** *** 374,378 **** AddNode(ISNS_LIST *plist, char *pdata, int data_size) { ! ISNS_Key key; SOIP_DB_Entry entry; --- 374,378 ---- AddNode(ISNS_LIST *plist, char *pdata, int data_size) { ! ISNS_DBKey key; SOIP_DB_Entry entry; *************** *** 387,391 **** DEBUG_1 (isns_list_debug &1, AddNode - list_id:%i,plist->list_id); ! memset(&key,0,sizeof(ISNS_Key)); key.tag = LIST_KEY; key.val.list.list_id = plist->list_id; --- 387,391 ---- DEBUG_1 (isns_list_debug &1, AddNode - list_id:%i,plist->list_id); ! memset(&key,0,sizeof(ISNS_DBKey)); key.tag = LIST_KEY; key.val.list.list_id = plist->list_id; *************** *** 509,513 **** { ISNS_LIST_NODE *node; ! ISNS_Key key; SOIP_DB_Entry entry; int rval; --- 509,513 ---- { ISNS_LIST_NODE *node; ! ISNS_DBKey key; SOIP_DB_Entry entry; int rval; *************** *** 527,531 **** } ! memset(&key,0,sizeof(ISNS_Key)); key.tag = LIST_KEY; key.val.list.list_id = plist->list_id; --- 527,531 ---- } ! memset(&key,0,sizeof(ISNS_DBKey)); key.tag = LIST_KEY; key.val.list.list_id = plist->list_id; Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNSesi.c 15 Dec 2006 01:13:29 -0000 1.7 --- iSNSesi.c 15 Dec 2006 18:17:19 -0000 1.8 *************** *** 75,82 **** int rval; SOIP_Portal *p_portal; ! SOIP_DB_Portal db_portal; ISNS_Msg_Descp *p_md; time_t mytime; ! ISNS_Key read_key = { 0 }; DEBUG_0 (isns_esi_debug &1, ISNS_SendESI); --- 75,82 ---- int rval; SOIP_Portal *p_portal; ! SOIP_Portal_Key db_portal; ISNS_Msg_Descp *p_md; time_t mytime; ! ISNS_DBKey read_key = { 0 }; DEBUG_0 (isns_esi_debug &1, ISNS_SendESI); *************** *** 190,198 **** ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ) { ! ISNS_Attr *p_attr; SOIP_Entity *p_entity; SOIP_Portal *p_portal; time_t mytime; ! SOIP_DB_Portal db_portal; int i; int len; --- 190,198 ---- ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ) { ! ISNS_Key *p_attr; SOIP_Entity *p_entity; SOIP_Portal *p_portal; time_t mytime; ! SOIP_Portal_Key db_portal; int i; int len; *************** *** 200,204 **** char *key_indx[SNS_MAX_ATTRS]; int rval; ! ISNS_Key update_key; DEBUG_0 (isns_esi_debug &1, ISNS_ProcessESI); --- 200,205 ---- char *key_indx[SNS_MAX_ATTRS]; int rval; ! SOIP_Entity_Id db_entity_id; ! ISNS_DBKey update_key; DEBUG_0 (isns_esi_debug &1, ISNS_ProcessESI); *************** *** 211,219 **** return ( ERROR ); } ! p_attr = (ISNS_Attr *)(key_indx[ i ]); ! ISNS_Key key; key.tag = ENTITY_ID_KEY; ! strcpy(key.val.entity_id.id,p_attr->val.entity_id.id); rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) --- 212,223 ---- return ( ERROR ); } ! p_attr = (ISNS_Key *)(key_indx[ i ]); ! memset(db_entity_id.id,0,sizeof(SOIP_Entity_Id)); ! strncpy(db_entity_id.id,p_attr->val.entity_id.id,sizeof(SOIP_Entity_Id)); ! ! ISNS_DBKey key; key.tag = ENTITY_ID_KEY; ! strcpy(key.val.entity_id.id,db_entity_id.id); rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) *************** *** 233,237 **** ISNSdbWrite(&key,entry); ! memset(&db_portal,0,sizeof(SOIP_DB_Portal)); /* Fetch the portal IP */ --- 237,241 ---- ISNSdbWrite(&key,entry); ! memset(&db_portal,0,sizeof(SOIP_Portal_Key)); /* Fetch the portal IP */ *************** *** 242,246 **** return ( ERROR ); } ! p_attr = (ISNS_Attr *)(key_indx[i]); memcpy(db_portal.ip_addr.v, p_attr->val.ip_addr.v, ISNS_IP_SIZE); --- 246,250 ---- return ( ERROR ); } ! p_attr = (ISNS_Key *)(key_indx[i]); memcpy(db_portal.ip_addr.v, p_attr->val.ip_addr.v, ISNS_IP_SIZE); *************** *** 251,259 **** return ( ERROR ); } ! p_attr = (ISNS_Attr *)(key_indx[i]); db_portal.ip_port=p_attr->val.ip_port; update_key.tag = PORTAL_ID_KEY; ! memcpy(&update_key.val,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&update_key,&entry); if (rval != SUCCESS) --- 255,263 ---- return ( ERROR ); } ! p_attr = (ISNS_Key *)(key_indx[i]); db_portal.ip_port=p_attr->val.ip_port; update_key.tag = PORTAL_ID_KEY; ! memcpy(&update_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&update_key,&entry); if (rval != SUCCESS) Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** iSNSparse.c 15 Dec 2006 01:13:29 -0000 1.14 --- iSNSparse.c 15 Dec 2006 18:17:19 -0000 1.15 *************** *** 145,151 **** case ISNS_DD_ISCSI_MEMBER: case ISNS_PORTAL_GROUP_ISCSI_NAME: - //if ( len != PAD2(strlen(ptr)) && len != 0) - // rval = FALSE; - if ( len == 0) DEBUG_3 (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); --- 145,148 ---- *************** *** 153,167 **** DEBUG_4 (isns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),(char *)ptr); break; ! case ISNS_MGMT_IP: case ISNS_PORTAL_IP: ! { ! char ipaddr[256]; if (len != ISNS_IP_SIZE && len != 0) rval = FALSE; ! ipaddrchar (ptr,ipaddr); ! DEBUG_4 (isns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),ipaddr); break; - } case ISNS_TIMESTAMP: if (len != ISNS_TIMESTAMP_SIZE && len != 0 ) --- 150,162 ---- DEBUG_4 (isns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),(char *)ptr); break; ! case ISNS_MGMT_IP: case ISNS_PORTAL_IP: ! case ISNS_PORTAL_GROUP_IP: if (len != ISNS_IP_SIZE && len != 0) rval = FALSE; ! DEBUG_4 (isns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag), ! inet_ntoa(*(struct in_addr *)(ptr+12)) ); break; case ISNS_TIMESTAMP: if (len != ISNS_TIMESTAMP_SIZE && len != 0 ) *************** *** 229,243 **** case ISNS_FC_NODE_IP: - case ISNS_PORTAL_GROUP_IP: case ISNS_FC_NODE_IPA: - #if 0 - case ISNS_VENDOR_ID: - case ISNS_VENDOR_REV: - case ISNS_PRIMARY_VER: - case ISNS_PRIMARY_IP: - case ISNS_PRIMARY_TCP_PORT: - case ISNS_PRIMARY_UDP_PORT: - case ISNS_PRIMARY_MGMT_IP: - #endif case ISNS_COMPANY_OUI: case ISNS_SCN_CALLBACK: --- 224,228 ---- *************** *** 460,463 **** --- 445,449 ---- case ISNS_PORTAL_SECURITY_BITMAP: case ISNS_PORTAL_GROUP_PORT: + case ISNS_PORTAL_GROUP_TAG: if (pattr->len != 0) { *************** *** 507,511 **** case ISNS_ISCSI_ALIAS: case ISNS_SCN_PORT: - case ISNS_PORTAL_GROUP_TAG: case ISNS_PORTAL_GROUP_ISCSI_NAME: case ISNS_PORTAL_GROUP_IP: --- 493,496 ---- *************** *** 604,607 **** --- 589,594 ---- case ISNS_COMPANY_OUI: case ISNS_PORTAL_PORT: + case ISNS_PORTAL_GROUP_PORT: + case ISNS_PORTAL_GROUP_TAG: case ISNS_PORT_TYPE: case ISNS_DDS_STATUS: *************** *** 629,632 **** --- 616,620 ---- case ISNS_FC4_TYPE: case ISNS_PORTAL_IP: + case ISNS_PORTAL_GROUP_IP: case ISNS_PORT_ID: case ISNS_FC_NODE_IP: *************** *** 653,656 **** --- 641,645 ---- case ISNS_ISCSI_CERT: case ISNS_ISCSI_ALIAS: + case ISNS_PORTAL_GROUP_ISCSI_NAME: ptr = (uint8_t *) ptr + len; break; Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** iSNSdereg.c 15 Dec 2006 01:13:29 -0000 1.14 --- iSNSdereg.c 15 Dec 2006 18:17:19 -0000 1.15 *************** *** 778,782 **** ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) --- 778,782 ---- ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) *************** *** 827,831 **** { int foundFlag; ! SOIP_DB_Portal db_portal; int ii; int portalIpIndex; --- 827,831 ---- { int foundFlag; ! SOIP_Portal_Key db_portal; int ii; int portalIpIndex; *************** *** 1239,1243 **** read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,portal_key,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1239,1243 ---- read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,portal_key,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** iSNSreg.c 15 Dec 2006 01:13:29 -0000 1.14 --- iSNSreg.c 15 Dec 2006 18:17:19 -0000 1.15 *************** *** 93,96 **** --- 93,97 ---- int regPortalFlag; int regISCSIFlag; + int regPortalGroupFlag; int regFlag; char *attr_indx[SNS_MAX_ATTRS]; *************** *** 106,109 **** --- 107,111 ---- regPortalFlag = 0; regISCSIFlag = 0; + regPortalGroupFlag = 0; ISNSParseMsg( &p_md->msg, attr_indx, key_indx, &src_attr ); *************** *** 163,166 **** --- 165,172 ---- regISCSIFlag = TRUE; break; + + case ISNS_PORTAL_GROUP_ISCSI_NAME: + regPortalGroupFlag = TRUE; + break; default: break; *************** *** 168,171 **** --- 174,179 ---- } + regPortalGroupFlag = (regISCSIFlag && regPortalFlag) || regPortalGroupFlag; + DEBUG_1 (isns_reg_debug &1,regISCSIFlag:%i,regISCSIFlag); DEBUG_1 (isns_reg_debug &1,regPortalFlag:%i,regPortalFlag); *************** *** 204,207 **** --- 212,221 ---- } + if (regPortalGroupFlag && status == ISNS_NO_ERR) + { + regFlag=TRUE; + status = ISNSdbAddAttrPortalGroup (attr_indx, key_indx, p_md, rspMsg); + } + if (!regFlag) status=ISNS_INVALID_REG_ERR; *************** *** 224,228 **** SOIP_Portal *p_portal; SOIP_Entity *p_entity; ! SOIP_DB_Portal db_portal; int ii; int rval; --- 238,242 ---- SOIP_Portal *p_portal; SOIP_Entity *p_entity; ! SOIP_Portal_Key db_portal; int ii; int rval; *************** *** 364,368 **** DEBUG_1 (isns_reg_debug &1,(read portal:%s),db_portal.ip_addr.v); read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); --- 378,382 ---- DEBUG_1 (isns_reg_debug &1,(read portal:%s),db_portal.ip_addr.v); read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry2); *************** *** 629,633 **** ISNS_Key update_key; update_key.tag = PORTAL_ID_KEY; ! memcpy(&update_key.val,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbWrite(&update_key,entry2); --- 643,647 ---- ISNS_Key update_key; update_key.tag = PORTAL_ID_KEY; ! memcpy(&update_key.val,&db_portal,sizeof(SOIP_Portal_Key)); rval = ISNSdbWrite(&update_key,entry2); *************** *** 665,668 **** --- 679,942 ---- /********************************************************************* + _ISNSdbAddAttrPortalGroup + + Adds a portal group to the database. The keys are appended to the + rsp message. + *********************************************************************/ + int + ISNSdbAddAttrPortalGroup (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, + ISNS_Msg * p_rspmsg) + { + ISNS_Key *key = NULL; + ISNS_Attr *attr = NULL; + SOIP_Portal_Group *p_portal_group; + SOIP_Portal_Key db_portal_group; + int ii; + int rval; + int portalIpIndex; + int portalPortIndex; + int saveIndex; + int stopFlag = FALSE; + int newPortalRegFlag; + int updateFlag; + //char *p_iscsi_name; + ISNS_Key read_key; + + DEBUG_0 (isns_reg_debug & 1, (Registering Portal)); + + newPortalRegFlag = FALSE; + portalPortIndex = -1; + portalIpIndex = -1; + + for (ii = 0; ii < SNS_MAX_ATTRS && key_indx[ ii ] + && (portalIpIndex == -1 || portalPortIndex == -1); ii++) + { + key = (ISNS_Key *)( key_indx[ ii ] ); + switch ( key->tag ) + { + case ISNS_PORTAL_GROUP_IP: + /* Check to see if we already had an IP */ + if (portalIpIndex != -1) + { + DEBUG_0 (isns_reg_debug & 1, (PORTAL_IP tag found twice)); + return ( ISNS_INVALID_REG_ERR ); + } + portalIpIndex = ii; + break; + case ISNS_PORTAL_GROUP_PORT: + /* Check to see if we already had a PORT */ + if (portalPortIndex != -1) + { + DEBUG_0 (isns_reg_debug & 1, (PORTAL_PORT tag found twice)); + return ( ISNS_INVALID_REG_ERR ); + } + portalPortIndex = ii; + break; + default: + break; + } + } + + if (portalIpIndex == -1 && portalPortIndex == -1) + { + /* No keys */ + newPortalRegFlag = TRUE; + } + else if (portalIpIndex == -1 || portalPortIndex == -1) + { + /* One or the other key */ + DEBUG_0 (isns_reg_debug & 1, (Portal Reg: Missing keys)); + return ( ISNS_INVALID_REG_ERR ); + } + + saveIndex = 0; + /* Loop for every portal IP and portal PORT */ + while ( saveIndex < SNS_MAX_ATTRS ) + { + if ( newPortalRegFlag ) + { + /* Search for the tag portal IP and portal PORT. */ + /* These are going to be used as the key. */ + portalIpIndex = -1; + portalPortIndex = -1; + + for ( ii = saveIndex; ii < SNS_MAX_ATTRS && attr_indx[ii] + && (portalIpIndex == -1 || portalPortIndex == -1); ii++ ) + { + attr = (ISNS_Attr *) attr_indx[ ii ]; + switch ( attr->tag ) + { + case ISNS_PORTAL_IP: + /* Check to see if we already had an IP */ + if (portalIpIndex != -1) + { + DEBUG_0 (isns_reg_debug & 1, (PORTAL_IP tag found twice)); + return ( ISNS_INVALID_REG_ERR ); + } + portalIpIndex = ii; + break; + case ISNS_PORTAL_PORT: + /* Check to see if we already had a PORT */ + if (portalPortIndex != -1) + { + DEBUG_0 (isns_reg_debug & 1, (PORTAL_PORT tag found twice)); + return ( ISNS_INVALID_REG_ERR ); + } + portalPortIndex = ii; + break; + default: + break; + } + } + + /* Check to see if we have both indices */ + if ( portalIpIndex == -1 || portalPortIndex == -1 ) + { + DEBUG_0 (isns_reg_debug & 1, (PORTAL REG, MISSING KEYS)); + return ( ISNS_INVALID_REG_ERR ); + } + + DEBUG_1 (isns_reg_debug &1,(Portal ip_port:%i),attr->val.ip_port); + attr = (ISNS_Attr *) attr_indx[ portalPortIndex ]; + db_portal_group.ip_port = attr->val.ip_port; + + attr = (ISNS_Attr *) attr_indx[ portalIpIndex ]; + memcpy ( (char *) db_portal_group.ip_addr.v, &attr->val, + ISNS_PORTAL_IP_SIZE ); + + saveIndex = ii; + } + else + { + DEBUG_1 (isns_reg_debug &1,(Portal ip_port:%i),key->val.ip_port); + /* Use Keys to fetch the portal Object */ + key = (ISNS_Key *) key_indx[ portalPortIndex ]; + db_portal_group.ip_port = key->val.ip_port; + + DEBUG_1 (isns_reg_debug &1,(Portal ip_addr len:%i),key->len); + key = (ISNS_Key *) key_indx[ portalIpIndex ]; + memcpy ( (char *) db_portal_group.ip_addr.v, &key->val, + key->len ); + saveIndex = 0; + } + + DEBUG_1 (isns_reg_debug &1,(read portal:%s),db_portal_group.ip_addr.v); + read_key.tag = PORTAL_GROUP_ID_KEY; + memcpy(&read_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); + rval = ISNSdbRead(&read_key,&entry2); + + p_portal_group = &entry2.data.portal_group; + + if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) + { + DEBUG_0 (isns_reg_debug & 1,Deregistering PortalGroup); + // SNSRemovePortalEntry ((char *)&db_portal_group, NULL, NULL); + rval = ERROR; + } + + /* Create new entry */ + if ( rval != SUCCESS ) + { + DEBUG_0 (isns_reg_debug &1,create new portal entry); + + if ( FALSE == newPortalRegFlag ) + { + DEBUG_0 (isns_reg_debug & 1, (Unable to retrieve portal entry)); + return ( ISNS_INVALID_REG_ERR ); + } + /* create a new node element */ + memset (&entry2, 0, sizeof (SOIP_DB_Entry)); + entry2.data_type = PORTAL_ID_KEY; + + attr = (ISNS_Attr *) attr_indx[portalIpIndex]; + memcpy (p_portal_group->ip_addr.v, attr->val.ip_addr.v, attr->len); + + attr = (ISNS_Attr *) attr_indx[portalPortIndex]; + p_portal_group->ip_port = attr->val.ip_port; + + //p_portal_group->portal_index = ISNSGetNewPortalIdx(); + + newPortalRegFlag = TRUE; + } + else + + stopFlag = FALSE; + updateFlag = FALSE; + memset(p_scn_all_msg_buffer, 0, sizeof(ISNS_Msg)); + for ( ii = saveIndex; (ii < SNS_MAX_ATTRS) && (attr_indx[ ii ]); ii++ ) + { + attr = (ISNS_Attr *) attr_indx[ ii ]; + switch ( attr->tag ) + { + case ISNS_PORTAL_IP: + case ISNS_PORTAL_PORT: + saveIndex = ii; + stopFlag = TRUE; + break; + case ISNS_PORTAL_GROUP: + //if (p_portal->group!=*(uint32_t *)&attr->val) + //{ + // p_portal->group=*(uint32_t *)&attr->val; + + // ISNSAppendKey( p_scn_all_msg_buffer, ISNS_PORTAL_GROUP, + // ISNS_PORTAL_GROUP_SIZE, NULL, p_portal->group ); + + //updateFlag = TRUE; + //} + break; + default: + break; + } + + if (stopFlag) + break; + } + + /* Store the portal */ + DEBUG_1 (isns_reg_debug &1,Store Portal Group:%s,db_portal_group.ip_addr.v); + ISNS_Key update_key; + update_key.tag = PORTAL_GROUP_ID_KEY; + memcpy(&update_key.val,&db_portal_group,sizeof(SOIP_Portal_Group_Key)); + rval = ISNSdbWrite(&update_key,entry2); + + if ( newPortalRegFlag ) + iSNS_stats.num_portal_groups++; + + /* insert the key(s) */ + if (p_rspmsg != NULL) + { + ISNSAppendKey (p_rspmsg, ISNS_PORTAL_GROUP_IP, ISNS_PORTAL_IP_SIZE, + p_portal_group->ip_addr.v, 0); + ISNSAppendKey (p_rspmsg, ISNS_PORTAL_GROUP_PORT, ISNS_PORTAL_PORT_SIZE, 0, + p_portal_group->ip_port); + ISNSAppendKey (p_rspmsg, ISNS_PORTAL_GROUP_ISCSI_NAME, ISNS_PORTAL_PORT_SIZE, 0, + p_portal_group->ip_port); + ISNSAppendKey (p_rspmsg, ISNS_PORTAL_GROUP_TAG, ISNS_PORTAL_GROUP_TAG_SIZE, 0, + p_portal_group->portal_tag); + } + + /* Loop on the following conditions. */ + attr = (ISNS_Attr *)(attr_indx[saveIndex]); + + if (!newPortalRegFlag) + break; + + if (!attr_indx[saveIndex]) + break; + + newPortalRegFlag = TRUE; + if ((attr->tag == ISNS_PORTAL_IP) || (attr->tag == ISNS_PORTAL_PORT)) + continue; + else + break; + + DEBUG_0 (isns_reg_debug &1,end of loop); + } + + DEBUG_0 (isns_reg_debug &1,return); + return (ISNS_NO_ERR); + } + + /********************************************************************* _SNSdbAddAttrDDS *************** *** 2126,2130 **** memset ( &db_node_name, 0, sizeof (db_node_name) ); ! strncpy ((char *) db_node_name.v, (char *) &key->val, sizeof(db_node_name.v) ); ISNS_Key read_key; --- 2400,2404 ---- memset ( &db_node_name, 0, sizeof (db_node_name) ); ! strncpy ((char *) db_node_name.v, (char *) &key->val, key->len ); ISNS_Key read_key; *************** *** 2490,2494 **** ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) --- 2764,2768 ---- ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_Portal_Key)); rval = ISNSdbRead(&read_key,&entry3); if (rval != SUCCESS) *************** *** 3598,3602 **** SOIP_DB_Entry lentry2; SOIP_Dd *p_dd = NULL; ! ISNS_Key dd_key = { 0 }; int rval; int found; --- 3872,3876 ---- SOIP_DB_Entry lentry2; SOIP_Dd *p_dd = NULL; ! ISNS_Key dd_key = { 0 }; int rval; int found; Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** iSNSdb.c 15 Dec 2006 01:13:29 -0000 1.20 --- iSNSdb.c 15 Dec 2006 18:17:18 -0000 1.21 *************** *** 105,109 **** *********************************************************************/ int ! ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry) { datum k; --- 105,109 ---- *********************************************************************/ int ! ISNSdbRead (ISNS_DBKey *key, SOIP_DB_Entry *entry) { datum k; *************** *** 204,219 **** case PORTAL_ID_KEY: { ! SOIP_DB_Portal db_portal; ! char ipaddr[256]; ! memcpy(&db_portal,&key->val,sizeof(SOIP_DB_Portal)); ! ipaddrchar(&db_portal.ip_addr,ipaddr); ! DEBUG_2 (isns_db_debug &1,read Portal ip_addr:%s port:%i,ipaddr,db_portal.ip_port); k.dptr = (char *)&key->val; ! k.dsize = sizeof(SOIP_DB_Portal); d = ndb_fetch_sns (PORTAL_ID_KEY, k, (char *)entry); if (d.dptr == NULL) { ! DEBUG_2 (isns_db_debug &1,read failure Portal ip_addr:%s port:%i,ipaddr,db_portal.ip_port); return (ISNS_NO_SUCH_ENTRY_ERR); } --- 204,219 ---- case PORTAL_ID_KEY: { ! SOIP_Portal_Key db_portal; ! memcpy(&db_portal,&key->val,sizeof(SOIP_Portal_Key)); ! DEBUG_2 (isns_db_debug &1,read Portal ip_addr:%s port:%i, ! inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); k.dptr = (char *)&key->val; ! k.dsize = sizeof(SOIP_Portal_Key); d = ndb_fetch_sns (PORTAL_ID_KEY, k, (char *)entry); if (d.dptr == NULL) { ! DEBUG_2 (isns_db_debug &1,read failure Portal ip_addr:%s port:%i, ! inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); return (ISNS_NO_SUCH_ENTRY_ERR); } *************** *** 222,225 **** --- 222,245 ---- break; } + case PORTAL_GROUP_ID_KEY: + { + SOIP_Portal_Group_Key db_portal; + memcpy(&db_portal,&key->val,sizeof(SOIP_Portal_Group_Key)); + DEBUG_2 (isns_db_debug &1,read Portal Group ip_addr:%s port:%i, + inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); + + k.dptr = (char *)&key->val; + k.dsize = sizeof(SOIP_Portal_Group_Key); + d = ndb_fetch_sns (PORTAL_GROUP_ID_KEY, k, (char *)entry); + if (d.dptr == NULL) + { + DEBUG_2 (isns_db_debug &1,read Portal Group ip_addr:%s port:%i, + inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); + return (ISNS_NO_SUCH_ENTRY_ERR); + } + if (entry->data_type != PORTAL_GROUP_ID_KEY) + return (ISNS_UNKNOWN_ERR); + break; + } case ENTITY_IDX_KEY: case ISCSI_IDX_KEY: *************** *** 255,259 **** case PORTAL_ENTITY_LIST: DEBUG_1 (isns_db_debug & 1, (read list:%i),key->val.list.key.portal.ip_port); ! k.dsize = LIST_KEY_SIZE + sizeof(SOIP_DB_Portal); break; case ISCSI_DD_LIST: --- 275,279 ---- case PORTAL_ENTITY_LIST: DEBUG_1 (isns_db_debug & 1, (read list:%i),key->val.list.key.portal.ip_port); ! k.dsize = LIST_KEY_SIZE + sizeof(SOIP_Portal_Key); break; case ISCSI_DD_LIST: *************** *** 299,303 **** *********************************************************************/ int ! ISNSdbWrite (ISNS_Key *key, SOIP_DB_Entry entry) { datum k; --- 319,323 ---- *********************************************************************/ int ! ISNSdbWrite (ISNS_DBKey *key, SOIP_DB_Entry entry) { datum k; *************** *** 361,369 **** case PORTAL_ID_KEY: k.dptr = (char *)&key->val; ! k.dsize = sizeof(SOIP_DB_Portal); rc = ndb_store_sns (key->tag, k, d, GDBM_REPLACE); if (rc == ERROR) DEBUG_0 (isns_db_debug &1,PORTAL Name Write failed); break; case ENTITY_IDX_KEY: case ISCSI_IDX_KEY: --- 381,396 ---- case PORTAL_ID_KEY: k.dptr = (char *)&key->val; ! k.dsize = sizeof(SOIP_Portal_Key); rc = ndb_store_sns (key->tag, k, d, GDBM_REPLACE); if (rc == ERROR) DEBUG_0 (isns_db_debug &1,PORTAL Name Write failed); break; + case PORTAL_GROUP_ID_KEY: + k.dptr = (char *)&key->val; + k.dsize = sizeof(SOIP_Portal_Group_Key); + rc = ndb_store_sns (key->tag, k, d, GDBM_REPLACE); + if (rc == ERROR) + DEBUG_0 (isns_db_debug &1,PORTAL Group Write failed); + break; case ENTITY_IDX_KEY: case ISCSI_IDX_KEY: *************** *** 395,399 **** case PORTAL_ENTITY_LIST: DEBUG_1 (isns_db_debug & 1, (write list:%i),key->val.list.key.portal.ip_port); ! k.dsize = LIST_KEY_SIZE + sizeof(SOIP_DB_Portal); break; case ISCSI_DD_LIST: --- 422,426 ---- case PORTAL_ENTITY_LIST: DEBUG_1 (isns_db_debug & 1, (write list:%i),key->val.list.key.portal.ip_port); ! k.dsize = LIST_KEY_SIZE + sizeof(SOIP_Portal_Key); break; case ISCSI_DD_LIST: *************** *** 432,436 **** *********************************************************************/ int ! ISNSdbDelete (ISNS_Key *key) { datum k; --- 459,463 ---- *********************************************************************/ int ! ISNSdbDelete (ISNS_DBKey *key) { datum k; *************** *** 489,497 **** case PORTAL_ID_KEY: k.dptr = (char *)&key->val; ! k.dsize = sizeof(SOIP_DB_Portal); rc = ndb_delete (key->tag, k); if (rc == ERROR) DEBUG_0 (isns_db_debug &1,PORTAL Name Delete failed); break; case ENTITY_IDX_KEY: case ISCSI_IDX_KEY: --- 516,531 ---- case PORTAL_ID_KEY: k.dptr = (char *)&key->val; ! k.dsize = sizeof(SOIP_Portal_Key); rc = ndb_delete (key->tag, k); if (rc == ERROR) DEBUG_0 (isns_db_debug &1,PORTAL Name Delete failed); break; + case PORTAL_GROUP_ID_KEY: + k.dptr = (char *)&key->val; + k.dsize = sizeof(SOIP_Portal_Group_Key); + rc = ndb_delete (key->tag, k); + if (rc == ERROR) + DEBUG_0 (isns_db_debug &1,PORTAL Group Delete failed); + break; case ENTITY_IDX_KEY: case ISCSI_IDX_KEY: *************** *** 520,524 **** break; case PORTAL_ENTITY_LIST: ! k.dsize = LIST_KEY_SIZE + sizeof(SOIP_DB_Portal); break; case ISCSI_DD_LIST: --- 554,558 ---- break; case PORTAL_ENTITY_LIST: ! k.dsize = LIST_KEY_SIZE + sizeof(SOIP_Portal_Key); break; case ISCSI_DD_LIST: *************** *** 608,612 **** dbfp[PORT_NAME_KEY] = gdbm_open("isns7.db",1024,GDBM_WRCREAT,0666, ISNSExceptionHdlr); ! dbfp[ESI_KEY] = gdbm_open("isns8.db",1024,GDBM_WRCREAT,0666, ISNSExceptionHdlr); dbfp[ENTITY_IDX_KEY] = gdbm_open("isns9.db",1024,GDBM_WRCREAT,0666, --- 642,646 ---- dbfp[PORT_NAME_KEY] = gdbm_open("isns7.db",1024,GDBM_WRCREAT,0666, ISNSExceptionHdlr); ! dbfp[PORTAL_GROUP_ID_KEY] = gdbm_open("isns8.db",1024,GDBM_WRCREAT,0666, ISNSExceptionHdlr); dbfp[ENTITY_IDX_KEY] = gdbm_open("isns9.db",1024,GDBM_WRCREAT,0666, *************** *** 645,649 **** gdbm_close(dbfp[NODE_NAME_KEY]); gdbm_close(dbfp[PORT_NAME_KEY]); ! gdbm_close(dbfp[ESI_KEY]); gdbm_close(dbfp[ENTITY_IDX_KEY]); gdbm_close(dbfp[ISCSI_IDX_KEY]); --- 679,683 ---- gdbm_close(dbfp[NODE_NAME_KEY]); gdbm_close(dbfp[PORT_NAME_KEY]); ! gdbm_close(dbfp[PORTAL_GROUP_ID_KEY]); gdbm_close(dbfp[ENTITY_IDX_KEY]); gdbm_close(dbfp[ISCSI_IDX_KEY]); *************** *** 671,675 **** SOIP_DB_Entry * p_entry) { ! ISNS_Key key; int rval; --- 705,709 ---- SOIP_DB_Entry * p_entry) { ! ISNS_DBKey key; int rval; *************** *** 695,699 **** { SOIP_DD_Key dd_key; ! ISNS_Key key; int rval; --- 729,733 ---- { SOIP_DD_Key dd_key; ! ISNS_DBKey key; int rval; *************** *** 714,721 **** *********************************************************************/ int ! SNSdbGetNextOfKey (ISNS_Key * key) { datum k, d, next; ! ISNS_Key null_key = { 0 }; SOIP_DB_Entry *p_entry; --- 748,755 ---- *********************************************************************/ int ! SNSdbGetNextOfKey (ISNS_DBKey * key) { datum k, d, next; ! ISNS_DBKey null_key = { 0 }; SOIP_DB_Entry *p_entry; |
From: Robert W. <wrw...@us...> - 2006-12-15 01:14:21
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4746/src Modified Files: iSNSInit.c iSNSLinux.c iSNSMain.c iSNSUtil.c iSNSdb.c iSNSdereg.c iSNSesi.c iSNSfsm.c iSNSparse.c iSNSquery.c iSNSqueue.c iSNSreg.c iSNSresponse.c iSNSscn.c Added Files: iSNSconfig.c Log Message: clean up global variables and create a global config Index: iSNSInit.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSInit.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSInit.c 6 Dec 2006 22:05:34 -0000 1.3 --- iSNSInit.c 15 Dec 2006 01:13:29 -0000 1.4 *************** *** 48,52 **** #include "iSNSbuffer.h" #include "iSNSreg.h" - #include "iSNSdebug.h" --- 48,51 ---- *************** *** 55,60 **** #endif - extern void ISNSInitDBTables(void); - STATUS SNSInit (ISNS_Entity sns_role) --- 54,57 ---- Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNSUtil.c 14 Dec 2006 23:04:28 -0000 1.11 --- iSNSUtil.c 15 Dec 2006 01:13:29 -0000 1.12 *************** *** 43,52 **** #include "iSNSipc.h" #include "iSNSList.h" - - #ifdef SNS_DEBUG #include "iSNSdebug.h" - void SNSDisplay_Entity (SOIP_Entity *p_entity); - static char *p_name = "Port Name"; --- 43,48 ---- *************** *** 1165,1167 **** printf("\n"); } - #endif --- 1161,1162 ---- Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSquery.c 14 Dec 2006 23:04:28 -0000 1.9 --- iSNSquery.c 15 Dec 2006 01:13:29 -0000 1.10 *************** *** 49,66 **** #include "iSNStbl.h" #include "iSNSparse.h" - #include "iSNSdebug.h" - - #ifndef MAX_PARSE_ATTRS - #define MAX_PARSE_ATTRS 30 - #endif - /* Global */ ! int isns_query_debug=0; extern uint32_t isns_esi_interval; ! ! extern ISNS_ATTR_VALS_CB * ! ISNSAttrGetList (ISNS_Msg_Descp *p_md); /* --- 49,67 ---- #include "iSNStbl.h" #include "iSNSparse.h" #include "iSNSdebug.h" /* Global */ ! extern int isns_query_debug; extern uint32_t isns_esi_interval; ! extern uint32_t *dlist_src; /*[MAX_DD_PER_LIST];*/ ! extern uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ ! extern SOIP_Dd_Member *ddmem; /* [100]; */ ! extern ISNS_LIST scn_list; ! extern ISNS_LIST scn_callback_list; ! extern ISNS_Msg *p_scn_msg_buffer; ! extern ISNS_Msg *p_scn_all_msg_buffer; ! extern ISNS_Msg_Descp *p_scn_md; ! extern ISNS_Msg_Descp *p_rspMd; ! extern dbStats iSNS_stats; /* *************** *** 76,93 **** static SOIP_DB_Entry entry5; ! extern uint32_t *dlist_src; /*[MAX_DD_PER_LIST];*/ ! extern uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ ! extern SOIP_Dd_Member *ddmem; /* [100]; */ ! ! extern ISNS_LIST scn_list; ! extern ISNS_LIST scn_callback_list; ! ! extern ISNS_Msg *p_scn_msg_buffer; ! extern ISNS_Msg *p_scn_all_msg_buffer; ! extern ISNS_Msg_Descp *p_scn_md; ! extern ISNS_Msg_Descp *p_rspMd; ! ! extern dbStats iSNS_stats; ! static int SNSdbGetAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * md, --- 77,81 ---- static SOIP_DB_Entry entry5; ! /* local prototypes */ static int SNSdbGetAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * md, *************** *** 126,132 **** SNSdbGetAttrEntity (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - int - Check_Permission (ISNS_Attr *src_attr, int rectype, void * ptr); - /********************************************************************* --- 114,117 ---- Index: iSNSresponse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSresponse.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iSNSresponse.c 14 Dec 2006 23:04:28 -0000 1.5 --- iSNSresponse.c 15 Dec 2006 01:13:29 -0000 1.6 *************** *** 33,83 **** /* ! * This file contains source code for managing the ! * iSNS database. ! * */ #include "iSNS.h" - #include "iSNSdb.h" #include "iSNStypes.h" #include "iSNSmsg.h" - #include "iSNScomm.h" - #include "iSNSbuffer.h" - #include "iSNStbl.h" - #include "iSNSList.h" - #include "iSNSparse.h" - - #include "iSNSdebug.h" - - - #ifndef MAX_PARSE_ATTRS - #define MAX_PARSE_ATTRS 30 - #endif - - /* Global */ - extern int isns_db_debug; - - extern ISNS_ATTR_VALS_CB * - ISNSAttrGetList (ISNS_Msg_Descp *p_md); - - /* - * static common variables for gdbm fetches - * entry is for common registrations and queries - * scn_entry is for state change notifications - * opn_entry is for access control - */ - - uint32_t *dlist_src; /*[MAX_DD_PER_LIST];*/ - uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ - SOIP_Dd_Member *ddmem; /* [100]; */ - - ISNS_LIST scn_list; - ISNS_LIST scn_callback_list; - - ISNS_Msg *p_scn_msg_buffer; - ISNS_Msg *p_scn_all_msg_buffer; - ISNS_Msg_Descp *p_scn_md; - ISNS_Msg_Descp *p_rspMd; - - dbStats iSNS_stats; /********************************************************************* --- 33,41 ---- /* ! * This file contains source code for managing the responses back to clients. */ #include "iSNS.h" #include "iSNStypes.h" #include "iSNSmsg.h" /********************************************************************* Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iSNSesi.c 14 Dec 2006 23:04:28 -0000 1.6 --- iSNSesi.c 15 Dec 2006 01:13:29 -0000 1.7 *************** *** 48,60 **** #include "iSNStbl.h" #include "iSNSparse.h" - #include "iSNSdebug.h" ! /* Global */ ! int isns_esi_debug=0; ! ! int sns_esi_interval = SNS_ESI_INTERVAL; ! extern int sns_heartbeat_interval; /* --- 48,57 ---- #include "iSNStbl.h" #include "iSNSparse.h" #include "iSNSdebug.h" ! extern int isns_esi_debug; ! extern int sns_esi_interval; ! extern int esi_sent_limit; /* *************** *** 67,78 **** static SOIP_DB_Entry entry2; /* secondary fetches */ ! uint32_t *dlist_src; /*[MAX_DD_PER_LIST];*/ ! uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ ! SOIP_Dd_Member *ddmem; /* [100]; */ ! ! ISNS_Msg *p_scn_msg_buffer; ! ISNS_Msg *p_scn_all_msg_buffer; ! ISNS_Msg_Descp *p_scn_md; ! ISNS_Msg_Descp *p_rspMd; /********************************************************************* --- 64,68 ---- static SOIP_DB_Entry entry2; /* secondary fetches */ ! ISNS_Msg_Descp *p_rspMd; /********************************************************************* *************** *** 138,142 **** DEBUG_1 (isns_esi_debug &1, esi_timer Timer Expired esiSend:%i,p_portal->esiSent); ! if ( p_portal->esiSent < 4 ) { DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), p_portal->entity_id.id); --- 128,132 ---- DEBUG_1 (isns_esi_debug &1, esi_timer Timer Expired esiSend:%i,p_portal->esiSent); ! if ( p_portal->esiSent < esi_sent_limit ) { DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), p_portal->entity_id.id); Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** iSNSparse.c 14 Dec 2006 23:27:50 -0000 1.13 --- iSNSparse.c 15 Dec 2006 01:13:29 -0000 1.14 *************** *** 38,56 **** #include "iSNSmsg.h" #include "iSNSparse.h" - - #ifdef SNS_DEBUG #include "iSNSdebug.h" - #endif ! #define MAX_PARSE_ATTRS 17 /*** local function prototypes ***/ - int SNSConvertPayloadNTOH (ISNS_Msg_Descp * p_md); - - /* updates msg_type based on rscn_type */ - - int sns_parse_debug = 0; - - static int ISNSProfileKeysAttr (ISNS_Msg * msg, --- 38,46 ---- #include "iSNSmsg.h" #include "iSNSparse.h" #include "iSNSdebug.h" ! extern int isns_parse_debug; /*** local function prototypes ***/ static int ISNSProfileKeysAttr (ISNS_Msg * msg, *************** *** 58,61 **** --- 48,54 ---- char **key_index, int *num_keys, ISNS_Attr **src_attr); + /************************************************************* + * ISNSParseMsg + *************************************************************/ int ISNSParseMsg (ISNS_Msg * msg, char **attr_index, char **key_index, *************** *** 139,143 **** if (len != ISNS_DELIMITER_SIZE) rval = FALSE; ! DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; /* Variable Length */ --- 132,136 ---- if (len != ISNS_DELIMITER_SIZE) rval = FALSE; ! DEBUG_3 (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; /* Variable Length */ *************** *** 156,162 **** if ( len == 0) ! DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); else ! DEBUG_4 (sns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),(char *)ptr); break; --- 149,155 ---- if ( len == 0) ! DEBUG_3 (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); else ! DEBUG_4 (isns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),(char *)ptr); break; *************** *** 168,172 **** rval = FALSE; ipaddrchar (ptr,ipaddr); ! DEBUG_4 (sns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),ipaddr); break; } --- 161,165 ---- rval = FALSE; ipaddrchar (ptr,ipaddr); ! DEBUG_4 (isns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),ipaddr); break; } *************** *** 174,178 **** if (len != ISNS_TIMESTAMP_SIZE && len != 0 ) rval = FALSE; ! DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; --- 167,171 ---- if (len != ISNS_TIMESTAMP_SIZE && len != 0 ) rval = FALSE; ! DEBUG_3 (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; *************** *** 208,214 **** rval = FALSE; if (len == 0) ! DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); else ! DEBUG_4 (sns_parse_debug &1,%sTag:%i (%s) %i,src,tag,isnsTagText(tag),*(uint32_t *)ptr); break; --- 201,207 ---- rval = FALSE; if (len == 0) ! DEBUG_3 (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); else ! DEBUG_4 (isns_parse_debug &1,%sTag:%i (%s) %i,src,tag,isnsTagText(tag),*(uint32_t *)ptr); break; *************** *** 220,226 **** rval = FALSE; if (len == 0) ! DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); else ! DEBUG_4 (sns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),(char *)ptr); break; --- 213,219 ---- rval = FALSE; if (len == 0) ! DEBUG_3 (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); else ! DEBUG_4 (isns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),(char *)ptr); break; *************** *** 253,263 **** case ISNS_FC_NODE_CERT: if (len == 0) ! DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); else ! DEBUG_4 (sns_parse_debug &1,%sTag:%i (%s) %i,src,tag,isnsTagText(tag),*(uint32_t *)ptr); break; default: ! DEBUG_1 (sns_parse_debug &1,(Tag not Defined:%i),tag); break; } --- 246,256 ---- case ISNS_FC_NODE_CERT: if (len == 0) ! DEBUG_3 (isns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); else ! DEBUG_4 (isns_parse_debug &1,%sTag:%i (%s) %i,src,tag,isnsTagText(tag),*(uint32_t *)ptr); break; default: ! DEBUG_1 (isns_parse_debug &1,(Tag not Defined:%i),tag); break; } *************** *** 265,269 **** if (!rval) ! DEBUG_0 (sns_parse_debug &1,(VerifyTag rval)); return (rval); --- 258,262 ---- if (!rval) ! DEBUG_0 (isns_parse_debug &1,(VerifyTag rval)); return (rval); *************** *** 291,295 **** } ! DEBUG_2 (sns_parse_debug &1,%s flags:%x,FuncIDText(msg->hdr.type),msg->hdr.flags); /* Store Keys */ --- 284,288 ---- } ! DEBUG_2 (isns_parse_debug &1,%s flags:%x,FuncIDText(msg->hdr.type),msg->hdr.flags); /* Store Keys */ *************** *** 315,319 **** { ! DEBUG_0 (sns_parse_debug &1, skip the error status field / timestamp); offset += 4; ptr = (struct ISNS_attr *)((char *) ptr + 4); --- 308,312 ---- { ! DEBUG_0 (isns_parse_debug &1, skip the error status field / timestamp); offset += 4; ptr = (struct ISNS_attr *)((char *) ptr + 4); *************** *** 369,373 **** } - /* updates msg_type based on rscn_type */ int SNSConvertPayloadNTOH (ISNS_Msg_Descp * msg) --- 362,365 ---- *************** *** 423,427 **** pattr->tag = ntohl (pattr->tag); } ! // if (sns_parse_debug) // printf ("%s:%d Processing msg type=0x%x (%u), tag=0x%x (%u).\n", // __FILE__, __LINE__, msg->msg.hdr.type, msg->msg.hdr.type, --- 415,419 ---- pattr->tag = ntohl (pattr->tag); } ! // if (isns_parse_debug) // printf ("%s:%d Processing msg type=0x%x (%u), tag=0x%x (%u).\n", // __FILE__, __LINE__, msg->msg.hdr.type, msg->msg.hdr.type, *************** *** 577,581 **** pattr->tag = ntohl (pattr->tag); } ! // if (sns_parse_debug) // { // printf ("%s:%d Processing msg type=0x%x (%u), tag=0x%x (%u).\n", --- 569,573 ---- pattr->tag = ntohl (pattr->tag); } ! // if (isns_parse_debug) // { // printf ("%s:%d Processing msg type=0x%x (%u), tag=0x%x (%u).\n", --- NEW FILE: iSNSconfig.c --- /*********************************************************************** Copyright (c) 2006, Novell, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Novell, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NISHAN SYSTEMS, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ #include "iSNS.h" /* Global Configuration Variables */ int sns_esi_interval = SNS_ESI_INTERVAL; int esi_sent_limit = 4; /* debug settings */ int isns_db_debug = 0; int isns_esi_debug = 0; int isns_reg_debug = 0; int isns_dereg_debug = 0; int isns_query_debug = 0; int isns_parse_debug = 0; int sns_fsm_debug = 0; /* state machine debugging */ int sns_bcast_debug = 0; /* broadcast debugging (except hb, scn) */ Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** iSNSdereg.c 14 Dec 2006 23:04:28 -0000 1.13 --- iSNSdereg.c 15 Dec 2006 01:13:29 -0000 1.14 *************** *** 50,69 **** #include "iSNStbl.h" #include "iSNSparse.h" - #include "iSNSdebug.h" - - #ifndef MAX_PARSE_ATTRS - #define MAX_PARSE_ATTRS 30 - #endif - /* Global */ ! int isns_dereg_debug;; extern uint32_t isns_esi_interval; ! ! extern ISNS_ATTR_VALS_CB * ! ISNSAttrGetList (ISNS_Msg_Descp *p_md); ! ! int Check_Permission (ISNS_Attr *src_attr, int rectype, void * ptr); /* --- 50,66 ---- #include "iSNStbl.h" #include "iSNSparse.h" #include "iSNSdebug.h" /* Global */ ! extern int isns_dereg_debug;; extern uint32_t isns_esi_interval; ! extern uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ ! extern ISNS_LIST scn_list; ! extern ISNS_LIST scn_callback_list; ! extern ISNS_Msg *p_scn_msg_buffer; ! extern ISNS_Msg *p_scn_all_msg_buffer; ! extern ISNS_Msg_Descp *p_scn_md; ! extern ISNS_Msg_Descp *p_rspMd; ! extern dbStats iSNS_stats; /* *************** *** 79,95 **** static SOIP_DB_Entry entry5; - extern uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ - - extern ISNS_LIST scn_list; - extern ISNS_LIST scn_callback_list; - - extern ISNS_Msg *p_scn_msg_buffer; - extern ISNS_Msg *p_scn_all_msg_buffer; - extern ISNS_Msg_Descp *p_scn_md; - extern ISNS_Msg_Descp *p_rspMd; - - - extern dbStats iSNS_stats; - /********************************************************************* _SNSdbRemoveAttr --- 76,79 ---- Index: iSNSfsm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSfsm.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iSNSfsm.c 13 Dec 2006 23:53:01 -0000 1.5 --- iSNSfsm.c 15 Dec 2006 01:13:29 -0000 1.6 *************** *** 42,51 **** #include "iSNSipc.h" #include "iSNStbl.h" - #include "iSNSdebug.h" - int sns_fsm_debug = 0; /* state machine debugging */ - int sns_bcast_debug = 0; /* broadcast debugging (except hb, scn) */ - extern int sns_hb_debug; extern int sns_comm_support; --- 42,51 ---- #include "iSNSipc.h" #include "iSNStbl.h" #include "iSNSdebug.h" + /* Globals */ + extern int sns_fsm_debug; /* state machine debugging */ + extern int sns_bcast_debug; /* broadcast debugging (except hb, scn) */ + extern int sns_hb_debug; extern int sns_comm_support; Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** iSNSreg.c 14 Dec 2006 23:04:28 -0000 1.13 --- iSNSreg.c 15 Dec 2006 01:13:29 -0000 1.14 *************** *** 50,66 **** #include "iSNStbl.h" #include "iSNSparse.h" - #include "iSNSdebug.h" - int Check_if_member_of_DD (char * id); - - #ifndef MAX_PARSE_ATTRS - #define MAX_PARSE_ATTRS 30 - #endif - /* Global */ ! int isns_reg_debug=0; ! int sns_esi_interval; ! /* --- 50,66 ---- #include "iSNStbl.h" #include "iSNSparse.h" #include "iSNSdebug.h" /* Global */ ! extern int isns_reg_debug; ! extern int sns_esi_interval; ! extern uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ ! extern ISNS_LIST scn_list; ! extern ISNS_LIST scn_callback_list; ! extern ISNS_Msg *p_scn_msg_buffer; ! extern ISNS_Msg *p_scn_all_msg_buffer; ! extern ISNS_Msg_Descp *p_scn_md; ! extern ISNS_Msg_Descp *p_rspMd; ! extern dbStats iSNS_stats; /* *************** *** 74,89 **** static SOIP_DB_Entry entry3; ! extern uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ ! ! extern ISNS_LIST scn_list; ! extern ISNS_LIST scn_callback_list; ! ! extern ISNS_Msg *p_scn_msg_buffer; ! extern ISNS_Msg *p_scn_all_msg_buffer; ! extern ISNS_Msg_Descp *p_scn_md; ! extern ISNS_Msg_Descp *p_rspMd; ! ! extern dbStats iSNS_stats; ! static int Add_ISCSINode_Default_DD (SOIP_Iscsi *p_node); --- 74,78 ---- static SOIP_DB_Entry entry3; ! int Check_if_member_of_DD (char * id); static int Add_ISCSINode_Default_DD (SOIP_Iscsi *p_node); Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** iSNSdb.c 14 Dec 2006 23:27:50 -0000 1.19 --- iSNSdb.c 15 Dec 2006 01:13:29 -0000 1.20 *************** *** 58,62 **** /* Global */ ! int isns_db_debug = 0; /* --- 58,62 ---- /* Global */ ! extern int isns_db_debug; /* Index: iSNSscn.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSscn.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iSNSscn.c 13 Dec 2006 19:45:57 -0000 1.5 --- iSNSscn.c 15 Dec 2006 01:13:29 -0000 1.6 *************** *** 45,51 **** #include "iSNSList.h" #include "iSNSparse.h" ! #include "iSNSdebug.h" extern int sns_scn_debug; extern int sns_scn_msg_filter; --- 45,63 ---- #include "iSNSList.h" #include "iSNSparse.h" ! #include "iSNSquery.h" ! #include "iSNSresponse.h" ! #include "iSNSreg.h" #include "iSNSdebug.h" + /* Global */ + extern int isns_scn_msg_filter; + extern int isns_rsync_debug; + extern ISNS_LIST scn_list; + extern ISNS_LIST scn_callback_list; + extern ISNS_Msg *p_scn_msg_buffer; + extern ISNS_Msg *p_scn_all_msg_buffer; + extern ISNS_Msg_Descp *p_scn_md; + extern ISNS_Msg_Descp *p_rspMd; + extern dbStats iSNS_stats; extern int sns_scn_debug; extern int sns_scn_msg_filter; *************** *** 53,61 **** extern int SNSGetMgmtAddr (void); extern int sns_esi_interval; ! ! /* Global */ ! static int scn_xid = 1; ! extern int isns_scn_msg_filter; ! extern int isns_rsync_debug; /* --- 65,71 ---- extern int SNSGetMgmtAddr (void); extern int sns_esi_interval; ! extern uint32_t *dlist_src; /*[MAX_DD_PER_LIST];*/ ! extern uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ ! extern SOIP_Dd_Member *ddmem; /* [100]; */ /* *************** *** 65,69 **** * opn_entry is for access control */ - static SOIP_DB_Entry scn_entry; static SOIP_DB_Entry scn_entry2; --- 75,78 ---- *************** *** 71,144 **** static SOIP_DB_Entry scn_entry4; ! uint32_t *dlist_src; /*[MAX_DD_PER_LIST];*/ ! uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ ! SOIP_Dd_Member *ddmem; /* [100]; */ ! ! ISNS_LIST scn_list; ! ISNS_LIST scn_callback_list; ! ! ISNS_Msg *p_scn_msg_buffer; ! ISNS_Msg *p_scn_all_msg_buffer; ! ISNS_Msg_Descp *p_scn_md; ! ISNS_Msg_Descp *p_rspMd; ! ! dbStats iSNS_stats; ! ! /* ! * Local function prototypes ! */ ! int ! ISNSAppendAttr (ISNS_Msg * msg, int tag, int size, char *p_value, int value); ! ! int ! ISNSAppendKey (ISNS_Msg * msg, int tag, int size, char *p_value, int value); ! ! int ! ISNSAppendTimeStamp (ISNS_Msg *msg); ! ! ISNS_ATTR_VALS_CB * ! ISNSAttrGetList (ISNS_Msg_Descp *p_md); ! ! int ! SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); ! ! int ! Copy_DD_List(ISNS_LIST *dd_list, ISNS_DD_LIST p_dlist); ! ! int ! Get_Active_DD_List (ISNS_LIST *dd_list, ISNS_DD_LIST p_dlist, int flag); ! ! int ! Get_Active_DD_List_From_ISCSI_Node (char *nodename, ISNS_DD_LIST p_dlist, ! int flag); ! int ! ISNSRemoveSCNEntry(uint32_t type, char *nodename); ! ! int ! ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ); ! ! int ! ISNS_Process_SCN_Event (ISNS_Msg *p_msg); ! ! int ! ISNS_Process_SCN(ISNS_Msg_Descp *p_md, ISNS_Msg *p_rsp_msg); ! ! int ! Append_Nodes_From_DD_List (ISNS_DD_LIST p_dlist, ! SOIP_Dd_Member p_ddmem[], uint32_t type); ! ! int ! SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, ! SOIP_DB_Entry * p_entry); ! ! int ! ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry); ! ! int ! ISNSdbWrite (ISNS_Key *key, SOIP_DB_Entry entry); ! ! int ! ISNSdbDelete (ISNS_Key *key); ! /********************************************************************* --- 80,84 ---- static SOIP_DB_Entry scn_entry4; ! static int scn_xid = 1; /********************************************************************* Index: iSNSqueue.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSqueue.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSqueue.c 2 Apr 2002 20:56:54 -0000 1.2 --- iSNSqueue.c 15 Dec 2006 01:13:29 -0000 1.3 *************** *** 39,48 **** * */ #include "iSNStypes.h" - #include "iSNSqueue.h" - #include "iSNS.h" ! int sns_retry_timeout = SNS_REQUEST_TIMEOUT; /* --- 39,47 ---- * */ + #include "iSNS.h" #include "iSNStypes.h" #include "iSNSqueue.h" ! static int sns_retry_timeout = SNS_REQUEST_TIMEOUT; /* Index: iSNSMain.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSMain.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNSMain.c 13 Dec 2006 23:53:01 -0000 1.11 --- iSNSMain.c 15 Dec 2006 01:13:29 -0000 1.12 *************** *** 245,249 **** } #endif ! InitAllTables (); #ifndef SNS_LINUX if (loadFlag) --- 245,249 ---- } #endif ! //InitAllTables (); #ifndef SNS_LINUX if (loadFlag) Index: iSNSLinux.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSLinux.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSLinux.c 13 Dec 2006 19:45:57 -0000 1.10 --- iSNSLinux.c 15 Dec 2006 01:13:29 -0000 1.11 *************** *** 57,60 **** --- 57,61 ---- extern int sns_esi_interval; extern int sns_request_timeout; + extern int sns_comm_main_port_set; /* Linux */ *************** *** 68,81 **** extern pthread_mutex_t sns_esi_timer; int pauseFlag = FALSE; int snsServiceFlag = FALSE; - int loadFlag = FALSE; - extern int SNSMain(ISNS_Entity role); extern void SNSReqTimeoutHdlr(void); - extern void SNSFSMTimeoutHdlr(void); - extern void SNSESITimeoutHdlr(void); - extern int sns_comm_main_port_set; HANDLE init_ipc_rcv (void); --- 69,96 ---- extern pthread_mutex_t sns_esi_timer; + /* debug */ + extern int sns_bcast_debug; + extern int sns_cb_debug; + extern int sns_fsm_debug; + extern int sns_hb_debug; + extern int isns_main_debug; + extern int sns_recv_debug; + extern int sns_rsync_debug; + extern int sns_scn_debug; + extern int sns_comm_debug; + extern int isns_db_debug; + extern int isns_list_debug; + extern int isns_parse_debug; + extern int sns_tcp_debug; + extern int isns_query_debug; + extern int isns_reg_debug; + extern int isns_dereg_debug; + extern int isns_esi_debug; + int pauseFlag = FALSE; int snsServiceFlag = FALSE; extern void SNSReqTimeoutHdlr(void); HANDLE init_ipc_rcv (void); *************** *** 380,404 **** DebugOn (char * type) { - extern int sns_bcast_debug; - extern int sns_cb_debug; - extern int sns_fsm_debug; - extern int sns_hb_debug; - extern int isns_main_debug; - extern int sns_recv_debug; - extern int sns_rsync_debug; - extern int sns_scn_debug; - extern int sns_comm_debug; - extern int isns_db_debug; - extern int isns_list_debug; - extern int sns_parse_debug; - extern int sns_tcp_debug; - extern int isns_query_debug; - extern int isns_reg_debug; - extern int isns_dereg_debug; - extern int isns_esi_debug; if (!strcmp(type,"parse")) { ! sns_parse_debug = -1; isns_main_debug = -1; sns_comm_debug = -1; --- 395,402 ---- DebugOn (char * type) { if (!strcmp(type,"parse")) { ! isns_parse_debug = -1; isns_main_debug = -1; sns_comm_debug = -1; *************** *** 445,449 **** sns_rsync_debug = -1; sns_scn_debug = -1; ! sns_parse_debug = -1; sns_tcp_debug = -1; isns_list_debug = -1; --- 443,447 ---- sns_rsync_debug = -1; sns_scn_debug = -1; ! isns_parse_debug = -1; sns_tcp_debug = -1; isns_list_debug = -1; |
From: Robert W. <wrw...@us...> - 2006-12-15 01:13:33
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4746 Modified Files: Makefile Log Message: clean up global variables and create a global config Index: Makefile =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 8 Dec 2006 20:05:50 -0000 1.7 --- Makefile 15 Dec 2006 01:13:29 -0000 1.8 *************** *** 46,50 **** OBJECTS += iSNShash.o OBJECTS += iSNSparse.o ! OBJECTS += iSNStbl.o OBJECTS += iSNSInit.o OBJECTS += iSNSUtil.o --- 46,50 ---- OBJECTS += iSNShash.o OBJECTS += iSNSparse.o ! #OBJECTS += iSNStbl.o OBJECTS += iSNSInit.o OBJECTS += iSNSUtil.o *************** *** 64,67 **** --- 64,68 ---- OBJECTS += iSNSrcv.o OBJECTS += iSNSList.o + OBJECTS += iSNSconfig.o OPTFLAGS ?= -g -O2 *************** *** 148,151 **** --- 149,155 ---- $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + iSNSconfig.o : $(SRCDIR)iSNSconfig.c + $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + clean : rm $(OBJECTS) isnsd |
From: Robert W. <wrw...@us...> - 2006-12-15 01:13:32
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4746/include Modified Files: iSNSdb.h iSNSparse.h iSNSquery.h iSNSresponse.h Log Message: clean up global variables and create a global config Index: iSNSdb.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdb.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iSNSdb.h 22 Nov 2006 17:45:39 -0000 1.5 --- iSNSdb.h 15 Dec 2006 01:13:29 -0000 1.6 *************** *** 118,121 **** --- 118,122 ---- uint32_t ISNSGetNewPortalIdx(void); + void ISNSInitDBTables (void); #endif Index: iSNSparse.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSparse.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSparse.h 8 Dec 2006 20:20:34 -0000 1.3 --- iSNSparse.h 15 Dec 2006 01:13:29 -0000 1.4 *************** *** 35,38 **** --- 35,40 ---- #define _parse_h + #define MAX_PARSE_ATTRS 30 + typedef int SNS_Error_Codes; Index: iSNSresponse.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSresponse.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSresponse.h 3 Nov 2006 20:22:29 -0000 1.1 --- iSNSresponse.h 15 Dec 2006 01:13:29 -0000 1.2 *************** *** 52,54 **** --- 52,57 ---- ISNSAppendKey (ISNS_Msg * msg, int tag, int size, char *p_value, int value); + int + ISNSAppendTimeStamp (ISNS_Msg * msg); + #endif Index: iSNSquery.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSquery.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSquery.h 3 Nov 2006 20:22:29 -0000 1.1 --- iSNSquery.h 15 Dec 2006 01:13:29 -0000 1.2 *************** *** 154,156 **** --- 154,159 ---- ISNS_DD_LIST p_list, int flag); + int + Check_Permission (ISNS_Attr *src_attr, int rectype, void *ptr); + #endif |
From: Robert W. <wrw...@us...> - 2006-12-14 23:27:53
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30524/src Modified Files: iSNSdb.c iSNSparse.c Log Message: use correct ipaddr convert Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** iSNSparse.c 14 Dec 2006 23:04:28 -0000 1.12 --- iSNSparse.c 14 Dec 2006 23:27:50 -0000 1.13 *************** *** 163,172 **** case ISNS_MGMT_IP: case ISNS_PORTAL_IP: if (len != ISNS_IP_SIZE && len != 0) rval = FALSE; ! DEBUG_4 (sns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag), ! inet_ntoa(*(struct in_addr *)(ptr+12)) ); break; ! case ISNS_TIMESTAMP: if (len != ISNS_TIMESTAMP_SIZE && len != 0 ) --- 163,174 ---- case ISNS_MGMT_IP: case ISNS_PORTAL_IP: + { + char ipaddr[256]; if (len != ISNS_IP_SIZE && len != 0) rval = FALSE; ! ipaddrchar (ptr,ipaddr); ! DEBUG_4 (sns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag),ipaddr); break; ! } case ISNS_TIMESTAMP: if (len != ISNS_TIMESTAMP_SIZE && len != 0 ) Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** iSNSdb.c 14 Dec 2006 23:04:28 -0000 1.18 --- iSNSdb.c 14 Dec 2006 23:27:50 -0000 1.19 *************** *** 205,211 **** { SOIP_DB_Portal db_portal; memcpy(&db_portal,&key->val,sizeof(SOIP_DB_Portal)); ! DEBUG_2 (isns_db_debug &1,read Portal ip_addr:%s port:%i, ! inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); k.dptr = (char *)&key->val; --- 205,212 ---- { SOIP_DB_Portal db_portal; + char ipaddr[256]; memcpy(&db_portal,&key->val,sizeof(SOIP_DB_Portal)); ! ipaddrchar(&db_portal.ip_addr,ipaddr); ! DEBUG_2 (isns_db_debug &1,read Portal ip_addr:%s port:%i,ipaddr,db_portal.ip_port); k.dptr = (char *)&key->val; *************** *** 214,219 **** if (d.dptr == NULL) { ! DEBUG_2 (isns_db_debug &1,read failed Portal ip_addr:%s port:%i, ! inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); return (ISNS_NO_SUCH_ENTRY_ERR); } --- 215,219 ---- if (d.dptr == NULL) { ! DEBUG_2 (isns_db_debug &1,read failure Portal ip_addr:%s port:%i,ipaddr,db_portal.ip_port); return (ISNS_NO_SUCH_ENTRY_ERR); } |
From: Robert W. <wrw...@us...> - 2006-12-14 23:05:36
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21394/src Modified Files: portal.c Log Message: Fix up Portal object and rework ESI processing Index: portal.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/portal.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** portal.c 8 Dec 2006 20:05:49 -0000 1.5 --- portal.c 14 Dec 2006 23:04:47 -0000 1.6 *************** *** 71,80 **** /* Get Portal Type */ portal_type = 0; - if (0 != - GetInput (cmdLine, "Portal Type", "*0: UDP 1: TCP", sizeof (cmdLine))) - { - portal_type = atoi (cmdLine); - } /* Get Port */ --- 71,81 ---- /* Get Portal Type */ + // portal_type = 0; + // if (0 != + // GetInput (cmdLine, "Portal Type", "*0: UDP 1: TCP", sizeof (cmdLine))) + // { + // portal_type = atoi (cmdLine); + // } portal_type = 0; /* Get Port */ *************** *** 85,88 **** --- 86,90 ---- port = atoi (cmdLine); } + printf("port:%i\n",port); ISNSAppendAttr (&cmd, ISNS_PORTAL_PORT, 4, NULL, port | (portal_type == 0 ? 0x10000 : 0)); *************** *** 295,299 **** ! while (GetInput (cmdLine, "Entity ID", "(none)", sizeof (cmdLine))) { memset (eid, 0, sizeof (eid)); --- 297,301 ---- ! if (0 != GetInput (cmdLine, "Entity ID", "(none)", sizeof (cmdLine))) { memset (eid, 0, sizeof (eid)); *************** *** 348,352 **** } ISNSAppendAttr (&cmd, ISNS_PORTAL_PORT, 4, NULL, ! port | (port_type == 1 ? 0 : 0x10000)); /* Get an Portal Sym Name */ --- 350,354 ---- } ISNSAppendAttr (&cmd, ISNS_PORTAL_PORT, 4, NULL, ! port | (port_type == 1 ? 0 : 0x10000)); /* Get an Portal Sym Name */ |
From: Robert W. <wrw...@us...> - 2006-12-14 23:05:01
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21359/include Modified Files: iSNSreg.h iSNStypes.h Log Message: Fix up Portal object and rework ESI processing Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNStypes.h 8 Dec 2006 20:05:50 -0000 1.7 --- iSNStypes.h 14 Dec 2006 23:04:27 -0000 1.8 *************** *** 583,594 **** /* More iSNS Stuff */ - ISNS_LIST entity_list; - uint32_t portal_index; char sym_name[ PORTAL_SYM_NAME_SIZE ]; uint32_t esi_sockfd; uint32_t esi_port; uint32_t esi_interval; uint32_t esiSent; ! int esi_timer; void *ptr_cert; --- 583,595 ---- /* More iSNS Stuff */ char sym_name[ PORTAL_SYM_NAME_SIZE ]; + SOIP_Entity_Id entity_id; + uint32_t entity_index; + uint32_t portal_index; uint32_t esi_sockfd; uint32_t esi_port; uint32_t esi_interval; uint32_t esiSent; ! time_t esi_timer; void *ptr_cert; *************** *** 673,677 **** DDS_DD_LIST, PORTAL_ENTITY_LIST, - ESI_LIST, SCN_CALLBACK_LIST, SCN_LIST --- 674,677 ---- *************** *** 804,807 **** --- 804,808 ---- SOIP_Time timestamp; void (*scn_callback)(ISNS_ATTR_VALS_CB *attr_vals_sptr); + SOIP_Entity_Id entity_id; } val; Index: iSNSreg.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSreg.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSreg.h 6 Dec 2006 22:05:34 -0000 1.2 --- iSNSreg.h 14 Dec 2006 23:04:27 -0000 1.3 *************** *** 85,94 **** int - ISNSRemoveESIEntry(IP_Address *p_ip, uint32_t port, char *p_eid); - - int - ISNSAddESIEntry(IP_Address *p_ip, uint32_t port, char *p_eid); - - int Copy_DD_List(ISNS_LIST *dd_list, ISNS_DD_LIST p_dlist); --- 85,88 ---- |
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21359/src Modified Files: iSNSList.c iSNSUtil.c iSNSdb.c iSNSdereg.c iSNSesi.c iSNSparse.c iSNSquery.c iSNSreg.c iSNSresponse.c Log Message: Fix up Portal object and rework ESI processing Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSUtil.c 13 Dec 2006 23:53:01 -0000 1.10 --- iSNSUtil.c 14 Dec 2006 23:04:28 -0000 1.11 *************** *** 758,762 **** { ISNS_LIST_NODE *pnode; - ENTITY_LIST_ENTRY *lentry; /* Assumes a IPv4 Address */ --- 758,761 ---- *************** *** 776,784 **** pnode = NULL; ! while ((pnode = GetNextNode(&p_portal->entity_list, pnode))) ! { ! lentry = (ENTITY_LIST_ENTRY *) GetNodeData(pnode); ! printf("ENTITY : %s (%u)\n", lentry->eid.id, lentry->entity_index); ! } printf("GROUP : %#x\n", p_portal->group); printf("ESI INTERVAL : %u\n", p_portal->esi_interval); --- 775,779 ---- pnode = NULL; ! printf("ENTITY : %s\n", p_portal->entity_id.id); printf("GROUP : %#x\n", p_portal->group); printf("ESI INTERVAL : %u\n", p_portal->esi_interval); Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** iSNSquery.c 13 Dec 2006 19:45:57 -0000 1.8 --- iSNSquery.c 14 Dec 2006 23:04:28 -0000 1.9 *************** *** 80,84 **** extern SOIP_Dd_Member *ddmem; /* [100]; */ - extern ISNS_LIST esi_list; extern ISNS_LIST scn_list; extern ISNS_LIST scn_callback_list; --- 80,83 ---- *************** *** 251,255 **** int iFCPNodeKeyFlag; int foundFlag; - ISNS_LIST_NODE *lnode; ISNS_Key *key; ISNS_Attr *attr; /* query attr, response attr */ --- 250,253 ---- *************** *** 401,424 **** /* Fetch entity from hash */ ! lnode = NULL; ! while ((lnode = GetNextNode(&p_portal->entity_list, lnode))) { - ENTITY_LIST_ENTRY *lentry; - - lentry = (ENTITY_LIST_ENTRY *) GetNodeData(lnode); - if (ISNS_NO_ERR != - SNSdbFetchEntity (lentry->eid.id, &p_entity, &entry)) - { return (ISNS_INVALID_QUERY_ERR); ! } ! rval = Check_Permission (src_attr, ENTITY_ID_KEY, p_entity); ! if (rval == SUCCESS) ! { foundFlag = TRUE; ISNSdbProcessEntityOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_entity); - } } - } else if (iFCPNodeKeyFlag != -1) --- 399,414 ---- /* Fetch entity from hash */ ! if (ISNS_NO_ERR != ! SNSdbFetchEntity (p_portal->entity_id.id, &p_entity, &entry)) { return (ISNS_INVALID_QUERY_ERR); ! } ! rval = Check_Permission (src_attr, ENTITY_ID_KEY, p_entity); ! if (rval == SUCCESS) ! { foundFlag = TRUE; ISNSdbProcessEntityOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_entity); } } else if (iFCPNodeKeyFlag != -1) *************** *** 1305,1309 **** SOIP_Entity *p_entity; SOIP_Portal *p_portal; - SOIP_Entity_Key db_entity_id; SOIP_DB_Portal db_portal; int entityKeyFlag; --- 1295,1298 ---- *************** *** 1315,1319 **** int foundFlag; ISNS_LIST_NODE *pnode; - ISNS_LIST_NODE *pnode2; int rval; --- 1304,1307 ---- *************** *** 1491,1507 **** p_portal = &entry2.data.portal; - pnode2 = NULL; - while ((pnode2 = GetNextNode(&p_portal->entity_list, pnode2))) { - ENTITY_LIST_ENTRY *lentry; - - lentry = (ENTITY_LIST_ENTRY *) GetNodeData(pnode2); - /* Fetch entity from hash */ - memset (&db_entity_id, 0, sizeof (db_entity_id)); - strncpy (db_entity_id.id, lentry->eid.id, sizeof(db_entity_id.id) ); ISNS_Key read_key; read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_id.id,db_entity_id.id); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) --- 1479,1487 ---- p_portal = &entry2.data.portal; { /* Fetch entity from hash */ ISNS_Key read_key; read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_id.id,p_portal->entity_id.id); rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) *************** *** 1585,1589 **** SOIP_ISCSI_Node_Id db_node_name; ISNS_LIST_NODE *pnode; - ISNS_LIST_NODE *pnode2; int rval; --- 1565,1568 ---- *************** *** 1785,1816 **** p_portal = &entry.data.portal; - pnode2 = NULL; - while ((pnode2 = GetNextNode(&p_portal->entity_list, pnode2))) { ! ENTITY_LIST_ENTRY *lentry; ! ! lentry = (ENTITY_LIST_ENTRY *) GetNodeData(pnode2); ! ! /* Fetch ENTITY */ ! ISNS_Key read_key; ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_id.id,lentry->eid.id); ! rval = ISNSdbRead(&read_key,&entry); ! if (rval != SUCCESS) return rval; ! p_entity = &entry.data.entity; ! ! /* Check to make sure this is an iSCSI Entity */ ! if (p_entity->eid_type != ENTITY_TYPE_ISCSI) ! { ! printf ("***ERROR: Expected an iSCSI Entity.\n"); ! return (ERROR); ! } ! /* Scan the entity's iSCSI List */ ! pnode=NULL; ! while ((pnode=GetNextNode(&p_entity->iscsi_node_list, pnode))) ! { /* Fetch the iSCSI Node */ ISNS_Key read_key; --- 1764,1782 ---- p_portal = &entry.data.portal; { ! /* Fetch ENTITY */ ! ISNS_Key read_key; ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_id.id,p_portal->entity_id.id); ! rval = ISNSdbRead(&read_key,&entry); ! if (rval != SUCCESS) return rval; ! p_entity = &entry.data.entity; ! /* Scan the entity's iSCSI List */ ! pnode=NULL; ! while ((pnode=GetNextNode(&p_entity->iscsi_node_list, pnode))) ! { /* Fetch the iSCSI Node */ ISNS_Key read_key; *************** *** 1830,1834 **** foundFlag = TRUE; } ! } } } --- 1796,1800 ---- foundFlag = TRUE; } ! } } } *************** *** 2932,2936 **** int ii; ISNS_Attr *q_attr; - ISNS_LIST_NODE *pnode; for (ii = 0; ii < MAX_PARSE_ATTRS && attr_indx[ii]; ii++) --- 2898,2901 ---- *************** *** 2940,2953 **** { case ISNS_ENTITY_ID: ! pnode = NULL; ! while ((pnode = GetNextNode(&p_portal->entity_list, pnode))) ! { ! ENTITY_LIST_ENTRY *lentry; ! ! lentry = (ENTITY_LIST_ENTRY *) GetNodeData(pnode); ! ISNSAppendAttr ( p_msg, ISNS_ENTITY_ID, ! PAD4 (strlen (lentry->eid.id)), ! lentry->eid.id, 0 ); ! } break; case ISNS_PORTAL_PORT: --- 2905,2911 ---- { case ISNS_ENTITY_ID: ! ISNSAppendAttr ( p_msg, ISNS_ENTITY_ID, ! PAD4 (strlen (p_portal->entity_id.id)), ! p_portal->entity_id.id, 0 ); break; case ISNS_PORTAL_PORT: *************** *** 2984,2996 **** break; case ISNS_ENTITY_IDX: ! pnode = NULL; ! while ((pnode = GetNextNode(&p_portal->entity_list, pnode))) ! { ! ENTITY_LIST_ENTRY *lentry; ! ! lentry = (ENTITY_LIST_ENTRY *) GetNodeData(pnode); ! ISNSAppendAttr ( p_msg, ISNS_ENTITY_IDX, ISNS_ENTITY_IDX_SIZE, ! NULL, lentry->entity_index ); ! } break; case ISNS_PORTAL_IDX: --- 2942,2947 ---- break; case ISNS_ENTITY_IDX: ! ISNSAppendAttr ( p_msg, ISNS_ENTITY_IDX, ISNS_ENTITY_IDX_SIZE, ! NULL, p_portal->entity_index ); break; case ISNS_PORTAL_IDX: *************** *** 3593,3612 **** if (src_attr->tag) { - ISNS_LIST_NODE *pnode; SOIP_Portal *p_portal; p_portal = ptr; ! pnode = NULL; ! while ((pnode = GetNextNode(&p_portal->entity_list, pnode))) ! { ! ENTITY_LIST_ENTRY *lentry; ! lentry = (ENTITY_LIST_ENTRY *) GetNodeData(pnode); ! if (ISNS_NO_ERR != ! Get_Active_DD_List_From_ENTITY_Node (lentry->eid.id, NULL, ! dlist_node, 0)) ! { ! return (ERROR); ! } ! } if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) --- 3544,3552 ---- if (src_attr->tag) { SOIP_Portal *p_portal; p_portal = ptr; ! Get_Active_DD_List_From_ENTITY_Node (p_portal->entity_id.id, NULL, ! dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) Index: iSNSList.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSList.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** iSNSList.c 13 Dec 2006 19:45:57 -0000 1.8 --- iSNSList.c 14 Dec 2006 23:04:27 -0000 1.9 *************** *** 60,71 **** break; } - case PORTAL_ENTITY_LIST: - { - SOIP_Portal *p_entry; - p_entry = record; - plist = &p_entry->entity_list; - plist->p_entry = p_entry; - break; - } case DDS_DD_LIST: { --- 60,63 ---- *************** *** 132,143 **** break; } - case ESI_LIST: - { - ISNS_LIST *p_entry; - p_entry = record; - plist = p_entry; - plist->p_entry = p_entry; - break; - } case SCN_CALLBACK_LIST: { --- 124,127 ---- *************** *** 294,302 **** key.val.list.key.portal.ip_port = p_portal->ip_port; } - else if (plist->list_id == ESI_LIST) - { - p_list = plist->p_entry; - strcpy (key.val.list.key.node_name.v,"esi_list"); - } else if (plist->list_id == SCN_LIST) { --- 278,281 ---- *************** *** 468,476 **** memcpy(&entry.data.list.key.portal,pdata,data_size); } - else if (plist->list_id == ESI_LIST) - { - strcpy (key.val.list.key.node_name.v,"esi_list"); - memcpy(&entry.data.list.key.node_name.v,pdata,data_size); - } else if (plist->list_id == SCN_LIST) { --- 447,450 ---- *************** *** 700,714 **** memcpy(node->data,&entry.data.list.key.portal,node->data_size); } - else if (plist->list_id == ESI_LIST) - { - p_list = (ISNS_LIST *)plist->p_entry; - strcpy (key.val.list.key.node_name.v,"esi_list"); - rval = ISNSdbRead(&key,&entry); - if (rval != SUCCESS) - return NULL; - node->data_size = sizeof(SOIP_ESI); - node->data = (char *)ISNSAllocBuffer(node->data_size+1); - memcpy(node->data,&entry.data.list.key.entity_id.id,node->data_size); - } else if (plist->list_id == SCN_LIST) { --- 674,677 ---- Index: iSNSresponse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSresponse.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSresponse.c 12 Dec 2006 21:38:29 -0000 1.4 --- iSNSresponse.c 14 Dec 2006 23:04:28 -0000 1.5 *************** *** 71,75 **** SOIP_Dd_Member *ddmem; /* [100]; */ - ISNS_LIST esi_list; ISNS_LIST scn_list; ISNS_LIST scn_callback_list; --- 71,74 ---- Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iSNSesi.c 13 Dec 2006 23:53:01 -0000 1.5 --- iSNSesi.c 14 Dec 2006 23:04:28 -0000 1.6 *************** *** 71,76 **** SOIP_Dd_Member *ddmem; /* [100]; */ - ISNS_LIST esi_list; - ISNS_Msg *p_scn_msg_buffer; ISNS_Msg *p_scn_all_msg_buffer; --- 71,74 ---- *************** *** 86,100 **** static int esi_xid = 1; int rval; - int more_esi_portals; SOIP_Portal *p_portal; - SOIP_Entity *p_entity; SOIP_DB_Portal db_portal; - ISNS_LIST_NODE *pnode2; - ISNS_LIST_NODE *pnode; - ISNS_LIST_NODE *p_esi_node; - SOIP_Esi_Entry *p_esi_entry; ISNS_Msg_Descp *p_md; ! SOIP_Entity_Key db_entity_id = {{0}}; ! ENTITY_LIST_ENTRY *lentry; DEBUG_0 (isns_esi_debug &1, ISNS_SendESI); --- 84,92 ---- static int esi_xid = 1; int rval; SOIP_Portal *p_portal; SOIP_DB_Portal db_portal; ISNS_Msg_Descp *p_md; ! time_t mytime; ! ISNS_Key read_key = { 0 }; DEBUG_0 (isns_esi_debug &1, ISNS_SendESI); *************** *** 108,130 **** } ! if ( IsEmptyList(&esi_list) ) ! { ! /* Nothing to do */ ! return (ISNS_NO_ERR); ! } ! DEBUG_0 (isns_esi_debug &1, process esi_list); ! /* Go through the ESI Table */ ! p_esi_node = GetNextNode( &esi_list, NULL ); ! while ( p_esi_node ) { ! DEBUG_0 (isns_esi_debug &1, GetNodeData); ! /* Get Node Data */ ! p_esi_entry = (SOIP_Esi_Entry *)GetNodeData(p_esi_node); - ISNS_Key read_key; - read_key.tag = PORTAL_ID_KEY; - memcpy(&read_key.val,p_esi_entry,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 100,111 ---- } ! DEBUG_0 (isns_esi_debug &1, process each portal record); ! read_key.tag = PORTAL_ID_KEY; ! while ( SNSdbGetNextOfKey (&read_key) == SUCCESS ) { ! DEBUG_0 (isns_esi_debug &1, Next Portal Record found); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 133,171 **** p_portal = (SOIP_Portal *)&entry2.data; ! /* Is ESI? */ if ( p_portal->esi_interval == 0 ) { ! p_esi_node = GetNextNode(&esi_list, p_esi_node); continue; } - - /* Send a msg to the client & update the counter */ - memset (&p_md->msg, 0, sizeof (ISNS_Msg)); - p_md->msg.hdr.type = ISNS_ESI; ! /* TODO: FIX FIX */ ! /* Don't assume first entity */ ! pnode2 = GetNextNode( &p_portal->entity_list, NULL); ! lentry = (ENTITY_LIST_ENTRY *)GetNodeData(pnode2); ! ISNSAppendKey (&p_md->msg, ISNS_ENTITY_ID, ! PAD4 (strlen (lentry->eid.id)), lentry->eid.id, 0); ! rval = ERROR; ! p_portal->esi_timer -= sns_heartbeat_interval; ! if ( p_portal->esiSent < 3 ) { ! if ( p_portal->esi_timer > 0 ) ! { ! ISNS_Key key; ! key.tag = PORTAL_ID_KEY; ! memcpy(&key.val,p_esi_entry,sizeof(SOIP_DB_Portal)); ! rval = ISNSdbWrite(&key,entry2); ! p_esi_node = GetNextNode( &esi_list, p_esi_node ); ! continue; ! } ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); ISNSAppendKey ( &p_md->msg, ISNS_PORTAL_IP, ISNS_IP_SIZE, --- 114,151 ---- p_portal = (SOIP_Portal *)&entry2.data; ! /* check to see if an interval is set > 0 */ if ( p_portal->esi_interval == 0 ) { ! DEBUG_0 (isns_esi_debug &1, esi_interval not set); continue; } ! /* check to see if timer interval expired */ ! time ( &mytime ); ! if (p_portal->esi_timer > 0 && (p_portal->esi_timer + p_portal->esi_interval) > mytime) ! { ! DEBUG_0 (isns_esi_debug &1, esi_timer plus interval not reached yet); ! DEBUG_1 (isns_esi_debug &1, esi_timer:%ld,p_portal->esi_timer); ! DEBUG_1 (isns_esi_debug &1, esi_interval:%i,p_portal->esi_interval); ! DEBUG_1 (isns_esi_debug &1, mytime:%ld,mytime); ! continue; ! } ! p_portal->esi_timer = mytime; ! p_portal->esiSent++; ! rval = ISNSdbWrite(&read_key,entry2); ! DEBUG_1 (isns_esi_debug &1, esi_timer Timer Expired esiSend:%i,p_portal->esiSent); ! ! if ( p_portal->esiSent < 4 ) { ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), p_portal->entity_id.id); ! /* Send a msg to the client & update the counter */ ! memset (&p_md->msg, 0, sizeof (ISNS_Msg)); ! p_md->msg.hdr.type = ISNS_ESI; ! ISNSAppendKey (&p_md->msg, ISNS_ENTITY_ID, ! PAD4 (strlen (p_portal->entity_id.id)), p_portal->entity_id.id, 0); ISNSAppendKey ( &p_md->msg, ISNS_PORTAL_IP, ISNS_IP_SIZE, *************** *** 178,205 **** sizeof (p_md->cb.sock.addr.sin_addr.s_addr)); - p_portal->esiSent++; - p_portal->esi_timer = p_portal->esi_interval; - - ISNS_Key key; - key.tag = PORTAL_ID_KEY; - memcpy(&key.val,p_esi_entry,sizeof(SOIP_DB_Portal)); - rval = ISNSdbWrite(&key,entry2); - /* Determine how to send */ - - /* Fetch the Portal */ - memset ( &db_portal, 0, sizeof (db_portal)); - memcpy ( db_portal.ip_addr.v, p_portal->ip_addr.v, ISNS_IP_SIZE); - db_portal.ip_port = p_portal->ip_port; - - ISNS_Key read_key; - read_key.tag = PORTAL_ID_KEY; - memcpy(&read_key.val,&db_portal,sizeof(SOIP_DB_Portal)); - rval = ISNSdbRead(&read_key,&entry2); - if (rval != SUCCESS) - return rval; - - p_portal = (SOIP_Portal *)&entry2.data; - if ( p_portal->esi_port ) { --- 158,162 ---- *************** *** 215,231 **** } ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); rval = ISNSSendMsg ( p_md ); } ! if ( rval != SUCCESS ) { ! ! /* TODO: FIX FIX */ ! /* Don't assume first entity */ ! pnode2 = GetNextNode( &p_portal->entity_list, NULL); ! lentry = (ENTITY_LIST_ENTRY *)GetNodeData(pnode2); ! ! strncpy (db_entity_id.id, lentry->eid.id, sizeof(db_entity_id.id) ); /* remove portal */ --- 172,184 ---- } ! DEBUG_1 (isns_esi_debug & 2, (Call ISNSSendMsg to Send ESI to Entity %s), p_portal->entity_id.id); rval = ISNSSendMsg ( p_md ); } ! else { ! DEBUG_0 (isns_esi_debug &1,esi timed out - remove portal record); ! DEBUG_1 (isns_esi_debug &1,portal ip_addr:%s,inet_ntoa(*(struct in_addr *)(p_portal->ip_addr.v+12)) ); ! DEBUG_1 (isns_esi_debug &1,port:%i,p_portal->ip_port); /* remove portal */ *************** *** 234,288 **** db_portal.ip_port=p_portal->ip_port; - p_esi_node=GetNextNode(&esi_list, p_esi_node); SNSRemovePortalEntry ((char *)&db_portal, NULL, NULL); - - /* Fetch Entity */ - ISNS_Key read_key; - read_key.tag = ENTITY_ID_KEY; - strcpy(read_key.val.entity_id.id,db_entity_id.id); - rval = ISNSdbRead(&read_key,&entry); - if (rval != SUCCESS) - return rval; - - p_entity = &entry.data.entity; - - /* Anymore Portals w/ ESI */ - more_esi_portals = FALSE; - pnode = NULL; - while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) ) - { - /* Fetch Portal */ - ISNS_Key read_key; - read_key.tag = PORTAL_ID_KEY; - memcpy(&read_key.val,GetNodeData(pnode),sizeof(SOIP_DB_Portal)); - rval = ISNSdbRead(&read_key,&entry2); - if (rval != SUCCESS) - return rval; - - p_portal = (SOIP_Portal *)&entry2.data; - - if (p_portal->esi_interval != 0) - { - more_esi_portals = TRUE; - break; - } - } - - if ( !more_esi_portals ) - { - /* TODO: FIX FIX */ - /* Don't assume first entity */ - pnode2 = GetNextNode( &p_portal->entity_list, NULL); - lentry = (ENTITY_LIST_ENTRY *)GetNodeData(pnode2); - - /* remove entity */ - ISNSdbRemoveAttrEntityEntry (lentry->eid.id, NULL, NULL); - } } - else - { - p_esi_node = GetNextNode(&esi_list, p_esi_node); - } - } --- 187,192 ---- *************** *** 301,305 **** time_t mytime; SOIP_DB_Portal db_portal; - SOIP_Entity_Key db_entity_id = {{0}}; int i; int len; --- 205,208 ---- *************** *** 307,310 **** --- 210,214 ---- char *key_indx[SNS_MAX_ATTRS]; int rval; + ISNS_Key update_key; DEBUG_0 (isns_esi_debug &1, ISNS_ProcessESI); *************** *** 319,345 **** p_attr = (ISNS_Attr *)(key_indx[ i ]); ! /* Fetch Entity */ ! /* The first Attr should be entity */ ! if (SNSdbFetchEntity ((char *)&p_attr->val, &p_entity, &entry)) ! return ( ERROR ); /* Update the time stamp */ ! { ! len = sizeof (mytime); ! time ( &mytime ); ! p_entity->timestamp.t_pad = 0; ! p_entity->timestamp.t_time = mytime; ! /* printf( "Time in seconds since UTC 1/1/70:\t%ld\n", mytime ); */ ! /* printf( "UNIX time and date:\t\t\t%s", ctime( &mytime ) ); */ ! } /* Store Entry */ - strncpy(db_entity_id.id, (char *)&p_attr->val, sizeof(db_entity_id.id) ); - - ISNS_Key key; - key.tag = ENTITY_ID_KEY; - strcpy(key.val.entity_id.id,db_entity_id.id); ISNSdbWrite(&key,entry); /* Fetch the portal IP */ i = ISNSFindTag (0, ISNS_PORTAL_IP, key_indx); --- 223,248 ---- p_attr = (ISNS_Attr *)(key_indx[ i ]); ! ISNS_Key key; ! key.tag = ENTITY_ID_KEY; ! strcpy(key.val.entity_id.id,p_attr->val.entity_id.id); ! rval = ISNSdbRead(&key,&entry); ! if (rval != SUCCESS) ! return (ERROR); ! ! p_entity = &entry.data.entity; /* Update the time stamp */ ! len = sizeof (mytime); ! time ( &mytime ); ! p_entity->timestamp.t_pad = 0; ! p_entity->timestamp.t_time = mytime; ! DEBUG_1 (isns_esi_debug &1,(Time in seconds since UTC 1/1/70: %ld),mytime); ! DEBUG_1 (isns_esi_debug &1,(UNIX time and date: %s),ctime(&mytime) ); /* Store Entry */ ISNSdbWrite(&key,entry); + memset(&db_portal,0,sizeof(SOIP_DB_Portal)); + /* Fetch the portal IP */ i = ISNSFindTag (0, ISNS_PORTAL_IP, key_indx); *************** *** 350,354 **** } p_attr = (ISNS_Attr *)(key_indx[i]); - memcpy(db_portal.ip_addr.v, p_attr->val.ip_addr.v, ISNS_IP_SIZE); --- 253,256 ---- *************** *** 360,370 **** } p_attr = (ISNS_Attr *)(key_indx[i]); - db_portal.ip_port=p_attr->val.ip_port; ! ISNS_Key read_key; ! read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_DB_Portal)); ! rval = ISNSdbRead(&read_key,&entry); if (rval != SUCCESS) return rval; --- 262,270 ---- } p_attr = (ISNS_Attr *)(key_indx[i]); db_portal.ip_port=p_attr->val.ip_port; ! update_key.tag = PORTAL_ID_KEY; ! memcpy(&update_key.val,&db_portal,sizeof(SOIP_DB_Portal)); ! rval = ISNSdbRead(&update_key,&entry); if (rval != SUCCESS) return rval; *************** *** 374,380 **** p_portal->esiSent = 0; ! key.tag = PORTAL_ID_KEY; ! memcpy(&key.val,&db_portal,sizeof(SOIP_DB_Portal)); ! ISNSdbWrite(&key,entry); return ( ISNS_NO_ERR ); --- 274,279 ---- p_portal->esiSent = 0; ! /* Store Portal */ ! rval = ISNSdbWrite(&update_key,entry); return ( ISNS_NO_ERR ); Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNSparse.c 13 Dec 2006 23:53:01 -0000 1.11 --- iSNSparse.c 14 Dec 2006 23:04:28 -0000 1.12 *************** *** 165,169 **** if (len != ISNS_IP_SIZE && len != 0) rval = FALSE; ! DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; --- 165,170 ---- if (len != ISNS_IP_SIZE && len != 0) rval = FALSE; ! DEBUG_4 (sns_parse_debug &1,%sTag:%i (%s) %s,src,tag,isnsTagText(tag), ! inet_ntoa(*(struct in_addr *)(ptr+12)) ); break; Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** iSNSdereg.c 13 Dec 2006 19:45:57 -0000 1.12 --- iSNSdereg.c 14 Dec 2006 23:04:28 -0000 1.13 *************** *** 81,85 **** extern uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ - extern ISNS_LIST esi_list; extern ISNS_LIST scn_list; extern ISNS_LIST scn_callback_list; --- 81,84 ---- *************** *** 1246,1263 **** SOIP_Portal *p_portal; SOIP_Entity *p_entity; - SOIP_Entity_Key db_entity_id; int rval; ISNS_LIST_NODE *pnode; ISNS_LIST_NODE *pnode2; PORTAL_LIST_ENTRY portalListEntry; - ENTITY_LIST_ENTRY *p_lentry; char *p_iscsi_name; ! ISNS_Key delete_key; DEBUG_0 (isns_dereg_debug & 1, (Deregistering Portal)); - ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&portal_key,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) --- 1245,1259 ---- SOIP_Portal *p_portal; SOIP_Entity *p_entity; int rval; ISNS_LIST_NODE *pnode; ISNS_LIST_NODE *pnode2; PORTAL_LIST_ENTRY portalListEntry; char *p_iscsi_name; ! ISNS_Key read_key; DEBUG_0 (isns_dereg_debug & 1, (Deregistering Portal)); read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,portal_key,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); if (rval != SUCCESS) *************** *** 1273,1301 **** */ ! /* Send detailed SCN */ ! pnode = NULL; ! while ( (pnode = GetNextNode( &p_portal->entity_list, pnode)) ) ! { ! p_lentry = (ENTITY_LIST_ENTRY *) GetNodeData(pnode); ! if ( SNSdbFetchEntity ((char *)p_lentry->eid.id, &p_entity, &entry) ) ! return ( ERROR ); ! ! if ( p_entity->eid_type != ENTITY_TYPE_ISCSI ) ! continue; ! ! pnode2 = NULL; ! while ( (pnode2 = GetNextNode( &p_entity->iscsi_node_list, pnode2)) ) ! { ! p_iscsi_name = (char *) GetNodeData( pnode2 ); ! send_scn_object_change_to_all( ISNS_ISCSI_NODE_ID, PAD4(strlen(p_iscsi_name)), p_iscsi_name, ! ISNS_SCN_OBJ_UPDATED); ! } ! } RemoveCert (&p_portal->ptr_cert); ! delete_key.tag = PORTAL_ID_KEY; ! memcpy(&delete_key.val,&portal_key,sizeof(SOIP_DB_Portal)); ! if ( ISNSdbDelete(&delete_key) != SUCCESS) { printf ("***ERROR: Portal DEREG Failed.\n"); --- 1269,1277 ---- */ ! DEBUG_0 (isns_dereg_debug &1,(Remove Cert)); RemoveCert (&p_portal->ptr_cert); ! if (ISNSdbDelete(&read_key) != SUCCESS) { printf ("***ERROR: Portal DEREG Failed.\n"); *************** *** 1303,1307 **** } - iSNS_stats.num_portals--; ISNS_Key remove_key; remove_key.tag = PORTAL_IDX_KEY; --- 1279,1282 ---- *************** *** 1310,1348 **** ISNSdbDelete(&remove_key); ! pnode2 = NULL; ! while ((pnode2 = GetNextNode(&p_portal->entity_list, pnode2))) ! { ! ENTITY_LIST_ENTRY *lentry; ! ! lentry = (ENTITY_LIST_ENTRY *) GetNodeData(pnode2); ! /* Fetch Entity Entry */ ! memset (&db_entity_id, 0, sizeof (db_entity_id)); ! strncpy ((char *) db_entity_id.id, (char *) lentry->eid.id, sizeof(db_entity_id.id) ); ! ISNS_Key read_key; ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_id.id,db_entity_id.id); ! rval = ISNSdbRead(&read_key,&entry4); ! if (rval != SUCCESS) ! return rval; ! p_entity = &entry4.data.entity; ! /* Remove Portals */ ! memcpy(&portalListEntry.portal_ip_port, portal_key, sizeof(portalListEntry.portal_ip_port)); ! portalListEntry.portal_idx = p_portal->portal_index; ! pnode = NULL; ! if ((pnode=FindNode(&p_entity->iportal_list, (char *)&portalListEntry, sizeof (portalListEntry)))) ! { RemoveNode(&p_entity->iportal_list, pnode); ! } ! ISNS_Key key; ! key.tag = ENTITY_ID_KEY; ! strcpy(key.val.entity_id.id,db_entity_id.id); ! rval = ISNSdbWrite(&key,entry4); } return (rval); } --- 1285,1320 ---- ISNSdbDelete(&remove_key); ! iSNS_stats.num_portals--; ! read_key.tag = ENTITY_ID_KEY; ! strcpy(read_key.val.entity_id.id,p_portal->entity_id.id); ! rval = ISNSdbRead(&read_key,&entry4); ! if (rval != SUCCESS) ! return rval; ! p_entity = &entry4.data.entity; ! /* Remove Portals */ ! memcpy(&portalListEntry.portal_ip_port, portal_key, sizeof(portalListEntry.portal_ip_port)); ! portalListEntry.portal_idx = p_portal->portal_index; ! pnode = NULL; ! if ((pnode=FindNode(&p_entity->iportal_list, (char *)&portalListEntry, sizeof (portalListEntry)))) ! { RemoveNode(&p_entity->iportal_list, pnode); ! } ! rval = ISNSdbWrite(&read_key,entry4); ! ! /* Send detailed SCN */ ! pnode2 = NULL; ! while ( (pnode2 = GetNextNode( &p_entity->iscsi_node_list, pnode2)) ) ! { ! p_iscsi_name = (char *) GetNodeData( pnode2 ); ! send_scn_object_change_to_all( ISNS_ISCSI_NODE_ID, PAD4(strlen(p_iscsi_name)), p_iscsi_name, ! ISNS_SCN_OBJ_UPDATED); } + return (rval); } *************** *** 1736,1763 **** ********************************************************************/ int - ISNSRemoveESIEntry(IP_Address *p_ip, uint32_t port, char *p_eid) - { - SOIP_Esi_Entry new_entry; - ISNS_LIST_NODE *pnode; - - memset(&new_entry, 0, sizeof(new_entry)); - memcpy(new_entry.ip_addr.v, p_ip->v, IP_ADDR_SIZE); - new_entry.ip_port=port; - - if ( p_eid ) - strncpy(new_entry.eid.id, p_eid, sizeof(new_entry.eid.id) ); - - if (NULL==(pnode=FindNode(&esi_list, (char *)&new_entry, sizeof(new_entry)))) - { - return (ERROR); - } - - RemoveNode(&esi_list, pnode); - return (SUCCESS); - } - - /******************************************************************** - ********************************************************************/ - int ISNSRemoveSCNEntry(uint32_t type, char *nodename) { --- 1708,1711 ---- Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** iSNSreg.c 13 Dec 2006 23:53:01 -0000 1.12 --- iSNSreg.c 14 Dec 2006 23:04:28 -0000 1.13 *************** *** 76,80 **** extern uint32_t *dlist_node; /*[MAX_DD_PER_LIST];*/ - extern ISNS_LIST esi_list; extern ISNS_LIST scn_list; extern ISNS_LIST scn_callback_list; --- 76,79 ---- *************** *** 252,257 **** ISNS_LIST_NODE *pnode2; PORTAL_LIST_ENTRY newPortalEntry; - ENTITY_LIST_ENTRY newPortalEntityEntry; - ENTITY_LIST_ENTRY *p_lentry; char *p_iscsi_name; ISNS_Key read_key; --- 251,254 ---- *************** *** 378,383 **** DEBUG_1 (isns_reg_debug &1,(read portal:%s),db_portal.ip_addr.v); read_key.tag = PORTAL_ID_KEY; ! memcpy(read_key.val.ip_addr.v,db_portal.ip_addr.v,ISNS_PORTAL_IP_SIZE); ! read_key.val.ip_port = db_portal.ip_port; rval = ISNSdbRead(&read_key,&entry2); --- 375,379 ---- DEBUG_1 (isns_reg_debug &1,(read portal:%s),db_portal.ip_addr.v); read_key.tag = PORTAL_ID_KEY; ! memcpy(&read_key.val,&db_portal,sizeof(SOIP_DB_Portal)); rval = ISNSdbRead(&read_key,&entry2); *************** *** 386,390 **** if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { ! DEBUG_0 (isns_reg_debug & 1, "Deregistering Portal.\n"); SNSRemovePortalEntry ((char *)&db_portal, NULL, NULL); rval = ERROR; --- 382,386 ---- if ( (rval == SUCCESS) && (p_md->msg.hdr.flags & ISNS_FLAG_REPLACE_REG) ) { ! DEBUG_0 (isns_reg_debug & 1,Deregistering Portal); SNSRemovePortalEntry ((char *)&db_portal, NULL, NULL); rval = ERROR; *************** *** 424,428 **** rval = ISNSdbWrite(&idx_key,entry3); - InitList(PORTAL_ENTITY_LIST, p_portal); /* Update Entity's portal Bitmap */ eidKeyIndex = ISNSFindTag (0, ISNS_ENTITY_ID, key_indx); --- 420,423 ---- *************** *** 431,442 **** { attr = ISNSFindKeyInResponseMsg (ISNS_ENTITY_ID, p_rspmsg); - - if (attr == NULL) - { - DEBUG_0 (isns_reg_debug & 1, (Entity Key not found)); - DeleteList(&p_portal->entity_list); - - return (ISNS_INVALID_REG_ERR); - } } else --- 426,429 ---- *************** *** 448,453 **** do { - strncpy(db_entity_id.id, (char *)&attr->val, sizeof(db_entity_id.id)); DEBUG_0 (isns_reg_debug &1,Fetch entity); read_key.tag = ENTITY_ID_KEY; strcpy(read_key.val.entity_id.id,db_entity_id.id); --- 435,441 ---- do { DEBUG_0 (isns_reg_debug &1,Fetch entity); + strncpy(db_entity_id.id, (char *)&attr->val, sizeof(db_entity_id.id)); + ISNS_Key read_key; read_key.tag = ENTITY_ID_KEY; strcpy(read_key.val.entity_id.id,db_entity_id.id); *************** *** 456,464 **** if ( rval != SUCCESS) { ! DEBUG_0 (isns_reg_debug & 1, (Fetching Entity)); ! ! if (newPortalRegFlag) ! DeleteList(&p_portal->entity_list); ! return (ISNS_INVALID_REG_ERR); } --- 444,449 ---- if ( rval != SUCCESS) { ! DEBUG_0 (isns_reg_debug & 1, Error Fetching Entity); ! return (ERROR); } *************** *** 488,502 **** } ! memset(&newPortalEntityEntry, 0, sizeof(newPortalEntityEntry)); ! newPortalEntityEntry.entity_index = p_entity->entity_index; ! strncpy(newPortalEntityEntry.eid.id, p_entity->eid.id, sizeof(newPortalEntityEntry.eid.id)); ! ! pnode = NULL; ! if (!(pnode = FindNode( &p_portal->entity_list, (char *)&newPortalEntityEntry, ! sizeof(newPortalEntityEntry)))) ! { ! AddNode( &p_portal->entity_list, (char *)&newPortalEntityEntry, ! sizeof(newPortalEntityEntry)); ! } if (eidKeyIndex!=-1) --- 473,478 ---- } ! strcpy(p_portal->entity_id.id,p_entity->eid.id); ! p_portal->entity_index = p_entity->entity_index; if (eidKeyIndex!=-1) *************** *** 547,568 **** newPortalEntry.portal_idx = p_portal->portal_index; AddNode(&p_entity->iportal_list, (char *)&newPortalEntry, sizeof(newPortalEntry)); ! ! memset(&newPortalEntityEntry, 0, sizeof(newPortalEntityEntry)); ! newPortalEntityEntry.entity_index = p_entity->entity_index; ! strncpy(newPortalEntityEntry.eid.id, p_entity->eid.id, sizeof(newPortalEntityEntry.eid.id)); ! ! pnode = NULL; ! if (!(pnode = FindNode( &p_portal->entity_list, (char *)&newPortalEntityEntry, ! sizeof(newPortalEntityEntry)))) ! { ! AddNode( &p_portal->entity_list, (char *)&newPortalEntityEntry, ! sizeof(newPortalEntityEntry)); ! } /* Store Entity Entry */ ! strncpy(db_entity_id.id, (char *)&attr->val, sizeof(db_entity_id.id)); ! //ISNS_Key key; ! //key.tag = ENTITY_ID_KEY; ! //strcpy(key.val.entity_id.id,db_entity_id.id); rval = ISNSdbWrite(&read_key,entry); } --- 523,530 ---- newPortalEntry.portal_idx = p_portal->portal_index; AddNode(&p_entity->iportal_list, (char *)&newPortalEntry, sizeof(newPortalEntry)); ! strcpy(p_portal->entity_id.id,p_entity->eid.id); /* Store Entity Entry */ ! //strncpy(db_entity_id.id, (char *)&attr->val, sizeof(db_entity_id.id)); rval = ISNSdbWrite(&read_key,entry); } *************** *** 606,612 **** p_portal->esi_interval, sns_esi_interval); ! if (newPortalRegFlag) ! DeleteList(&p_portal->entity_list); ! return ( ISNS_ESI_TOO_SHORT ); } updateESIflag = TRUE; --- 568,572 ---- p_portal->esi_interval, sns_esi_interval); ! p_portal->esi_interval = sns_esi_interval; } updateESIflag = TRUE; *************** *** 656,690 **** p_portal->esi_sockfd=p_md->cb.sock.sockfd; } - - pnode = NULL; - if (p_portal->esi_interval) - ISNSAddESIEntry(&p_portal->ip_addr, p_portal->ip_port, NULL); - else - ISNSRemoveESIEntry(&p_portal->ip_addr, p_portal->ip_port, NULL); - } - - #if 0 - if (newPortalRegFlag) - { - /* Update the entity */ - strcpy (p_portal->eid.id, p_entity->eid.id); - - /* Store Entity Entry */ } - #endif /* Send Out Detailed SCN */ if (newPortalRegFlag || updateFlag) { ! pnode = NULL; ! while ( (pnode = GetNextNode( &p_portal->entity_list, pnode)) ) ! { ! p_lentry = (ENTITY_LIST_ENTRY *) GetNodeData(pnode); ! if ( SNSdbFetchEntity ((char *)p_lentry->eid.id, &p_entity, &entry) ) return ( ERROR ); - if ( p_entity->eid_type != ENTITY_TYPE_ISCSI ) - continue; - pnode2 = NULL; while ( (pnode2 = GetNextNode( &p_entity->iscsi_node_list, pnode2)) ) --- 616,627 ---- p_portal->esi_sockfd=p_md->cb.sock.sockfd; } } /* Send Out Detailed SCN */ if (newPortalRegFlag || updateFlag) { ! if ( SNSdbFetchEntity ((char *)p_portal->entity_id.id, &p_entity, &entry) ) return ( ERROR ); pnode2 = NULL; while ( (pnode2 = GetNextNode( &p_entity->iscsi_node_list, pnode2)) ) *************** *** 694,698 **** ISNS_SCN_OBJ_UPDATED); } - } } --- 631,634 ---- *************** *** 2896,2922 **** ********************************************************************/ int - ISNSAddESIEntry(IP_Address *p_ip, uint32_t port, char *p_eid) - { - SOIP_Esi_Entry new_entry; - - memset (&new_entry, 0, sizeof(new_entry)); - - memcpy(new_entry.ip_addr.v, p_ip->v, IP_ADDR_SIZE); - new_entry.ip_port=port; - if (p_eid) - strncpy(new_entry.eid.id, p_eid, sizeof(new_entry.eid.id) ); - - if (NULL==FindNode(&esi_list, (char *)&new_entry, sizeof(new_entry))) - { - AddNode(&esi_list, (char *)&new_entry, sizeof(new_entry)); - } - - return (SUCCESS); - } - - - /******************************************************************** - ********************************************************************/ - int ISNSAddSCNEntry( uint32_t type, char *nodename, uint32_t bitmap, int sockfd ) { --- 2832,2835 ---- Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** iSNSdb.c 8 Dec 2006 20:05:50 -0000 1.17 --- iSNSdb.c 14 Dec 2006 23:04:28 -0000 1.18 *************** *** 83,87 **** SOIP_Dd_Member *ddmem; /* [100]; */ - ISNS_LIST esi_list; ISNS_LIST scn_list; ISNS_LIST scn_callback_list; --- 83,86 ---- *************** *** 204,207 **** --- 203,212 ---- break; case PORTAL_ID_KEY: + { + SOIP_DB_Portal db_portal; + memcpy(&db_portal,&key->val,sizeof(SOIP_DB_Portal)); + DEBUG_2 (isns_db_debug &1,read Portal ip_addr:%s port:%i, + inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); + k.dptr = (char *)&key->val; k.dsize = sizeof(SOIP_DB_Portal); *************** *** 209,219 **** if (d.dptr == NULL) { ! DEBUG_1 (isns_db_debug & 1, (read failed Portal port:%i),key->val.ip_port); return (ISNS_NO_SUCH_ENTRY_ERR); } if (entry->data_type != PORTAL_ID_KEY) return (ISNS_UNKNOWN_ERR); - entry->data.portal.entity_list.p_entry = &entry->data.portal; break; case ENTITY_IDX_KEY: case ISCSI_IDX_KEY: --- 214,225 ---- if (d.dptr == NULL) { ! DEBUG_2 (isns_db_debug &1,read failed Portal ip_addr:%s port:%i, ! inet_ntoa(*(struct in_addr *)(db_portal.ip_addr.v+12)),db_portal.ip_port); return (ISNS_NO_SUCH_ENTRY_ERR); } if (entry->data_type != PORTAL_ID_KEY) return (ISNS_UNKNOWN_ERR); break; + } case ENTITY_IDX_KEY: case ISCSI_IDX_KEY: *************** *** 265,269 **** k.dsize = 4 + LIST_KEY_SIZE; break; - case ESI_LIST: case SCN_LIST: case SCN_CALLBACK_LIST: --- 271,274 ---- *************** *** 406,410 **** k.dsize = 4 + LIST_KEY_SIZE; break; - case ESI_LIST: case SCN_LIST: case SCN_CALLBACK_LIST: --- 411,414 ---- *************** *** 532,536 **** k.dsize = 4 + LIST_KEY_SIZE; break; - case ESI_LIST: case SCN_LIST: case SCN_CALLBACK_LIST: --- 536,539 ---- *************** *** 858,862 **** { DEBUG_0 (isns_db_debug &1, ISNSInitDBTables); - InitList(ESI_LIST, &esi_list); InitList(SCN_LIST, &scn_list ); InitList(SCN_CALLBACK_LIST, &scn_callback_list); --- 861,864 ---- |
From: Robert W. <wrw...@us...> - 2006-12-13 23:53:05
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17418/src Modified Files: iSNSMain.c iSNSUtil.c iSNSesi.c iSNSfsm.c iSNSparse.c iSNSreg.c Log Message: Enable ESI to work Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSUtil.c 8 Dec 2006 20:20:34 -0000 1.9 --- iSNSUtil.c 13 Dec 2006 23:53:01 -0000 1.10 *************** *** 806,856 **** char * FuncIDText (uint16_t funcid) { ! switch (funcid) ! { ! /* Request */ ! case ISNS_REG_DEV_ATTR_REQ : return("Register Device Attribute Request"); ! case ISNS_DEV_ATTR_QRY_REQ : return("Device Attribute Query Request"); ! case ISNS_DEV_GET_NXT_REQ : return("Device Get Next Request"); ! case ISNS_DEREG_DEV_REQ : return("Deregister Device Request"); ! case ISNS_SCN_REG_REQ : return("SCN Register Request"); ! case ISNS_SCN_DEREG_REQ : return("SCN Deregister Request"); ! case ISNS_SCN_EVENT : return("SCN Event"); ! case ISNS_SCN : return("State Change Notification"); ! case ISNS_REG_DD_REQ : return("Discovery Domain Register"); ! case ISNS_DEREG_DD_REQ : return("Discovery Domain Deregister"); ! case ISNS_REG_DDS_REQ : return("Discovery Domain Set Register"); ! case ISNS_DEREG_DDS_REQ : return("Discovery Domain Set Deregister"); ! case ISNS_ESI : return("Entity Status Inquiry"); ! case ISNS_HEART_BEAT : return("Name Service Heartbeat"); ! case ISNS_REQ_SW_ID_REQ : return("Request Switch ID Request"); ! case ISNS_REL_SW_ID_REQ : return("Release Switch ID Request"); ! case ISNS_GET_SW_ID_REQ : return("Get Switch ID Request"); ! case ISNS_SAVE_DB_REQ : return("Save Database Request"); ! case ISNS_DDS_GET_NXT_MEMBER_REQ: return("Get DDS Next Member Request"); ! case ISNS_DD_GET_NXT_ISCSI_MEMBER_REQ: return("Get DDS Next Member Request"); ! case ISNS_ENTITY_GET_NXT_PORTAL_REQ: return("Get Entity Next Portal Request"); ! /* Response */ ! case ISNS_REG_DEV_ATTR_RES : return("Register Device Attribute Response"); ! case ISNS_DEV_ATTR_QRY_RES : return("Device Attribute Query Response"); ! case ISNS_DEV_GET_NXT_RES : return("Device Get Next Response"); ! case ISNS_DEREG_DEV_RES : return("Deregister Device Response"); ! case ISNS_SCN_REG_RES : return("SCN Register Response"); ! case ISNS_SCN_DEREG_RES : return("SCN Degregister Response"); ! case ISNS_SCN_EVENT_RES : return("SCN Event Response"); ! case ISNS_SCN_RES : return("SCN Response"); ! case ISNS_REG_DD_RES : return("Discovery Domain Register Response"); ! case ISNS_DEREG_DD_RES : return("Discovery Domain Deregister Response"); ! case ISNS_REG_DDS_RES : return("Discovery Domain Set Register Response"); ! case ISNS_DEREG_DDS_RES : return("Discovery Domain Set Deregister Response"); ! case ISNS_ESI_RSP : return("Entity Status Inquiry Response"); ! case ISNS_REQ_SW_ID_RES : return("Request Switch ID Response"); ! case ISNS_REL_SW_ID_RES : return("Release Switch ID Response"); ! case ISNS_GET_SW_ID_RES : return("Get Switch ID Response"); ! case ISNS_SAVE_DB_RES : return("Save Database Response"); ! case ISNS_DDS_GET_NXT_MEMBER_RES: return("Get DDS Next Member Response"); ! case ISNS_DD_GET_NXT_ISCSI_MEMBER_RES: return("Get DDS Next Member Response"); ! case ISNS_ENTITY_GET_NXT_PORTAL_RES: return("Get Portal Next Entity Response"); ! default : return(""); ! } } --- 806,861 ---- char * FuncIDText (uint16_t funcid) { ! switch (funcid) ! { ! /* Request */ ! case ISNS_REG_DEV_ATTR_REQ : return("Register Device Attribute Request"); ! case ISNS_DEV_ATTR_QRY_REQ : return("Device Attribute Query Request"); ! case ISNS_DEV_GET_NXT_REQ : return("Device Get Next Request"); ! case ISNS_DEREG_DEV_REQ : return("Deregister Device Request"); ! case ISNS_SCN_REG_REQ : return("SCN Register Request"); ! case ISNS_SCN_DEREG_REQ : return("SCN Deregister Request"); ! case ISNS_SCN_EVENT : return("SCN Event"); ! case ISNS_SCN : return("State Change Notification"); ! case ISNS_REG_DD_REQ : return("Discovery Domain Register"); ! case ISNS_DEREG_DD_REQ : return("Discovery Domain Deregister"); ! case ISNS_REG_DDS_REQ : return("Discovery Domain Set Register"); ! case ISNS_DEREG_DDS_REQ : return("Discovery Domain Set Deregister"); ! case ISNS_ESI : return("Entity Status Inquiry"); ! case ISNS_HEART_BEAT : return("Name Service Heartbeat"); ! case ISNS_REQ_SW_ID_REQ : return("Request Switch ID Request"); ! case ISNS_REL_SW_ID_REQ : return("Release Switch ID Request"); ! case ISNS_GET_SW_ID_REQ : return("Get Switch ID Request"); ! case ISNS_DDS_GET_NXT_MEMBER_REQ: return("Get DDS Next Member Request"); ! case ISNS_DD_GET_NXT_ISCSI_MEMBER_REQ: return("Get DDS Next Member Request"); ! case ISNS_ENTITY_GET_NXT_PORTAL_REQ: return("Get Entity Next Portal Request"); ! ! /* Response */ ! case ISNS_REG_DEV_ATTR_RES : return("Register Device Attribute Response"); ! case ISNS_DEV_ATTR_QRY_RES : return("Device Attribute Query Response"); ! case ISNS_DEV_GET_NXT_RES : return("Device Get Next Response"); ! case ISNS_DEREG_DEV_RES : return("Deregister Device Response"); ! case ISNS_SCN_REG_RES : return("SCN Register Response"); ! case ISNS_SCN_DEREG_RES : return("SCN Degregister Response"); ! case ISNS_SCN_EVENT_RES : return("SCN Event Response"); ! case ISNS_SCN_RES : return("SCN Response"); ! case ISNS_REG_DD_RES : return("Discovery Domain Register Response"); ! case ISNS_DEREG_DD_RES : return("Discovery Domain Deregister Response"); ! case ISNS_REG_DDS_RES : return("Discovery Domain Set Register Response"); ! case ISNS_DEREG_DDS_RES : return("Discovery Domain Set Deregister Response"); ! case ISNS_ESI_RSP : return("Entity Status Inquiry Response"); ! case ISNS_REQ_SW_ID_RES : return("Request Switch ID Response"); ! case ISNS_REL_SW_ID_RES : return("Release Switch ID Response"); ! case ISNS_GET_SW_ID_RES : return("Get Switch ID Response"); ! case ISNS_DDS_GET_NXT_MEMBER_RES: return("Get DDS Next Member Response"); ! case ISNS_DD_GET_NXT_ISCSI_MEMBER_RES: return("Get DDS Next Member Response"); ! case ISNS_ENTITY_GET_NXT_PORTAL_RES: return("Get Portal Next Entity Response"); ! ! /* Internal */ ! case ESI_TIMEOUT_EVENT : return("ESI Timeout Event"); ! case FSM_TIMEOUT_EVENT : return("FSM Timeout Event"); ! case REQ_TIMEOUT_EVENT : return("REQ Timeout Event"); ! ! default : return("Unknown Message Type"); ! } } Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSesi.c 13 Dec 2006 19:45:57 -0000 1.4 --- iSNSesi.c 13 Dec 2006 23:53:01 -0000 1.5 *************** *** 55,60 **** int isns_esi_debug=0; ! uint32_t isns_esi_interval = 15; ! extern int sns_esi_interval; extern int sns_heartbeat_interval; --- 55,59 ---- int isns_esi_debug=0; ! int sns_esi_interval = SNS_ESI_INTERVAL; extern int sns_heartbeat_interval; *************** *** 99,102 **** --- 98,103 ---- ENTITY_LIST_ENTRY *lentry; + DEBUG_0 (isns_esi_debug &1, ISNS_SendESI); + p_md = p_rspMd; memset( p_md, 0, sizeof( ISNS_Msg_Descp ) ); *************** *** 113,120 **** --- 114,124 ---- } + DEBUG_0 (isns_esi_debug &1, process esi_list); + /* Go through the ESI Table */ p_esi_node = GetNextNode( &esi_list, NULL ); while ( p_esi_node ) { + DEBUG_0 (isns_esi_debug &1, GetNodeData); /* Get Node Data */ p_esi_entry = (SOIP_Esi_Entry *)GetNodeData(p_esi_node); *************** *** 163,168 **** } ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), ! lentry->eid.id); ISNSAppendKey ( &p_md->msg, ISNS_PORTAL_IP, ISNS_IP_SIZE, --- 167,171 ---- } ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); ISNSAppendKey ( &p_md->msg, ISNS_PORTAL_IP, ISNS_IP_SIZE, *************** *** 212,215 **** --- 215,219 ---- } + DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); rval = ISNSSendMsg ( p_md ); } *************** *** 304,307 **** --- 308,313 ---- int rval; + DEBUG_0 (isns_esi_debug &1, ISNS_ProcessESI); + ISNSParseMsg( &p_md->msg, attr_indx, key_indx, NULL ); i = ISNSFindTag (0, ISNS_ENTITY_ID, key_indx); Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSparse.c 13 Dec 2006 19:45:57 -0000 1.10 --- iSNSparse.c 13 Dec 2006 23:53:01 -0000 1.11 *************** *** 86,89 **** --- 86,90 ---- { case ISNS_REG_DEV_ATTR_REQ: + case ISNS_ESI: case ISNS_ESI_RSP: case ISNS_SCN_RES: *************** *** 282,286 **** --- 283,290 ---- */ if ((msg == NULL) || (msg->hdr.msg_len > sizeof (ISNS_Msg))) + { + printf("Invalid msg header length: %i\n",msg->hdr.msg_len); return (ERROR); + } DEBUG_2 (sns_parse_debug &1,%s flags:%x,FuncIDText(msg->hdr.type),msg->hdr.flags); *************** *** 303,309 **** } ! if (msg->hdr.type == ISNS_ESI_RSP || msg->hdr.type == ISNS_REG_DEV_ATTR_RES || ! msg->hdr.type == ISNS_DEV_ATTR_QRY_RES) { offset += 4; ptr = (struct ISNS_attr *)((char *) ptr + 4); --- 307,316 ---- } ! if ( (msg->hdr.type == ISNS_ESI_RSP) ! || (msg->hdr.type == ISNS_REG_DEV_ATTR_RES) ! || (msg->hdr.type == ISNS_DEV_ATTR_QRY_RES) ) ! { + DEBUG_0 (sns_parse_debug &1, skip the error status field / timestamp); offset += 4; ptr = (struct ISNS_attr *)((char *) ptr + 4); Index: iSNSfsm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSfsm.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSfsm.c 1 Dec 2006 15:35:17 -0000 1.4 --- iSNSfsm.c 13 Dec 2006 23:53:01 -0000 1.5 *************** *** 218,222 **** ! int sns_esi_interval = SNS_ESI_INTERVAL; int sns_heartbeat_interval = SNS_HEARTBEAT_INTERVAL; int sns_heartbeat_timeout = SNS_HEARTBEAT_WAITTIME; --- 218,222 ---- ! extern int sns_esi_interval; int sns_heartbeat_interval = SNS_HEARTBEAT_INTERVAL; int sns_heartbeat_timeout = SNS_HEARTBEAT_WAITTIME; *************** *** 228,232 **** */ int sns_fsm_tree_wait = TRUE; ! int sns_ready; SNS_State sns_state; --- 228,232 ---- */ int sns_fsm_tree_wait = TRUE; ! int sns_ready = FALSE; SNS_State sns_state; *************** *** 294,297 **** --- 294,299 ---- ISNSNotReady(); DEBUG_0 (sns_fsm_debug & 4, (iSNS starting...)); + //sns_ready = TRUE; + //isns_role = ISNS_PRIMARY_SERVER; /* *************** *** 303,328 **** /* ! * Install the heartbeat timeout handler. */ #ifdef SNS_LINUX ! { ! /* HANDLE junk */ ! pthread_t junk; ! /*printf ("Creating thread for FSMTimeoutThread\n");*/ ! if (0 != pthread_create (&junk, NULL, (void*)SNSFSMTimeoutThread, NULL)) ! perror ("Error creating thread for FSM Timeout"); ! /*printf ("Creating thread for ESITimeoutThread\n");*/ ! if (0 != pthread_create (&junk, NULL, (void*)SNSESITimeoutThread, NULL)) ! perror ("Error creating thread for ESI Timeout"); ! /*printf ("Creating thread for ResyncTimeoutThread\n");*/ ! sns_resync_pid = pthread_create (&junk, NULL, (void*)SNSResyncTimeoutThread, NULL); ! if (sns_resync_pid != 0) ! perror ("Error creating thread for iSNS Resync"); ! } ! #else sns_esi_timer=CreateWaitableTimer(NULL, FALSE, NULL); sns_fsm_timer=CreateWaitableTimer(NULL, FALSE, NULL); --- 305,325 ---- /* ! * Activate timeout handlers. */ #ifdef SNS_LINUX ! { ! pthread_t junk; ! if (0 != pthread_create (&junk, NULL, (void*)SNSFSMTimeoutThread, NULL)) ! perror ("Error creating thread for FSM Timeout"); ! if (0 != pthread_create (&junk, NULL, (void*)SNSESITimeoutThread, NULL)) ! perror ("Error creating thread for ESI Timeout"); ! if (0 != pthread_create (&junk, NULL, (void*)SNSResyncTimeoutThread, NULL)) ! perror ("Error creating thread for iSNS Resync"); ! } + #else sns_esi_timer=CreateWaitableTimer(NULL, FALSE, NULL); sns_fsm_timer=CreateWaitableTimer(NULL, FALSE, NULL); *************** *** 422,436 **** sns_fsm_timeout = 1; ! bzero ((char *) fsm_timeout_md, sizeof (fsm_timeout_md)); ! /* ! * Send a FSM timeout message to the iSNS core task ! */ ((ISNS_Msg_Descp *)fsm_timeout_md)->msg.hdr.type = FSM_TIMEOUT_EVENT; ! ((ISNS_Msg_Descp *)fsm_timeout_md)->msg.hdr.msg_len = 0; ! status = SendIPCMessage (SNS_EP, (void *)fsm_timeout_md, sizeof(fsm_timeout_md), IPC_NO_WAIT); - } --- 419,433 ---- sns_fsm_timeout = 1; ! bzero ((char *) fsm_timeout_md, sizeof (fsm_timeout_md)); ! ! /* ! * Send a FSM timeout message to the iSNS core task ! */ ((ISNS_Msg_Descp *)fsm_timeout_md)->msg.hdr.type = FSM_TIMEOUT_EVENT; ! ((ISNS_Msg_Descp *)fsm_timeout_md)->msg.hdr.msg_len = 0; ! status = SendIPCMessage (SNS_EP, (void *)fsm_timeout_md, sizeof(fsm_timeout_md), IPC_NO_WAIT); } *************** *** 441,445 **** STATUS status = 0; ! bzero ((char *) esi_timeout_md, sizeof (esi_timeout_md)); /* * Send a ESI timeout message to the iSNS core task --- 438,442 ---- STATUS status = 0; ! bzero ((char *) esi_timeout_md, sizeof (esi_timeout_md)); /* * Send a ESI timeout message to the iSNS core task *************** *** 447,453 **** ((ISNS_Msg_Descp *)esi_timeout_md)->msg.hdr.type = ESI_TIMEOUT_EVENT; ! ((ISNS_Msg_Descp *)esi_timeout_md)->msg.hdr.msg_len = 0; ! status = SendIPCMessage (SNS_EP, (void *)esi_timeout_md, sizeof(esi_timeout_md), IPC_NO_WAIT); } --- 444,450 ---- ((ISNS_Msg_Descp *)esi_timeout_md)->msg.hdr.type = ESI_TIMEOUT_EVENT; ! ((ISNS_Msg_Descp *)esi_timeout_md)->msg.hdr.msg_len = 0; ! status = SendIPCMessage (SNS_EP, (void *)esi_timeout_md, sizeof(esi_timeout_md), IPC_NO_WAIT); } Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNSreg.c 13 Dec 2006 19:45:57 -0000 1.11 --- iSNSreg.c 13 Dec 2006 23:53:01 -0000 1.12 *************** *** 61,65 **** /* Global */ int isns_reg_debug=0; ! extern uint32_t isns_esi_interval; --- 61,65 ---- /* Global */ int isns_reg_debug=0; ! int sns_esi_interval; *************** *** 601,608 **** if (p_portal->esi_interval != 0 ! && p_portal->esi_interval < isns_esi_interval) { DEBUG_2 (isns_reg_debug & 1, (ESI Interval too small %u < %u), ! p_portal->esi_interval, isns_esi_interval); if (newPortalRegFlag) --- 601,608 ---- if (p_portal->esi_interval != 0 ! && p_portal->esi_interval < sns_esi_interval) { DEBUG_2 (isns_reg_debug & 1, (ESI Interval too small %u < %u), ! p_portal->esi_interval, sns_esi_interval); if (newPortalRegFlag) *************** *** 651,655 **** return (ISNS_INVALID_REG_ERR); } - if (p_portal->esi_port == 0 && p_portal->esi_interval != 0 && p_md->cb.sock.socketType == ISNS_SOCKET_TYPE_TCP) --- 651,654 ---- Index: iSNSMain.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSMain.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSMain.c 7 Dec 2006 22:47:38 -0000 1.10 --- iSNSMain.c 13 Dec 2006 23:53:01 -0000 1.11 *************** *** 344,347 **** --- 344,349 ---- inet_ntoa_b (source_ip, dot_not_addr); + DEBUG_2(isns_main_debug &1,(SNSProcessRequest type: 0x%x - %s),msg_type,FuncIDText(msg_type)); + switch (msg_type) { *************** *** 372,375 **** --- 374,378 ---- break; case ISNS_HEART_BEAT: + DEBUG_0 (isns_main_debug & 1, ISNS_HEART_BEAT Not Implemented); break; case ISNS_REG_DDS_REQ: *************** *** 605,614 **** } break; ! case ISNS_SAVE_DB_REQ: ! { ! DEBUG_1 (isns_main_debug & 16, (Received %s), FuncIDText((short)msg_type)); ! DEBUG_0( isns_main_debug & 1, (Save is not implemented) ); ! break; ! } default: printf ("Received unknown message type %#x : \n", msg_type); --- 608,612 ---- } break; ! default: printf ("Received unknown message type %#x : \n", msg_type); |
From: Robert W. <wrw...@us...> - 2006-12-13 23:53:04
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17418/include Modified Files: iSNSdefs.h Log Message: Enable ESI to work Index: iSNSdefs.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdefs.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iSNSdefs.h 25 Oct 2006 21:19:36 -0000 1.5 --- iSNSdefs.h 13 Dec 2006 23:53:01 -0000 1.6 *************** *** 145,151 **** ISNS_ENTITY_GET_NXT_PORTAL_REQ, - /* Nishan vendor specific messages */ - ISNS_SAVE_DB_REQ=0x100, - /* End */ ISNS_END_VALID_REQ_FUNC_ID, --- 145,148 ---- *************** *** 172,179 **** ISNS_ENTITY_GET_NXT_PORTAL_RES, - /* Nishan specific messages */ - ISNS_SAVE_DB_RES=0x8100, - /* End */ - ISNS_END_VALID_RES_FUNC_ID, --- 169,172 ---- |
From: Robert W. <wrw...@us...> - 2006-12-13 19:46:01
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15329/src Modified Files: iSNSLinux.c iSNSList.c iSNScomm.c iSNSdereg.c iSNSesi.c iSNSparse.c iSNSquery.c iSNSreg.c iSNSscn.c iSNStrcv.c Log Message: Add more debug code Index: iSNScomm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNScomm.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNScomm.c 7 Dec 2006 00:12:03 -0000 1.7 --- iSNScomm.c 13 Dec 2006 19:45:57 -0000 1.8 *************** *** 110,114 **** void pipe_handler(int n) { ! printf("SIG_PIPE received:%i\n",n); } --- 110,114 ---- void pipe_handler(int n) { ! printf("SIGPIPE received:%i\n",n); } *************** *** 364,370 **** --- 364,377 ---- ISNSSendMsg(ISNS_Msg_Descp *p_md) { + char * attr_indx[SNS_MAX_ATTRS]; + char * key_indx[SNS_MAX_ATTRS]; int rval; + + DEBUG_0 (sns_comm_debug &1,ISNSSendMsg); + p_md->msg.hdr.flags |= ISNS_FLAG_SND_SERVER; + ISNSParseMsg(&p_md->msg, attr_indx, key_indx, NULL); + if (p_md->cb.sock.socketType==ISNS_SOCKET_TYPE_UDP) { Index: iSNSLinux.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSLinux.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSLinux.c 8 Dec 2006 20:05:50 -0000 1.9 --- iSNSLinux.c 13 Dec 2006 19:45:57 -0000 1.10 *************** *** 80,84 **** HANDLE init_ipc_rcv (void); ! void DebugOn (void); void --- 80,84 ---- HANDLE init_ipc_rcv (void); ! void DebugOn (char *); void *************** *** 154,158 **** while (optind != argc) { ! c = getopt (argc, argv, "fda:b:p:c:"); switch (c) --- 154,158 ---- while (optind != argc) { ! c = getopt (argc, argv, "fa:b:p:c:d:"); switch (c) *************** *** 180,184 **** case 'd': ! DebugOn(); break; case 'f': --- 180,184 ---- case 'd': ! DebugOn(optarg); break; case 'f': *************** *** 378,382 **** void ! DebugOn (void) { extern int sns_bcast_debug; --- 378,382 ---- void ! DebugOn (char * type) { extern int sns_bcast_debug; *************** *** 390,405 **** extern int sns_comm_debug; extern int isns_db_debug; extern int sns_parse_debug; ! sns_bcast_debug = -1; ! sns_cb_debug = -1; ! sns_comm_debug = -1; ! isns_db_debug = -1; ! sns_fsm_debug = -1; ! sns_hb_debug = -1; ! isns_main_debug = -1; ! sns_recv_debug = -1; ! sns_rsync_debug = -1; ! sns_scn_debug = -1; ! sns_parse_debug = -1; } --- 390,455 ---- extern int sns_comm_debug; extern int isns_db_debug; + extern int isns_list_debug; extern int sns_parse_debug; + extern int sns_tcp_debug; + extern int isns_query_debug; + extern int isns_reg_debug; + extern int isns_dereg_debug; + extern int isns_esi_debug; ! if (!strcmp(type,"parse")) ! { ! sns_parse_debug = -1; ! isns_main_debug = -1; ! sns_comm_debug = -1; ! sns_tcp_debug = -1; ! } ! else if (!strcmp(type,"db")) ! { ! isns_db_debug = -1; ! } ! else if (!strcmp(type,"list")) ! { ! isns_list_debug = -1; ! } ! else if (!strcmp(type,"reg")) ! { ! isns_reg_debug = -1; ! isns_dereg_debug = -1; ! isns_query_debug = -1; ! } ! else if (!strcmp(type,"fsm")) ! { ! sns_fsm_debug = -1; ! sns_hb_debug = -1; ! sns_cb_debug = -1; ! } ! else if (!strcmp(type,"esi")) ! { ! isns_esi_debug = -1; ! } ! else if (!strcmp(type,"scn")) ! { ! sns_scn_debug = -1; ! } ! else ! { ! sns_bcast_debug = -1; ! sns_cb_debug = -1; ! sns_comm_debug = -1; ! isns_db_debug = -1; ! sns_fsm_debug = -1; ! sns_hb_debug = -1; ! isns_main_debug = -1; ! sns_recv_debug = -1; ! sns_rsync_debug = -1; ! sns_scn_debug = -1; ! sns_parse_debug = -1; ! sns_tcp_debug = -1; ! isns_list_debug = -1; ! isns_query_debug = -1; ! isns_reg_debug = -1; ! isns_dereg_debug = -1; ! isns_esi_debug = -1; ! } } Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNSquery.c 12 Dec 2006 21:38:29 -0000 1.7 --- iSNSquery.c 13 Dec 2006 19:45:57 -0000 1.8 *************** *** 58,62 **** /* Global */ ! extern int isns_db_debug;; extern uint32_t isns_esi_interval; --- 58,62 ---- /* Global */ ! int isns_query_debug=0; extern uint32_t isns_esi_interval; *************** *** 149,153 **** if (attr == NULL) { ! DEBUG_0 (isns_db_debug & 1, (No attr in query msg)); return ( ISNS_MSG_FMT_ERR ); } --- 149,153 ---- if (attr == NULL) { ! DEBUG_0 (isns_query_debug & 1, (No attr in query msg)); return ( ISNS_MSG_FMT_ERR ); } *************** *** 272,276 **** iSCSINodeIdxKeyFlag = -1; ! DEBUG_0 (isns_db_debug &1,(GetAttrEntity)); ISNSTouchEntity( src_attr ); --- 272,276 ---- iSCSINodeIdxKeyFlag = -1; ! DEBUG_0 (isns_query_debug &1,(GetAttrEntity)); ISNSTouchEntity( src_attr ); *************** *** 345,349 **** /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); ! DEBUG_1 (isns_db_debug &1,(Find Entity Index:%i),key->val.index); ISNS_Key read_key; read_key.tag = ENTITY_IDX_KEY; --- 345,349 ---- /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); ! DEBUG_1 (isns_query_debug &1,(Find Entity Index:%i),key->val.index); ISNS_Key read_key; read_key.tag = ENTITY_IDX_KEY; *************** *** 355,359 **** ptr = (char *)&entry3.data.entity_idx.id; ! DEBUG_1 (isns_db_debug &1,(entity_idx.id:%s),ptr); if (!ptr) --- 355,359 ---- ptr = (char *)&entry3.data.entity_idx.id; ! DEBUG_1 (isns_query_debug &1,(entity_idx.id:%s),ptr); if (!ptr) *************** *** 643,655 **** else if (ddKeyIndex != -1) { ! DEBUG_0(isns_db_debug & 1, (Not implemented)); } else if (ifcpKeyIndex != -1) { ! DEBUG_0 (isns_db_debug & 1, (Not implemented)); } else if (iscsiKeyIndex != -1) { ! DEBUG_0 (isns_db_debug & 1, (Not implemented)); } else --- 643,655 ---- else if (ddKeyIndex != -1) { ! DEBUG_0(isns_query_debug & 1, (Not implemented)); } else if (ifcpKeyIndex != -1) { ! DEBUG_0 (isns_query_debug & 1, (Not implemented)); } else if (iscsiKeyIndex != -1) { ! DEBUG_0 (isns_query_debug & 1, (Not implemented)); } else *************** *** 1228,1232 **** if (rval != SUCCESS) { ! DEBUG_0(isns_db_debug & 1, "***ERROR Invalid dd"); return (ISNS_NO_SUCH_ENTRY_ERR); } --- 1228,1232 ---- if (rval != SUCCESS) { ! DEBUG_0(isns_query_debug & 1, "***ERROR Invalid dd"); return (ISNS_NO_SUCH_ENTRY_ERR); } *************** *** 1534,1538 **** else if (fc4TypesKeyFlag != -1) { ! DEBUG_0 (isns_db_debug & 1, (Not Implemented)); return (ERROR); } --- 1534,1538 ---- else if (fc4TypesKeyFlag != -1) { ! DEBUG_0 (isns_query_debug & 1, (Not Implemented)); return (ERROR); } *************** *** 1588,1592 **** int rval; ! DEBUG_1 (isns_db_debug &1,(Attribute Query - ISCSI:%s),(char *)&src_attr->val); foundFlag = FALSE; --- 1588,1592 ---- int rval; ! DEBUG_1 (isns_query_debug &1,(Attribute Query - ISCSI:%s),(char *)&src_attr->val); foundFlag = FALSE; *************** *** 1635,1639 **** if (nodeKeyIndex != -1) { ! DEBUG_0 (isns_db_debug &1,nodeKeyIndex); nodeKeyIndex = ISNSFindTag (0, ISNS_ISCSI_NODE_ID, key_indx); --- 1635,1639 ---- if (nodeKeyIndex != -1) { ! DEBUG_0 (isns_query_debug &1,nodeKeyIndex); nodeKeyIndex = ISNSFindTag (0, ISNS_ISCSI_NODE_ID, key_indx); *************** *** 1657,1661 **** if (rval == SUCCESS) { ! DEBUG_0 (isns_db_debug &1,call ISNSdbProcessICSCIOpAttr); ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); foundFlag = TRUE; --- 1657,1661 ---- if (rval == SUCCESS) { ! DEBUG_0 (isns_query_debug &1,call ISNSdbProcessICSCIOpAttr); ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); foundFlag = TRUE; *************** *** 1759,1763 **** SOIP_Portal * p_portal; ! DEBUG_0 (isns_db_debug &1,(Search for Portal)); memset (&db_portal, 0, sizeof (db_portal)); --- 1759,1763 ---- SOIP_Portal * p_portal; ! DEBUG_0 (isns_query_debug &1,(Search for Portal)); memset (&db_portal, 0, sizeof (db_portal)); *************** *** 1838,1842 **** ISNS_Key qkey = { 0 }; ! DEBUG_0 (isns_db_debug &1,search node table); /* Search the node table */ --- 1838,1842 ---- ISNS_Key qkey = { 0 }; ! DEBUG_0 (isns_query_debug &1,search node table); /* Search the node table */ *************** *** 1878,1882 **** return (ISNS_NO_SUCH_ENTRY_ERR); ! DEBUG_0 (isns_db_debug &1,return from GetAttrISCSI); return ISNS_NO_ERR; --- 1878,1882 ---- return (ISNS_NO_SUCH_ENTRY_ERR); ! DEBUG_0 (isns_query_debug &1,return from GetAttrISCSI); return ISNS_NO_ERR; *************** *** 1909,1913 **** int rval; ! DEBUG_0 (isns_db_debug &1, (ISNSGetNextAttr)); ISNSParseMsg( &p_md->msg, attr_indx, key_indx,&src_attr ); --- 1909,1913 ---- int rval; ! DEBUG_0 (isns_query_debug &1, (ISNSGetNextAttr)); ISNSParseMsg( &p_md->msg, attr_indx, key_indx,&src_attr ); *************** *** 1928,1932 **** { key = (ISNS_Key *)(key_indx[ii]); ! DEBUG_2 (isns_db_debug &1,(keytag:%i (%s)),key->tag,isnsTagText(key->tag)); switch (key->tag) { --- 1928,1932 ---- { key = (ISNS_Key *)(key_indx[ii]); ! DEBUG_2 (isns_query_debug &1,(keytag:%i (%s)),key->tag,isnsTagText(key->tag)); switch (key->tag) { *************** *** 2052,2056 **** else if ( nodeKeyIndex != -1 || iscsiIdxKeyIndex!=-1 ) { ! DEBUG_0 (isns_db_debug &1,process nodeKeyIndex); memset(&qkey, 0, sizeof(qkey)); qkey.tag = ISCSI_ID_KEY; --- 2052,2056 ---- else if ( nodeKeyIndex != -1 || iscsiIdxKeyIndex!=-1 ) { ! DEBUG_0 (isns_query_debug &1,process nodeKeyIndex); memset(&qkey, 0, sizeof(qkey)); qkey.tag = ISCSI_ID_KEY; *************** *** 2058,2065 **** if ( nodeKeyIndex !=-1 ) { ! DEBUG_1 (isns_db_debug &1,(nodeKeyIndex:%i),nodeKeyIndex); key=(ISNS_Key *)(key_indx[nodeKeyIndex]); ! DEBUG_1 (isns_db_debug &1,key length:%i,key->len); ! DEBUG_1 (isns_db_debug &1,key:%s,(char *)&key->val); if (key->len) { --- 2058,2065 ---- if ( nodeKeyIndex !=-1 ) { ! DEBUG_1 (isns_query_debug &1,(nodeKeyIndex:%i),nodeKeyIndex); key=(ISNS_Key *)(key_indx[nodeKeyIndex]); ! DEBUG_1 (isns_query_debug &1,key length:%i,key->len); ! DEBUG_1 (isns_query_debug &1,key:%s,(char *)&key->val); if (key->len) { *************** *** 2097,2102 **** while (!found) { ! DEBUG_1 (isns_db_debug &1, (GetNextOfKey:%s),(char *)&qkey.val); ! DEBUG_1 (isns_db_debug &1, (GetNextOfKey length:%i),qkey.len); if (SNSdbGetNextOfKey (&qkey) != SUCCESS) { --- 2097,2102 ---- while (!found) { ! DEBUG_1 (isns_query_debug &1, (GetNextOfKey:%s),(char *)&qkey.val); ! DEBUG_1 (isns_query_debug &1, (GetNextOfKey length:%i),qkey.len); if (SNSdbGetNextOfKey (&qkey) != SUCCESS) { *************** *** 2106,2110 **** if (rval != SUCCESS) { ! DEBUG_0 (isns_db_debug &1,(ERROR reading Key)); return rval; } --- 2106,2110 ---- if (rval != SUCCESS) { ! DEBUG_0 (isns_query_debug &1,(ERROR reading Key)); return rval; } *************** *** 2221,2225 **** if (rval != SUCCESS) { ! DEBUG_0 (isns_db_debug &1,(Error reading getnext)); return 0; } --- 2221,2225 ---- if (rval != SUCCESS) { ! DEBUG_0 (isns_query_debug &1,(Error reading getnext)); return 0; } *************** *** 2304,2308 **** if (rval != SUCCESS) { ! DEBUG_0 (isns_db_debug &1,(getnextkey error)); } --- 2304,2308 ---- if (rval != SUCCESS) { ! DEBUG_0 (isns_query_debug &1,(getnextkey error)); } *************** *** 2758,2765 **** { q_attr = (ISNS_Attr *) attr_indx[ ii ]; switch ( q_attr->tag ) { case ISNS_ISCSI_NODE_ID: ! DEBUG_1 (isns_db_debug &1,ISCSI NODE ID %s,p_node->id.v); ISNSAppendAttr ( p_msg, ISNS_ISCSI_NODE_ID, PAD4 (strlen (p_node->id.v)), p_node->id.v, 0 ); --- 2758,2767 ---- { q_attr = (ISNS_Attr *) attr_indx[ ii ]; + + DEBUG_1 (isns_query_debug &1, process attribute for iscsi and entity objects (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) { case ISNS_ISCSI_NODE_ID: ! DEBUG_1 (isns_query_debug &1,ISCSI NODE ID %s,p_node->id.v); ISNSAppendAttr ( p_msg, ISNS_ISCSI_NODE_ID, PAD4 (strlen (p_node->id.v)), p_node->id.v, 0 ); *************** *** 2852,2861 **** if ( fetchPortalFlag ) { ! DEBUG_0 (isns_db_debug &1, (fetchPortalFlag)); /* Cycle through all portal */ pnode = NULL; while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) ) { ! DEBUG_0 (isns_db_debug &1, get portal); ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; --- 2854,2863 ---- if ( fetchPortalFlag ) { ! DEBUG_0 (isns_query_debug &1, (fetchPortalFlag)); /* Cycle through all portal */ pnode = NULL; while ( (pnode = GetNextNode(&p_entity->iportal_list, pnode)) ) { ! DEBUG_0 (isns_query_debug &1, get portal); ISNS_Key read_key; read_key.tag = PORTAL_ID_KEY; *************** *** 2870,2874 **** { q_attr = (ISNS_Attr *) attr_indx[jj]; ! DEBUG_0 (isns_db_debug &1, process attribute list); switch ( q_attr->tag ) --- 2872,2876 ---- { q_attr = (ISNS_Attr *) attr_indx[jj]; ! DEBUG_1 (isns_query_debug &1, process attribute for portal object (%s),isnsTagText(q_attr->tag)); switch ( q_attr->tag ) *************** *** 2880,2884 **** break; case ISNS_PORTAL_IP: ! DEBUG_0 (isns_db_debug &1,Add ISNS_PORTAL_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_IP, ISNS_PORTAL_IP_SIZE, p_portal->ip_addr.v, 0); --- 2882,2886 ---- break; case ISNS_PORTAL_IP: ! DEBUG_0 (isns_query_debug &1,Add ISNS_PORTAL_IP); ISNSAppendAttr (p_msg, ISNS_PORTAL_IP, ISNS_PORTAL_IP_SIZE, p_portal->ip_addr.v, 0); *************** *** 3285,3293 **** pnode = NULL; ! DEBUG_0 (isns_db_debug &1,(Get_Active_DD_list)); while ( (pnode=GetNextNode(dd_list, pnode)) ) { ! DEBUG_0 (isns_db_debug &1,(Get_Active_DD_List - node data)); /* First, look at the Node's Local DD_LIST. */ if (flag) --- 3287,3295 ---- pnode = NULL; ! DEBUG_0 (isns_query_debug &1,(Get_Active_DD_list)); while ( (pnode=GetNextNode(dd_list, pnode)) ) { ! DEBUG_0 (isns_query_debug &1,(Get_Active_DD_List - node data)); /* First, look at the Node's Local DD_LIST. */ if (flag) *************** *** 3491,3495 **** else { ! DEBUG_0(isns_db_debug & 1, (ISNSTouchEntity(): Not implemented)); return (ERROR); } --- 3493,3497 ---- else { ! DEBUG_0(isns_query_debug & 1, (ISNSTouchEntity(): Not implemented)); return (ERROR); } *************** *** 3559,3568 **** memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_db_debug &1, Get_Active_DD_List); Get_Active_DD_List (&pnode->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_db_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } --- 3561,3570 ---- memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_query_debug &1, Get_Active_DD_List); Get_Active_DD_List (&pnode->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } *************** *** 3583,3587 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_db_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } --- 3585,3589 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } *************** *** 3610,3614 **** if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_db_debug & 1, "***ERROR: Invalid DD"); return (ISNS_NO_SUCH_ENTRY_ERR); } --- 3612,3616 ---- if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR: Invalid DD"); return (ISNS_NO_SUCH_ENTRY_ERR); } *************** *** 3623,3632 **** memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_db_debug &1, Get_Active_DD_List); Get_Active_DD_List (&p_port->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_db_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } --- 3625,3634 ---- memset (dlist_node, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); ! DEBUG_0 (isns_query_debug &1, Get_Active_DD_List); Get_Active_DD_List (&p_port->dd_id_list, dlist_node, 0); if (FALSE == Check_Overlap_DD (dlist_src, dlist_node)) { ! DEBUG_0(isns_query_debug & 1, "***ERROR*** Invalid DD"); return (ISNS_INVALID_QUERY_ERR); } Index: iSNSList.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSList.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNSList.c 8 Dec 2006 20:05:50 -0000 1.7 --- iSNSList.c 13 Dec 2006 19:45:57 -0000 1.8 *************** *** 39,43 **** #include "iSNSdebug.h" ! extern int isns_db_debug; /******************************************************************** --- 39,43 ---- #include "iSNSdebug.h" ! int isns_list_debug = 0; /******************************************************************** *************** *** 164,169 **** plist->node_count = 0; ! DEBUG_1 (isns_db_debug &1,InitList list_id:%i,plist->list_id); ! DEBUG_1 (isns_db_debug &1,InitList node_count:%i,plist->node_count); return ( SUCCESS ); --- 164,169 ---- plist->node_count = 0; ! DEBUG_1 (isns_list_debug &1,InitList list_id:%i,plist->list_id); ! DEBUG_1 (isns_list_debug &1,InitList node_count:%i,plist->node_count); return ( SUCCESS ); *************** *** 178,182 **** ISNS_LIST_NODE pnode; ! DEBUG_1 (isns_db_debug &1,DeleteList list_id:%i,plist->list_id); while (!IsEmptyList(plist)) --- 178,182 ---- ISNS_LIST_NODE pnode; ! DEBUG_1 (isns_list_debug &1,DeleteList list_id:%i,plist->list_id); while (!IsEmptyList(plist)) *************** *** 212,216 **** ! DEBUG_0 (isns_db_debug &1,Remove Node); foundFlag = FALSE; --- 212,216 ---- ! DEBUG_0 (isns_list_debug &1,Remove Node); foundFlag = FALSE; *************** *** 220,224 **** while ( curr_node != NULL ) { ! DEBUG_2 (isns_db_debug &1, curr_node:%i pnode:%i,curr_node->index,pnode->index); if (curr_node->index == pnode->index ) { --- 220,224 ---- while ( curr_node != NULL ) { ! DEBUG_2 (isns_list_debug &1, curr_node:%i pnode:%i,curr_node->index,pnode->index); if (curr_node->index == pnode->index ) { *************** *** 231,243 **** if ( (curr_node == NULL) && (plist->node_count > 0) ) { ! DEBUG_1 (isns_db_debug &1,Remove Node FAILURE node_count:%i,plist->node_count); plist->node_count--; return ERROR; /* we should have found a node in this case */ } ! DEBUG_1 (isns_db_debug &1, Remove Node FoundFlag: %i,foundFlag); if ( foundFlag ) { ! DEBUG_0 (isns_db_debug &1, FoundFlag); /* read current node */ --- 231,243 ---- if ( (curr_node == NULL) && (plist->node_count > 0) ) { ! DEBUG_1 (isns_list_debug &1,Remove Node FAILURE node_count:%i,plist->node_count); plist->node_count--; return ERROR; /* we should have found a node in this case */ } ! DEBUG_1 (isns_list_debug &1, Remove Node FoundFlag: %i,foundFlag); if ( foundFlag ) { ! DEBUG_0 (isns_list_debug &1, FoundFlag); /* read current node */ *************** *** 348,352 **** /*update node_count*/ ! DEBUG_1 (isns_db_debug &1, RemoveNode - node_count:%i,plist->node_count); plist->node_count--; } --- 348,352 ---- /*update node_count*/ ! DEBUG_1 (isns_list_debug &1, RemoveNode - node_count:%i,plist->node_count); plist->node_count--; } *************** *** 361,365 **** GetNodeData(ISNS_LIST_NODE *pnode ) { ! DEBUG_0 (isns_db_debug &1, GetNodeData); return ( pnode->data ); } --- 361,365 ---- GetNodeData(ISNS_LIST_NODE *pnode ) { ! DEBUG_0 (isns_list_debug &1, GetNodeData); return ( pnode->data ); } *************** *** 373,377 **** ISNS_LIST_NODE *ptr; ! DEBUG_0 (isns_db_debug &1,FindNode); ptr = NULL; --- 373,377 ---- ISNS_LIST_NODE *ptr; ! DEBUG_0 (isns_list_debug &1,FindNode); ptr = NULL; *************** *** 406,410 **** SOIP_Fc_Node *p_ifcp; ! DEBUG_1 (isns_db_debug &1, AddNode - list_id:%i,plist->list_id); memset(&key,0,sizeof(ISNS_Key)); --- 406,410 ---- SOIP_Fc_Node *p_ifcp; ! DEBUG_1 (isns_list_debug &1, AddNode - list_id:%i,plist->list_id); memset(&key,0,sizeof(ISNS_Key)); *************** *** 484,488 **** } ! DEBUG_0 (isns_db_debug &1, update last_index); plist->last_index++; --- 484,488 ---- } ! DEBUG_0 (isns_list_debug &1, update last_index); plist->last_index++; *************** *** 508,512 **** plist->node_count++; ! DEBUG_1 (isns_db_debug &1, AddNode node_count:%i,plist->node_count); return ( SUCCESS ); --- 508,512 ---- plist->node_count++; ! DEBUG_1 (isns_list_debug &1, AddNode node_count:%i,plist->node_count); return ( SUCCESS ); *************** *** 519,523 **** IsEmptyList(ISNS_LIST *plist) { ! DEBUG_1 (isns_db_debug &1,IsEmptyList node_count:%i,plist->node_count); if (plist->node_count == 0) --- 519,523 ---- IsEmptyList(ISNS_LIST *plist) { ! DEBUG_1 (isns_list_debug &1,IsEmptyList node_count:%i,plist->node_count); if (plist->node_count == 0) *************** *** 546,550 **** ISNS_LIST *p_list; ! DEBUG_2 (isns_db_debug &1,GetNextNode list_id:%i node_count:%i, plist->list_id,plist->node_count); if (!plist || plist->node_count == 0) --- 546,550 ---- ISNS_LIST *p_list; ! DEBUG_2 (isns_list_debug &1,GetNextNode list_id:%i node_count:%i, plist->list_id,plist->node_count); if (!plist || plist->node_count == 0) *************** *** 560,569 **** if ( pnode == NULL) { ! DEBUG_0 (isns_db_debug &1, AllocBuffer for first node); node = (ISNS_LIST_NODE *)ISNSAllocBuffer(sizeof(ISNS_LIST_NODE)); key.val.list.list_index = plist->first_index; if (key.val.list.list_index == 0 ) { ! DEBUG_0 (isns_db_debug &1,Error condition node count>0 but first_index is 0); plist->node_count = 0; return NULL; --- 560,569 ---- if ( pnode == NULL) { ! DEBUG_0 (isns_list_debug &1, AllocBuffer for first node); node = (ISNS_LIST_NODE *)ISNSAllocBuffer(sizeof(ISNS_LIST_NODE)); key.val.list.list_index = plist->first_index; if (key.val.list.list_index == 0 ) { ! DEBUG_0 (isns_list_debug &1,Error condition node count>0 but first_index is 0); plist->node_count = 0; return NULL; *************** *** 573,577 **** { node = pnode; ! DEBUG_1 (isns_db_debug &1, next_index:%i,node->next_index); key.val.list.list_index = node->next_index; } --- 573,577 ---- { node = pnode; ! DEBUG_1 (isns_list_debug &1, next_index:%i,node->next_index); key.val.list.list_index = node->next_index; } *************** *** 579,592 **** if (key.val.list.list_index == 0) { ! DEBUG_0 (isns_db_debug &1, No More Entries in list); return NULL; } ! DEBUG_0 (isns_db_debug &1,Now Read entry); if (plist->list_id == ENTITY_ISCSI_LIST) { p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! DEBUG_0 (isns_db_debug &1, read list entry); rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) --- 579,592 ---- if (key.val.list.list_index == 0) { ! DEBUG_0 (isns_list_debug &1, No More Entries in list); return NULL; } ! DEBUG_0 (isns_list_debug &1,Now Read entry); if (plist->list_id == ENTITY_ISCSI_LIST) { p_entity = plist->p_entry; strcpy(key.val.list.key.node_name.v,p_entity->eid.id); ! DEBUG_0 (isns_list_debug &1, read list entry); rval = ISNSdbRead(&key,&entry); if (rval != SUCCESS) *************** *** 598,602 **** node->data = (char *)ISNSAllocBuffer(node->data_size+1); memcpy(node->data,entry.data.list.key.node_name.v,node->data_size); ! DEBUG_0 (isns_db_debug &1, Successfully read list entry); } else if (plist->list_id == ENTITY_FCP_LIST) --- 598,602 ---- node->data = (char *)ISNSAllocBuffer(node->data_size+1); memcpy(node->data,entry.data.list.key.node_name.v,node->data_size); ! DEBUG_0 (isns_list_debug &1, Successfully read list entry); } else if (plist->list_id == ENTITY_FCP_LIST) *************** *** 740,744 **** node->p_entry = plist->p_entry; ! DEBUG_0 (isns_db_debug &1, return GetNextNode node); return node; } --- 740,744 ---- node->p_entry = plist->p_entry; ! DEBUG_0 (isns_list_debug &1, return GetNextNode node); return node; } Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSesi.c 6 Nov 2006 18:04:38 -0000 1.3 --- iSNSesi.c 13 Dec 2006 19:45:57 -0000 1.4 *************** *** 33,37 **** /* ! * This file contains source code for managing the SCN - state change notification. * */ --- 33,37 ---- /* ! * This file contains source code for managing the ESI - Entity State Inquiry. * */ *************** *** 53,60 **** /* Global */ ! uint32_t isns_esi_interval = 15; extern int sns_esi_interval; - extern int isns_db_debug; extern int sns_heartbeat_interval; --- 53,60 ---- /* Global */ ! int isns_esi_debug=0; + uint32_t isns_esi_interval = 15; extern int sns_esi_interval; extern int sns_heartbeat_interval; *************** *** 163,167 **** } ! DEBUG_1 (isns_db_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); --- 163,167 ---- } ! DEBUG_1 (isns_esi_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); *************** *** 308,312 **** if (i == -1) { ! DEBUG_0 (isns_db_debug & 1, (Entity ID tag not found in msg)); return ( ERROR ); } --- 308,312 ---- if (i == -1) { ! DEBUG_0 (isns_esi_debug & 1, (Entity ID tag not found in msg)); return ( ERROR ); } *************** *** 340,344 **** if ( i == -1 ) { ! DEBUG_0 (isns_db_debug & 1, (Portal IP tag not found in msg)); return ( ERROR ); } --- 340,344 ---- if ( i == -1 ) { ! DEBUG_0 (isns_esi_debug & 1, (Portal IP tag not found in msg)); return ( ERROR ); } *************** *** 350,354 **** if (i == -1) { ! DEBUG_0 (isns_db_debug & 1, (Portal PORT tag not found in msg)); return ( ERROR ); } --- 350,354 ---- if (i == -1) { ! DEBUG_0 (isns_esi_debug & 1, (Portal PORT tag not found in msg)); return ( ERROR ); } Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSparse.c 8 Dec 2006 20:20:34 -0000 1.9 --- iSNSparse.c 13 Dec 2006 19:45:57 -0000 1.10 *************** *** 102,105 **** --- 102,106 ---- case ISNS_DD_GET_NXT_ISCSI_MEMBER_REQ: case ISNS_ENTITY_GET_NXT_PORTAL_REQ: + case ISNS_DEV_ATTR_QRY_RES: parse_status = ISNSProfileKeysAttr (msg, attr_index, &num_attrs, key_index, &num_keys, (ISNS_Attr **)src_attr); *************** *** 136,140 **** case ISNS_DELIMITER: if (len != ISNS_DELIMITER_SIZE) ! rval = FALSE; DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; --- 137,141 ---- case ISNS_DELIMITER: if (len != ISNS_DELIMITER_SIZE) ! rval = FALSE; DEBUG_3 (sns_parse_debug &1,%sTag:%i (%s),src,tag,isnsTagText(tag)); break; *************** *** 283,287 **** return (ERROR); ! DEBUG_1(sns_parse_debug &1,message hdr flags:%x,msg->hdr.flags); /* Store Keys */ --- 284,288 ---- return (ERROR); ! DEBUG_2 (sns_parse_debug &1,%s flags:%x,FuncIDText(msg->hdr.type),msg->hdr.flags); /* Store Keys */ *************** *** 302,306 **** } ! if (msg->hdr.type == ISNS_ESI_RSP) { offset += 4; --- 303,308 ---- } ! if (msg->hdr.type == ISNS_ESI_RSP || msg->hdr.type == ISNS_REG_DEV_ATTR_RES || ! msg->hdr.type == ISNS_DEV_ATTR_QRY_RES) { offset += 4; Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** iSNSdereg.c 8 Dec 2006 20:20:34 -0000 1.11 --- iSNSdereg.c 13 Dec 2006 19:45:57 -0000 1.12 *************** *** 59,63 **** /* Global */ ! extern int isns_db_debug;; extern uint32_t isns_esi_interval; --- 59,63 ---- /* Global */ ! int isns_dereg_debug;; extern uint32_t isns_esi_interval; *************** *** 228,232 **** ! DEBUG_0 (isns_db_debug &1, RemoveAttrDSS_Entry); dds_key.id = id; --- 228,232 ---- ! DEBUG_0 (isns_dereg_debug &1, RemoveAttrDSS_Entry); dds_key.id = id; *************** *** 315,319 **** if ( ISNSdbDelete (&delete_key) != SUCCESS) { ! DEBUG_1 (isns_db_debug & 1, (DDS Removal failed, %u), dds_key.id); return (ISNS_UNKNOWN_ERR); } --- 315,319 ---- if ( ISNSdbDelete (&delete_key) != SUCCESS) { ! DEBUG_1 (isns_dereg_debug & 1, (DDS Removal failed, %u), dds_key.id); return (ISNS_UNKNOWN_ERR); } *************** *** 349,353 **** /* int isActiveFlag; */ ! DEBUG_0 (isns_db_debug &1, RemoveAttrDDS_Member); dds_key.id = id; --- 349,353 ---- /* int isActiveFlag; */ ! DEBUG_0 (isns_dereg_debug &1, RemoveAttrDDS_Member); dds_key.id = id; *************** *** 465,469 **** char *key_indx[SNS_MAX_ATTRS]; ! DEBUG_0 (isns_db_debug & 1, "Entering RemoveAttrDDS()\n"); ISNSParseMsg(&p_md->msg, attr_indx, key_indx, &src_attr); --- 465,469 ---- char *key_indx[SNS_MAX_ATTRS]; ! DEBUG_0 (isns_dereg_debug & 1, "Entering RemoveAttrDDS()\n"); ISNSParseMsg(&p_md->msg, attr_indx, key_indx, &src_attr); *************** *** 497,501 **** if (keyRemovedFlag != TRUE) { ! DEBUG_0 (isns_db_debug & 1, (No DDS deregistered)); return (ISNS_UNKNOWN_ERR); } --- 497,501 ---- if (keyRemovedFlag != TRUE) { ! DEBUG_0 (isns_dereg_debug & 1, (No DDS deregistered)); return (ISNS_UNKNOWN_ERR); } *************** *** 554,558 **** if (FALSE == flag) { ! DEBUG_0 (isns_db_debug & 1, (Key not found)); return (ISNS_MSG_FMT_ERR); } --- 554,558 ---- if (FALSE == flag) { ! DEBUG_0 (isns_dereg_debug & 1, (Key not found)); return (ISNS_MSG_FMT_ERR); } *************** *** 575,579 **** ISNS_Key key; ! DEBUG_1 ( isns_db_debug & 1, (Deregistering Entity %s),p_entity_id); /* --- 575,579 ---- ISNS_Key key; ! DEBUG_1 ( isns_dereg_debug & 1, (Deregistering Entity %s),p_entity_id); /* *************** *** 592,596 **** /* Remove Portals */ ! DEBUG_0 (isns_db_debug &1,Remove iportal_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->iportal_list, pnode))) --- 592,596 ---- /* Remove Portals */ ! DEBUG_0 (isns_dereg_debug &1,Remove iportal_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->iportal_list, pnode))) *************** *** 604,608 **** { /* Remove IFCP Nodes */ ! DEBUG_0 (isns_db_debug &1,Remove ifcp_node_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->ifcp_node_list, pnode))) --- 604,608 ---- { /* Remove IFCP Nodes */ ! DEBUG_0 (isns_dereg_debug &1,Remove ifcp_node_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->ifcp_node_list, pnode))) *************** *** 615,623 **** { /* Remove ISCSI Nodes */ ! DEBUG_0 (isns_db_debug &1,Remove iscsi_node_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->iscsi_node_list, pnode))) { ! DEBUG_0 (isns_db_debug &1, Call SNSRemoveISCSINodeEntry); rval = SNSRemoveISCSINodeEntry (GetNodeData(pnode), NULL, p_rspmsg); if (rval) --- 615,623 ---- { /* Remove ISCSI Nodes */ ! DEBUG_0 (isns_dereg_debug &1,Remove iscsi_node_list); pnode = NULL; while ((pnode = GetNextNode(&p_entity->iscsi_node_list, pnode))) { ! DEBUG_0 (isns_dereg_debug &1, Call SNSRemoveISCSINodeEntry); rval = SNSRemoveISCSINodeEntry (GetNodeData(pnode), NULL, p_rspmsg); if (rval) *************** *** 628,632 **** else { ! DEBUG_1 (isns_db_debug & 1, (Entity Type invalid %u), p_entity->eid_type); } --- 628,632 ---- else { ! DEBUG_1 (isns_dereg_debug & 1, (Entity Type invalid %u), p_entity->eid_type); } *************** *** 671,675 **** ISNS_Key delete_key; ! DEBUG_0 (isns_db_debug & 1, (Deregistering IFCP WWPN)); /* --- 671,675 ---- ISNS_Key delete_key; ! DEBUG_0 (isns_dereg_debug & 1, (Deregistering IFCP WWPN)); /* *************** *** 969,973 **** if (nodeKeyIndex == -1) { ! DEBUG_0 (isns_db_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } --- 969,973 ---- if (nodeKeyIndex == -1) { ! DEBUG_0 (isns_dereg_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } *************** *** 1001,1005 **** if (FCNodeKeyIndex == -1) { ! DEBUG_0 (isns_db_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } --- 1001,1005 ---- if (FCNodeKeyIndex == -1) { ! DEBUG_0 (isns_dereg_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } *************** *** 1034,1038 **** if (entityKeyIndex == -1) { ! DEBUG_0 (isns_db_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } --- 1034,1038 ---- if (entityKeyIndex == -1) { ! DEBUG_0 (isns_dereg_debug & 1, (Entity Key not found)); return (ISNS_MSG_FMT_ERR); } *************** *** 1069,1073 **** ISNS_Key remove_key; ! DEBUG_0 (isns_db_debug & 1, (Deregistering iSCSI Node)); scn_bitmap = 0; --- 1069,1073 ---- ISNS_Key remove_key; ! DEBUG_0 (isns_dereg_debug & 1, (Deregistering iSCSI Node)); scn_bitmap = 0; *************** *** 1173,1177 **** if (rval != SUCCESS) { ! DEBUG_1 (isns_db_debug & 1, (ISCSI NODE Removal failed %s), iscsi_node_key); return (ERROR); } --- 1173,1177 ---- if (rval != SUCCESS) { ! DEBUG_1 (isns_dereg_debug & 1, (ISCSI NODE Removal failed %s), iscsi_node_key); return (ERROR); } *************** *** 1196,1200 **** ISNS_Key read_key; ! DEBUG_0 (isns_db_debug & 1, (Deregistering FC Node)); memset (&db_node_name, 0, sizeof (db_node_name)); --- 1196,1200 ---- ISNS_Key read_key; ! DEBUG_0 (isns_dereg_debug & 1, (Deregistering FC Node)); memset (&db_node_name, 0, sizeof (db_node_name)); *************** *** 1255,1259 **** ISNS_Key delete_key; ! DEBUG_0 (isns_db_debug & 1, (Deregistering Portal)); ISNS_Key read_key; --- 1255,1259 ---- ISNS_Key delete_key; ! DEBUG_0 (isns_dereg_debug & 1, (Deregistering Portal)); ISNS_Key read_key; *************** *** 1501,1505 **** if ( ISNSdbDelete(&delete_key) == ERROR ) { ! DEBUG_1 ( isns_db_debug & 1, (DD Removal failed %u), dd_key.id ); return ( ERROR ); } --- 1501,1505 ---- if ( ISNSdbDelete(&delete_key) == ERROR ) { ! DEBUG_1 ( isns_dereg_debug & 1, (DD Removal failed %u), dd_key.id ); return ( ERROR ); } *************** *** 1778,1782 **** else { ! DEBUG_1(isns_db_debug & 1, (SCN node type wrong: %u), type); return (ERROR); } --- 1778,1782 ---- else { ! DEBUG_1(isns_dereg_debug & 1, (SCN node type wrong: %u), type); return (ERROR); } *************** *** 1952,1956 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid key in SCN request)); return (ISNS_MSG_FMT_ERR); } --- 1952,1956 ---- else { ! DEBUG_0 (isns_dereg_debug & 1, (No valid key in SCN request)); return (ISNS_MSG_FMT_ERR); } Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSreg.c 8 Dec 2006 20:20:34 -0000 1.10 --- iSNSreg.c 13 Dec 2006 19:45:57 -0000 1.11 *************** *** 60,64 **** /* Global */ ! extern int isns_db_debug;; extern uint32_t isns_esi_interval; --- 60,64 ---- /* Global */ ! int isns_reg_debug=0; extern uint32_t isns_esi_interval; [...1236 lines suppressed...] /* Add DD to DDS */ --- 3683,3687 ---- p_dd->activeFlag = p_dds->status; rval = ISNSdbWrite(&dd_key,lentry2); ! DEBUG_1 (isns_reg_debug &1,Create Default DD rval:%i,rval); /* Add DD to DDS */ *************** *** 3724,3728 **** p_node->activeFlag = TRUE; ! DEBUG_1 (isns_db_debug &1,Add_DD_to_ISCSI_Node rval:%i,rval); Add_DD_Member(p_dd,p_node->id.v,PAD4(strlen(p_node->id.v)),ISNS_DD_ISCSI_MEMBER,ISNS_DD_MEMBER_ENABLE,0); ISNSdbWrite(&dd_key,lentry2); --- 3724,3728 ---- p_node->activeFlag = TRUE; ! DEBUG_1 (isns_reg_debug &1,Add_DD_to_ISCSI_Node rval:%i,rval); Add_DD_Member(p_dd,p_node->id.v,PAD4(strlen(p_node->id.v)),ISNS_DD_ISCSI_MEMBER,ISNS_DD_MEMBER_ENABLE,0); ISNSdbWrite(&dd_key,lentry2); Index: iSNSscn.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSscn.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSscn.c 8 Dec 2006 20:20:34 -0000 1.4 --- iSNSscn.c 13 Dec 2006 19:45:57 -0000 1.5 *************** *** 55,62 **** /* Global */ - extern int isns_db_debug; static int scn_xid = 1; - - extern int isns_scn_debug; extern int isns_scn_msg_filter; extern int isns_rsync_debug; --- 55,59 ---- *************** *** 198,202 **** if ( SUCCESS != ISNSSendMsg (p_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN)); p_node->scn_bitmap = 0; --- 195,199 ---- if ( SUCCESS != ISNSSendMsg (p_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN)); p_node->scn_bitmap = 0; *************** *** 260,264 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid Portal to send SCN)); return (ERROR); } --- 257,261 ---- else { ! DEBUG_0 (sns_scn_debug & 1, (No valid Portal to send SCN)); return (ERROR); } *************** *** 417,421 **** if ( SUCCESS != ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN, removing SCN)); /* Remove Node from SCN List */ --- 414,418 ---- if ( SUCCESS != ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN, removing SCN)); /* Remove Node from SCN List */ *************** *** 489,493 **** if ( SUCCESS != ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN, removing SCN)); /* Remove Node from SCN List */ --- 486,490 ---- if ( SUCCESS != ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN, removing SCN)); /* Remove Node from SCN List */ *************** *** 627,631 **** if ( SUCCESS!=ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN)); p_iscsi_node->scn_bitmap=0; --- 624,628 ---- if ( SUCCESS!=ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN)); p_iscsi_node->scn_bitmap=0; *************** *** 688,692 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid Portal to send SCN)); } --- 685,689 ---- else { ! DEBUG_0 (sns_scn_debug & 1, (No valid Portal to send SCN)); } *************** *** 736,740 **** if (0 == dd_key.id) { ! DEBUG_0(isns_db_debug & 1, (DD ID of zero is reserved)); return(ISNS_INVALID_REG_ERR); } --- 733,737 ---- if (0 == dd_key.id) { ! DEBUG_0(sns_scn_debug & 1, (DD ID of zero is reserved)); return(ISNS_INVALID_REG_ERR); } *************** *** 911,915 **** if (0 == dd_key.id) { ! DEBUG_0(isns_db_debug & 1, (DD ID of zero is reserved)); return(ISNS_INVALID_REG_ERR); } --- 908,912 ---- if (0 == dd_key.id) { ! DEBUG_0(sns_scn_debug & 1, (DD ID of zero is reserved)); return(ISNS_INVALID_REG_ERR); } *************** *** 1003,1007 **** if ( SUCCESS!=ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(isns_db_debug & 1, (Warning: Failure sending SCN)); p_iscsi_node->scn_bitmap=0; --- 1000,1004 ---- if ( SUCCESS!=ISNSSendMsg (p_scn_md) ) { ! DEBUG_0(sns_scn_debug & 1, (Warning: Failure sending SCN)); p_iscsi_node->scn_bitmap=0; *************** *** 1064,1068 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid Portal to send SCN)); } --- 1061,1065 ---- else { ! DEBUG_0 (sns_scn_debug & 1, (No valid Portal to send SCN)); } *************** *** 1219,1223 **** else { ! DEBUG_0 (isns_db_debug & 1, (No valid Portal to send SCN)); } --- 1216,1220 ---- else { ! DEBUG_0 (sns_scn_debug & 1, (No valid Portal to send SCN)); } *************** *** 1246,1250 **** if (key == NULL) { ! DEBUG_0 (isns_db_debug & 1, (SCN Rejected:No Key)); return (ISNS_SCN_EVENT_REJECTED_ERR); } --- 1243,1247 ---- if (key == NULL) { ! DEBUG_0 (sns_scn_debug & 1, (SCN Rejected:No Key)); return (ISNS_SCN_EVENT_REJECTED_ERR); } *************** *** 1253,1257 **** if (p_attr == NULL) { ! DEBUG_0 (isns_db_debug & 1, (SCN Rejected:No Op Attr)); return (ISNS_SCN_EVENT_REJECTED_ERR); } --- 1250,1254 ---- if (p_attr == NULL) { ! DEBUG_0 (sns_scn_debug & 1, (SCN Rejected:No Op Attr)); return (ISNS_SCN_EVENT_REJECTED_ERR); } *************** *** 1262,1266 **** if ( p_attr->tag != ISNS_ISCSI_SCN_BITMAP ) { ! DEBUG_1 (isns_db_debug & 1, (SCN Rejected:Wrong Op Attr %u), p_attr->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); --- 1259,1263 ---- if ( p_attr->tag != ISNS_ISCSI_SCN_BITMAP ) { ! DEBUG_1 (sns_scn_debug & 1, (SCN Rejected:Wrong Op Attr %u), p_attr->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); *************** *** 1275,1279 **** if (p_attr->tag != ISNS_IFCP_SCN_BITMAP) { ! DEBUG_1 (isns_db_debug & 1, (SCN Rejected:Wrong Op Attr %u), p_attr->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); --- 1272,1276 ---- if (p_attr->tag != ISNS_IFCP_SCN_BITMAP) { ! DEBUG_1 (sns_scn_debug & 1, (SCN Rejected:Wrong Op Attr %u), p_attr->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); *************** *** 1286,1290 **** default: ! DEBUG_1 (isns_db_debug & 1, (SCN Rejected:Invalid Key %u), key->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); --- 1283,1287 ---- default: ! DEBUG_1 (sns_scn_debug & 1, (SCN Rejected:Invalid Key %u), key->tag); return ( ISNS_SCN_EVENT_REJECTED_ERR ); Index: iSNStrcv.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNStrcv.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNStrcv.c 1 Dec 2006 21:49:29 -0000 1.4 --- iSNStrcv.c 13 Dec 2006 19:45:57 -0000 1.5 *************** *** 31,34 **** --- 31,36 ---- ***********************************************************************/ + #include <signal.h> + #include <sys/poll.h> #include "iSNS.h" *************** *** 139,143 **** cb_p->sock=sockfd; #ifdef SNS_LINUX ! pthread_create (&ignore, NULL, (void*) TCP_RecvThread, (LPVOID)cb_p); #else CreateThread(0, 0, TCP_RecvThread, (LPVOID)cb_p, 0, &ignore); --- 141,145 ---- cb_p->sock=sockfd; #ifdef SNS_LINUX ! pthread_create (&ignore, NULL, (void*) TCP_RecvThread, (LPVOID)cb_p); #else CreateThread(0, 0, TCP_RecvThread, (LPVOID)cb_p, 0, &ignore); *************** *** 149,152 **** --- 151,156 ---- } + #define SOCKET_TIMEOUT_VALUE 120*1000 + /******************************************/ #ifdef SNS_LINUX *************** *** 165,168 **** --- 169,174 ---- int msg_size; int i; + struct pollfd ufds; + int rc; SNS_Msg_Hdr *p_msg; *************** *** 171,174 **** --- 177,183 ---- DEBUG_0(sns_tcp_debug & 1, (TCP_RecvThread: Starting)); sockfd=cb_p->sock; + + DEBUG_1(sns_tcp_debug & 1, (connection starting sockfd:%i), sockfd); + free(cb_p); startIndex=0; *************** *** 176,183 **** --- 185,205 ---- while (1) { + ufds.fd = sockfd; + ufds.events = POLLIN; + ufds.revents = 0; + rc = poll(&ufds, 1, SOCKET_TIMEOUT_VALUE); + if (rc == 0) + { + /* close connection if no activity */ + DEBUG_1(sns_tcp_debug &1, (connection timed out and closed:%i),sockfd); + close(sockfd); + break; + } + i = recv(sockfd, &buffer[endIndex], sizeof(buffer)-endIndex, 0); if (i<=0) { DEBUG_0(sns_tcp_debug & 1, (recv error or connection closed)); + close(sockfd); break; } |
From: Robert W. <wrw...@us...> - 2006-12-12 22:14:34
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18248/src Modified Files: comm.c Log Message: Check for connection close Index: comm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/comm.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** comm.c 1 Dec 2006 15:35:17 -0000 1.4 --- comm.c 12 Dec 2006 22:14:31 -0000 1.5 *************** *** 729,732 **** --- 729,738 ---- exit(-1); } + else if (e == 0) + { + printf("\nConnection closed by isns server\n"); + exit(-1); + } + endIndex += e; pending = endIndex - startIndex; |
From: Robert W. <wrw...@us...> - 2006-12-12 21:39:03
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3984/src Modified Files: iSNSquery.c iSNSresponse.c Log Message: Add ISCSI_TYPE to query Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iSNSquery.c 8 Dec 2006 20:20:34 -0000 1.6 --- iSNSquery.c 12 Dec 2006 21:38:29 -0000 1.7 *************** *** 1581,1585 **** int portalPortKeyIndex; SOIP_Entity *p_entity; ! ISNS_Key *key; SOIP_Iscsi *p_node; SOIP_ISCSI_Node_Id db_node_name; --- 1581,1585 ---- int portalPortKeyIndex; SOIP_Entity *p_entity; ! ISNS_Key *key=NULL; SOIP_Iscsi *p_node; SOIP_ISCSI_Node_Id db_node_name; *************** *** 1860,1864 **** if (rval == SUCCESS) { ! /* ISNSDisplay_ISCSINode (p_node, HI_DETAIL); */ ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); foundFlag = TRUE; --- 1860,1872 ---- if (rval == SUCCESS) { ! /* if the first found entry then add the key attr */ ! if (!foundFlag) ! { ! if (nodeTypeKeyIndex != -1) ! { ! ISNSAppendKey(p_rspmsg, ISNS_ISCSI_TYPE, key->len, (char *)&key->val, 0); ! ISNSAppendKey(p_rspmsg, ISNS_DELIMITER, 0, NULL, 0); ! } ! } ISNSdbProcessISCSIOpAttr (p_rspmsg, (ISNS_Attr **)attr_indx, p_node); foundFlag = TRUE; Index: iSNSresponse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSresponse.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSresponse.c 6 Nov 2006 18:04:38 -0000 1.3 --- iSNSresponse.c 12 Dec 2006 21:38:29 -0000 1.4 *************** *** 95,100 **** return (ERROR); if (msg->hdr.msg_len == 0) ! msg->hdr.msg_len = 4 + ISNS_SIZEOF_TAG; /* Jump to the end */ --- 95,104 ---- return (ERROR); + /* add room for error code */ if (msg->hdr.msg_len == 0) ! { ! msg->hdr.msg_len = 4; ! msg->hdr.msg_len += ISNS_SIZEOF_TAG; // add delimiter ! } /* Jump to the end */ |
From: Robert W. <wrw...@us...> - 2006-12-11 18:50:15
|
Update of /cvsroot/linuxisns/iscsiClient In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17609 Modified Files: target.cfg Log Message: add dynamic dd and dds support Index: target.cfg =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/target.cfg,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** target.cfg 11 Dec 2006 18:02:18 -0000 1.3 --- target.cfg 11 Dec 2006 18:50:04 -0000 1.4 *************** *** 11,13 **** --- 11,18 ---- * rectype 5 = Entity Period 5 120 + * rectype 6 = Entity ID 6 sample.target.com + * rectype 7 = Discovery Domain Name + 7 testDD + * rectype 8 = Discovery Domain Set + 8 testDDS |
From: Robert W. <wrw...@us...> - 2006-12-11 18:50:13
|
Update of /cvsroot/linuxisns/iscsiClient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17609/src Modified Files: config.c initiator.c target.c Log Message: add dynamic dd and dds support Index: config.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/config.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** config.c 11 Dec 2006 18:12:27 -0000 1.1 --- config.c 11 Dec 2006 18:50:04 -0000 1.2 *************** *** 145,148 **** --- 145,158 ---- break; + case '7': + fscanf (ifp, "%s", line); + strcpy (thisInit->DDAlias, line); + break; + + case '8': + fscanf (ifp, "%s", line); + strcpy (thisInit->DDSAlias, line); + break; + default: break; Index: initiator.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/initiator.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** initiator.c 11 Dec 2006 18:12:27 -0000 1.6 --- initiator.c 11 Dec 2006 18:50:04 -0000 1.7 *************** *** 287,294 **** char *ptr; char ipstring[100]; - FILE* OutputFile; - OutputFile = fopen ("Targets.txt", "w"); - pdu = (struct isns_hdr *)buffer; ptr = buffer + sizeof (ISNS_HDR) + 4 /* Error Code Length */; --- 287,291 ---- *************** *** 303,334 **** { case ISNS_ISCSI_NODE_ID: - fprintf (OutputFile, "iSCSI Target: %s", &p_attr->val); printf ("iSCSI Target: %s", &p_attr->val); break; case ISNS_ISCSI_ALIAS: - fprintf (OutputFile, ", \"%s\"",&p_attr->val); printf (", \"%s\"",&p_attr->val); break; case ISNS_PORTAL_IP: ipaddrchar(&p_attr->val, ipstring); - fprintf (OutputFile, ", %s",ipstring); printf (", %s",ipstring); break; case ISNS_PORTAL_PORT: ! p_attr->val.etype = ntohl (p_attr->val.etype); ! fprintf (OutputFile, ", %d\n", p_attr->val.etype & 0xFFFF); ! printf (", %d\n", p_attr->val.etype & 0xFFFF); break; ! case ISNS_ENTITY_ID: ! printf ("Entity ID : %s\n", &p_attr->val); ! strcpy (current->EntityID, (char*) (&(p_attr->val))); ! break; default: ! break; } ptr = (char *) ptr + p_attr->len + 8/* Size of tag and length fields*/; } - - fclose (OutputFile); } --- 300,330 ---- { case ISNS_ISCSI_NODE_ID: printf ("iSCSI Target: %s", &p_attr->val); break; + case ISNS_ISCSI_ALIAS: printf (", \"%s\"",&p_attr->val); break; + case ISNS_PORTAL_IP: ipaddrchar(&p_attr->val, ipstring); printf (", %s",ipstring); break; + case ISNS_PORTAL_PORT: ! p_attr->val.etype = ntohl (p_attr->val.etype); ! printf (", %d\n", p_attr->val.etype & 0xFFFF); break; ! ! case ISNS_ENTITY_ID: ! printf ("Entity ID : %s\n", &p_attr->val); ! strcpy (current->EntityID, (char*) (&(p_attr->val))); ! break; ! default: ! break; } ptr = (char *) ptr + p_attr->len + 8/* Size of tag and length fields*/; } } Index: target.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/target.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** target.c 11 Dec 2006 18:01:08 -0000 1.5 --- target.c 11 Dec 2006 18:50:04 -0000 1.6 *************** *** 189,193 **** /* Add the Entity ID */ - printf("EntityID is %s\n",input->EntityID); ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4(strlen(input->EntityID)),input->EntityID,0); --- 189,192 ---- *************** *** 230,234 **** ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* We are adding a portal to our target's entity */ ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (current->EntityID)), current->EntityID, 0); --- 229,233 ---- ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* We are adding a portal to our target's entity */ ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (current->EntityID)), current->EntityID, 0); *************** *** 279,284 **** ISNSAppendAttr (&cmd, ISNS_DD_ID, 0, NULL, 0); ! /* The DD Symbolic Name is the Target ID */ ! ISNSAppendAttr (&cmd, ISNS_DD_SYM_NAME, PAD4 (strlen ((char*)current->iscsiID)), (char*)current->iscsiID, 0); if(0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) --- 278,283 ---- ISNSAppendAttr (&cmd, ISNS_DD_ID, 0, NULL, 0); ! /* The DD Symbolic Name */ ! ISNSAppendAttr (&cmd, ISNS_DD_SYM_NAME, PAD4 (strlen ((char*)current->DDAlias)), (char*)current->DDAlias, 0); if(0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) *************** *** 297,322 **** char sym[256]={0}; uint32_t status=0; ! int* pmember = &(current->DDSmember); ! printf ("Registering a DDS\n"); ! ISNSCreateHdr (ISNS_REG_DDS_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); ! /* The source type is iSCSI node and the name is the name of the target */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); ! /* Delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* We do not request a particular DDS ID */ ! ISNSAppendAttr (&cmd, ISNS_DDS_ID, 0, NULL, 0); ! /* The DDS Symbolic Name is the Target ID */ ! ISNSAppendAttr (&cmd, ISNS_DDS_SYM_NAME, PAD4 (strlen ((char*)current->iscsiID)), (char*)current->iscsiID, 0); ! /* Turn the status to ON by default */ status = 1; ! ISNSAppendAttr (&cmd, ISNS_DDS_STATUS, 4, NULL, status); if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) --- 296,321 ---- char sym[256]={0}; uint32_t status=0; ! int* pmember = &(current->DDSmember); ! printf ("Registering a DDS\n"); ! ISNSCreateHdr (ISNS_REG_DDS_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); ! /* The source type is iSCSI node and the name is the name of the target */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); ! /* Delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* We do not request a particular DDS ID */ ! ISNSAppendAttr (&cmd, ISNS_DDS_ID, 0, NULL, 0); ! /* The DDS Symbolic Name */ ! ISNSAppendAttr (&cmd, ISNS_DDS_SYM_NAME, PAD4 (strlen ((char*)current->DDSAlias)), (char*)current->DDSAlias, 0); ! /* Turn the status to ON by default */ status = 1; ! ISNSAppendAttr (&cmd, ISNS_DDS_STATUS, 4, NULL, status); if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) *************** *** 332,349 **** listelement* temp; char buffer[2048]; ! printf ("Adding DD to DDS\n"); ! ISNSCreateHdr (ISNS_REG_DDS_REQ, &cmd, sizeof (cmd),0); ! /* Delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* The target's DDS ID is sent */ ! ISNSAppendAttr (&cmd, ISNS_DDS_ID, 4, NULL, current->DDSmember); ! /* Delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* The target's DD is sent */ ! ISNSAppendAttr (&cmd, ISNS_DD_ID, 4, NULL, current->DDmember); ISNSSendCmd2 (&cmd, buffer, sizeof (buffer)); --- 331,349 ---- listelement* temp; char buffer[2048]; ! printf ("Adding DD to DDS\n"); ! ISNSCreateHdr (ISNS_REG_DDS_REQ, &cmd, sizeof (cmd),0); ! ! /* Delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* The target's DDS ID is sent */ ! ISNSAppendAttr (&cmd, ISNS_DDS_ID, 4, NULL, current->DDSmember); ! /* Delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* The target's DD is sent */ ! ISNSAppendAttr (&cmd, ISNS_DD_ID, 4, NULL, current->DDmember); ISNSSendCmd2 (&cmd, buffer, sizeof (buffer)); *************** *** 358,363 **** printf ("Adding ISCSI to DD.\n"); ! /* Adding an iSCSI node to a DD is actually a DD Register Request without replacing the DD */ ! ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); --- 358,363 ---- printf ("Adding ISCSI to DD.\n"); ! /* Adding an iSCSI node to a DD is actually a DD Register Request without replacing the DD */ ! ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); *************** *** 369,373 **** printf ("DD ID> %d\n", current->DDmember); ! /* Insert as a key */ ISNSAppendAttr (&cmd, ISNS_DD_ID, 4, NULL, current->DDmember); --- 369,373 ---- printf ("DD ID> %d\n", current->DDmember); ! /* Insert as a key */ ISNSAppendAttr (&cmd, ISNS_DD_ID, 4, NULL, current->DDmember); *************** *** 375,382 **** ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* Add the target ID */ ! ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); ! /* Send the command, do not parse the reply */ ISNSSendCmd2 (&cmd, buffer, sizeof (buffer)); } --- 375,382 ---- ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* Add the target ID */ ! ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); ! /* Send the command, do not parse the reply */ ISNSSendCmd2 (&cmd, buffer, sizeof (buffer)); } *************** *** 392,396 **** printf ("Adding ISCSI to DD.\n"); /*ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), ISNS_FLAG_UPDATE_REG);*/ ! ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); --- 392,396 ---- printf ("Adding ISCSI to DD.\n"); /*ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), ISNS_FLAG_UPDATE_REG);*/ ! ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), 0); ISNSAppendAttr (&cmd, 0, 0, NULL, 0); *************** *** 402,406 **** printf ("DD ID> %d \n", current->DDmember); ! /* Insert as a key */ ISNSAppendAttr (&cmd, ISNS_DD_ID, 4, NULL, current->DDmember); --- 402,406 ---- printf ("DD ID> %d \n", current->DDmember); ! /* Insert as a key */ ISNSAppendAttr (&cmd, ISNS_DD_ID, 4, NULL, current->DDmember); *************** *** 408,412 **** ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* Add the initiator ID */ ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER, PAD4 (strlen (current->listPtr->InitiatorName)), current->listPtr->InitiatorName, 0); --- 408,412 ---- ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* Add the initiator ID */ ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER, PAD4 (strlen (current->listPtr->InitiatorName)), current->listPtr->InitiatorName, 0); *************** *** 423,427 **** char *ptr; ! printf ("Parsing the query\n"); pdu = (struct isns_hdr *)buffer; --- 423,427 ---- char *ptr; ! printf ("Parsing the query\n"); pdu = (struct isns_hdr *)buffer; *************** *** 437,482 **** case ISNS_DD_ID: p_attr->val.etype = htonl (p_attr->val.etype); ! /* Assign the DD ID */ ! current->DDmember = p_attr->val.etype; ! /* Just to show what was returned */ printf ("DD ID : %d\n", p_attr->val.etype); break; ! case ISNS_DD_SYM_NAME: ! memset (current->DDAlias, (int) NULL, 256); ! /* Just to show what was returned */ ! printf ("DD Alias = %s\n", &p_attr->val); ! /* Assign the DD Symbolic name */ ! /* This assignment could just as well have used the Target ID from the config file ! But I wanted to check what the server was returning */ ! strcpy (current->DDAlias, (char*) (&p_attr->val)); ! break; case ISNS_DD_ISCSI_MEMBER: ! /* Just to show what was returned */ ! printf ("DD iSCSI MEMBER : %s\n", &p_attr->val); ! /* Note this does not make any assignments */ break; case ISNS_DDS_ID: p_attr->val.etype = htonl (p_attr->val.etype); ! /* Assign the DDS ID */ ! current->DDSmember = p_attr->val.etype; ! /* Just to show what was returned */ ! printf ("DDS ID : %d\n", p_attr->val.etype); ! break; ! case ISNS_DDS_SYM_NAME: ! memset (current->DDSAlias, (int) NULL, 256); ! printf ("DDS Alias : %s\n", &p_attr->val); ! /* Assign the DDS Symbolic name */ ! /* This assignment could just as well have used the Target ID from the config file ! But I wanted to check what the server was returning */ ! strcpy (current->DDSAlias, (char*) (&p_attr->val)); ! break; ! case ISNS_ENTITY_ID: ! /* There should be no reason to do this but being thorough is good */ ! memset (current->EntityID, (int) NULL, 256); ! /* Just to show what was returned */ ! printf ("Entity ID : %s\n", &p_attr->val); ! /* Assign the entity ID to what is returned from the server */ ! strcpy (current->EntityID, (char*) (&(p_attr->val))); ! break; default: break; --- 437,487 ---- case ISNS_DD_ID: p_attr->val.etype = htonl (p_attr->val.etype); ! /* Assign the DD ID */ ! current->DDmember = p_attr->val.etype; ! /* Just to show what was returned */ printf ("DD ID : %d\n", p_attr->val.etype); break; ! ! case ISNS_DD_SYM_NAME: ! memset (current->DDAlias, (int) NULL, 256); ! /* Just to show what was returned */ ! printf ("DD Alias = %s\n", &p_attr->val); ! /* Assign the DD Symbolic name */ ! /* This assignment could just as well have used the Target ID from the config file ! But I wanted to check what the server was returning */ ! strcpy (current->DDAlias, (char*) (&p_attr->val)); ! break; ! case ISNS_DD_ISCSI_MEMBER: ! /* Just to show what was returned */ ! printf ("DD iSCSI MEMBER : %s\n", &p_attr->val); ! /* Note this does not make any assignments */ break; + case ISNS_DDS_ID: p_attr->val.etype = htonl (p_attr->val.etype); ! /* Assign the DDS ID */ ! current->DDSmember = p_attr->val.etype; ! /* Just to show what was returned */ ! printf ("DDS ID : %d\n", p_attr->val.etype); ! break; ! ! case ISNS_DDS_SYM_NAME: ! memset (current->DDSAlias, (int) NULL, 256); ! printf ("DDS Alias : %s\n", &p_attr->val); ! /* Assign the DDS Symbolic name */ ! /* This assignment could just as well have used the Target ID from the config file ! But I wanted to check what the server was returning */ ! strcpy (current->DDSAlias, (char*) (&p_attr->val)); ! break; ! ! case ISNS_ENTITY_ID: ! memset (current->EntityID, (int) NULL, 256); ! /* Just to show what was returned */ ! printf ("Entity ID : %s\n", &p_attr->val); ! /* Assign the entity ID to what is returned from the server */ ! strcpy (current->EntityID, (char*) (&(p_attr->val))); ! break; ! default: break; |
From: Robert W. <wrw...@us...> - 2006-12-11 18:18:49
|
Update of /cvsroot/linuxisns/iscsiClient In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5078 Added Files: README Removed Files: README.IBM Log Message: update README files --- README.IBM DELETED --- --- NEW FILE: README --- This tar file contains all the source files and the executables for a version of iSNS client for Linux. The executables have been developed and tested on SuSE SLES 10 To make the sample iscsi target and initiator clients type "make". To run the target executable you will need a file named target.cfg. The sample that we have been using is included in this tar file. Modify the values there to ones that are appropriate for your own use. To run the initiator executable you will need a file named init.cfg. Again, our sample is included. Modify it to values appropriate to your own use. In both config files the IP address of the server can be removed. This will result in the program waiting for a heartbeat from an iSNS server. |
From: Robert W. <wrw...@us...> - 2006-12-11 18:12:30
|
Update of /cvsroot/linuxisns/iscsiClient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2579/src Modified Files: initiator.c Added Files: config.c Log Message: added filename option --- NEW FILE: config.c --- /*********************************************************************** * Copyright (c) Novell, Inc 2006 * * This file derived from code originally in initiator.c * * Copyright (c) IBM Corporation 2001 * Licensed Material - Program Property of IBM * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM Corporation or Novell Inc, nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ #include <stdlib.h> #include <pthread.h> #include <errno.h> #include "isns.h" #include "config.h" #define CLIENT_VERSION "1.1" #define MAX_VERSION 6 #define MIN_VERSION 0 #define HANDLE pthread_t* /*************************************** Globals **************************************/ char p_ip[256]; /******************************** ********************************/ extern int isns_port; extern int tcpFlag; extern ISNS_CMD cmd; /************************************************************************* *************************************************************************/ int config_init (char * filename, configuration * current, char ip[]) { FILE* configFile; current->hb_flag = TRUE; current->Port = 0; current->portalFlag = FALSE; current->EntityPeriod = 0; memset (current->iscsiID, (int) NULL, 256); memset (current->Alias, (int) NULL, 256); memset (current->PortalIP, (int) NULL, 256); memset (current->EntityID, (int) NULL, 256); memset (current->DDAlias, (int) NULL, 256); memset (current->DDSAlias, (int) NULL, 256); memset (current->Initiator, (int) NULL, 256); /* Open the file for reading */ configFile = fopen (filename, "r"); /* Read in the target information */ ReadFile (configFile, current, ip); fclose (configFile); return current->hb_flag; } /*********************************************************************** Accepts a pointer to an open file and a target object /***********************************************************************/ void ReadFile (FILE* ifp, configuration * thisInit, char ip_addr[]) { char temp, word[256], line[256]; int ii = 0; while (fscanf(ifp, "%c" , &temp) != EOF) { switch (temp) { /* This line is a comment */ case '*': fgets (line, 80, ifp); break; /* This line has the IP address of the iSNS Server */ case '1': fscanf (ifp, "%s", line); strcpy (ip_addr, line); thisInit->hb_flag = FALSE; break; /* This line has the iscsi ID and the iscsi Alias */ case '2': fscanf (ifp, "%s", line); strcpy (thisInit->iscsiID, line); fscanf (ifp, "%s", line); strcpy (thisInit->Alias, line); break; /* This line has the portal IP address and the port number */ case '3': fscanf (ifp, "%s", line); strcpy (thisInit->PortalIP, line); fscanf (ifp, "%d", &(thisInit->Port)); thisInit->portalFlag = TRUE; break; case '4': fscanf (ifp, "%s", line); /* formating only - gets rid of a newline */ for (ii = 0; ii < 256; ii++) if (line[ii] == '\n') line[ii] = '\0'; thisInit->listPtr = AddItem (thisInit->listPtr, line); break; case '5': fscanf (ifp, "%d", &(thisInit->EntityPeriod)); break; case '6': fscanf (ifp, "%s", line); strcpy (thisInit->EntityID, line); break; default: break; } } } listelement * AddItem (listelement * listpointer, char data[]) { listelement * lp = listpointer; if (listpointer != NULL) { while (listpointer->link != NULL) listpointer = (listelement*) listpointer->link; listpointer->link = (struct listelement *) malloc (sizeof (listelement)); listpointer = (listelement*) listpointer->link; listpointer->link = NULL; strncpy (listpointer->InitiatorName, data, 256); return lp; } else { listpointer = (listelement *) malloc (sizeof (listelement)); listpointer->link = NULL; strncpy (listpointer->InitiatorName, data, 256); return listpointer; } } void ClearQueue (listelement * listpointer) { while (listpointer != NULL) { listpointer = RemoveItem (listpointer); } } listelement * RemoveItem (listelement * listpointer) { listelement * tempp; printf ("Added %s to the initiator list.\n", listpointer->InitiatorName); tempp = (listelement*) listpointer->link; free (listpointer); return tempp; } void PrintList (listelement* TheList) { /* for keeping track of the head of the list */ listelement* temp; temp = TheList; while (TheList != NULL) { printf ("DD: %d\n", TheList->DDS); TheList = (listelement*)TheList->link; } /* TheList still points to the head of the list */ TheList = temp; } Index: initiator.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/initiator.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** initiator.c 11 Dec 2006 18:01:08 -0000 1.5 --- initiator.c 11 Dec 2006 18:12:27 -0000 1.6 *************** *** 50,53 **** --- 50,54 ---- **************************************/ char p_ip[256]; + char filename[256]="init.cfg"; /******************************** *************** *** 80,87 **** while (optind != argc) { ! c = getopt (argc, argv, "h:s:"); switch (c) { case EOF: optarg = argv[optind]; --- 81,94 ---- while (optind != argc) { ! c = getopt (argc, argv, "h:s:f:"); switch (c) { + case 'f': + printf ("optarg: %s\n", optarg); + strcpy (filename, optarg); + printf ("filename: %s\n", filename); + break; + case EOF: optarg = argv[optind]; *************** *** 94,98 **** } ! hb_flag = config_init ("init.cfg",&config, p_ip); /* Init the Communications sockets */ --- 101,105 ---- } ! hb_flag = config_init (filename,&config, p_ip); /* Init the Communications sockets */ |
From: Robert W. <wrw...@us...> - 2006-12-11 18:04:26
|
Update of /cvsroot/linuxisns/iscsiClient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31648 Removed Files: InitiatorList.c Log Message: create a common config file --- InitiatorList.c DELETED --- |
From: Robert W. <wrw...@us...> - 2006-12-11 18:02:23
|
Update of /cvsroot/linuxisns/iscsiClient In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30784 Added Files: target.cfg Log Message: create a common config file --- NEW FILE: target.cfg --- * rectype 1 = iSNS Server IP address 1 9.37.224.199 * rectype 2 = Target ID and Alias 2 Target1 E1Target1 * rectype 4 = Access List (initiator ID) * rectype 3 = portal IP addr and port # 3 9.37.255.255 8001 4 E1-I1 4 E1-I2 4 E1-I3 * rectype 5 = Entity Period 5 120 6 sample.target.com |
From: Robert W. <wrw...@us...> - 2006-12-11 18:01:41
|
Update of /cvsroot/linuxisns/iscsiClient In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30127 Modified Files: Makefile init.cfg Removed Files: target.cfg Log Message: create a common config file --- target.cfg DELETED --- Index: Makefile =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 11 Dec 2006 00:42:28 -0000 1.4 --- Makefile 11 Dec 2006 18:01:05 -0000 1.5 *************** *** 36,39 **** --- 36,40 ---- INITIATOR_SRCS += $(SRCDIR)comm.c INITIATOR_SRCS += $(SRCDIR)isns.c + INITIATOR_SRCS += $(SRCDIR)config.c INITIATOR_SRCS += $(SRCDIR)initiator.c *************** *** 42,45 **** --- 43,47 ---- TARGET_SRCS += $(SRCDIR)comm.c TARGET_SRCS += $(SRCDIR)isns.c + TARGET_SRCS += $(SRCDIR)config.c TARGET_SRCS += $(SRCDIR)target.c Index: init.cfg =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/init.cfg,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** init.cfg 11 Dec 2006 15:17:37 -0000 1.2 --- init.cfg 11 Dec 2006 18:01:05 -0000 1.3 *************** *** 1,4 **** * rectype 1 = iSNS Server IP addr ! 1 137.65.67.203 * rectype 2 = Initiator ID and Alias 2 E1-I1 Initiator1 --- 1,4 ---- * rectype 1 = iSNS Server IP addr ! 1 9.37.224.199 * rectype 2 = Initiator ID and Alias 2 E1-I1 Initiator1 *************** *** 8,9 **** --- 8,11 ---- * rectype 5 = Entity Period 5 16000 + * rectype 6 = Entity ID + 6 sample.initiator.com |
From: Robert W. <wrw...@us...> - 2006-12-11 18:01:27
|
Update of /cvsroot/linuxisns/iscsiClient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30127/src Modified Files: comm.c initiator.c isns.c target.c util.c Log Message: create a common config file Index: isns.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/isns.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** isns.c 11 Dec 2006 00:24:22 -0000 1.2 --- isns.c 11 Dec 2006 18:01:08 -0000 1.3 *************** *** 32,42 **** /***********************************************************************/ - /* Contribuing authors: - *Tom McSweeney <rf4...@us...>, - *Curt du Laney <du...@us...> - *IBM Research Triangle Park - * - /***********************************************************************/ - #include "isns.h" [...1288 lines suppressed...] - currentLen2=ntohl(p_attr->len); } } - else - { - currentTag=0; - } } - void - SaveDb(void) - { - ISNSCreateHdr (ISNS_SAVE_DB_REQ, &cmd, sizeof (cmd), 0); - ISNSAppendAttr (&cmd, ISNS_COMPANY_OUI, ISNS_COMPANY_OUI_SIZE, NULL, NISHAN_OUI); - ISNSSendCmd(&cmd); - } - - - --- 334,342 ---- Index: util.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/util.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** util.c 11 Dec 2006 00:42:28 -0000 1.2 --- util.c 11 Dec 2006 18:01:09 -0000 1.3 *************** *** 68,78 **** #include "util.h" #include "parse.h" - #ifdef TARGET - #include "parse.c" - #endif - - #ifdef INITIATOR - #include "parse.c" - #endif #ifndef HEX_DUMP_BYTES_PER_LINE --- 68,71 ---- *************** *** 80,87 **** #endif ! int hexDumpFlag=TRUE; int parserFlag=TRUE; - /*************************************************** _DumpHex: Prints out the contents of a ptr in hex. --- 73,79 ---- #endif ! int hexDumpFlag=FALSE; int parserFlag=TRUE; /*************************************************** _DumpHex: Prints out the contents of a ptr in hex. *************** *** 144,157 **** /***********************************************************************/ - /* Pauses until a key is pressed. */ - /***********************************************************************/ - void - WaitForKey (void) - { - printf ("Press ENTER to continue.\n"); - getchar (); - } - - /***********************************************************************/ /* Converts hex to ascii */ /***********************************************************************/ --- 136,139 ---- *************** *** 183,316 **** } - /***********************************************************************/ - /* Converts the time to hex-ascii */ - /***********************************************************************/ - void - GetHexTime (char *buffer) - { - char cstr[256]; - char two[3]; - time_t t; - - memset (cstr, 0, sizeof (cstr)); - time (&t); - strcpy (cstr, ctime (&t) + 11); - printf ("Time: %s", ctime (&t) + 11); - - memset (two, 0, sizeof (two)); - memcpy (two, cstr, 2); - sscanf (two, "%x", &buffer[0]); - - memset (two, 0, sizeof (two)); - memcpy (two, cstr + 3, 2); - sscanf (two, "%x", &buffer[1]); - - memset (two, 0, sizeof (two)); - memcpy (two, cstr + 6, 2); - sscanf (two, "%x", &buffer[2]); - - memset (two, 0, sizeof (two)); - memcpy (two, cstr + 9, 2); - sscanf (two, "%x", &buffer[3]); - - memset (two, 0, sizeof (two)); - memcpy (two, cstr + 12, 2); - sscanf (two, "%x", &buffer[4]); - } - - /***********************************************************************/ - /* Prompts for input. The input should be in ascii-hex. Stores it in - hex. */ - /***********************************************************************/ - int - GetHexInput (char *cmdLine, char *prompt, char *cDefault, int c_size) - { - char buffer[256]; - char buffer2[8]; - char two[3]; - char *ptr; - int count; - char *sptr; - - memset (buffer, 0, sizeof (buffer)); - memset (buffer2, 0, sizeof (buffer)); - memset (cmdLine, 0, c_size); - printf ("%s [%s] >", prompt, - cDefault != NULL ? HexToAscii (cDefault, 8, buffer2) : "(none)"); - fgets (buffer, sizeof(buffer), stdin); - sptr = strtok(buffer, TOKENS); - - ptr = sptr; - count = 0; - while (*ptr) - { - memset (two, 0, sizeof (two)); - memcpy (two, ptr, 2); - sscanf (two, "%x", &cmdLine[count]); - count++; - ptr = (char *) ptr + 2; - } - - return count; - } - - /***********************************************************************/ - /* Prompts for an ascii-input */ - /***********************************************************************/ - int - GetInput (char *cmdLine, char *prompt, char *cDefault, int c_size) - { - int rval; - char *sptr; - - memset (cmdLine, 0, c_size); - printf ("%s [%s] >", prompt, cDefault != NULL ? cDefault : "(none)"); - fgets (cmdLine, c_size, stdin); - sptr = strtok(cmdLine, TOKENS); - rval = sptr?strlen (sptr):0; - - return (rval); - } - - /***********************************************************************/ - /* Prompts for yes/no. Returns TRUE if yes. */ - /***********************************************************************/ - int - GetYesNo (char *cmdLine, char *prompt, int dvalue, int c_size) - { - int rval; - char *sptr; - - memset (cmdLine, 0, c_size); - printf ("%s [%s] >", prompt, dvalue == TRUE ? "*y/n" : "*n/y"); - fgets (cmdLine, c_size, stdin); - sptr = strtok(cmdLine, TOKENS); - - if (sptr == NULL || strlen (sptr) == 0) - rval = dvalue; - else if ((0 == strcmp (cmdLine, "Yes")) || - (0 == strcmp (cmdLine, "y")) || - (0 == strcmp (cmdLine, "yes")) || (0 == strcmp (cmdLine, "YES"))) - rval = TRUE; - else - rval = FALSE; - - return (rval); - } - - /***********************************************************************/ - /* Prints the commnd and returns input. */ - /***********************************************************************/ - int - GetCommand (void) - { - char buffer[256]={0}; - int item; - GetInput(buffer, "Please select an option", "0 for Help", sizeof(buffer)); - - item = atoi (buffer); - return (item); - } - - - --- 165,166 ---- Index: initiator.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/initiator.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** initiator.c 11 Dec 2006 04:27:37 -0000 1.4 --- initiator.c 11 Dec 2006 18:01:08 -0000 1.5 *************** *** 38,42 **** #include "isns.h" ! #include "initiator.h" #define CLIENT_VERSION "1.1" --- 38,42 ---- #include "isns.h" ! #include "config.h" #define CLIENT_VERSION "1.1" *************** *** 54,68 **** ********************************/ extern int isns_port; - extern struct sockaddr_in their_addr; - extern struct sockaddr_in my_addr; extern int tcpFlag; - extern SOCKET fd; extern ISNS_CMD cmd; - int - TCPReceiveMain (DWORD lparam); - /******************************** ********************************/ /***********************************************************************/ --- 54,63 ---- ********************************/ extern int isns_port; extern int tcpFlag; extern ISNS_CMD cmd; /******************************** ********************************/ + void ParseQuery (char *buffer, configuration *current); /***********************************************************************/ *************** *** 73,77 **** int c; int tcpFlag; ! initiator junk; memset (p_ip, 0, sizeof (p_ip)); --- 68,72 ---- int c; int tcpFlag; ! configuration config; memset (p_ip, 0, sizeof (p_ip)); *************** *** 99,103 **** } ! hb_flag = InitInitiator (&junk, p_ip); /* Init the Communications sockets */ --- 94,98 ---- } ! hb_flag = config_init ("init.cfg",&config, p_ip); /* Init the Communications sockets */ *************** *** 105,191 **** exit(-1); ! RegInitiator (&junk); return (0); } - /************************************************************************* *************************************************************************/ ! int InitInitiator (initiator* current, char ip[]) ! { ! FILE* InitiatorFile; ! ! current->hb_flag = TRUE; ! memset (current->InitID, (int) NULL, 256); ! memset (current->Alias, (int) NULL, 256); ! memset (current->PortalIP, (int) NULL, 256); ! current->Port = 0; ! current->portalFlag = FALSE; ! current->EntityPeriod = 0; ! memset (current->EntityID, (int) NULL, 256); ! ! /* Open the file for reading */ ! InitiatorFile = fopen ("init.cfg", "r"); ! ! /* Read in the target information */ ! ReadFile (InitiatorFile, current, ip); ! ! fclose (InitiatorFile); ! ! return current->hb_flag; ! } ! ! ! /*********************************************************************** ! Accepts a pointer to an open file and a target object - see initiator.h ! /***********************************************************************/ ! void ReadFile (FILE* ifp, initiator* thisInit, char ip_addr[]) ! { ! char temp, word[256], line[256]; ! int ii = 0; ! ! while (fscanf(ifp, "%c" , &temp) != EOF) ! { ! switch (temp) ! { ! /* This line is a comment */ ! case '*': ! fgets (line, 80, ifp); ! break; ! /* This line has the IP address of the iSNS Server */ ! case '1': ! fscanf (ifp, "%s", line); ! strcpy (ip_addr, line); ! thisInit->hb_flag = FALSE; ! break; ! /* This line has the Initiator ID and the Initiator Alias */ ! case '2': ! fscanf (ifp, "%s", line); ! strcpy (thisInit->InitID, line); ! fscanf (ifp, "%s", line); ! strcpy (thisInit->Alias, line); ! break; ! /* This line has the portal IP address and the port number */ ! case '3': ! fscanf (ifp, "%s", line); ! strcpy (thisInit->PortalIP, line); ! fscanf (ifp, "%d", &(thisInit->Port)); ! thisInit->portalFlag = TRUE; ! break; ! case '5': ! fscanf (ifp, "%d", &(thisInit->EntityPeriod)); ! break; ! ! default: ! break; ! } ! } ! } ! ! ! /************************************************************************* ! *************************************************************************/ ! void RegInitiator (initiator* current) { /* Register the initiator */ --- 100,111 ---- exit(-1); ! RegInitiator (&config); return (0); } /************************************************************************* *************************************************************************/ ! void RegInitiator (configuration *current) { /* Register the initiator */ *************** *** 207,216 **** This will register the iSCSI Initiator Node. **********************************************************************/ ! void InitiatorRegISCSI (initiator* input) { ! char buffer[2048]; ! /* type 2 means initiator */ int type = 2; ! SOIP_Ver ver; printf ("Registering ISCSI Node.\n"); --- 127,136 ---- This will register the iSCSI Initiator Node. **********************************************************************/ ! void InitiatorRegISCSI (configuration* input) { ! char buffer[2048]; ! /* type 2 means initiator */ int type = 2; ! SOIP_Ver ver; printf ("Registering ISCSI Node.\n"); *************** *** 234,255 **** ISNSAppendAttr ((struct cmd *)&cmd, ISNS_PROT_VER, 4, (char *)&ver, 0); } ! /* Add the Entity Period */ ISNSAppendAttr (&cmd, ISNS_ENTITY_PERIOD, 4, NULL, input->EntityPeriod); ! printf ("ID [%s] > %s\n", input->InitID, input->InitID); ! /* Add the Target ID to the PDU */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (input->InitID)), ! input->InitID, 0); /* Get Alias */ printf ("Alias [%s] > %s\n", input->Alias, input->Alias); ! /* Add the alias to the PDU */ ISNSAppendAttr (&cmd, ISNS_ISCSI_ALIAS, PAD4 (strlen (input->Alias)), input->Alias, 0); ! /* Add the type (iSCSI Node) to the PDU */ ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 4, NULL, type); --- 154,178 ---- ISNSAppendAttr ((struct cmd *)&cmd, ISNS_PROT_VER, 4, (char *)&ver, 0); } ! /* Add the Entity Period */ ISNSAppendAttr (&cmd, ISNS_ENTITY_PERIOD, 4, NULL, input->EntityPeriod); + /* Add the Entity */ + ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen(input->EntityID)), + input->EntityID, 0); ! printf ("ID [%s] > %s\n", input->iscsiID, input->iscsiID); ! /* Add the Target ID to the PDU */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (input->iscsiID)), ! input->iscsiID, 0); /* Get Alias */ printf ("Alias [%s] > %s\n", input->Alias, input->Alias); ! /* Add the alias to the PDU */ ISNSAppendAttr (&cmd, ISNS_ISCSI_ALIAS, PAD4 (strlen (input->Alias)), input->Alias, 0); ! /* Add the type (iSCSI Node) to the PDU */ ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 4, NULL, type); *************** *** 260,269 **** } - - /***********************************************************************/ /* Registers a portal */ /***********************************************************************/ ! void InitiatorRegPortal (initiator* current) { int ip; --- 183,190 ---- } /***********************************************************************/ /* Registers a portal */ /***********************************************************************/ ! void InitiatorRegPortal (configuration *current) { int ip; *************** *** 310,314 **** This will query for iSCSI Node(s) that the initiator can access. ***************************************************************/ ! void GetTargets (initiator* current) { char buffer[2048]; --- 231,235 ---- This will query for iSCSI Node(s) that the initiator can access. ***************************************************************/ ! void GetTargets (configuration *current) { char buffer[2048]; *************** *** 323,330 **** ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->InitID)), current->InitID, 0); ! /* Get only Targets or Mixed Targets/Initiators */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 4, NULL, (uint32_t) 1); /* Delimiter */ --- 244,251 ---- ISNSCreateHdr (ISNS_DEV_ATTR_QRY_REQ, &cmd, sizeof (cmd), 0); ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); ! /* Get only Targets or Mixed Targets/Initiators */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 4, NULL, (uint32_t) 1); /* Delimiter */ *************** *** 353,365 **** query msg. ***********************************************/ ! void ParseQuery (char *buffer, initiator* current) { ISNS_Attr *p_attr; ISNS_HDR *pdu; char *ptr; ! char ipstring[100]; ! FILE* OutputFile; ! ! OutputFile = fopen ("Targets.txt", "w"); pdu = (struct isns_hdr *)buffer; --- 274,286 ---- query msg. ***********************************************/ ! void ParseQuery (char *buffer, configuration *current) { ISNS_Attr *p_attr; ISNS_HDR *pdu; char *ptr; ! char ipstring[100]; ! FILE* OutputFile; ! ! OutputFile = fopen ("Targets.txt", "w"); pdu = (struct isns_hdr *)buffer; Index: target.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/target.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** target.c 11 Dec 2006 04:27:37 -0000 1.4 --- target.c 11 Dec 2006 18:01:08 -0000 1.5 *************** *** 33,37 **** /***********************************************************************/ - /*********************************************************************** This file goes through the process of initializing a target --- 33,36 ---- *************** *** 48,53 **** #include "isns.h" ! #include "target.h" ! /*************************************** --- 47,51 ---- #include "isns.h" ! #include "config.h" /*************************************** *************** *** 60,71 **** ********************************/ extern int isns_port; - extern struct sockaddr_in their_addr; - extern struct sockaddr_in my_addr; extern int tcpFlag; - extern SOCKET fd; extern ISNS_CMD cmd; ! int ! TCPReceiveMain (DWORD lparam); /****************************************************************/ --- 58,65 ---- ********************************/ extern int isns_port; extern int tcpFlag; extern ISNS_CMD cmd; ! void ParseQuery (char *buffer, configuration * current); /****************************************************************/ *************** *** 77,81 **** int c; int tcpFlag; ! target junk; memset (p_ip, 0, sizeof (p_ip)); --- 71,75 ---- int c; int tcpFlag; ! configuration config; memset (p_ip, 0, sizeof (p_ip)); *************** *** 94,101 **** { case 'f': ! printf ("optarg: %s\n", optarg); strcpy (filename, optarg); ! printf ("filename: %s\n", filename); ! filename[MAX_FILENAME_SIZE - 1] = '\0'; break; --- 88,95 ---- { case 'f': ! printf ("optarg: %s\n", optarg); strcpy (filename, optarg); ! printf ("filename: %s\n", filename); ! filename[MAX_FILENAME_SIZE - 1] = '\0'; break; *************** *** 110,114 **** } ! hb_flag = Read_cfg (&junk, (char*)&p_ip); /* Init the Communications sockets */ --- 104,108 ---- } ! hb_flag = config_init (filename, &config, (char*)&p_ip); /* Init the Communications sockets */ *************** *** 118,224 **** printf ("Using iSNS IP: %s.\n", p_ip); ! RegTarget (&junk); return (0); } - - /***********************************************************************/ - /* Opens the config file, reads in the values, returns whether we are - Waiting for a heartbeat or not */ - /***********************************************************************/ - int Read_cfg (target* Target, char* ip) - { - FILE* targetFile; - - /* Set the target values to appropriate defaults */ - Target->listPtr = NULL; - Target->DDmember = 0; - Target->DDSmember = 0; - Target->Port = 0; - Target->hb_flag = TRUE; - Target->EntityPeriod = 0; - memset (Target->DDAlias, (int) NULL, 256); - memset (Target->DDSAlias, (int) NULL, 256); - memset (Target->EntityID, (int) NULL, 256); - memset (Target->PortalIP, (int) NULL, 256); - memset (Target->TargetID, (int) NULL, 256); - memset (Target->Alias, (int) NULL, 256); - memset (Target->Initiator, (int) NULL, 256); - - /* Open the file for reading */ - targetFile = fopen (filename, "r"); - - /* Read in the target information*/ - ReadFile (targetFile, Target, ip); - - fclose (targetFile); - - /* Return whether we are waiting for a heartbeat or not */ - return Target->hb_flag; - } - - /*********************************************************************** - Accepts a pointer to an open file and a target object - see target.h - /***********************************************************************/ - void ReadFile (FILE* ifp, target* thisTarget, char* ip_addr) - { - char temp, word[256], line[256]; - int ii = 0; - - while (fscanf(ifp, "%c" , &temp) != EOF) - { - switch (temp) - { - /* This line is a comment */ - case '*': - fgets (line, 80, ifp); - break; - /* This line has the IP address of the iSNS Server - it is optional*/ - case '1': - /* Read in one line */ - fgetline (ifp, line, 256); - /* copy that line into our target's IP address */ - strcpy (ip_addr, line); - /* a iSNS server IP address is specified so we do not wait for a heatbeat */ - thisTarget->hb_flag = FALSE; - break; - /* This line has the Target ID and Alias - it is mandatory */ - case '2': - fscanf (ifp, "%s", line); - strcpy (thisTarget->TargetID, line); - fscanf (ifp, "%s", line); - strcpy (thisTarget->Alias, line); - break; - /* This line has the target's portal IP address and the port number */ - case '3': - fscanf (ifp, "%s", line); - strcpy (thisTarget->PortalIP, line); - fscanf (ifp, "%d", &(thisTarget->Port)); - break; - /* This line has the name of one initiator - you can have 0 to N of these*/ - case '4': - fgetline (ifp, line, 256); - /* formating only - gets rid of a newline */ - for (ii = 0; ii < 256; ii++) - if (line[ii] == '\n') - line[ii] = '\0'; - thisTarget->listPtr = AddItem (thisTarget->listPtr, line); - break; - /* This line is an optional line. It has the Entity Period */ - case '5': - fscanf (ifp, "%d", &(thisTarget->EntityPeriod)); - break; - - default: break; - } - } - } - - - /***********************************************************************/ /***********************************************************************/ ! void RegTarget (target* holding) { /* Temporary to keep track of head of list */ --- 112,123 ---- printf ("Using iSNS IP: %s.\n", p_ip); ! RegTarget (&config); return (0); } /***********************************************************************/ /***********************************************************************/ ! void RegTarget (configuration *holding) { /* Temporary to keep track of head of list */ *************** *** 229,233 **** /* Register the portal */ ! TargetRegPortal (holding); /* Update an old or register a new DD */ --- 128,132 ---- /* Register the portal */ ! TargetRegPortal (holding); /* Update an old or register a new DD */ *************** *** 262,270 **** This will register the iSCSI Target Node. Intended for the 200i **********************************************************************/ ! void TargetRegISCSI (target* input) { ! char buffer[2048]; int type = 1; ! SOIP_Ver ver; printf ("Registering ISCSI Node.\n"); --- 161,169 ---- This will register the iSCSI Target Node. Intended for the 200i **********************************************************************/ ! void TargetRegISCSI (configuration *input) { ! char buffer[2048]; int type = 1; ! SOIP_Ver ver; printf ("Registering ISCSI Node.\n"); *************** *** 276,285 **** ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! memset (&ver, 0, sizeof (ver)); ! /* MAX_VERSION and MIN_VERSION are global constants set above */ ! ver.max = MAX_VERSION; ! ver.min = MIN_VERSION; ! ! if (ver.max || ver.min) { ver.max = htons (ver.max); --- 175,184 ---- ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! memset (&ver, 0, sizeof (ver)); ! /* MAX_VERSION and MIN_VERSION are global constants set above */ ! ver.max = MAX_VERSION; ! ver.min = MIN_VERSION; ! ! if (ver.max || ver.min) { ver.max = htons (ver.max); *************** *** 288,314 **** ISNSAppendAttr ((struct cmd *)&cmd, ISNS_PROT_VER, 4, (char *)&ver, 0); } - /* Add the Entity Period */ - /* Even though we don't specify an entity we can append an entity period */ - ISNSAppendAttr (&cmd, ISNS_ENTITY_PERIOD, 4, NULL, input->EntityPeriod); ! printf ("ID [%s] > %s\n", input->TargetID, input->TargetID); ! /* Add the Target ID to the PDU */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (input->TargetID)), ! input->TargetID, 0); /* Get Alias */ printf ("Alias [%s] > %s\n", input->Alias, input->Alias); ! /* Add the alias to the PDU */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_ALIAS, PAD4 (strlen (input->Alias)), ! input->Alias, 0); ! /* Add the type (iSCSI Node) to the PDU */ ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 4, NULL, type); ! /* Send the command, parse the response. We will get the entity ID back from this */ ! if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) ParseQuery (buffer, input); --- 187,213 ---- ISNSAppendAttr ((struct cmd *)&cmd, ISNS_PROT_VER, 4, (char *)&ver, 0); } + /* Add the Entity ID */ + printf("EntityID is %s\n",input->EntityID); + ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4(strlen(input->EntityID)),input->EntityID,0); + + /* Add the Entity Period */ + ISNSAppendAttr (&cmd, ISNS_ENTITY_PERIOD, 4, NULL, input->EntityPeriod); ! printf ("ID [%s] > %s\n", input->iscsiID, input->iscsiID); ! /* Add the Target ID to the PDU */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen(input->iscsiID)),input->iscsiID,0); /* Get Alias */ printf ("Alias [%s] > %s\n", input->Alias, input->Alias); ! /* Add the alias to the PDU */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_ALIAS, PAD4 (strlen (input->Alias)), input->Alias, 0); ! /* Add the type (iSCSI Node) to the PDU */ ISNSAppendAttr (&cmd, ISNS_ISCSI_TYPE, 4, NULL, type); ! /* Send the command, parse the response. We will get the entity ID back from this */ if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) ParseQuery (buffer, input); *************** *** 319,326 **** /* Registers a portal */ /***********************************************************************/ ! void TargetRegPortal (target* current) { int ip; int port_type; /* Insert Header */ --- 218,226 ---- /* Registers a portal */ /***********************************************************************/ ! void TargetRegPortal (configuration *current) { int ip; int port_type; + char buffer[2048]; /* Insert Header */ *************** *** 353,359 **** current->Port | (port_type == 1 ? 0 : 0x10000)); ! /* Send the command, don't parse the reply */ ! ISNSSendCmd (&cmd); ! } --- 253,259 ---- current->Port | (port_type == 1 ? 0 : 0x10000)); ! /* Send the command, don't parse the reply */ ! if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) ! ParseQuery (buffer, current); } *************** *** 362,383 **** /* Registers a DD */ /*********************************************************************/ ! int TargetRegDD (target* current) { char buffer[2048]; ! int* pmember = &(current->DDmember); printf ("Registering DD.\n"); ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); ! /* The source type is iSCSI node and the name is the name of the target */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->TargetID)), current->TargetID, 0); ! ! /* Delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! /* We do not request a particular DD ID */ ! ISNSAppendAttr (&cmd, ISNS_DD_ID, 0, NULL, 0); /* The DD Symbolic Name is the Target ID */ ! ISNSAppendAttr (&cmd, ISNS_DD_SYM_NAME, PAD4 (strlen ((char*)current->TargetID)), (char*)current->TargetID, 0); if(0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) --- 262,284 ---- /* Registers a DD */ /*********************************************************************/ ! int TargetRegDD (configuration *current) { char buffer[2048]; ! int* pmember = &(current->DDmember); printf ("Registering DD.\n"); ISNSCreateHdr (ISNS_REG_DD_REQ, &cmd, sizeof (cmd), ISNS_FLAG_REPLACE_REG); + /* The source type is iSCSI node and the name is the name of the target */ + ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); ! /* Delimiter */ ISNSAppendAttr (&cmd, 0, 0, NULL, 0); ! ! /* We do not request a particular DD ID */ ! ISNSAppendAttr (&cmd, ISNS_DD_ID, 0, NULL, 0); ! /* The DD Symbolic Name is the Target ID */ ! ISNSAppendAttr (&cmd, ISNS_DD_SYM_NAME, PAD4 (strlen ((char*)current->iscsiID)), (char*)current->iscsiID, 0); if(0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) *************** *** 391,395 **** /* Registers DDS */ /*********************************************************************/ ! int TargetRegDDS (target* current) { char buffer[2048]={0}; --- 292,296 ---- /* Registers DDS */ /*********************************************************************/ ! int TargetRegDDS (configuration *current) { char buffer[2048]={0}; *************** *** 403,408 **** /* The source type is iSCSI node and the name is the name of the target */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->TargetID)), ! current->TargetID, 0); /* Delimiter */ --- 304,309 ---- /* The source type is iSCSI node and the name is the name of the target */ ! ISNSAppendAttr (&cmd, ISNS_ISCSI_NODE_ID, PAD4 (strlen (current->iscsiID)), ! current->iscsiID, 0); /* Delimiter */ *************** *** 413,417 **** /* The DDS Symbolic Name is the Target ID */ ! ISNSAppendAttr (&cmd, ISNS_DDS_SYM_NAME, PAD4 (strlen ((char*)current->TargetID)), (char*)current->TargetID, 0); /* Turn the status to ON by default */ --- 314,318 ---- /* The DDS Symbolic Name is the Target ID */ ! ISNSAppendAttr (&cmd, ISNS_DDS_SYM_NAME, PAD4 (strlen ((char*)current->iscsiID)), (char*)current->iscsiID, 0); /* Turn the status to ON by default */ *************** *** 427,431 **** /* Adds a DD to a DDS */ /*********************************************************************/ ! void TargetAdd_DD_to_DDS (target* current) { listelement* temp; --- 328,332 ---- /* Adds a DD to a DDS */ /*********************************************************************/ ! void TargetAdd_DD_to_DDS (configuration *current) { listelement* temp; *************** *** 452,456 **** This will add the iSCSI target node to the DD. *****************************************************/ ! void TargetAdd_ISCSI_to_DD (target* current) { char buffer[2048]; --- 353,357 ---- This will add the iSCSI target node to the DD. *****************************************************/ ! void TargetAdd_ISCSI_to_DD (configuration *current) { char buffer[2048]; *************** *** 475,479 **** /* Add the target ID */ ! ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER, PAD4 (strlen (current->TargetID)), current->TargetID, 0); /* Send the command, do not parse the reply */ --- 376,380 ---- /* Add the target ID */ ! ISNSAppendAttr (&cmd, ISNS_DD_ISCSI_MEMBER, PAD4 (strlen (current->iscsiID)), current->iscsiID, 0); /* Send the command, do not parse the reply */ *************** *** 486,490 **** This will add the iSCSI initiator node(s) to a DD. *****************************************************/ ! void TargetAdd_ISCSI_to_DD2 (target* current) { char buffer[2048]; --- 387,391 ---- This will add the iSCSI initiator node(s) to a DD. *****************************************************/ ! void TargetAdd_ISCSI_to_DD2 (configuration *current) { char buffer[2048]; *************** *** 516,520 **** /* Parses a Query Response */ /*********************************************************************/ ! void ParseQuery (char *buffer, target* current) { ISNS_Attr *p_attr; --- 417,421 ---- /* Parses a Query Response */ /*********************************************************************/ ! void ParseQuery (char *buffer, configuration *current) { ISNS_Attr *p_attr; *************** *** 585,603 **** } - - /*****************************************************************/ - /*****************************************************************/ - int fgetline(FILE *fp, char s[], int lim) - { - int c, i; - - for (i = 0; i < lim-1 && (c = fgetc(fp)) != EOF && c != '\n'; i++) - s[i-1] = c; - - while (i < lim - 1) - s[i++ - 1] = '\0'; - - - return i; - } - --- 486,487 ---- Index: comm.c =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/src/comm.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** comm.c 11 Dec 2006 00:42:28 -0000 1.2 --- comm.c 11 Dec 2006 18:01:08 -0000 1.3 *************** *** 31,59 **** / /***********************************************************************/ - - /* Contribuing authors: - *Tom McSweeney <rf4...@us...>, - *Curt du Laney <du...@us...> - *IBM Research Triangle Park - * - /***********************************************************************/ #include <stdlib.h> ! #include <stdio.h> ! #include "isns.h" - - #ifndef SNS_LINUX - #include <io.h> - #include <winsock2.h> - #include <Ws2tcpip.h> - #else - #define Sleep(a) sleep(a) - #endif - - #include <time.h> - #include "util.h" #include "comm.h" - #include "parse.h" MSG_CB msg_q[MSG_Q_SIZE]; /* TCP msg Q */ --- 31,39 ---- / /***********************************************************************/ #include <stdlib.h> ! #include <time.h> #include "isns.h" #include "comm.h" MSG_CB msg_q[MSG_Q_SIZE]; /* TCP msg Q */ *************** *** 62,69 **** int msgCurrentHead = 0; - #ifndef SNS_LINUX - WSADATA g_WsaData; - #endif - SOCKET fd; --- 42,45 ---- *************** *** 89,99 **** { tcpFlag=t_flag; - #ifndef SNS_LINUX - /* Start up the winsock proprietary Stuff */ - if (WSAStartup (MAKEWORD (0x02, 0x00), &g_WsaData) == SOCKET_ERROR) - { - exit(-1); - } - #endif if (hb_flag) --- 65,68 ---- *************** *** 133,145 **** /* Spawn TCP Recv Thread*/ { - #ifdef SNS_LINUX pthread_t junk; if (0 != pthread_create (&junk, NULL, (void*) (TCPReceiveMain) , NULL)) printf ("\n\nThread Creation Failed!\n\n"); - #else - DWORD junk; - CreateThread ((LPSECURITY_ATTRIBUTES)0, 0, (LPTHREAD_START_ROUTINE) TCPReceiveMain, NULL, 0, &junk); - Sleep (10); - #endif } --- 102,108 ---- *************** *** 240,244 **** { /* Loops until we receive a msg */ ! Sleep (1); } --- 203,207 ---- { /* Loops until we receive a msg */ ! sleep (1); } *************** *** 299,358 **** /***********************************************************************/ - /* This will send a PDU and wait for a rsp. The rsp will be ignored. */ - /***********************************************************************/ - extern void ParsePDU (char* buffer); - int - ISNSSendCmd (ISNS_CMD * cmd) - { - int e; - char buffer[1500]; - int len = cmd->hdr.len + sizeof (ISNS_HDR); - int errorCode; - - cmd->hdr.len = htons (cmd->hdr.len); - e = SendPDU (cmd, len); - if (e < 0) - { - printf ("Error Sending.\n"); - return (e); - } - printf("PDU sent-->\n"); - DumpHex (cmd, len); - len = sizeof (their_addr); - e = RcvPDU ((struct cmd *)buffer, sizeof (buffer)); - if (e < 0) - { - printf ("Error Receiving.\n"); - } - printf("PDU rcv-->\n"); - DumpHex (buffer, e); - - { - char *ptr = (char *) buffer + sizeof (ISNS_HDR); - errorCode = ntohl (*(uint32_t *) ptr); - } - if (errorCode != 0) - { - printf ("***WARNING: iSNS returned an error, error=%#x, \"%s\"\n", errorCode, errorText(errorCode)); - } - else - { - ISNS_HDR *p_cmd; - - p_cmd = (struct isns_hdr *)buffer; - - /* Convert fields */ - p_cmd->flags = ntohs (p_cmd->flags); - p_cmd->func_id = ntohs (p_cmd->func_id); - p_cmd->len = ntohs (p_cmd->len); - p_cmd->seq = ntohs (p_cmd->seq); - p_cmd->version = ntohs (p_cmd->version); - p_cmd->xid = ntohs (p_cmd->xid); - } - - return (errorCode); - } - - /***********************************************************************/ /* This will send a PDU and wait for a rsp. The rsp will be returned. */ /***********************************************************************/ --- 262,265 ---- *************** *** 527,535 **** if (iRet < 0) { printf ("setsockopt() IP_ADD_MEMBERSHIP failed, Err: %d\n", - #ifdef SNS_LINUX 0); - #else - WSAGetLastError()); - #endif } --- 434,438 ---- *************** *** 580,588 **** /* Thread used for listening and responding to UDP ESI/SCN messages. */ /***********************************************************************/ - #ifdef SNS_LINUX int - #else - DWORD WINAPI - #endif ESIListener (DWORD lparam) { --- 483,487 ---- *************** *** 686,722 **** } } - /***********************************************************************/ - /* Sends an ESI response message. */ - /***********************************************************************/ - void - SendESIRsp (void) - { - char cmdLine[256]; - ISNS_CMD cmd; - - memset (cmdLine, 0, sizeof (cmdLine)); - - printf ("Sending ESI Response.\n"); - ISNSCreateHdr (ISNS_REG_DEV_ATTR_REQ, &cmd, sizeof (cmd), 0); - /* Get an entity ID */ - if (0 == GetInput(cmdLine, "Entity ID", NULL, sizeof(cmdLine))) - { - printf ("***ERROR: Cmd Line required.\n"); - exit (-1); - } - - ISNSAppendAttr (&cmd, ISNS_ENTITY_ID, PAD4 (strlen (cmdLine)), cmdLine, 0); - - ISNSJustSendCmd (&cmd); - } /***********************************************************************/ /* Thread used to receive ALL TCP messages */ /***********************************************************************/ - #ifdef SNS_LINUX int - #else - DWORD WINAPI - #endif TCPReceiveMain (DWORD lparam) { --- 585,593 ---- *************** *** 777,780 **** --- 648,652 ---- } } + /***********************************************************************/ /* Used to retrieve messages from the TCP message Q. */ |
From: Robert W. <wrw...@us...> - 2006-12-11 18:01:14
|
Update of /cvsroot/linuxisns/iscsiClient/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30127/include Modified Files: isns.h parse.h util.h Added Files: config.h Removed Files: initiator.h target.h Log Message: create a common config file --- NEW FILE: config.h --- /* Authors: Tom McSweeney <rf4...@us...>, Curt du Laney <du...@us...> IBM Research Triangle Park * * Copyright (c) IBM Corporation 2001 * Licensed Material - Program Property of IBM * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of IBM Corporation nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /***********************************************************************/ #ifndef __configuration_H #define __configuration_H typedef struct { char InitiatorName[256]; int DDS; struct listelement *link; } listelement; typedef struct { int hb_flag; char iscsiID[256]; char Alias[256]; char PortalIP[256]; int Port; char EntityID[256]; int portalFlag; int EntityPeriod; int DDmember; char DDAlias[256]; int DDSmember; char DDSAlias[256]; char Initiator[256]; listelement* listPtr; } configuration; void RegInitiator (configuration *); void InitiatorRegPortal (configuration *); void InitiatorRegISCSI (configuration *); void GetTargets (configuration *); void RegTarget (configuration *); void TargetRegISCSI (configuration *); int TargetRegDD (configuration *); int TargetRegDDS (configuration *); void TargetRegPortal (configuration *); void TargetAdd_DD_to_DDS (configuration *); void TargetAdd_ISCSI_to_DD (configuration *); void TargetAdd_ISCSI_to_DD2 (configuration *); void ReadFile (FILE*, configuration *, char*); int config_init (char * filename, configuration *, char[]); listelement * AddItem (listelement * listpointer, char[]); listelement * RemoveItem (listelement * listpointer); listelement * RemoveDDSItem (listelement * listpointer); void ClearDDSQueue (listelement * listpointer); void ClearQueue (listelement * listpointer); #endif --- initiator.h DELETED --- --- target.h DELETED --- Index: util.h =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/include/util.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** util.h 2 Apr 2002 02:57:40 -0000 1.1.1.1 --- util.h 11 Dec 2006 18:01:08 -0000 1.2 *************** *** 31,42 **** / /***********************************************************************/ - - /* Contribuing authors: - *Tom McSweeney <rf4...@us...>, - *Curt du Laney <du...@us...> - *IBM Research Triangle Park - * - /***********************************************************************/ - #ifndef __UTIL_H #define __UTIL_H --- 31,34 ---- *************** *** 45,67 **** DumpHex (void *data, int size); - void WaitForKey(void); - char * HexToAscii(char *srcbuffer, int size, char *dstbuffer); - void - GetHexTime(char *buffer); - - int - GetHexInput(char *cmdLine, char *prompt, char *cDefault, int c_size); - - int - GetInput(char *cmdLine, char *prompt, char *cDefault, int c_size); - - int - GetYesNo(char *cmdLine, char *prompt, int dvalue, int c_size); - - int GetCommand(void); - #endif --- 37,43 ---- Index: isns.h =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/include/isns.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** isns.h 11 Dec 2006 04:27:37 -0000 1.2 --- isns.h 11 Dec 2006 18:01:07 -0000 1.3 *************** *** 42,46 **** #define _isns_h - #ifdef SNS_LINUX #include <stdio.h> #include <sched.h> --- 42,45 ---- *************** *** 64,78 **** #define itoa(a,b,c) (((c)==10)?sprintf(b,"%d",a):sprintf(b,"%x",a)) - #else - // #include <windows.h> - #include <io.h> - #include <winsock2.h> - #include <Ws2tcpip.h> - #include <stdio.h> - - #define uint16_t unsigned short - #define uint32_t unsigned long - #endif - #include "iSNSdefs.h" #include <time.h> --- 63,66 ---- *************** *** 187,195 **** - #ifdef SNS_LINUX int - #else - DWORD WINAPI - #endif ESIListener(DWORD lparam); --- 175,179 ---- *************** *** 218,249 **** void ISNSAppendAttr(ISNS_CMD *cmd, ISNS_TAG tag, int len, char *ptr, int val); - int GetSrc(ISNS_CMD *p_cmd, int flags); - - void ParseDDSQuery(char *buffer); - - void GetDDS(void); - - void ParseDDQuery(char *buffer); - - void GetDD(void); - - void RegDDS(void); - - void UpdateDDS(void); - - void DeRegDDS(void); - - void Remove_DD_from_DDS(void); - - void RegDD(void); - - void UpdateDD(void); - - void DeRegDD(void); - - void Remove_Member_from_DD(void); - - void Add_DD_to_DDS(void); - void DisableESI(void); --- 202,205 ---- *************** *** 258,265 **** void Process_SCN(ISNS_CMD *p_msg, int size); - int RegSCN(void); - - void DeRegSCN(void); - void InitESITable(void); --- 214,217 ---- *************** *** 270,275 **** void GetNext(void); - void SaveDb(void); - #endif --- 222,225 ---- Index: parse.h =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/include/parse.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** parse.h 2 Apr 2002 02:57:40 -0000 1.1.1.1 --- parse.h 11 Dec 2006 18:01:07 -0000 1.2 *************** *** 31,43 **** / /***********************************************************************/ - - /* Contribuing authors: - *Tom McSweeney <rf4...@us...>, - *Curt du Laney <du...@us...> - *IBM Research Triangle Park - * - /***********************************************************************/ - - #ifndef __PARSE_H #define __PARSE_H --- 31,34 ---- *************** *** 51,57 **** char * errorText(int errorCode); - void - ParsePDU (char *buffer); - #endif --- 42,45 ---- |
From: Robert W. <wrw...@us...> - 2006-12-11 15:17:44
|
Update of /cvsroot/linuxisns/iscsiClient In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29430 Modified Files: init.cfg Removed Files: README.txt Release 1.1.txt iSNSC.dsp iSNSC.dsw iSNSC.mak Log Message: Remove duplicate files already contained in isnsNT/isnsclient --- iSNSC.dsp DELETED --- --- iSNSC.dsw DELETED --- --- Release 1.1.txt DELETED --- --- iSNSC.mak DELETED --- Index: init.cfg =================================================================== RCS file: /cvsroot/linuxisns/iscsiClient/init.cfg,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** init.cfg 2 Apr 2002 02:57:39 -0000 1.1.1.1 --- init.cfg 11 Dec 2006 15:17:37 -0000 1.2 *************** *** 1,4 **** * rectype 1 = iSNS Server IP addr ! 1 9.37.224.199 * rectype 2 = Initiator ID and Alias 2 E1-I1 Initiator1 --- 1,4 ---- * rectype 1 = iSNS Server IP addr ! 1 137.65.67.203 * rectype 2 = Initiator ID and Alias 2 E1-I1 Initiator1 --- README.txt DELETED --- |
Update of /cvsroot/linuxisns/iscsiClient/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29430/include Removed Files: custom.h entity.h fcnode.h getarg.h ifcp.h iscsi.h menu.h portal.h Log Message: Remove duplicate files already contained in isnsNT/isnsclient --- iscsi.h DELETED --- --- fcnode.h DELETED --- --- portal.h DELETED --- --- ifcp.h DELETED --- --- getarg.h DELETED --- --- menu.h DELETED --- --- custom.h DELETED --- --- entity.h DELETED --- |
Update of /cvsroot/linuxisns/iscsiClient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29430/src Removed Files: custom.c entity.c fcnode.c getarg.c ifcp.c iscsi.c main.c menu.c portal.c Log Message: Remove duplicate files already contained in isnsNT/isnsclient --- portal.c DELETED --- --- fcnode.c DELETED --- --- iscsi.c DELETED --- --- entity.c DELETED --- --- getarg.c DELETED --- --- custom.c DELETED --- --- ifcp.c DELETED --- --- main.c DELETED --- --- menu.c DELETED --- |