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-11-06 18:04:48
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27583/src Modified Files: iSNSdb.c iSNSdereg.c iSNSesi.c iSNSquery.c iSNSreg.c iSNSresponse.c iSNSscn.c Log Message: convert idx hashin memory to database read and makewrite Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSquery.c 3 Nov 2006 20:22:29 -0000 1.3 --- iSNSquery.c 6 Nov 2006 18:04:38 -0000 1.4 *************** *** 91,101 **** extern dbStats iSNS_stats; - #define MAX_HASH 1024 - #define HASH_MARK 0x3FF - #define MAP_HASH(a) (a & HASH_MARK) - extern IDX_HASH_ENTRY *entityIdxHashTbl[MAX_HASH]; - extern IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; - extern IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - static int SNSdbGetAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * md, --- 91,94 ---- *************** *** 277,280 **** --- 270,274 ---- iSCSINodeIdxKeyFlag = -1; + DEBUG_0 (isns_db_debug &1,(GetAttrEntity)); memset (dlist_src, 0, MAX_DD_PER_LIST*sizeof(uint32_t)); *************** *** 371,375 **** /* Entity ID found in key */ key = (ISNS_Key *)(key_indx[entityKeyFlag]); ! ptr = (char *)ISNSGetDataFromIdxHashTable(entityIdxHashTbl, key->val.index); if (!ptr) --- 365,379 ---- /* 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; ! read_key.val.idx.index = key->val.index; ! read_key.val.idx.index_type = ENTITY_IDX_KEY; ! rval = ISNSdbRead(&read_key,&entry3); ! if (rval != SUCCESS) ! return rval; ! ! ptr = (char *)&entry3.data.entity_idx.id; ! DEBUG_1 (isns_db_debug &1,(entity_idx.id:%s),ptr); if (!ptr) *************** *** 512,516 **** { key = (ISNS_Key *)(key_indx[iSCSINodeIdxKeyFlag]); ! ptr = ISNSGetDataFromIdxHashTable(iscsiIdxHashTbl, key->val.index); if ( !ptr ) --- 516,528 ---- { key = (ISNS_Key *)(key_indx[iSCSINodeIdxKeyFlag]); ! ISNS_Key read_key; ! read_key.tag = ISCSI_IDX_KEY; ! read_key.val.idx.index = key->val.index; ! read_key.val.idx.index_type = ISCSI_IDX_KEY; ! rval = ISNSdbRead(&read_key,&entry3); ! if (rval != SUCCESS) ! return rval; ! ! ptr = &entry3.data.iscsi_idx; if ( !ptr ) *************** *** 1273,1277 **** attr = (ISNS_Attr *) key_indx[portalIdxKeyFlag]; ! ptr = ISNSGetDataFromIdxHashTable(portalIdxHashTbl, attr->val.index); if (!ptr) { --- 1285,1298 ---- attr = (ISNS_Attr *) key_indx[portalIdxKeyFlag]; ! ISNS_Key idx_key; ! idx_key.tag = PORTAL_IDX_KEY; ! idx_key.val.idx.index = attr->val.index; ! idx_key.val.idx.index_type = PORTAL_IDX_KEY; ! rval = ISNSdbRead(&idx_key,&entry3); ! if (rval != SUCCESS) ! return rval; ! ! ptr = &entry3.data.portal_idx; ! if (!ptr) { *************** *** 1987,1991 **** void *ptr; key = (ISNS_Key *)(key_indx[nodeIdxKeyIndex]); ! ptr = ISNSGetDataFromIdxHashTable(iscsiIdxHashTbl, key->val.index); if ( !ptr ) --- 2008,2020 ---- void *ptr; key = (ISNS_Key *)(key_indx[nodeIdxKeyIndex]); ! ISNS_Key idx_key; ! idx_key.tag = ISCSI_IDX_KEY; ! idx_key.val.idx.index = key->val.index; ! idx_key.val.idx.index_type = ISCSI_IDX_KEY; ! rval = ISNSdbRead(&idx_key,&entry3); ! if (rval != SUCCESS) ! return rval; ! ! ptr = &entry3.data.iscsi_idx; if ( !ptr ) *************** *** 2456,2460 **** if (key->len && key->val.index) { ! ptr = ISNSGetDataFromIdxHashTable(iscsiIdxHashTbl, key->val.index); if (!ptr) { --- 2485,2497 ---- if (key->len && key->val.index) { ! ISNS_Key read_key; ! read_key.tag = ISCSI_IDX_KEY; ! read_key.val.idx.index = key->val.index; ! read_key.val.idx.index_type = ISCSI_IDX_KEY; ! rval = ISNSdbRead(&read_key,&entry3); ! if (rval != SUCCESS) ! return rval; ! ! ptr = &entry3.data.iscsi_idx; if (!ptr) { *************** *** 2536,2540 **** if (key->len && key->val.index) { ! ptr = ISNSGetDataFromIdxHashTable(entityIdxHashTbl, key->val.index); if (!ptr) { --- 2573,2585 ---- if (key->len && key->val.index) { ! ISNS_Key read_key; ! read_key.tag = ENTITY_IDX_KEY; ! read_key.val.idx.index = key->val.index; ! read_key.val.idx.index_type = ENTITY_IDX_KEY; ! rval = ISNSdbRead(&read_key,&entry3); ! if (rval != SUCCESS) ! return rval; ! ! ptr = &entry3.data.entity_idx; if (!ptr) { *************** *** 2649,2653 **** if (key->len && key->val.index) { ! ptr = ISNSGetDataFromIdxHashTable(portalIdxHashTbl, key->val.index); if (!ptr) { --- 2694,2706 ---- if (key->len && key->val.index) { ! ISNS_Key read_key; ! read_key.tag = PORTAL_IDX_KEY; ! read_key.val.idx.index = key->val.index; ! read_key.val.idx.index_type = PORTAL_IDX_KEY; ! rval = ISNSdbRead(&read_key,&entry3); ! if (rval != SUCCESS) ! return rval; ! ! ptr = &entry3.data.portal_idx; if (!ptr) { *************** *** 2818,2821 **** --- 2871,2875 ---- SOIP_Entity *p_entity; PORTAL_LIST_ENTRY *p_portalListEntry; + int rval; ISNSParseMsg( &p_md->msg, attr_indx, key_indx, (char **) &src_attr ); *************** *** 2830,2834 **** /* Entity ID found in key */ p_attr = (ISNS_Attr *)(key_indx[entityKeyIndex]); ! ptr = (char *)ISNSGetDataFromIdxHashTable(entityIdxHashTbl, p_attr->val.index); if (!ptr) { --- 2884,2896 ---- /* Entity ID found in key */ p_attr = (ISNS_Attr *)(key_indx[entityKeyIndex]); ! ISNS_Key read_key; ! read_key.tag = ENTITY_IDX_KEY; ! read_key.val.idx.index = p_attr->val.index; ! read_key.val.idx.index_type = ENTITY_IDX_KEY; ! rval = ISNSdbRead(&read_key,&entry3); ! if (rval != SUCCESS) ! return rval; ! ! ptr = &entry3.data.entity_idx; if (!ptr) { Index: iSNSresponse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSresponse.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSresponse.c 3 Nov 2006 20:22:29 -0000 1.2 --- iSNSresponse.c 6 Nov 2006 18:04:38 -0000 1.3 *************** *** 82,93 **** dbStats iSNS_stats; - #define MAX_HASH 1024 - #define HASH_MARK 0x3FF - #define MAP_HASH(a) (a & HASH_MARK) - IDX_HASH_ENTRY *entityIdxHashTbl[MAX_HASH]; - IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; - IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - - /********************************************************************* _ISNSAppendAttr --- 82,85 ---- Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSesi.c 3 Nov 2006 20:22:29 -0000 1.2 --- iSNSesi.c 6 Nov 2006 18:04:38 -0000 1.3 *************** *** 79,89 **** ISNS_Msg_Descp *p_rspMd; - #define MAX_HASH 1024 - #define HASH_MARK 0x3FF - #define MAP_HASH(a) (a & HASH_MARK) - IDX_HASH_ENTRY *entityIdxHashTbl[MAX_HASH]; - IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; - IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - /********************************************************************* Sends out one or more ESI(s). --- 79,82 ---- Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSdereg.c 3 Nov 2006 20:22:29 -0000 1.3 --- iSNSdereg.c 6 Nov 2006 18:04:38 -0000 1.4 *************** *** 93,104 **** extern dbStats iSNS_stats; - #define MAX_HASH 1024 - #define HASH_MARK 0x3FF - #define MAP_HASH(a) (a & HASH_MARK) - extern IDX_HASH_ENTRY *entityIdxHashTbl[MAX_HASH]; - extern IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; - extern IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - - /********************************************************************* _SNSdbRemoveAttr --- 93,96 ---- *************** *** 724,728 **** } ! ISNSRemoveFromIdxHashTable(entityIdxHashTbl, p_entity->entity_index); /* Remove Self */ --- 716,724 ---- } ! ISNS_Key remove_key; ! remove_key.tag = ENTITY_IDX_KEY; ! remove_key.val.idx.index = p_entity->entity_index; ! remove_key.val.idx.index_type = ENTITY_IDX_KEY; ! ISNSdbDelete(&remove_key); /* Remove Self */ *************** *** 1311,1315 **** /* Delete the iSCSI Node */ ! ISNSRemoveFromIdxHashTable( iscsiIdxHashTbl, p_node->iscsi_index ); iSNS_stats.num_iscsi--; RemoveCert (&p_node->ptr_cert); --- 1307,1315 ---- /* Delete the iSCSI Node */ ! ISNS_Key remove_key; ! remove_key.tag = ISCSI_IDX_KEY; ! remove_key.val.idx.index = p_node->iscsi_index; ! remove_key.val.idx.index_type = ISCSI_IDX_KEY; ! ISNSdbDelete(&remove_key); iSNS_stats.num_iscsi--; RemoveCert (&p_node->ptr_cert); *************** *** 1481,1485 **** iSNS_stats.num_portals--; ! ISNSRemoveFromIdxHashTable(portalIdxHashTbl, p_portal->portal_index); pnode2 = NULL; --- 1481,1489 ---- iSNS_stats.num_portals--; ! ISNS_Key remove_key; ! remove_key.tag = PORTAL_IDX_KEY; ! remove_key.val.idx.index = p_portal->portal_index; ! remove_key.val.idx.index_type = PORTAL_IDX_KEY; ! ISNSdbDelete(&remove_key); pnode2 = NULL; Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSreg.c 3 Nov 2006 20:22:29 -0000 1.3 --- iSNSreg.c 6 Nov 2006 18:04:38 -0000 1.4 *************** *** 88,98 **** extern dbStats iSNS_stats; - #define MAX_HASH 1024 - #define HASH_MARK 0x3FF - #define MAP_HASH(a) (a & HASH_MARK) - extern IDX_HASH_ENTRY *entityIdxHashTbl[MAX_HASH]; - extern IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; - extern IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - /********************************************************************* _SNSdbAddAttr --- 88,91 ---- *************** *** 422,427 **** DEBUG_1 (isns_db_debug & 1, (Obtain Portal ip_port:%i),p_portal->ip_port); p_portal->portal_index = ISNSGetNewPortalIdx(); ! ISNSAddToIdxHashTable( portalIdxHashTbl, p_portal->portal_index, ! &db_portal, sizeof(db_portal) ); InitList(&p_portal->entity_list); /* Update Entity's portal Bitmap */ --- 415,430 ---- DEBUG_1 (isns_db_debug & 1, (Obtain Portal ip_port:%i),p_portal->ip_port); p_portal->portal_index = ISNSGetNewPortalIdx(); ! ! ISNS_Key idx_key; ! idx_key.tag = PORTAL_IDX_KEY; ! idx_key.val.idx.index_type = PORTAL_IDX_KEY; ! idx_key.val.idx.index = p_portal->portal_index; ! SOIP_DB_Portal *p_idx; ! memset (&entry3, 0, sizeof(SOIP_DB_Entry)); ! entry3.data_type = PORTAL_IDX_KEY; ! p_idx = &entry3.data.portal_idx; ! memcpy(p_idx,&db_portal,sizeof(SOIP_DB_Portal)); ! rval = ISNSdbWrite(&idx_key,entry3); ! InitList(&p_portal->entity_list); /* Update Entity's portal Bitmap */ *************** *** 1414,1441 **** if ( rval != SUCCESS) { ! /* Create New INDEX */ ! new_member.node_idx = ISNSGetIdxFromIdxHashTableByData(iscsiIdxHashTbl, ptr, strlen(ptr)); ! if ( index && new_member.node_idx && index != new_member.node_idx) ! { ! DEBUG_0(isns_db_debug & 1, (Warning Index ID mismatch)); ! } ! else if ( index ) ! { ! new_member.node_idx = index; ! } ! if (!new_member.node_idx) ! { ! new_member.node_idx = ISNSGetNewISCSIIdx(); ! ISNSAddToIdxHashTable( iscsiIdxHashTbl, new_member.node_idx, ! ptr, strlen(ptr)); ! } } - else if (entry2.data_type != ISCSI_ID_KEY) - { - DEBUG_2 (isns_db_debug & 1, (Database key mismatch %u %u), - entry2.data_type, ISCSI_ID_KEY); - return ( ISNS_UNKNOWN_ERR ); - } else { --- 1417,1435 ---- if ( rval != SUCCESS) { ! new_member.node_idx = index; if (!new_member.node_idx) ! ! new_member.node_idx = ISNSGetNewISCSIIdx(); ! ISNS_Key idx_key; ! idx_key.tag = ISCSI_IDX_KEY; ! idx_key.val.idx.index_type = ISCSI_IDX_KEY; ! idx_key.val.idx.index = new_member.node_idx; ! SOIP_ISCSI_Node_Id *p_idx; ! memset (&entry3, 0, sizeof(SOIP_ISCSI_Node_Id)); ! entry3.data_type = ISCSI_IDX_KEY; ! p_idx = &entry3.data.iscsi_idx; ! memcpy(p_idx,&ptr,strlen(ptr)); ! rval = ISNSdbWrite(&idx_key,entry3); } else { *************** *** 1558,1563 **** p_entity->entity_index = ISNSGetNewEntityIdx(); ! ISNSAddToIdxHashTable( entityIdxHashTbl, p_entity->entity_index, ! db_entity_id.id, PAD4(strlen(db_entity_id.id))); strncpy (p_entity->eid.id, db_entity_id.id, sizeof(p_entity->eid.id) ); --- 1552,1566 ---- p_entity->entity_index = ISNSGetNewEntityIdx(); ! ! ISNS_Key idx_key; ! idx_key.tag = ENTITY_IDX_KEY; ! idx_key.val.idx.index_type = ENTITY_IDX_KEY; ! idx_key.val.idx.index = p_entity->entity_index; ! SOIP_Entity_Id *p_idx; ! memset (&entry3, 0, sizeof(SOIP_Entity_Id)); ! entry3.data_type = ENTITY_IDX_KEY; ! p_idx = &entry3.data.entity_idx; ! memcpy(p_idx,&db_entity_id.id,sizeof(SOIP_Entity_Id)); ! rval = ISNSdbWrite(&idx_key,entry3); strncpy (p_entity->eid.id, db_entity_id.id, sizeof(p_entity->eid.id) ); *************** *** 2336,2345 **** strncpy ( p_node->id.v, db_node_name.v, sizeof(p_node->id.v) ); p_node->iscsi_id_len = PAD4(strlen(p_node->id.v)); ! if (!(p_node->iscsi_index = ISNSGetIdxFromIdxHashTableByData( iscsiIdxHashTbl, p_node->id.v, strlen(p_node->id.v))) ) ! { ! p_node->iscsi_index = ISNSGetNewISCSIIdx(); ! ISNSAddToIdxHashTable( iscsiIdxHashTbl, p_node->iscsi_index, ! p_node->id.v, p_node->iscsi_id_len); ! } strncpy ( p_node->entity_id.id, db_entity.id, sizeof(p_node->entity_id.id) ); InitList( &p_node->dd_id_list ); --- 2339,2354 ---- strncpy ( p_node->id.v, db_node_name.v, sizeof(p_node->id.v) ); p_node->iscsi_id_len = PAD4(strlen(p_node->id.v)); ! ! p_node->iscsi_index = ISNSGetNewISCSIIdx(); ! ISNS_Key idx_key; ! idx_key.tag = ISCSI_IDX_KEY; ! idx_key.val.idx.index_type = ISCSI_IDX_KEY; ! idx_key.val.idx.index = p_node->iscsi_index; ! SOIP_ISCSI_Node_Id *p_idx; ! memset (&entry3, 0, sizeof(SOIP_ISCSI_Node_Id)); ! entry3.data_type = ISCSI_IDX_KEY; ! p_idx = &entry3.data.iscsi_idx; ! memcpy(p_idx,&p_node->id.v,sizeof(SOIP_ISCSI_Node_Id)); ! rval = ISNSdbWrite(&idx_key,entry3); strncpy ( p_node->entity_id.id, db_entity.id, sizeof(p_node->entity_id.id) ); InitList( &p_node->dd_id_list ); Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** iSNSdb.c 3 Nov 2006 20:22:29 -0000 1.10 --- iSNSdb.c 6 Nov 2006 18:04:38 -0000 1.11 *************** *** 87,97 **** dbStats iSNS_stats; - #define MAX_HASH 1024 - #define HASH_MARK 0x3FF - #define MAP_HASH(a) (a & HASH_MARK) - IDX_HASH_ENTRY *entityIdxHashTbl[MAX_HASH]; - IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; - IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - /* * Local function prototypes --- 87,90 ---- *************** *** 101,112 **** ISNSExceptionHdlr (void); - int - ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry); - - int - ISNSdbWrite (ISNS_Key *key, SOIP_DB_Entry entry); - - int - ISNSdbDelete (ISNS_Key *key); /********************************************************************* --- 94,97 ---- *************** *** 209,212 **** --- 194,214 ---- return (ISNS_UNKNOWN_ERR); break; + case ENTITY_IDX_KEY: + case ISCSI_IDX_KEY: + case PORTAL_IDX_KEY: + k.dptr = (char *)&key->val; + k.dsize = sizeof(SOIP_IDX_Key); + d = ndb_fetch_sns (key->tag, k, (char *)entry); + if (d.dptr == NULL) + { + DEBUG_1 (isns_db_debug & 1, (read failed index:%i),(int)&key->val); + return (ISNS_NO_SUCH_ENTRY_ERR); + } + if (entry->data_type != key->tag) + return (ISNS_UNKNOWN_ERR); + break; + default: + return ERROR; + break; } return SUCCESS; *************** *** 283,286 **** --- 285,297 ---- DEBUG_0 (isns_db_debug &1,PORTAL Name Write failed); break; + case ENTITY_IDX_KEY: + case ISCSI_IDX_KEY: + case PORTAL_IDX_KEY: + k.dptr = (char *)&key->val; + k.dsize = sizeof(SOIP_IDX_Key); + rc = ndb_store (dbfp, k, d, 0); + if (rc == ERROR) + DEBUG_0 (isns_db_debug &1,Index Write failed); + break; } return SUCCESS; *************** *** 352,521 **** DEBUG_0 (isns_db_debug &1,PORTAL Name Delete failed); break; } return SUCCESS; } - - /********************************************************************* - Adds an index to the hash table. - *********************************************************************/ - void - ISNSAddToIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index, void *p_data, int size) - { - int key; - IDX_HASH_ENTRY *hashEntry; - - key = MAP_HASH(index); - hashEntry = (IDX_HASH_ENTRY *) ISNSAllocBuffer(sizeof(IDX_HASH_ENTRY)); - memset(hashEntry, 0, sizeof(IDX_HASH_ENTRY)); - - hashEntry->index = index; - memcpy(hashEntry->buffer, p_data, size>HASH_MAX_BUFFER?HASH_MAX_BUFFER:size); - - /* Always insert at the begining. */ - hashEntry->next = table[key]; - table[key] = hashEntry; - } - - /********************************************************************* - Removes an index from a hash table. - *********************************************************************/ - void - ISNSRemoveFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index) - { - int found; - int key; - IDX_HASH_ENTRY *curEntry, *prevEntry; - - key = MAP_HASH(index); - - /* Find Entry */ - found = FALSE; - curEntry = table[key]; - prevEntry = NULL; - while ( curEntry ) - { - if (curEntry->index == index) - { - found = TRUE; - break; - } - - prevEntry = curEntry; - curEntry = curEntry->next; - } - - if ( found ) - { - if ( prevEntry ) - prevEntry->next = curEntry->next; - else - table[key] = curEntry->next; - - ISNSFreeBuffer((char *)curEntry); - } - } - /******************************************************************** - Gets the data from a hash table given an index. - ********************************************************************/ - void * - ISNSGetDataFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index) - { - int key; - IDX_HASH_ENTRY *curEntry; - - key = MAP_HASH( index ); - - /* Find Entry */ - curEntry = table[key]; - while ( curEntry ) - { - if (curEntry->index == index) - { - return (curEntry->buffer); - } - - curEntry = curEntry->next; - } - - return ( NULL ); - } - - /******************************************************************** - Gets an index given a data ptr. - ********************************************************************/ - uint32_t - ISNSGetIdxFromIdxHashTableByData(IDX_HASH_ENTRY **table, void *ptr, int len) - { - int key; - IDX_HASH_ENTRY *curEntry; - - for ( key = 0; key < MAX_HASH; key++ ) - { - /* Find Entry */ - curEntry = table[ key ]; - while ( curEntry ) - { - if (!memcmp(curEntry->buffer, ptr, len)) - { - return ( curEntry->index ); - } - - curEntry = curEntry->next; - } - } - - return ( 0 ); - } - - /******************************************************************** - Dumps the contents of all the index hash table. - ********************************************************************/ - void - ISNSDumpIdxHashTable( void ) - { - int i; - IDX_HASH_ENTRY *p_entry; - SOIP_DB_Portal *p_db_portal; - - printf("Dumping Index Hash Table [BIN:INDEX]\n"); - /* Dump Entity Hash Table */ - printf("Entity:\n"); - for (i = 0; i<MAX_HASH; i++) - { - if (!entityIdxHashTbl[i]) - continue; - p_entry = entityIdxHashTbl[i]; - - printf("[%d:%u] Entity ID = %s\n", i, p_entry->index, p_entry->buffer); - } - - /* Dump iSCSI Hash Table */ - printf("iSCSI:\n"); - for (i = 0; i<MAX_HASH; i++) - { - if (!iscsiIdxHashTbl[i]) - continue; - p_entry = iscsiIdxHashTbl[i]; - - printf("[%d:%u] Entity ID = %s\n", i, p_entry->index, p_entry->buffer); - } - - /* Dump Portal Hash Table */ - printf("Portal:\n"); - for (i = 0; i<MAX_HASH; i++) - { - if (!portalIdxHashTbl[i]) - continue; - p_entry = portalIdxHashTbl[i]; - p_db_portal = (SOIP_DB_Portal *)p_entry->buffer; - #if 0 - printf( "[%d:%lu] IP = %s, Port = %lu\n", i, p_entry->index, - inet_ntoa(p_db_portal->ip_addr.v+12), - p_db_portal->ip_port); - #endif - } - } - /********************************************************************* Returns a new entity Index. --- 363,379 ---- DEBUG_0 (isns_db_debug &1,PORTAL Name Delete failed); break; + case ENTITY_IDX_KEY: + case ISCSI_IDX_KEY: + case PORTAL_IDX_KEY: + k.dptr = (char *)&key->val; + k.dsize = sizeof(SOIP_IDX_Key); + rc = ndb_delete (key->tag, k); + if (rc == ERROR) + DEBUG_0 (isns_db_debug &1, Index Delete failed); + break; } return SUCCESS; } /********************************************************************* Returns a new entity Index. *************** *** 535,545 **** { static uint32_t indx = 1; ! ! while (ISNSGetDataFromIdxHashTable(iscsiIdxHashTbl, indx)) ! { ! indx++; ! } ! ! return ( indx ); } --- 393,397 ---- { static uint32_t indx = 1; ! return ( indx++ ); } *************** *** 650,655 **** } - - /********************************************************************* Gets the next object after the passed in key. --- 502,505 ---- *************** *** 835,1159 **** } - #ifndef SNS_LINUX - - #define FILE_MEMORY_SIZE (1024*10) - - typedef enum { - - DDS_ID_FILE_REC=1, - DDS_SYM_FILE_REC, - DDS_MEMBER_FILE_REC, - DDS_STATUS_FILE_REC, - DD_ID_FILE_REC, - DD_SYM_FILE_REC, - DD_MEMBER_DDS_FILE_REC, - DD_MEMBER_NODE_TYPE_FILE_REC, - DD_MEMBER_NODE_NAME_FILE_REC, - DD_MEMBER_STATUS_FILE_REC - - } ISNS_FILE_REC; - - /********************************************************************* - _ISNSdbSave - - Saves the DDS and DD information into the database. - *********************************************************************/ - int - ISNSdbSave(ISNS_Msg *p_msg) - { - ISNS_Key key = { 0 }; - void *p_mem; - int total_size = 0; - SOIP_Dd *p_dd; - SOIP_Dds *p_dds; - ISNS_LIST_NODE *pnode; - SOIP_Dd_Member *p_member; - - p_mem = malloc( FILE_MEMORY_SIZE ); - memset ( p_mem, 0, FILE_MEMORY_SIZE ); - - /* retrieve all DDS */ - /* Get first entity id */ - memset(&key, 0, sizeof(key)); - key.tag = ISNS_DDS_ID; - key.len = DDS_KEY_SIZE; - - while ( SNSdbGetNextOfKey ( &key ) == SUCCESS ) - { - if ( ISNS_NO_ERR != SNSdbFetchDDS ( key.val.dd_key.id, &p_dds, &entry ) ) - { - free(p_mem); - printf("Fatal error.\n"); - return (ERROR); - } - - ISNSAppendTLV( p_mem, &total_size, DDS_ID_FILE_REC, - ISNS_DDS_ID_SIZE, NULL, p_dds->id ); - - ISNSAppendTLV( p_mem, &total_size, DDS_SYM_FILE_REC, - PAD4(strlen(p_dds->sym_name)), p_dds->sym_name, 0 ); - - ISNSAppendTLV( p_mem, &total_size, DDS_STATUS_FILE_REC, - ISNS_DDS_STATUS_SIZE, NULL, p_dds->status ); - - pnode=NULL; - while ((pnode=GetNextNode(&p_dds->dd_list, pnode))) - { - ISNSAppendTLV(p_mem, &total_size, DDS_MEMBER_FILE_REC, - ISNS_DD_ID_SIZE, NULL, *(uint32_t *)GetNodeData(pnode)); - } - - } - - /* retrieve all DD */ - - /* Get first entity id */ - memset(&key, 0, sizeof(key)); - key.tag = ISNS_DD_ID; - key.len = DD_KEY_SIZE; - - while (SNSdbGetNextOfKey ( &key ) == SUCCESS) - { - if (ISNS_NO_ERR != SNSdbFetchDD( key.val.dd_key.id, &p_dd, &entry )) - { - printf("Fatal error.\n"); - free(p_mem); - } - - ISNSAppendTLV( p_mem, &total_size, DD_ID_FILE_REC, - ISNS_DDS_ID_SIZE, NULL, p_dd->id ); - - ISNSAppendTLV( p_mem, &total_size, DD_SYM_FILE_REC, - PAD4(strlen(p_dd->sym_name)), p_dd->sym_name, 0 ); - - pnode=NULL; - while ((pnode=GetNextNode(&p_dd->dds_list, pnode))) - { - ISNSAppendTLV( p_mem, &total_size, DD_MEMBER_DDS_FILE_REC, - ISNS_DD_ID_SIZE, NULL, *(uint32_t *)GetNodeData(pnode) ); - } - - pnode=NULL; - while ((pnode=GetNextNode(&p_dd->member_list, pnode))) - { - p_member=(SOIP_Dd_Member *)GetNodeData(pnode); - - ISNSAppendTLV( p_mem, &total_size, DD_MEMBER_NODE_TYPE_FILE_REC, - 4, NULL, p_member->type ); - - ISNSAppendTLV( p_mem, &total_size, DD_MEMBER_NODE_NAME_FILE_REC, - PAD4 (strlen (p_member->node_id)), p_member->node_id, 0 ); - - } - - } - - /* Write memory to file */ - NTWriteToFile( total_size, p_mem ); - free( p_mem ); - #if 0 - p_msg->hdr.msg_len = 0; - ISNSAppendKey(p_msg, ISNS_COMPANY_OUI, ISNS_COMPANY_OUI_SIZE, NULL, NISHAN_OUI); - #endif - return (SUCCESS); - } - - /********************************************************************* - _ISNSdbLoad - - Loads the DD and DDS information from the database. - *********************************************************************/ - - int - ISNSdbLoad(void) - { - #if 0 - int ii; - #endif - void *p_mem; - int total_size=0; - ISNS_Attr *attr; - int parsed_size=0; - int firstTimeFlag; - int recType; - SOIP_Dd *p_dd; - SOIP_Dds *p_dds; - SOIP_DD_Key dd_key; - SOIP_DD_Key dds_key; - /*SOIP_Dd_Member *p_member;*/ - - p_mem = malloc( FILE_MEMORY_SIZE ); - p_dd = (SOIP_Dd *)&entry.data; - p_dds = (SOIP_Dds *)&entry.data; - - /* Read file */ - if (SUCCESS != NTReadFromFile( &total_size, p_mem )) - return ERROR; - - attr = (ISNS_Attr *)p_mem; - - /* Let the parsing begin */ - firstTimeFlag = TRUE; - while ( (char *)attr<(char *)p_mem+total_size ) - { - switch (attr->tag) - { - case DDS_ID_FILE_REC: - if (!firstTimeFlag) - { - if (recType == DD_ID_FILE_REC) - { - /* Save DD record */ - entry.data_type = ISNS_DD_ID; - ISNS_Key key; - key.tag = DD_ID_KEY; - key.val.dd_id = dd_key.id; - ISNSdbWrite(&key,entry); - } - else if (recType == DDS_ID_FILE_REC) - { - /* Save DDS record */ - entry.data_type = ISNS_DDS_ID; - ISNS_Key key; - key.tag = DDS_ID_KEY; - key.val.dd_id = dds_key.id; - ISNSdbWrite(&key,entry); - } - else - { - DEBUG_1(isns_db_debug & 1, (Error invalid record type %d), recType); - } - } - firstTimeFlag = FALSE; - recType = DDS_ID_FILE_REC; - memset(&entry, 0, sizeof(entry)); - entry.data_type = ISNS_DDS_ID; - p_dds->id = *(uint32_t *)&attr->val; - dds_key.id = p_dds->id; - break; - - case DDS_SYM_FILE_REC: - strcpy( p_dds->sym_name, (char *)&attr->val ); - break; - case DDS_STATUS_FILE_REC: - p_dds->status = *(uint32_t *)&attr->val; - break; - case DDS_MEMBER_FILE_REC: - #if 0 - for (ii = 0; ii < MAX_DD_PER_DDS; ii++) - { - if (p_dds->dd_list[ ii ] == 0) - break; - } - - p_dds->dd_list[ ii ] = *(uint32_t *)&attr->val; - #endif - break; - case DD_ID_FILE_REC: - if (!firstTimeFlag) - { - if (recType == DD_ID_FILE_REC) - { - /* Save DD record */ - entry.data_type = ISNS_DD_ID; - ISNS_Key key; - key.tag = DD_ID_KEY; - key.val.dd_id = dd_key.id; - ISNSdbWrite(&key,entry); - } - else if (recType == DDS_ID_FILE_REC) - { - /* Save DDS record */ - entry.data_type = ISNS_DDS_ID; - ISNS_Key key; - key.tag = DDS_ID_KEY; - key.val.dds_id = dds_key.id; - ISNSdbWrite(&key,entry); - } - else - { - DEBUG_1(isns_db_debug & 1, (Error invalid record type %d), recType); - } - firstTimeFlag = FALSE; - recType = DD_ID_FILE_REC; - memset(&entry, 0, sizeof(entry)); - entry.data_type = ISNS_DD_ID; - p_dd->id = *(uint32_t *)&attr->val; - dd_key.id = p_dd->id; - InitList( &p_dd->dds_list ); - InitList( &p_dd->member_list ); - - } - break; - case DD_SYM_FILE_REC: - strcpy( p_dd->sym_name, (char *)&attr->val ); - break; - case DD_MEMBER_DDS_FILE_REC: - #if 0 - for ( ii = 0; ii < MAX_DDS_PER_DD; ii++) - { - if (p_dd->dds_list[ ii ] == 0) - break; - } - p_dd->dds_list [ ii ] = *(uint32_t *)&attr->val; - #endif - break; - case DD_MEMBER_NODE_TYPE_FILE_REC: - #if 0 - for ( ii = 0; ii < MAX_DDS_PER_DD; ii++) - { - if (p_dd->member[ ii ].type == 0) - break; - } - p_dd->member[ ii ].type = *(uint32_t *)&attr->val; - #endif - break; - case DD_MEMBER_NODE_NAME_FILE_REC: - #if 0 - strcpy(p_dd->member[ ii ].node_id, (char *)&attr->val); - #endif - break; - #if 0 - case DD_MEMBER_STATUS_FILE_REC: - #if 0 - p_dd->member[ ii ].status = *(uint32_t *)&attr->val; - #endif - break; - #endif - default: - DEBUG_0(isns_db_debug & 1, (Error: Parsing data file).); - break; - } /* End Switch */ - - attr=(ISNS_Attr *)((char *)attr+attr->len+ISNS_SIZEOF_TAG); - } - - /* One last save */ - if (!firstTimeFlag) - { - if (recType == DD_ID_FILE_REC) - { - /* Save DD record */ - entry.data_type = ISNS_DD_ID; - key.tag = DD_ID_KEY; - key.val.dd_id = dd_key.id; - ISNSdbWrite(&key,entry); - } - else if (recType == DDS_ID_FILE_REC) - { - /* Save DDS record */ - entry.data_type = ISNS_DDS_ID; - ISNS_Key key; - key.tag = DDS_ID_KEY; - key.val.dds_id = dds_key.id; - ISNSdbWrite(&key,entry); - } - else - { - DEBUG_1(isns_db_debug & 1, (Error invalid record type %d), recType); - } - } - free(p_mem); - return (SUCCESS); - } - #endif --- 685,686 ---- Index: iSNSscn.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSscn.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSscn.c 3 Nov 2006 20:22:29 -0000 1.2 --- iSNSscn.c 6 Nov 2006 18:04:38 -0000 1.3 *************** *** 88,98 **** dbStats iSNS_stats; - #define MAX_HASH 1024 - #define HASH_MARK 0x3FF - #define MAP_HASH(a) (a & HASH_MARK) - IDX_HASH_ENTRY *entityIdxHashTbl[MAX_HASH]; - IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; - IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - /* * Local function prototypes --- 88,91 ---- |
From: Robert W. <wrw...@us...> - 2006-11-06 18:04:48
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27583/include Modified Files: iSNStypes.h Log Message: convert idx hashin memory to database read and makewrite Index: iSNStypes.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNStypes.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNStypes.h 24 Oct 2006 21:04:19 -0000 1.3 --- iSNStypes.h 6 Nov 2006 18:04:38 -0000 1.4 *************** *** 277,280 **** --- 277,283 ---- ISCSI_ID_KEY, ESI_KEY, + ENTITY_IDX_KEY, + ISCSI_IDX_KEY, + PORTAL_IDX_KEY, END_SNS_DEVI_KEY *************** *** 567,570 **** --- 570,578 ---- } ENTITY_LIST_ENTRY; + typedef struct index_entry { + uint32_t index; + uint32_t index_type; + } SOIP_IDX_Key; + typedef struct soip_portal { *************** *** 671,680 **** SOIP_Dd dd; SOIP_Prot_Ver prot_ver; - - /* Not used */ - IP_Address ip_addr; - SOIP_Port_List port_list; - SOIP_Zone zone; SOIP_Node node; } data; --- 679,686 ---- SOIP_Dd dd; SOIP_Prot_Ver prot_ver; SOIP_Node node; + SOIP_Entity_Id entity_idx; + SOIP_ISCSI_Node_Id iscsi_idx; + SOIP_DB_Portal portal_idx; } data; *************** *** 706,709 **** --- 712,716 ---- SOIP_Port_Type port_type; uint32_t integer32; + SOIP_IDX_Key idx; } val; |
From: Robert W. <wrw...@us...> - 2006-11-06 17:18:10
|
Update of /cvsroot/linuxisns/isnsNT/isnsclient/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6619/src Modified Files: entity.c portal.c Log Message: src input required for portal entry Index: portal.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/portal.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** portal.c 2 Apr 2002 20:56:54 -0000 1.2 --- portal.c 6 Nov 2006 17:18:00 -0000 1.3 *************** *** 290,293 **** --- 290,298 ---- /* Get Entity ID */ flag = FALSE; + + if (-1 ==GetSrc(&cmd,0)) + return 0; + + while (GetInput (cmdLine, "Entity ID", "(none)", sizeof (cmdLine))) { Index: entity.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsclient/src/entity.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** entity.c 25 Oct 2006 22:40:16 -0000 1.3 --- entity.c 6 Nov 2006 17:18:00 -0000 1.4 *************** *** 200,203 **** --- 200,205 ---- ISNSAppendAttr (&cmd, ISNS_PROT_VER, 0, NULL, 0); ISNSAppendAttr (&cmd, ISNS_ENTITY_PERIOD, 0, NULL, 0); + ISNSAppendAttr (&cmd, ISNS_PORTAL_IP, 0, NULL, 0); + ISNSAppendAttr (&cmd, ISNS_PORTAL_PORT, 0, NULL, 0); if (0 == ISNSSendCmd2 (&cmd, buffer, sizeof (buffer))) |
From: Robert W. <wrw...@us...> - 2006-11-03 20:22:35
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9512/include Modified Files: iSNSdb.h ndb.h Added Files: iSNSesi.h iSNSquery.h iSNSreg.h iSNSresponse.h iSNSscn.h Log Message: separate out include files --- NEW FILE: iSNSesi.h --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, 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. ***********************************************************************/ /* * This file contains definitions related to iSNSreg * */ #ifndef _SNSesi_h_ #define _SNSesi_h_ int ISNS_SendESI(void); int ISNS_ProcessESI(ISNS_Msg_Descp* p_md); int ISNSdbExec(ISNS_Msg_Descp* p_md,ISNS_Msg_Descp* p_rsp_md); int ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ); #endif --- NEW FILE: iSNSresponse.h --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, 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. ***********************************************************************/ /* * This file contains definitions related to iSNSreg * */ #ifndef _SNSresponse_h_ #define _SNSresponse_h_ int ISNSFindTag (int start_indx, int key, char **attr_indx); ISNS_Attr * ISNSFindKeyInResponseMsg (int key, ISNS_Msg * msg); 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); #endif --- NEW FILE: iSNSquery.h --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, 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. ***********************************************************************/ /* * This file contains definitions related to iSNSreg * */ #ifndef _SNSquery_h_ #define _SNSquery_h_ extern int SNSdbGetAttr (char **attr_indx, char **key_indx, char *src_attr, ISNS_Msg_Descp * md); extern ISNS_Msg_Descp * SNSdbGetPorts(char **attr_indx, ISNS_Msg_Descp *); extern int SNSdbGetPortName(IP_Address *ip, SOIP_Port_Id *id, SOIP_Port_Name *pn); ISNS_ATTR_VALS_CB * ISNSAttrGetList (ISNS_Msg_Descp *p_md); int ISNS_GetDD_ID_from_sym ( char *p_sym ); int ISNS_GetDDS_ID_from_sym ( char *p_sym ); int ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); int ISNSGetNextAttr( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int IsDDActive(int dd_id, int exclude_dds_id); int IsDDSActive(int dds_id); int Get_Active_DD_List (ISNS_LIST *dd_list, ISNS_DD_LIST p_dlist, int flag); int ISNSdbProcessISCSIOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, SOIP_Iscsi * p_node); int ISNSdbProcessFCNodeOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, SOIP_Fc_Node * p_node); int Get_Active_DD_List_From_ISCSI_Node (char *nodename, ISNS_DD_LIST p_dlist, int flag); int Append_Nodes_From_DD_List (ISNS_DD_LIST p_dlist, SOIP_Dd_Member p_ddmem[], uint32_t type); int Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, int flag); int Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, SOIP_Entity * p_entity, ISNS_DD_LIST p_list, int flag); int SNSProcessPortalOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, SOIP_Portal * p_portal); int ISNSdbProcessPortOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, SOIP_Ifcp * p_port); int ISNSdbProcessEntityOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, SOIP_Entity *p_entity); int ISNSdbProcessDDSOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, SOIP_Dds *p_dds); int ISNSdbProcessDDOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, SOIP_Dd *p_dd); int ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); int Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, int flag); int SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, ISNS_DD_LIST p_dlist_src, int flag); int Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, SOIP_Entity * p_entity, ISNS_DD_LIST p_list, int flag); #endif Index: ndb.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/ndb.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ndb.h 2 Apr 2002 20:56:54 -0000 1.2 --- ndb.h 3 Nov 2006 20:22:29 -0000 1.3 *************** *** 66,68 **** --- 66,72 ---- extern datum ndb_nextkey __P((uint32_t key_type, datum)); + extern datum ndb_fetch_sns (); + extern datum ndb_firstkey_isns (uint32_t key_type, char *key); + extern datum ndb_nextkey_isns (uint32_t key_type, datum key, char *pkey); + #endif --- NEW FILE: iSNSscn.h --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, 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. ***********************************************************************/ /* * This file contains definitions related to iSNSreg * */ #ifndef _SNSscn_h_ #define _SNSscn_h_ int send_iscsi_scn_on_dd_mem_change( SOIP_Iscsi * p_src_node, char *p_src_name, SOIP_Dd *p_dd, uint32_t dd_id, uint32_t event_bitmap); int send_scn_parameter_change_to_all( ISNS_Msg *p_msg, uint32_t bitmap ); int send_scn_object_change_to_all( uint32_t src_type, uint32_t src_len, void *src_val, uint32_t bitmap ); int send_dd_iscsi_scn( SOIP_Dd *p_dd, int dd_id, uint32_t scn_bitmap ); int Send_IFCP_SCN (SOIP_Ifcp * p_src_node, char *p_src_name, uint32_t event_bitmap); int send_iscsi_scn_to_members ( SOIP_Iscsi * p_src_node, char *p_src_name, ISNS_Msg *p_msg, uint32_t event_bitmap ); int SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, ISNS_DD_LIST p_dlist_src, int flag); int ISNS_Process_SCN_Event (ISNS_Msg *p_msg); int ISNS_Process_SCN_Event (ISNS_Msg *p_msg); int ISNS_Process_SCN(ISNS_Msg_Descp *p_md, ISNS_Msg *p_rsp_msg); #endif Index: iSNSdb.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdb.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** iSNSdb.h 3 Nov 2006 18:55:41 -0000 1.3 --- iSNSdb.h 3 Nov 2006 20:22:29 -0000 1.4 *************** *** 42,46 **** #include <time.h> - #include "ndb.h" #include "iSNSmsg.h" --- 42,45 ---- *************** *** 82,289 **** ISNSdbClose (void); - extern int - SNSdbAddAttr (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md); - - extern int - SNSdbGetAttr (char **attr_indx, char **key_indx, - char *src_attr, ISNS_Msg_Descp * md); - - extern ISNS_Msg_Descp * - SNSdbGetPorts(char **attr_indx, ISNS_Msg_Descp *); - - extern int - SNSdbGetPortName(IP_Address *ip, SOIP_Port_Id *id, SOIP_Port_Name *pn); - - extern int - SNSDeRegisterSCN (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, - ISNS_Msg * rspmsg); - - extern STATUS - SNSRemoveAllPortsFromNode(SOIP_Node_Name nn); - - extern void - ISNS_CheckEntities (void); - int ISNSdbLoad(void); int ISNSdbSave(ISNS_Msg *p_msg); - int ISNS_SendESI(void); - - int ISNS_ProcessESI(ISNS_Msg_Descp* p_md); - int ISNSdbExec(ISNS_Msg_Descp* p_md,ISNS_Msg_Descp* p_rsp_md); - int ISNS_RegisterSCNCallback(ISNS_Msg_Descp* p_md); - - int ISNSTouchEntity(ISNS_Attr* src_attr); - - ISNS_ATTR_VALS_CB * - ISNSAttrGetList (ISNS_Msg_Descp *p_md); - - int - ISNS_GetDD_ID_from_sym ( char *p_sym ); - - int - ISNS_GetDDS_ID_from_sym ( char *p_sym ); - - int - ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - send_iscsi_scn_on_dd_mem_change( SOIP_Iscsi * p_src_node, char *p_src_name, - SOIP_Dd *p_dd, uint32_t dd_id, uint32_t event_bitmap); - - int - send_scn_parameter_change_to_all( ISNS_Msg *p_msg, uint32_t bitmap ); - - int - send_scn_object_change_to_all( uint32_t src_type, uint32_t src_len, - void *src_val, uint32_t bitmap ); - - int - change_dd_member_active_flag( SOIP_Dd *p_dd ); - - int - ISNS_DeRegisterSCN ( ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - ISNS_RegisterSCN (ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - ISNSdbRemoveAttr (ISNS_Msg_Descp * p_md); - - - int - ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); - - int - ISNSGetNextAttr( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbRemoveAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbRemoveAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); - - int - send_dd_iscsi_scn( SOIP_Dd *p_dd, int dd_id, uint32_t scn_bitmap ); - - int - IsDDActive(int dd_id, int exclude_dds_id); - - int - IsDDSActive(int dds_id); - - int - ISNSAddSCNEntry(uint32_t type, char *nodename, uint32_t bitmap, int sockfd); - - int - ISNSRemoveSCNEntry(uint32_t type, char *nodename); - - 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); - int ! Get_Active_DD_List (ISNS_LIST *dd_list, ISNS_DD_LIST p_dlist, int flag); ! ! ! int ! SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, ! ISNS_Msg * p_rspmsg); ! ! int ! ISNSdbAddAttrPortal (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ! ISNS_Msg * p_rspmsg);\ ! ! int ! SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ! ISNS_Msg * p_rspmsg); ! ! int ! AddCert (void **ptr, int *size, void *p_cert, int cert_size); ! ! int ! RemoveCert (void **ptr); ! ! int ! SNSRemoveIFCPNodeEntry (char *ifcp_node_key, ISNS_Attr * src_attr, ! ISNS_Msg * p_rspmsg); ! ! int ! Activate_DD_Membership (uint32_t type, void *p_node); ! ! int ! SNSRemoveFCNodeEntry (char *p_key, ISNS_Msg * p_rspmsg); ! ! int ! ISNSdbProcessISCSIOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, ! SOIP_Iscsi * p_node); int - ISNSdbProcessFCNodeOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Fc_Node * p_node); - int SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, ! SOIP_DB_Entry * p_entry); ! ! ! int ! Get_Active_DD_List_From_ISCSI_Node (char *nodename, ISNS_DD_LIST p_dlist, ! int flag); ! ! int ! Append_Nodes_From_DD_List (ISNS_DD_LIST p_dlist, ! SOIP_Dd_Member p_ddmem[], uint32_t type); ! ! int ! Check_Overlap_DD (ISNS_DD_LIST p_dlist_src, ISNS_DD_LIST p_dlist_node); ! ! int ! Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, ! int flag); ! ! ! int ! SNSRemoveISCSINodeEntry (char *iscsi_node_key, ISNS_Attr * src_attr, ! ISNS_Msg * p_rspmsg); ! ! int ! Send_IFCP_SCN (SOIP_Ifcp * p_src_node, char *p_src_name, ! uint32_t event_bitmap); ! ! int ! ISNSdbAddAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ! ISNS_Msg * p_rspmsg); ! ! int ! send_iscsi_scn_to_members ( SOIP_Iscsi * p_src_node, char *p_src_name, ! ISNS_Msg *p_msg, uint32_t event_bitmap ); ! ! int ! SNSdbAddAttrEntity (char **attr_indx, char **key_indx, ! ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); ! ! int ! Remove_DD_from_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); int ! SNSdbGetNextOfKey (ISNS_Key * key); void --- 81,99 ---- ISNSdbClose (void); int ISNSdbLoad(void); int ISNSdbSave(ISNS_Msg *p_msg); int ISNSdbExec(ISNS_Msg_Descp* p_md,ISNS_Msg_Descp* p_rsp_md); int ! SNSdbGetNextOfKey (ISNS_Key * key); int SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, ! SOIP_DB_Entry * p_entry); int ! SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); void *************** *** 291,397 **** int - Add_dds_to_dd (SOIP_Dds *p_dds, int dd_id); - - int - Remove_DD_from_IFCP_Node (int id, char *p_node_name); - - int - Add_DD_to_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); - - int - Add_DD_Member (SOIP_Dd * p_dd, char *ptr, int p_len, uint32_t type, uint32_t status, uint32_t index); - - int - Remove_DD_Member (SOIP_Dd *p_dd, char *ptr, uint32_t type); - - int - Add_DD_to_IFCP_Node (int id, char *p_node_name); - - int - SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, - ISNS_DD_LIST p_dlist_src, int flag); - - int - Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, - SOIP_Entity * p_entity, - ISNS_DD_LIST p_list, int flag); - - int - Remove_dd_from_dds (SOIP_Dds * p_dds, int id); - - int - SNSProcessPortalOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Portal * p_portal); - - int - ISNSdbProcessPortOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Ifcp * p_port); - - int - ISNSdbProcessEntityOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Entity *p_entity); - - int - ISNSdbAddAttrISCSINode (char **attr_indx, char **key_indx, - ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); - - int - ISNSFindTag (int start_indx, int key, char **attr_indx); - - ISNS_Attr * - ISNSFindKeyInResponseMsg (int key, ISNS_Msg * msg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - 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 - SNSdbRemoveAttrEntity (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPort (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - ISNSdbRemoveAttrEntityEntry (char *p_entity_id, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - int - ISNSdbAddAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbAddAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNS_Process_SCN(ISNS_Msg_Descp *p_md, ISNS_Msg *p_rsp_msg); - - int - ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ); - - int ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry); --- 101,104 ---- *************** *** 402,413 **** ISNSdbDelete (ISNS_Key *key); - int - ISNSdbProcessDDSOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, - SOIP_Dds *p_dds); - - int - ISNSdbProcessDDOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, - SOIP_Dd *p_dd); - void * ISNSGetDataFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index); --- 109,112 ---- *************** *** 421,486 **** int ISNS_GetNewDD_ID (void); - int Check_Unique_DDS_Sym (SOIP_Dds * p_dds, char *p_sym_name); - int Check_Unique_DD_Sym (SOIP_Dd * p_dd, char *p_sym_name); uint32_t ISNSGetNewEntityIdx(void); uint32_t ISNSGetNewISCSIIdx(void); uint32_t ISNSGetNewPortalIdx(void); - int SNSdbRemoveAttrDDS_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); - int SNSdbRemoveDD_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); - - int - SNSdbRemoveDD_Member (int id, char **attr_indx, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - int - Disable_DD_Member (SOIP_Dd * p_dd, char *ptr, uint32_t type); void ISNSRemoveFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index); - int - ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); - - int - Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, - int flag); - - int - SNSdbGetNextOfKey (ISNS_Key * key); - - int - SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, - ISNS_DD_LIST p_dlist_src, int flag); - - int - Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, - SOIP_Entity * p_entity, - ISNS_DD_LIST p_list, int flag); - - int - SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - - int - SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - Append_DD_to_List (ISNS_DD_LIST p_dlist, uint32_t id); - #endif --- 120,128 ---- --- NEW FILE: iSNSreg.h --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, 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. ***********************************************************************/ /* * This file contains definitions related to iSNSreg * */ #ifndef _SNSreg_h_ #define _SNSreg_h_ #include <time.h> #include "iSNSmsg.h" extern int SNSdbAddAttr (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md); extern int SNSDeRegisterSCN (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg * rspmsg); extern STATUS SNSRemoveAllPortsFromNode(SOIP_Node_Name nn); extern void ISNS_CheckEntities (void); int ISNS_RegisterSCNCallback(ISNS_Msg_Descp* p_md); int ISNSTouchEntity(ISNS_Attr* src_attr); int change_dd_member_active_flag( SOIP_Dd *p_dd ); int ISNS_DeRegisterSCN ( ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int ISNS_RegisterSCN (ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int ISNSdbRemoveAttr (ISNS_Msg_Descp * p_md); int ISNSdbRemoveAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); int ISNSdbRemoveAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); int ISNSAddSCNEntry(uint32_t type, char *nodename, uint32_t bitmap, int sockfd); int ISNSRemoveSCNEntry(uint32_t type, char *nodename); 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); int SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); int ISNSdbAddAttr (ISNS_Msg_Descp * p_md, ISNS_Msg *rspMsg); int ISNSdbAddAttrPortal (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg);\ int SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); int AddCert (void **ptr, int *size, void *p_cert, int cert_size); int RemoveCert (void **ptr); int SNSRemoveIFCPNodeEntry (char *ifcp_node_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); int Activate_DD_Membership (uint32_t type, void *p_node); int SNSRemoveFCNodeEntry (char *p_key, ISNS_Msg * p_rspmsg); int Check_Overlap_DD (ISNS_DD_LIST p_dlist_src, ISNS_DD_LIST p_dlist_node); int SNSRemoveISCSINodeEntry (char *iscsi_node_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); int ISNSdbAddAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); int SNSdbAddAttrEntity (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); int Remove_DD_from_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); int Add_dds_to_dd (SOIP_Dds *p_dds, int dd_id); int Remove_DD_from_IFCP_Node (int id, char *p_node_name); int Add_DD_to_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); int Add_DD_Member (SOIP_Dd * p_dd, char *ptr, int p_len, uint32_t type, uint32_t status, uint32_t index); int Remove_DD_Member (SOIP_Dd *p_dd, char *ptr, uint32_t type); int Add_DD_to_IFCP_Node (int id, char *p_node_name); int Remove_dd_from_dds (SOIP_Dds * p_dds, int id); int ISNSdbAddAttrISCSINode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); int SNSdbRemoveAttrEntity (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrPort (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int ISNSdbRemoveAttrEntityEntry (char *p_entity_id, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); int SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int ISNSdbAddAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); int ISNSdbAddAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); int ISNSdbProcessDDOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, SOIP_Dd *p_dd); int ISNS_GetNewDDS_ID (void); int ISNS_GetNewDD_ID (void); int Check_Unique_DDS_Sym (SOIP_Dds * p_dds, char *p_sym_name); int Check_Unique_DD_Sym (SOIP_Dd * p_dd, char *p_sym_name); uint32_t ISNSGetNewEntityIdx(void); uint32_t ISNSGetNewISCSIIdx(void); uint32_t ISNSGetNewPortalIdx(void); int SNSdbRemoveAttrDDS_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); int SNSdbRemoveDD_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); int SNSdbRemoveDD_Member (int id, char **attr_indx, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); int Disable_DD_Member (SOIP_Dd * p_dd, char *ptr, uint32_t type); int SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int Append_DD_to_List (ISNS_DD_LIST p_dlist, uint32_t id); #endif |
From: Robert W. <wrw...@us...> - 2006-11-03 20:22:35
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9512/src Modified Files: iSNSMain.c iSNSUtil.c iSNScomm.c iSNSdb.c iSNSdereg.c iSNSesi.c iSNSfsm.c iSNSipc.c iSNSquery.c iSNSreg.c iSNSresponse.c iSNSscn.c iSNStrcv.c Log Message: separate out include files Index: iSNScomm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNScomm.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNScomm.c 2 Apr 2002 20:56:54 -0000 1.2 --- iSNScomm.c 3 Nov 2006 20:22:29 -0000 1.3 *************** *** 322,326 **** if (recvfrom (rsd, (char *) &md->msg, sizeof (ISNS_Msg), 0, (struct sockaddr *) &md->cb.sock.addr, ! (int *) &md->cb.sock.len) == -1 ) { // printf ("\n%s:%d sd %d",__FILE__,__LINE__,sd); --- 322,326 ---- if (recvfrom (rsd, (char *) &md->msg, sizeof (ISNS_Msg), 0, (struct sockaddr *) &md->cb.sock.addr, ! &md->cb.sock.len) == -1 ) { // printf ("\n%s:%d sd %d",__FILE__,__LINE__,sd); Index: iSNSipc.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSipc.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSipc.c 2 Apr 2002 20:56:54 -0000 1.2 --- iSNSipc.c 3 Nov 2006 20:22:29 -0000 1.3 *************** *** 166,170 **** len=sizeof(ipc_ep[ep_name].their_addr); cnt = recvfrom( ipc_ep[ep_name].s, p_msg, max_len, 0, ! (struct sockaddr * )&ipc_ep[ep_name].their_addr, &len); if (cnt < 0) --- 166,170 ---- len=sizeof(ipc_ep[ep_name].their_addr); cnt = recvfrom( ipc_ep[ep_name].s, p_msg, max_len, 0, ! (struct sockaddr * )&ipc_ep[ep_name].their_addr, (socklen_t *)&len); if (cnt < 0) Index: iSNSresponse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSresponse.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSresponse.c 3 Nov 2006 18:55:41 -0000 1.1 --- iSNSresponse.c 3 Nov 2006 20:22:29 -0000 1.2 *************** *** 54,89 **** #endif - extern int sns_scn_debug; - extern int sns_scn_msg_filter; - extern int sns_rsync_debug; - extern int SNSGetMgmtAddr (void); - extern int sns_esi_interval; - - #ifndef SNS_LINUX - extern void NTWriteToFile(int len, void *ptr); - extern int NTReadFromFile(int *lenPtr, void *ptr); - #endif - /* Global */ extern int isns_db_debug; - extern int isns_scn_debug; - extern int isns_scn_msg_filter; - extern int isns_rsync_debug; - extern int sns_heartbeat_interval; - - extern datum ndb_fetch_sns (); - extern datum ndb_firstkey_isns (uint32_t key_type, char *key); - extern datum ndb_nextkey_isns (uint32_t key_type, datum key, char *pkey); - extern ISNS_ATTR_VALS_CB * ISNSAttrGetList (ISNS_Msg_Descp *p_md); /* - * GDBM errno - */ - extern ndb_error ndb_errno; - - /* * static common variables for gdbm fetches * entry is for common registrations and queries --- 54,64 ---- *************** *** 113,419 **** IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - /* - * Local function prototypes - */ - int - ISNS_GetDD_ID_from_sym ( char *p_sym ); - - int - ISNS_GetDDS_ID_from_sym ( char *p_sym ); - - int - ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - send_iscsi_scn_on_dd_mem_change( SOIP_Iscsi * p_src_node, char *p_src_name, - SOIP_Dd *p_dd, uint32_t dd_id, uint32_t event_bitmap); - - int - send_scn_parameter_change_to_all( ISNS_Msg *p_msg, uint32_t bitmap ); - - int - send_scn_object_change_to_all( uint32_t src_type, uint32_t src_len, - void *src_val, uint32_t bitmap ); - - int - change_dd_member_active_flag( SOIP_Dd *p_dd ); - - int - ISNS_DeRegisterSCN ( ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - ISNS_RegisterSCN (ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - ISNSdbRemoveAttr (ISNS_Msg_Descp * p_md); - - int - ISNSdbAddAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg *rspMsg ); - - int - ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); - - int - ISNSGetNextAttr( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbRemoveAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbRemoveAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); - - int - send_dd_iscsi_scn( SOIP_Dd *p_dd, int dd_id, uint32_t scn_bitmap ); - - int - IsDDActive(int dd_id, int exclude_dds_id); - - int - IsDDSActive(int dds_id); - - int - ISNSAddSCNEntry(uint32_t type, char *nodename, uint32_t bitmap, int sockfd); - - int - ISNSRemoveSCNEntry(uint32_t type, char *nodename); - - 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 - SNSdbGetAttrDD (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, - ISNS_Msg * p_rspmsg); - - 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 - SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - ISNSdbAddAttrPortal (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg); - - int - AddCert (void **ptr, int *size, void *p_cert, int cert_size); - - int - RemoveCert (void **ptr); - - int - SNSRemoveIFCPNodeEntry (char *ifcp_node_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - Activate_DD_Membership (uint32_t type, void *p_node); - - int - SNSRemoveFCNodeEntry (char *p_key, ISNS_Msg * p_rspmsg); - - int - ISNSdbProcessISCSIOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Iscsi * p_node); - int - SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, - SOIP_DB_Entry * p_entry); - - int - SNSdbGetAttrDDS (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, - ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - - int - Get_Active_DD_List_From_ISCSI_Node (char *nodename, ISNS_DD_LIST p_dlist, - int flag); - - int - Append_Nodes_From_DD_List (ISNS_DD_LIST p_dlist, - SOIP_Dd_Member p_ddmem[], uint32_t type); - - int - Check_Overlap_DD (ISNS_DD_LIST p_dlist_src, ISNS_DD_LIST p_dlist_node); - - int - Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, - int flag); - int - ISNSdbGetAttrISCSI (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, - ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - - int - SNSRemoveISCSINodeEntry (char *iscsi_node_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - Send_IFCP_SCN (SOIP_Ifcp * p_src_node, char *p_src_name, - uint32_t event_bitmap); - - int - ISNSdbAddAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg); - - int - send_iscsi_scn_to_members ( SOIP_Iscsi * p_src_node, char *p_src_name, - ISNS_Msg *p_msg, uint32_t event_bitmap ); - - int - SNSdbAddAttrEntity (char **attr_indx, char **key_indx, - ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); - - int - Remove_DD_from_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); - - int - SNSdbGetNextOfKey (ISNS_Key * key); - - void - ISNSExceptionHdlr (void); - - int - Add_dds_to_dd (SOIP_Dds *p_dds, int dd_id); - - int - Remove_DD_from_IFCP_Node (int id, char *p_node_name); - - int - Add_DD_to_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); - - int - Add_DD_Member (SOIP_Dd * p_dd, char *ptr, int p_len, uint32_t type, uint32_t status, uint32_t index); - - int - Remove_DD_Member (SOIP_Dd *p_dd, char *ptr, uint32_t type); - - int - Add_DD_to_IFCP_Node (int id, char *p_node_name); - - int - SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, - ISNS_DD_LIST p_dlist_src, int flag); - - int - Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, - SOIP_Entity * p_entity, - ISNS_DD_LIST p_list, int flag); - - int - Remove_dd_from_dds (SOIP_Dds * p_dds, int id); - - int - SNSProcessPortalOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Portal * p_portal); - - int - ISNSdbProcessPortOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Ifcp * p_port); - - int - ISNSdbProcessEntityOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Entity *p_entity); - - int - ISNSdbAddAttrISCSINode (char **attr_indx, char **key_indx, - ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); - - int - ISNSFindTag (int start_indx, int key, char **attr_indx); - - ISNS_Attr * - ISNSFindKeyInResponseMsg (int key, ISNS_Msg * msg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - 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 - SNSdbGetAttrEntity (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, - ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - - int - SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrEntity (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPort (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - SNSdbGetAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * md, - ISNS_Msg * p_rspmsg); - - int - SNSdbGetAttrPort (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, - ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - - int - SNSdbGetAttrPortal (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, - ISNS_Msg_Descp * md, ISNS_Msg * p_rsp_msg); - - int - ISNSdbRemoveAttrEntityEntry (char *p_entity_id, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - int - ISNSdbAddAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbAddAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNS_Process_SCN(ISNS_Msg_Descp *p_md, ISNS_Msg *p_rsp_msg); - - int - ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ); - - int - ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry); - - int - ISNSdbWrite (ISNS_Key *key, SOIP_DB_Entry entry); - - int - ISNSdbDelete (ISNS_Key *key); /********************************************************************* --- 88,92 ---- Index: iSNSesi.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSesi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSesi.c 3 Nov 2006 18:55:41 -0000 1.1 --- iSNSesi.c 3 Nov 2006 20:22:29 -0000 1.2 *************** *** 37,47 **** */ #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" --- 37,50 ---- */ #include "iSNS.h" + #include "iSNSmsg.h" + #include "iSNSList.h" #include "iSNSdb.h" + #include "iSNSesi.h" + #include "iSNSresponse.h" + #include "iSNSreg.h" #include "iSNStypes.h" #include "iSNScomm.h" #include "iSNSbuffer.h" #include "iSNStbl.h" #include "iSNSparse.h" Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iSNSUtil.c 2 Nov 2006 21:19:20 -0000 1.6 --- iSNSUtil.c 3 Nov 2006 20:22:29 -0000 1.7 *************** *** 47,51 **** #include "iSNSdebug.h" - void SNSDisplay_Trace_Data (datum data); void SNSDisplay_Entity (SOIP_Entity *p_entity); --- 47,50 ---- *************** *** 376,380 **** * are enabled in the bit mask */ ! for (i = 0, nptr = (char *) ((FC4_Types *)fc4_types)->bitmap; i < 8; i++, nptr++) --- 375,379 ---- * are enabled in the bit mask */ ! for (i = 0, nptr = (uint32_t *) ((FC4_Types *)fc4_types)->bitmap; i < 8; i++, nptr++) Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSdereg.c 3 Nov 2006 18:55:41 -0000 1.2 --- iSNSdereg.c 3 Nov 2006 20:22:29 -0000 1.3 *************** *** 38,48 **** */ #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" --- 38,52 ---- */ #include "iSNS.h" + #include "iSNSmsg.h" + #include "iSNSList.h" #include "iSNSdb.h" + #include "iSNSreg.h" + #include "iSNSquery.h" + #include "iSNSscn.h" + #include "iSNSresponse.h" #include "iSNStypes.h" #include "iSNScomm.h" #include "iSNSbuffer.h" #include "iSNStbl.h" #include "iSNSparse.h" *************** *** 54,96 **** #endif - extern int sns_scn_debug; - extern int sns_scn_msg_filter; - extern int sns_rsync_debug; - extern int SNSGetMgmtAddr (void); - extern int sns_esi_interval; - - #ifndef SNS_LINUX - extern void NTWriteToFile(int len, void *ptr); - extern int NTReadFromFile(int *lenPtr, void *ptr); - #endif - /* Global */ extern int isns_db_debug;; - - extern int isns_scn_debug; - extern int isns_scn_msg_filter; - extern int isns_rsync_debug; - extern int sns_heartbeat_interval; - extern uint32_t isns_esi_interval; - extern datum ndb_fetch_sns (); - extern datum ndb_firstkey_isns (uint32_t key_type, char *key); - extern datum ndb_nextkey_isns (uint32_t key_type, datum key, char *pkey); - extern ISNS_ATTR_VALS_CB * ISNSAttrGetList (ISNS_Msg_Descp *p_md); /* - * SoIP service Database file descriptor - */ - //wrw static NDB_FILE dbfp; - - /* - * GDBM errno - */ - extern ndb_error ndb_errno; - - /* * static common variables for gdbm fetches * entry is for common registrations and queries --- 58,69 ---- Index: iSNSfsm.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSfsm.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSfsm.c 2 Apr 2002 20:56:54 -0000 1.2 --- iSNSfsm.c 3 Nov 2006 20:22:29 -0000 1.3 *************** *** 87,93 **** static void - SNSSendCommAck(ISNS_Msg_Descp *); - - static void SNSSendHeartbeat(void); --- 87,90 ---- Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSreg.c 3 Nov 2006 18:55:41 -0000 1.2 --- iSNSreg.c 3 Nov 2006 20:22:29 -0000 1.3 *************** *** 38,48 **** */ #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" --- 38,52 ---- */ #include "iSNS.h" #include "iSNStypes.h" #include "iSNSmsg.h" + #include "iSNSList.h" + #include "iSNSdb.h" + #include "iSNSreg.h" + #include "iSNSscn.h" + #include "iSNSquery.h" + #include "iSNSresponse.h" #include "iSNScomm.h" #include "iSNSbuffer.h" #include "iSNStbl.h" #include "iSNSparse.h" Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** iSNSdb.c 3 Nov 2006 18:55:41 -0000 1.9 --- iSNSdb.c 3 Nov 2006 20:22:29 -0000 1.10 *************** *** 39,42 **** --- 39,43 ---- #include "iSNS.h" #include "iSNSdb.h" + #include "ndb.h" #include "iSNStypes.h" #include "iSNSmsg.h" *************** *** 54,61 **** int isns_db_debug = 0; - extern datum ndb_fetch_sns (); - extern datum ndb_firstkey_isns (uint32_t key_type, char *key); - extern datum ndb_nextkey_isns (uint32_t key_type, datum key, char *pkey); - /* * SoIP service Database file descriptor --- 55,58 ---- Index: iSNSscn.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSscn.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSscn.c 3 Nov 2006 18:55:41 -0000 1.1 --- iSNSscn.c 3 Nov 2006 20:22:29 -0000 1.2 *************** *** 48,56 **** #include "iSNSdebug.h" - - //#ifndef MAX_PARSE_ATTRS - //#define MAX_PARSE_ATTRS 30 - //#endif - extern int sns_scn_debug; extern int sns_scn_msg_filter; --- 48,51 ---- *************** *** 59,67 **** extern int sns_esi_interval; - //#ifndef SNS_LINUX - //extern void NTWriteToFile(int len, void *ptr); - //extern int NTReadFromFile(int *lenPtr, void *ptr); - //#endif - /* Global */ extern int isns_db_debug; --- 54,57 ---- *************** *** 71,86 **** extern int isns_scn_msg_filter; extern int isns_rsync_debug; - //extern int sns_heartbeat_interval; - - //extern uint32_t isns_esi_interval; - - //extern datum ndb_fetch_sns (); - //extern datum ndb_firstkey_isns (uint32_t key_type, char *key); - //extern datum ndb_nextkey_isns (uint32_t key_type, datum key, char *pkey); - - /* - * GDBM errno - */ - //extern ndb_error ndb_errno; /* --- 61,64 ---- *************** *** 100,104 **** SOIP_Dd_Member *ddmem; /* [100]; */ - //ISNS_LIST esi_list; ISNS_LIST scn_list; ISNS_LIST scn_callback_list; --- 78,81 ---- *************** *** 117,120 **** --- 94,98 ---- IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; + /* * Local function prototypes Index: iSNStrcv.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNStrcv.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNStrcv.c 2 Apr 2002 20:56:54 -0000 1.2 --- iSNStrcv.c 3 Nov 2006 20:22:29 -0000 1.3 *************** *** 121,125 **** if ((sockfd = accept (sock, (struct sockaddr *) &their_addr, ! &len)) < 0) { printf ("Fatal Error while doing an Accept.\n"); --- 121,125 ---- if ((sockfd = accept (sock, (struct sockaddr *) &their_addr, ! (socklen_t *)&len)) < 0) { printf ("Fatal Error while doing an Accept.\n"); Index: iSNSMain.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSMain.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iSNSMain.c 3 Nov 2006 18:55:41 -0000 1.6 --- iSNSMain.c 3 Nov 2006 20:22:29 -0000 1.7 *************** *** 65,69 **** #include "iSNStbl.h" #include "iSNSdb.h" ! #ifdef SNS_DEBUG --- 65,72 ---- #include "iSNStbl.h" #include "iSNSdb.h" ! #include "iSNSreg.h" ! #include "iSNSquery.h" ! #include "iSNSesi.h" ! #include "iSNSscn.h" #ifdef SNS_DEBUG Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSquery.c 3 Nov 2006 18:55:41 -0000 1.2 --- iSNSquery.c 3 Nov 2006 20:22:29 -0000 1.3 *************** *** 38,48 **** */ #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" --- 38,51 ---- */ #include "iSNS.h" + #include "iSNSmsg.h" + #include "iSNSList.h" #include "iSNSdb.h" + #include "iSNSquery.h" + #include "iSNSresponse.h" + #include "iSNSreg.h" #include "iSNStypes.h" #include "iSNScomm.h" #include "iSNSbuffer.h" #include "iSNStbl.h" #include "iSNSparse.h" *************** *** 54,91 **** #endif - extern int sns_scn_debug; - extern int sns_scn_msg_filter; - extern int sns_rsync_debug; - extern int SNSGetMgmtAddr (void); - extern int sns_esi_interval; - - #ifndef SNS_LINUX - extern void NTWriteToFile(int len, void *ptr); - extern int NTReadFromFile(int *lenPtr, void *ptr); - #endif - /* Global */ extern int isns_db_debug;; - - extern int isns_scn_debug; - extern int isns_scn_msg_filter; - extern int isns_rsync_debug; - extern int sns_heartbeat_interval; - extern uint32_t isns_esi_interval; - extern datum ndb_fetch_sns (); - extern datum ndb_firstkey_isns (uint32_t key_type, char *key); - extern datum ndb_nextkey_isns (uint32_t key_type, datum key, char *pkey); - extern ISNS_ATTR_VALS_CB * ISNSAttrGetList (ISNS_Msg_Descp *p_md); /* - * GDBM errno - */ - extern ndb_error ndb_errno; - - /* * static common variables for gdbm fetches * entry is for common registrations and queries --- 57,68 ---- *************** *** 112,116 **** extern ISNS_Msg_Descp *p_rspMd; - extern dbStats iSNS_stats; --- 89,92 ---- *************** *** 3728,3748 **** /* Fetch each DDS. */ dd_key.id = *(uint32_t *)GetNodeData(pnode2); - k.dptr = (char *) &dd_key; - k.dsize = DD_KEY_SIZE; - - d = ndb_fetch_sns (DD_ID_KEY, k, (char *) &lentry3); - - if (d.dptr == NULL) - { - printf ("***ERROR: Fetching DDS.\n"); - return (ERROR); - } ! if (lentry3.data_type != DDS_ID_KEY) ! { ! DEBUG_2 (isns_db_debug & 1, (Database key mismatch %u %u), ! lentry3.data_type, DDS_ID_KEY); ! return (ISNS_UNKNOWN_ERR); ! } p_dds = (SOIP_Dds *)&lentry3.data; --- 3704,3714 ---- /* Fetch each DDS. */ dd_key.id = *(uint32_t *)GetNodeData(pnode2); ! ISNS_Key read_key; ! read_key.tag = DD_ID_KEY; ! read_key.val.dd_id=dd_key.id; ! rval = ISNSdbRead(&read_key,&lentry3); ! if (rval != SUCCESS) ! return rval; p_dds = (SOIP_Dds *)&lentry3.data; |
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7941/src Modified Files: iSNSMain.c iSNSdb.c iSNSdereg.c iSNSparse.c iSNSquery.c iSNSreg.c Added Files: iSNSesi.c iSNSresponse.c iSNSscn.c Log Message: Separate iSNSdb.c into iSNSesi.c, iSNSscn.c, iSNSresponse.c Index: iSNSquery.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSquery.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSquery.c 3 Nov 2006 01:10:24 -0000 1.1 --- iSNSquery.c 3 Nov 2006 18:55:41 -0000 1.2 *************** *** 122,171 **** extern IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; ! /* ! * Local function prototypes ! */ ! int ! ISNS_GetDD_ID_from_sym ( char *p_sym ); ! ! int ! ISNS_GetDDS_ID_from_sym ( char *p_sym ); ! ! int ! ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); ! ! int ! ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); ! ! int ! ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); ! ! int ! send_iscsi_scn_on_dd_mem_change( SOIP_Iscsi * p_src_node, char *p_src_name, ! SOIP_Dd *p_dd, uint32_t dd_id, uint32_t event_bitmap); ! ! int ! send_scn_parameter_change_to_all( ISNS_Msg *p_msg, uint32_t bitmap ); ! ! int ! send_scn_object_change_to_all( uint32_t src_type, uint32_t src_len, ! void *src_val, uint32_t bitmap ); ! ! int ! change_dd_member_active_flag( SOIP_Dd *p_dd ); ! ! int ! ISNS_DeRegisterSCN ( ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); ! ! int ! ISNS_RegisterSCN (ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); ! ! int ! ISNSdbRemoveAttr (ISNS_Msg_Descp * p_md); ! int ! ISNSdbAddAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg *rspMsg ); ! int ! ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); static int --- 122,136 ---- extern IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; ! static int ! SNSdbGetAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * md, ! ISNS_Msg * p_rspmsg); ! static int ! SNSdbGetAttrPort (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ! ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); ! static int ! SNSdbGetAttrPortal (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ! ISNS_Msg_Descp * md, ISNS_Msg * p_rsp_msg); static int *************** *** 175,452 **** ISNSGetNextAttr( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - int - ISNSdbRemoveAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbRemoveAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); - - int - send_dd_iscsi_scn( SOIP_Dd *p_dd, int dd_id, uint32_t scn_bitmap ); - - int - IsDDActive(int dd_id, int exclude_dds_id); - - int - IsDDSActive(int dds_id); - - int - ISNSAddSCNEntry(uint32_t type, char *nodename, uint32_t bitmap, int sockfd); - - int - ISNSRemoveSCNEntry(uint32_t type, char *nodename); - - int - ISNSRemoveESIEntry(IP_Address *p_ip, uint32_t port, char *p_eid); - - int - ISNSAddESIEntry(IP_Address *p_ip, uint32_t port, char *p_eid); - static int SNSdbGetAttrDD (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - 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); - static int SNSdbGetAttrDDSEntry (int id, char **attr_indx, ISNS_Msg * p_msg); - int - SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - ISNSdbAddAttrPortal (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg); - - int - AddCert (void **ptr, int *size, void *p_cert, int cert_size); - - int - RemoveCert (void **ptr); - - int - SNSRemoveIFCPNodeEntry (char *ifcp_node_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - Activate_DD_Membership (uint32_t type, void *p_node); - - int - SNSRemoveFCNodeEntry (char *p_key, ISNS_Msg * p_rspmsg); - - int - ISNSdbProcessISCSIOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Iscsi * p_node); - - int - ISNSdbProcessFCNodeOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Fc_Node * p_node); - int - SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, - SOIP_DB_Entry * p_entry); - static int SNSdbGetAttrDDS (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - int - Get_Active_DD_List_From_ISCSI_Node (char *nodename, ISNS_DD_LIST p_dlist, - int flag); - - int - Append_Nodes_From_DD_List (ISNS_DD_LIST p_dlist, - SOIP_Dd_Member p_ddmem[], uint32_t type); - - int - Check_Overlap_DD (ISNS_DD_LIST p_dlist_src, ISNS_DD_LIST p_dlist_node); - - int - Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, - int flag); - static int ISNSdbGetAttrISCSI (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - int - SNSRemoveISCSINodeEntry (char *iscsi_node_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - Send_IFCP_SCN (SOIP_Ifcp * p_src_node, char *p_src_name, - uint32_t event_bitmap); - - int - ISNSdbAddAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg); - - int - send_iscsi_scn_to_members ( SOIP_Iscsi * p_src_node, char *p_src_name, - ISNS_Msg *p_msg, uint32_t event_bitmap ); - - int - SNSdbAddAttrEntity (char **attr_indx, char **key_indx, - ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); - - int - Remove_DD_from_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); - - int - SNSdbGetNextOfKey (ISNS_Key * key); - - void - ISNSExceptionHdlr (void); - - int - Add_dds_to_dd (SOIP_Dds *p_dds, int dd_id); - - int - Remove_DD_from_IFCP_Node (int id, char *p_node_name); - - int - Add_DD_to_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); - - int - Add_DD_Member (SOIP_Dd * p_dd, char *ptr, int p_len, uint32_t type, uint32_t status, uint32_t index); - - int - Remove_DD_Member (SOIP_Dd *p_dd, char *ptr, uint32_t type); - - int - Add_DD_to_IFCP_Node (int id, char *p_node_name); - - int - SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, - ISNS_DD_LIST p_dlist_src, int flag); - - int - Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, - SOIP_Entity * p_entity, - ISNS_DD_LIST p_list, int flag); - - int - Remove_dd_from_dds (SOIP_Dds * p_dds, int id); - - int - SNSProcessPortalOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Portal * p_portal); - - int - ISNSdbProcessPortOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Ifcp * p_port); - - int - ISNSdbProcessEntityOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Entity *p_entity); - - int - ISNSdbAddAttrISCSINode (char **attr_indx, char **key_indx, - ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); - - int - ISNSFindTag (int start_indx, int key, char **attr_indx); - - ISNS_Attr * - ISNSFindKeyInResponseMsg (int key, ISNS_Msg * msg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - 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); - static int SNSdbGetAttrEntity (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - int - SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrEntity (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPort (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - static int - SNSdbGetAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * md, - ISNS_Msg * p_rspmsg); - - static int - SNSdbGetAttrPort (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, - ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); - - static int - SNSdbGetAttrPortal (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, - ISNS_Msg_Descp * md, ISNS_Msg * p_rsp_msg); - - int - ISNSdbRemoveAttrEntityEntry (char *p_entity_id, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - int - ISNSdbAddAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbAddAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNS_Process_SCN(ISNS_Msg_Descp *p_md, ISNS_Msg *p_rsp_msg); - - int - ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ); - - int - ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry); - - int - ISNSdbWrite (ISNS_Key *key, SOIP_DB_Entry entry); - - int - ISNSdbDelete (ISNS_Key *key); - - int - ISNSdbProcessDDSOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, - SOIP_Dds *p_dds); - - int - ISNSdbProcessDDOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, - SOIP_Dd *p_dd); - - void * - ISNSGetDataFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index); - - int - Append_DD_to_List (ISNS_DD_LIST p_dlist, uint32_t id); /********************************************************************* --- 140,162 ---- --- NEW FILE: iSNSresponse.c --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, 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. ***********************************************************************/ /* * 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 extern int sns_scn_debug; extern int sns_scn_msg_filter; extern int sns_rsync_debug; extern int SNSGetMgmtAddr (void); extern int sns_esi_interval; #ifndef SNS_LINUX extern void NTWriteToFile(int len, void *ptr); extern int NTReadFromFile(int *lenPtr, void *ptr); #endif /* Global */ extern int isns_db_debug; extern int isns_scn_debug; extern int isns_scn_msg_filter; extern int isns_rsync_debug; extern int sns_heartbeat_interval; extern datum ndb_fetch_sns (); extern datum ndb_firstkey_isns (uint32_t key_type, char *key); extern datum ndb_nextkey_isns (uint32_t key_type, datum key, char *pkey); extern ISNS_ATTR_VALS_CB * ISNSAttrGetList (ISNS_Msg_Descp *p_md); /* * GDBM errno */ extern ndb_error ndb_errno; /* * 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 esi_list; 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; #define MAX_HASH 1024 #define HASH_MARK 0x3FF #define MAP_HASH(a) (a & HASH_MARK) IDX_HASH_ENTRY *entityIdxHashTbl[MAX_HASH]; IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; /* * Local function prototypes */ int ISNS_GetDD_ID_from_sym ( char *p_sym ); int ISNS_GetDDS_ID_from_sym ( char *p_sym ); int ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int send_iscsi_scn_on_dd_mem_change( SOIP_Iscsi * p_src_node, char *p_src_name, SOIP_Dd *p_dd, uint32_t dd_id, uint32_t event_bitmap); int send_scn_parameter_change_to_all( ISNS_Msg *p_msg, uint32_t bitmap ); int send_scn_object_change_to_all( uint32_t src_type, uint32_t src_len, void *src_val, uint32_t bitmap ); int change_dd_member_active_flag( SOIP_Dd *p_dd ); int ISNS_DeRegisterSCN ( ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int ISNS_RegisterSCN (ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int ISNSdbRemoveAttr (ISNS_Msg_Descp * p_md); int ISNSdbAddAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg *rspMsg ); int ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); int ISNSGetNextAttr( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); int ISNSdbRemoveAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); int ISNSdbRemoveAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); int SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); int send_dd_iscsi_scn( SOIP_Dd *p_dd, int dd_id, uint32_t scn_bitmap ); int IsDDActive(int dd_id, int exclude_dds_id); int IsDDSActive(int dds_id); int ISNSAddSCNEntry(uint32_t type, char *nodename, uint32_t bitmap, int sockfd); int ISNSRemoveSCNEntry(uint32_t type, char *nodename); 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 SNSdbGetAttrDD (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); 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 SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); int ISNSdbAddAttrPortal (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); int AddCert (void **ptr, int *size, void *p_cert, int cert_size); int RemoveCert (void **ptr); int SNSRemoveIFCPNodeEntry (char *ifcp_node_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); int Activate_DD_Membership (uint32_t type, void *p_node); int SNSRemoveFCNodeEntry (char *p_key, ISNS_Msg * p_rspmsg); int ISNSdbProcessISCSIOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, SOIP_Iscsi * p_node); int SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, SOIP_DB_Entry * p_entry); int SNSdbGetAttrDDS (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); int Get_Active_DD_List_From_ISCSI_Node (char *nodename, ISNS_DD_LIST p_dlist, int flag); int Append_Nodes_From_DD_List (ISNS_DD_LIST p_dlist, SOIP_Dd_Member p_ddmem[], uint32_t type); int Check_Overlap_DD (ISNS_DD_LIST p_dlist_src, ISNS_DD_LIST p_dlist_node); int Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, int flag); int ISNSdbGetAttrISCSI (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); int SNSRemoveISCSINodeEntry (char *iscsi_node_key, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); int Send_IFCP_SCN (SOIP_Ifcp * p_src_node, char *p_src_name, uint32_t event_bitmap); int ISNSdbAddAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); int send_iscsi_scn_to_members ( SOIP_Iscsi * p_src_node, char *p_src_name, ISNS_Msg *p_msg, uint32_t event_bitmap ); int SNSdbAddAttrEntity (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); int Remove_DD_from_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); int SNSdbGetNextOfKey (ISNS_Key * key); void ISNSExceptionHdlr (void); int Add_dds_to_dd (SOIP_Dds *p_dds, int dd_id); int Remove_DD_from_IFCP_Node (int id, char *p_node_name); int Add_DD_to_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); int Add_DD_Member (SOIP_Dd * p_dd, char *ptr, int p_len, uint32_t type, uint32_t status, uint32_t index); int Remove_DD_Member (SOIP_Dd *p_dd, char *ptr, uint32_t type); int Add_DD_to_IFCP_Node (int id, char *p_node_name); int SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, ISNS_DD_LIST p_dlist_src, int flag); int Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, SOIP_Entity * p_entity, ISNS_DD_LIST p_list, int flag); int Remove_dd_from_dds (SOIP_Dds * p_dds, int id); int SNSProcessPortalOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, SOIP_Portal * p_portal); int ISNSdbProcessPortOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, SOIP_Ifcp * p_port); int ISNSdbProcessEntityOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, SOIP_Entity *p_entity); int ISNSdbAddAttrISCSINode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); int ISNSFindTag (int start_indx, int key, char **attr_indx); ISNS_Attr * ISNSFindKeyInResponseMsg (int key, ISNS_Msg * msg); int ISNS_Process_SCN_Event (ISNS_Msg *p_msg); 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 SNSdbGetAttrEntity (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); int SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrEntity (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrPort (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbGetAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); int SNSdbGetAttrPort (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rspmsg); int SNSdbGetAttrPortal (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, ISNS_Msg * p_rsp_msg); int ISNSdbRemoveAttrEntityEntry (char *p_entity_id, ISNS_Attr * src_attr, ISNS_Msg * p_rspmsg); int SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); int ISNS_Process_SCN_Event (ISNS_Msg *p_msg); int ISNSdbAddAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); int ISNSdbAddAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); int ISNS_Process_SCN(ISNS_Msg_Descp *p_md, ISNS_Msg *p_rsp_msg); int ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ); int ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry); int ISNSdbWrite (ISNS_Key *key, SOIP_DB_Entry entry); int ISNSdbDelete (ISNS_Key *key); /********************************************************************* _ISNSAppendAttr Appends the attribute to the message in the TLV format. *********************************************************************/ int ISNSAppendAttr (ISNS_Msg * msg, int tag, int size, char *p_value, int value) { ISNS_Attr *attr; if (msg == NULL) return (ERROR); if (msg->hdr.msg_len == 0) msg->hdr.msg_len = 4 + ISNS_SIZEOF_TAG; /* Jump to the end */ attr = (ISNS_Attr *)((char *) &msg->payload + msg->hdr.msg_len); /* insert */ attr->tag = tag; attr->len = size; if (p_value) { memcpy (&attr->val, p_value, attr->len); } else if (attr->len == 8) { /* Special time format */ attr->val.timestamp.t_pad = 0; attr->val.timestamp.t_time = htonl (value); } else { *(uint32_t *) & attr->val = value; } msg->hdr.msg_len += attr->len + ISNS_SIZEOF_TAG; attr = (ISNS_Attr *)((char *) attr + attr->len + ISNS_SIZEOF_TAG); return (ISNS_NO_ERR); } int ISNSAppendTimeStamp ( ISNS_Msg *msg ) { ISNS_Attr *attr; time_t t; if ( msg == NULL ) return ( ERROR ); /* Jump to end */ attr = (ISNS_Attr *)((char *) &msg->payload + msg->hdr.msg_len); /* AppendTime */ attr->tag = ISNS_TIMESTAMP; attr->len = 8; attr->val.timestamp.t_pad = 0; attr->val.timestamp.t_time = htonl (time(&t)); msg->hdr.msg_len += attr->len + ISNS_SIZEOF_TAG; return (SUCCESS); } /********************************************************************* _ISNSAppendKey Appends the attribute to the message in the TLV format. *********************************************************************/ int ISNSAppendKey (ISNS_Msg * msg, int tag, int size, char *p_value, int value) { ISNS_Attr *attr; if (msg == NULL) return (ERROR); if (msg->hdr.msg_len == 0 && msg->hdr.type != ISNS_SCN && msg->hdr.type != ISNS_ESI && msg->hdr.type != ISNS_SCN_REG_REQ) { msg->hdr.msg_len = 4; /* Error Code */ } /* Jump to end */ attr = (ISNS_Attr *)((char *) &msg->payload + msg->hdr.msg_len); /* insert the key(s) */ attr->tag = tag; attr->len = size; if (p_value) { memcpy (&attr->val, p_value, attr->len); } else if (attr->len == 8) { /* Special time format */ attr->val.timestamp.t_pad = 0; attr->val.timestamp.t_time = htonl (value); } else { *(uint32_t *) & attr->val = value; } msg->hdr.msg_len += attr->len + ISNS_SIZEOF_TAG; return (ISNS_NO_ERR); } /********************************************************************* Finds a tag in the response msg. *********************************************************************/ ISNS_Attr * ISNSFindAttrInResponseMsg ( int key, ISNS_Msg *msg ) { ISNS_Attr *attr; /* Find Delimiter */ attr = (ISNS_Attr *)((char *) &msg->payload + 4); while ((char *)attr < (char *)&msg->payload + msg->hdr.msg_len) { if ( attr->tag == key ) return ( attr ); attr = (ISNS_Attr *)((char *) attr + attr->len + ISNS_SIZEOF_TAG); } return ( NULL ); } /********************************************************************* Finds a tag in the response msg. *********************************************************************/ ISNS_Attr * ISNSFindKeyInResponseMsg (int key, ISNS_Msg * msg) { ISNS_Attr *attr; /* Find Delimiter */ attr = (ISNS_Attr *)((char *) &msg->payload + 4); while ((char *)attr < (char *)&msg->payload + msg->hdr.msg_len && attr->tag != ISNS_DELIMITER) { if (attr->tag == key) return (attr); attr = (ISNS_Attr *)((char *) attr + attr->len + ISNS_SIZEOF_TAG); } return (NULL); } /********************************************************************* _ISNSAppendTLV Appends a TLV to a spot in memory at an offset. *********************************************************************/ int ISNSAppendTLV(void *ptr, int *offset, int tag, int len, char *p_value, int value) { ISNS_Attr *attr; attr = (ISNS_Attr *)((char *)ptr+(*offset)); /* insert */ attr->tag = tag; attr->len = len; if (p_value) { memcpy (&attr->val, p_value, attr->len); } else { *(uint32_t *) & attr->val = value; } *offset += ISNS_SIZEOF_TAG + attr->len; return (ISNS_NO_ERR); } --- NEW FILE: iSNSesi.c --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, 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. ***********************************************************************/ /* * This file contains source code for managing the SCN - state change notification. * */ #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" /* Global */ uint32_t isns_esi_interval = 15; extern int sns_esi_interval; extern int isns_db_debug; extern int sns_heartbeat_interval; /* * 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 */ static SOIP_DB_Entry entry; /* top level fetches ONLY */ 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_LIST esi_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; #define MAX_HASH 1024 #define HASH_MARK 0x3FF #define MAP_HASH(a) (a & HASH_MARK) IDX_HASH_ENTRY *entityIdxHashTbl[MAX_HASH]; IDX_HASH_ENTRY *iscsiIdxHashTbl[MAX_HASH]; IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; /********************************************************************* Sends out one or more ESI(s). *********************************************************************/ int ISNS_SendESI (void) { 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; p_md = p_rspMd; memset( p_md, 0, sizeof( ISNS_Msg_Descp ) ); if (isns_role != ISNS_PRIMARY_SERVER) { return ( ISNS_NO_ERR ); } if ( IsEmptyList(&esi_list) ) { /* Nothing to do */ return (ISNS_NO_ERR); } /* Go through the ESI Table */ p_esi_node = GetNextNode( &esi_list, NULL ); while ( p_esi_node ) { /* 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) return rval; 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_db_debug & 2, (Sending ESI to Entity %s), lentry->eid.id); ISNSAppendKey ( &p_md->msg, ISNS_PORTAL_IP, ISNS_IP_SIZE, p_portal->ip_addr.v, 0); ISNSAppendKey ( &p_md->msg, ISNS_PORTAL_PORT, ISNS_PORTAL_PORT_SIZE, NULL, p_portal->ip_port); memcpy ( &p_md->cb.sock.addr.sin_addr.s_addr, p_portal->ip_addr.v + 12, 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 ) { p_md->msg.hdr.xid = esi_xid++; p_md->cb.sock.socketType = ISNS_SOCKET_TYPE_UDP; p_md->cb.sock.addr.sin_port = htons ((short)(p_portal->esi_port & 0xFFFF)); } else { p_md->msg.hdr.xid = esi_xid++; p_md->cb.sock.socketType = ISNS_SOCKET_TYPE_TCP; p_md->cb.sock.sockfd = p_portal->esi_sockfd; } 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 */ 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; 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); } } return ( ISNS_NO_ERR ); } /********************************************************************* Processes an ESI response. *********************************************************************/ int 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; SOIP_Entity_Key db_entity_id = {{0}}; int i; int len; char *attr_indx[SNS_MAX_ATTRS]; char *key_indx[SNS_MAX_ATTRS]; int rval; ISNSParseMsg( &p_md->msg, attr_indx, key_indx, NULL ); i = ISNSFindTag (0, ISNS_ENTITY_ID, key_indx); if (i == -1) { DEBUG_0 (isns_db_debug & 1, (Entity ID tag not found in msg)); return ( ERROR ); } 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); if ( i == -1 ) { DEBUG_0 (isns_db_debug & 1, (Portal IP tag not found in msg)); return ( ERROR ); } p_attr = (ISNS_Attr *)(key_indx[i]); memcpy(db_portal.ip_addr.v, p_attr->val.ip_addr.v, ISNS_IP_SIZE); i = ISNSFindTag (0, ISNS_PORTAL_PORT, key_indx); if (i == -1) { DEBUG_0 (isns_db_debug & 1, (Portal PORT tag not found in msg)); return ( ERROR ); } 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; p_portal = &entry.data.portal; 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 ); } Index: iSNSparse.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSparse.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iSNSparse.c 25 Oct 2006 21:19:37 -0000 1.5 --- iSNSparse.c 3 Nov 2006 18:55:41 -0000 1.6 *************** *** 665,666 **** --- 665,687 ---- return (-1); } + + /********************************************************************* + Finds a tag. + *********************************************************************/ + int + ISNSFindTag (int startIndex, int key, char **attr_indx) + { + int ii; + ISNS_Attr *attr; + + for (ii = startIndex; ii < SNS_MAX_ATTRS && attr_indx[ii]; ii++) + { + attr = (ISNS_Attr *) attr_indx[ii]; + if (attr->tag == key) + { + return (ii); + } + } + return (-1); + } + Index: iSNSdereg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdereg.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSdereg.c 3 Nov 2006 01:10:24 -0000 1.1 --- iSNSdereg.c 3 Nov 2006 18:55:41 -0000 1.2 *************** *** 127,447 **** extern IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - /* - * Local function prototypes - */ - int - ISNS_GetDD_ID_from_sym ( char *p_sym ); - - int - ISNS_GetDDS_ID_from_sym ( char *p_sym ); - - int - ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - send_iscsi_scn_on_dd_mem_change( SOIP_Iscsi * p_src_node, char *p_src_name, - SOIP_Dd *p_dd, uint32_t dd_id, uint32_t event_bitmap); - - int - send_scn_parameter_change_to_all( ISNS_Msg *p_msg, uint32_t bitmap ); - - int - send_scn_object_change_to_all( uint32_t src_type, uint32_t src_len, - void *src_val, uint32_t bitmap ); - - int - change_dd_member_active_flag( SOIP_Dd *p_dd ); - - int - ISNS_DeRegisterSCN ( ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - ISNS_RegisterSCN (ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - ISNSdbRemoveAttr (ISNS_Msg_Descp * p_md); - - int - ISNSdbAddAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg *rspMsg ); - - int - ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); - - int - ISNSGetNextAttr( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbRemoveAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbRemoveAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); - - int - send_dd_iscsi_scn( SOIP_Dd *p_dd, int dd_id, uint32_t scn_bitmap ); - - int - IsDDActive(int dd_id, int exclude_dds_id); - - int - IsDDSActive(int dds_id); - - int - ISNSAddSCNEntry(uint32_t type, char *nodename, uint32_t bitmap, int sockfd); - - int - ISNSRemoveSCNEntry(uint32_t type, char *nodename); - - 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); - - int - Get_Active_DD_List (ISNS_LIST *dd_list, ISNS_DD_LIST p_dlist, int flag); - - - int - SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - ISNSdbAddAttrPortal (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg);\ - - int - SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg); - - int - AddCert (void **ptr, int *size, void *p_cert, int cert_size); - - int - RemoveCert (void **ptr); - - int - SNSRemoveIFCPNodeEntry (char *ifcp_node_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - Activate_DD_Membership (uint32_t type, void *p_node); - - int - SNSRemoveFCNodeEntry (char *p_key, ISNS_Msg * p_rspmsg); - - int - ISNSdbProcessISCSIOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Iscsi * p_node); - - int - ISNSdbProcessFCNodeOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Fc_Node * p_node); - int - SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, - SOIP_DB_Entry * p_entry); - - - int - Get_Active_DD_List_From_ISCSI_Node (char *nodename, ISNS_DD_LIST p_dlist, - int flag); - - int - Append_Nodes_From_DD_List (ISNS_DD_LIST p_dlist, - SOIP_Dd_Member p_ddmem[], uint32_t type); - - int - Check_Overlap_DD (ISNS_DD_LIST p_dlist_src, ISNS_DD_LIST p_dlist_node); - - int - Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, - int flag); - - - int - SNSRemoveISCSINodeEntry (char *iscsi_node_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - Send_IFCP_SCN (SOIP_Ifcp * p_src_node, char *p_src_name, - uint32_t event_bitmap); - - int - ISNSdbAddAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg); - - int - send_iscsi_scn_to_members ( SOIP_Iscsi * p_src_node, char *p_src_name, - ISNS_Msg *p_msg, uint32_t event_bitmap ); - - int - SNSdbAddAttrEntity (char **attr_indx, char **key_indx, - ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); - - int - Remove_DD_from_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); - - int - SNSdbGetNextOfKey (ISNS_Key * key); - - void - ISNSExceptionHdlr (void); - - int - Add_dds_to_dd (SOIP_Dds *p_dds, int dd_id); - - int - Remove_DD_from_IFCP_Node (int id, char *p_node_name); - - int - Add_DD_to_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); - - int - Add_DD_Member (SOIP_Dd * p_dd, char *ptr, int p_len, uint32_t type, uint32_t status, uint32_t index); - - int - Remove_DD_Member (SOIP_Dd *p_dd, char *ptr, uint32_t type); - - int - Add_DD_to_IFCP_Node (int id, char *p_node_name); - - int - SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, - ISNS_DD_LIST p_dlist_src, int flag); - - int - Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, - SOIP_Entity * p_entity, - ISNS_DD_LIST p_list, int flag); - - int - Remove_dd_from_dds (SOIP_Dds * p_dds, int id); - - int - SNSProcessPortalOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Portal * p_portal); - - int - ISNSdbProcessPortOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Ifcp * p_port); - - int - ISNSdbProcessEntityOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Entity *p_entity); - - int - ISNSdbAddAttrISCSINode (char **attr_indx, char **key_indx, - ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); - - int - ISNSFindTag (int start_indx, int key, char **attr_indx); - - ISNS_Attr * - ISNSFindKeyInResponseMsg (int key, ISNS_Msg * msg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - 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 - SNSdbRemoveAttrEntity (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPort (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - ISNSdbRemoveAttrEntityEntry (char *p_entity_id, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - int - ISNSdbAddAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbAddAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNS_Process_SCN(ISNS_Msg_Descp *p_md, ISNS_Msg *p_rsp_msg); - - int - ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ); - - int - ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry); - - int - ISNSdbWrite (ISNS_Key *key, SOIP_DB_Entry entry); - - int - ISNSdbDelete (ISNS_Key *key); - - int - ISNSdbProcessDDSOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, - SOIP_Dds *p_dds); - - int - ISNSdbProcessDDOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, - SOIP_Dd *p_dd); - - void * - ISNSGetDataFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index); - - uint32_t ISNSGetNewPortalIdx(void); - - void ISNSAddToIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index, void*p_data,int size); - uint32_t ISNSGetIdxFromIdxHashTableByData(IDX_HASH_ENTRY **table, void *ptr, int len); - void ISNSRemoveFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index); - - int ISNS_GetNewDDS_ID (void); - int ISNS_GetNewDD_ID (void); - - int Check_Unique_DDS_Sym (SOIP_Dds * p_dds, char *p_sym_name); - int Check_Unique_DD_Sym (SOIP_Dd * p_dd, char *p_sym_name); - uint32_t ISNSGetNewEntityIdx(void); - uint32_t ISNSGetNewISCSIIdx(void); - uint32_t ISNSGetNewPortalIdx(void); - int SNSdbRemoveAttrDDS_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); - int SNSdbRemoveDD_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); - int - SNSdbRemoveDD_Member (int id, char **attr_indx, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - int - Disable_DD_Member (SOIP_Dd * p_dd, char *ptr, uint32_t type); /********************************************************************* --- 127,130 ---- Index: iSNSreg.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSreg.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iSNSreg.c 3 Nov 2006 01:10:24 -0000 1.1 --- iSNSreg.c 3 Nov 2006 18:55:41 -0000 1.2 *************** *** 54,94 **** #endif - extern int sns_scn_debug; - extern int sns_scn_msg_filter; - extern int sns_rsync_debug; - extern int SNSGetMgmtAddr (void); - extern int sns_esi_interval; - - #ifndef SNS_LINUX - extern void NTWriteToFile(int len, void *ptr); - extern int NTReadFromFile(int *lenPtr, void *ptr); - #endif - /* Global */ extern int isns_db_debug;; - - extern int isns_scn_debug; - extern int isns_scn_msg_filter; - extern int isns_rsync_debug; - extern int sns_heartbeat_interval; - extern uint32_t isns_esi_interval; - extern datum ndb_fetch_sns (); - extern datum ndb_firstkey_isns (uint32_t key_type, char *key); - extern datum ndb_nextkey_isns (uint32_t key_type, datum key, char *pkey); - - extern ISNS_ATTR_VALS_CB * - ISNSAttrGetList (ISNS_Msg_Descp *p_md); - - /* - * SoIP service Database file descriptor - */ - //wrw static NDB_FILE dbfp; - - /* - * GDBM errno - */ - extern ndb_error ndb_errno; /* --- 54,61 ---- *************** *** 115,119 **** extern ISNS_Msg_Descp *p_rspMd; - extern dbStats iSNS_stats; --- 82,85 ---- *************** *** 125,440 **** extern IDX_HASH_ENTRY *portalIdxHashTbl[MAX_HASH]; - /* - * Local function prototypes - */ - int - ISNS_GetDD_ID_from_sym ( char *p_sym ); - - int - ISNS_GetDDS_ID_from_sym ( char *p_sym ); - - int - ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - send_iscsi_scn_on_dd_mem_change( SOIP_Iscsi * p_src_node, char *p_src_name, - SOIP_Dd *p_dd, uint32_t dd_id, uint32_t event_bitmap); - - int - send_scn_parameter_change_to_all( ISNS_Msg *p_msg, uint32_t bitmap ); - - int - send_scn_object_change_to_all( uint32_t src_type, uint32_t src_len, - void *src_val, uint32_t bitmap ); - - int - change_dd_member_active_flag( SOIP_Dd *p_dd ); - - int - ISNS_DeRegisterSCN ( ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - ISNS_RegisterSCN (ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - ISNSdbRemoveAttr (ISNS_Msg_Descp * p_md); - - int - ISNSdbAddAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg *rspMsg ); - - int - ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); - - int - ISNSGetNextAttr( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbRemoveAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbRemoveAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); - - int - send_dd_iscsi_scn( SOIP_Dd *p_dd, int dd_id, uint32_t scn_bitmap ); - - int - IsDDActive(int dd_id, int exclude_dds_id); - - int - IsDDSActive(int dds_id); - - int - ISNSAddSCNEntry(uint32_t type, char *nodename, uint32_t bitmap, int sockfd); - - int - ISNSRemoveSCNEntry(uint32_t type, char *nodename); - - 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); - - int - Get_Active_DD_List (ISNS_LIST *dd_list, ISNS_DD_LIST p_dlist, int flag); - - - int - SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - ISNSdbAddAttrPortal (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg);\ - - int - SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg); - - int - AddCert (void **ptr, int *size, void *p_cert, int cert_size); - - int - RemoveCert (void **ptr); - - int - SNSRemoveIFCPNodeEntry (char *ifcp_node_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - Activate_DD_Membership (uint32_t type, void *p_node); - - int - SNSRemoveFCNodeEntry (char *p_key, ISNS_Msg * p_rspmsg); - - int - ISNSdbProcessISCSIOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Iscsi * p_node); - - int - ISNSdbProcessFCNodeOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Fc_Node * p_node); - int - SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, - SOIP_DB_Entry * p_entry); - - - int - Get_Active_DD_List_From_ISCSI_Node (char *nodename, ISNS_DD_LIST p_dlist, - int flag); - - int - Append_Nodes_From_DD_List (ISNS_DD_LIST p_dlist, - SOIP_Dd_Member p_ddmem[], uint32_t type); - - int - Check_Overlap_DD (ISNS_DD_LIST p_dlist_src, ISNS_DD_LIST p_dlist_node); - - int - Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, - int flag); - - - int - SNSRemoveISCSINodeEntry (char *iscsi_node_key, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - Send_IFCP_SCN (SOIP_Ifcp * p_src_node, char *p_src_name, - uint32_t event_bitmap); - - int - ISNSdbAddAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, - ISNS_Msg * p_rspmsg); - - int - send_iscsi_scn_to_members ( SOIP_Iscsi * p_src_node, char *p_src_name, - ISNS_Msg *p_msg, uint32_t event_bitmap ); - - int - SNSdbAddAttrEntity (char **attr_indx, char **key_indx, - ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); - - int - Remove_DD_from_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); - - int - SNSdbGetNextOfKey (ISNS_Key * key); - - void - ISNSExceptionHdlr (void); - - int - Add_dds_to_dd (SOIP_Dds *p_dds, int dd_id); - - int - Remove_DD_from_IFCP_Node (int id, char *p_node_name); - - int - Add_DD_to_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); - - int - Add_DD_Member (SOIP_Dd * p_dd, char *ptr, int p_len, uint32_t type, uint32_t status, uint32_t index); - - int - Remove_DD_Member (SOIP_Dd *p_dd, char *ptr, uint32_t type); - - int - Add_DD_to_IFCP_Node (int id, char *p_node_name); - - int - SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, - ISNS_DD_LIST p_dlist_src, int flag); - - int - Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, - SOIP_Entity * p_entity, - ISNS_DD_LIST p_list, int flag); - - int - Remove_dd_from_dds (SOIP_Dds * p_dds, int id); - - int - SNSProcessPortalOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Portal * p_portal); - - int - ISNSdbProcessPortOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Ifcp * p_port); - - int - ISNSdbProcessEntityOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, - SOIP_Entity *p_entity); - - int - ISNSdbAddAttrISCSINode (char **attr_indx, char **key_indx, - ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); - - int - ISNSFindTag (int start_indx, int key, char **attr_indx); - - ISNS_Attr * - ISNSFindKeyInResponseMsg (int key, ISNS_Msg * msg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - 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 - SNSdbRemoveAttrEntity (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPort (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - ISNSdbRemoveAttrEntityEntry (char *p_entity_id, ISNS_Attr * src_attr, - ISNS_Msg * p_rspmsg); - - int - SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); - - int - SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, - ISNS_Msg * rspmsg); - - int - ISNS_Process_SCN_Event (ISNS_Msg *p_msg); - - int - ISNSdbAddAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNSdbAddAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); - - int - ISNS_Process_SCN(ISNS_Msg_Descp *p_md, ISNS_Msg *p_rsp_msg); - - int - ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ); - - int - ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry); - - int - ISNSdbWrite (ISNS_Key *key, SOIP_DB_Entry entry); - - int - ISNSdbDelete (ISNS_Key *key); - - int - ISNSdbProcessDDSOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, - SOIP_Dds *p_dds); - - int - ISNSdbProcessDDOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, - SOIP_Dd *p_dd); - - void * - ISNSGetDataFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index); - - uint32_t ISNSGetNewPortalIdx(void); - - void ISNSAddToIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index, void*p_data,int size); - uint32_t ISNSGetIdxFromIdxHashTableByData(IDX_HASH_ENTRY **table, void *ptr, int len); - - int ISNS_GetNewDDS_ID (void); - int ISNS_GetNewDD_ID (void); - - int Check_Unique_DDS_Sym (SOIP_Dds * p_dds, char *p_sym_name); - int Check_Unique_DD_Sym (SOIP_Dd * p_dd, char *p_sym_name); - uint32_t ISNSGetNewEntityIdx(void); - uint32_t ISNSGetNewISCSIIdx(void); - uint32_t ISNSGetNewPortalIdx(void); - int SNSdbRemoveAttrDDS_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); - int SNSdbRemoveDD_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); - /********************************************************************* _SNSdbAddAttr --- 91,94 ---- *************** *** 3743,3744 **** --- 3397,3718 ---- #endif + /********************************************************************* + *********************************************************************/ + int + change_dd_member_active_flag( SOIP_Dd *p_dd ) + { + ISNS_LIST_NODE *lnode; + ISNS_LIST_NODE *lnode2; + SOIP_Dd_Member *p_member; + SOIP_DB_Entry lentry; + uint32_t activeFlag; + SOIP_Iscsi *p_node; + SOIP_ISCSI_Node_Id db_node_name; + uint32_t old_activeFlag; + ISNS_Key key; + int rval; + + /* For each dd member */ + lnode = NULL; + while ( (lnode = GetNextNode(&p_dd->member_list, lnode)) ) + { + p_member = (SOIP_Dd_Member *) GetNodeData(lnode); + + if (!p_member->type || p_member->status == ISNS_DD_MEMBER_DISABLE) + continue; + + switch (p_member->type) + { + case ISNS_DD_ISCSI_MEMBER: + /* Fetch the node */ + memset (&db_node_name, 0, sizeof (db_node_name)); + strncpy ((char *) db_node_name.v, p_member->node_id, sizeof(db_node_name.v) ); + + key.tag = ISCSI_ID_KEY; + strcpy(key.val.node_name.v,db_node_name.v); + rval = ISNSdbRead(&key,&lentry); + if (rval != SUCCESS) + return rval; + + p_node = (SOIP_Iscsi *)&lentry.data.node; + + old_activeFlag = p_node->activeFlag; + + if ( p_dd->activeF... [truncated message content] |
From: Robert W. <wrw...@us...> - 2006-11-03 18:55:44
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7941/include Modified Files: iSNSdb.h Log Message: Separate iSNSdb.c into iSNSesi.c, iSNSscn.c, iSNSresponse.c Index: iSNSdb.h =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/include/iSNSdb.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iSNSdb.h 2 Apr 2002 20:56:54 -0000 1.2 --- iSNSdb.h 3 Nov 2006 18:55:41 -0000 1.3 *************** *** 111,115 **** int ISNS_SendESI(void); - int ISNS_ProcessESI(ISNS_Msg_Descp* p_md); --- 111,114 ---- *************** *** 120,122 **** --- 119,486 ---- int ISNSTouchEntity(ISNS_Attr* src_attr); + ISNS_ATTR_VALS_CB * + ISNSAttrGetList (ISNS_Msg_Descp *p_md); + + int + ISNS_GetDD_ID_from_sym ( char *p_sym ); + + int + ISNS_GetDDS_ID_from_sym ( char *p_sym ); + + int + ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); + + int + ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); + + int + ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); + + int + send_iscsi_scn_on_dd_mem_change( SOIP_Iscsi * p_src_node, char *p_src_name, + SOIP_Dd *p_dd, uint32_t dd_id, uint32_t event_bitmap); + + int + send_scn_parameter_change_to_all( ISNS_Msg *p_msg, uint32_t bitmap ); + + int + send_scn_object_change_to_all( uint32_t src_type, uint32_t src_len, + void *src_val, uint32_t bitmap ); + + int + change_dd_member_active_flag( SOIP_Dd *p_dd ); + + int + ISNS_DeRegisterSCN ( ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); + + int + ISNS_RegisterSCN (ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); + + int + ISNSdbRemoveAttr (ISNS_Msg_Descp * p_md); + + + int + ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); + + int + ISNSGetNextAttr( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); + + int + ISNSdbRemoveAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); + + int + ISNSdbRemoveAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); + + int + SNSdbFetchDD (int id, SOIP_Dd ** p_dd, SOIP_DB_Entry * p_entry); + + int + send_dd_iscsi_scn( SOIP_Dd *p_dd, int dd_id, uint32_t scn_bitmap ); + + int + IsDDActive(int dd_id, int exclude_dds_id); + + int + IsDDSActive(int dds_id); + + int + ISNSAddSCNEntry(uint32_t type, char *nodename, uint32_t bitmap, int sockfd); + + int + ISNSRemoveSCNEntry(uint32_t type, char *nodename); + + 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); + + int + Get_Active_DD_List (ISNS_LIST *dd_list, ISNS_DD_LIST p_dlist, int flag); + + + int + SNSRemovePortalEntry (char *portal_key, ISNS_Attr * src_attr, + ISNS_Msg * p_rspmsg); + + int + ISNSdbAddAttrPortal (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, + ISNS_Msg * p_rspmsg);\ + + int + SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, + ISNS_Msg * p_rspmsg); + + int + AddCert (void **ptr, int *size, void *p_cert, int cert_size); + + int + RemoveCert (void **ptr); + + int + SNSRemoveIFCPNodeEntry (char *ifcp_node_key, ISNS_Attr * src_attr, + ISNS_Msg * p_rspmsg); + + int + Activate_DD_Membership (uint32_t type, void *p_node); + + int + SNSRemoveFCNodeEntry (char *p_key, ISNS_Msg * p_rspmsg); + + int + ISNSdbProcessISCSIOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, + SOIP_Iscsi * p_node); + + int + ISNSdbProcessFCNodeOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, + SOIP_Fc_Node * p_node); + int + SNSdbFetchEntity (char *p_entity_id, SOIP_Entity ** p_entity, + SOIP_DB_Entry * p_entry); + + + int + Get_Active_DD_List_From_ISCSI_Node (char *nodename, ISNS_DD_LIST p_dlist, + int flag); + + int + Append_Nodes_From_DD_List (ISNS_DD_LIST p_dlist, + SOIP_Dd_Member p_ddmem[], uint32_t type); + + int + Check_Overlap_DD (ISNS_DD_LIST p_dlist_src, ISNS_DD_LIST p_dlist_node); + + int + Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, + int flag); + + + int + SNSRemoveISCSINodeEntry (char *iscsi_node_key, ISNS_Attr * src_attr, + ISNS_Msg * p_rspmsg); + + int + Send_IFCP_SCN (SOIP_Ifcp * p_src_node, char *p_src_name, + uint32_t event_bitmap); + + int + ISNSdbAddAttrNode (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, + ISNS_Msg * p_rspmsg); + + int + send_iscsi_scn_to_members ( SOIP_Iscsi * p_src_node, char *p_src_name, + ISNS_Msg *p_msg, uint32_t event_bitmap ); + + int + SNSdbAddAttrEntity (char **attr_indx, char **key_indx, + ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); + + int + Remove_DD_from_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); + + int + SNSdbGetNextOfKey (ISNS_Key * key); + + void + ISNSExceptionHdlr (void); + + int + Add_dds_to_dd (SOIP_Dds *p_dds, int dd_id); + + int + Remove_DD_from_IFCP_Node (int id, char *p_node_name); + + int + Add_DD_to_ISCSI_Node (SOIP_Dd *p_dd, char *p_node_name); + + int + Add_DD_Member (SOIP_Dd * p_dd, char *ptr, int p_len, uint32_t type, uint32_t status, uint32_t index); + + int + Remove_DD_Member (SOIP_Dd *p_dd, char *ptr, uint32_t type); + + int + Add_DD_to_IFCP_Node (int id, char *p_node_name); + + int + SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, + ISNS_DD_LIST p_dlist_src, int flag); + + int + Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, + SOIP_Entity * p_entity, + ISNS_DD_LIST p_list, int flag); + + int + Remove_dd_from_dds (SOIP_Dds * p_dds, int id); + + int + SNSProcessPortalOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, + SOIP_Portal * p_portal); + + int + ISNSdbProcessPortOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, + SOIP_Ifcp * p_port); + + int + ISNSdbProcessEntityOpAttr (ISNS_Msg * p_msg, ISNS_Attr ** attr_indx, + SOIP_Entity *p_entity); + + int + ISNSdbAddAttrISCSINode (char **attr_indx, char **key_indx, + ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg); + + int + ISNSFindTag (int start_indx, int key, char **attr_indx); + + ISNS_Attr * + ISNSFindKeyInResponseMsg (int key, ISNS_Msg * msg); + + int + ISNS_Process_SCN_Event (ISNS_Msg *p_msg); + + 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 + SNSdbRemoveAttrEntity (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * md, + ISNS_Msg * rspmsg); + + int + SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); + + int + SNSdbRemoveAttrPort (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, + ISNS_Msg * rspmsg); + + int + ISNSdbRemoveAttrEntityEntry (char *p_entity_id, ISNS_Attr * src_attr, + ISNS_Msg * p_rspmsg); + + int + SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, + ISNS_Msg * rspmsg); + + int + SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); + + int + SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, + ISNS_Msg * rspmsg); + + int + ISNS_Process_SCN_Event (ISNS_Msg *p_msg); + + int + ISNSdbAddAttrDDS ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); + + int + ISNSdbAddAttrDD ( ISNS_Msg_Descp * p_md, ISNS_Msg * p_rspmsg ); + + int + ISNS_Process_SCN(ISNS_Msg_Descp *p_md, ISNS_Msg *p_rsp_msg); + + int + ISNS_ProcessESI ( ISNS_Msg_Descp *p_md ); + + int + ISNSdbRead (ISNS_Key *key, SOIP_DB_Entry *entry); + + int + ISNSdbWrite (ISNS_Key *key, SOIP_DB_Entry entry); + + int + ISNSdbDelete (ISNS_Key *key); + + int + ISNSdbProcessDDSOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, + SOIP_Dds *p_dds); + + int + ISNSdbProcessDDOpAttr(ISNS_Msg *p_msg, ISNS_Attr **attr_indx, + SOIP_Dd *p_dd); + + void * + ISNSGetDataFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index); + + uint32_t ISNSGetNewPortalIdx(void); + + void ISNSAddToIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index, void*p_data,int size); + uint32_t ISNSGetIdxFromIdxHashTableByData(IDX_HASH_ENTRY **table, void *ptr, int len); + + int ISNS_GetNewDDS_ID (void); + int ISNS_GetNewDD_ID (void); + + int Check_Unique_DDS_Sym (SOIP_Dds * p_dds, char *p_sym_name); + int Check_Unique_DD_Sym (SOIP_Dd * p_dd, char *p_sym_name); + uint32_t ISNSGetNewEntityIdx(void); + uint32_t ISNSGetNewISCSIIdx(void); + uint32_t ISNSGetNewPortalIdx(void); + int SNSdbRemoveAttrDDS_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); + int SNSdbRemoveDD_Entry(int id, ISNS_Attr *src_attr, ISNS_Msg *p_rspmsg); + + int + SNSdbRemoveDD_Member (int id, char **attr_indx, ISNS_Attr * src_attr, + ISNS_Msg * p_rspmsg); + int + Disable_DD_Member (SOIP_Dd * p_dd, char *ptr, uint32_t type); + + void ISNSRemoveFromIdxHashTable(IDX_HASH_ENTRY **table, uint32_t index); + + int + ISNSGetNextEntityPortal( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); + + int + ISNSGetNextDDIscsiMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); + + int + ISNSGetNextDDSMember( ISNS_Msg_Descp *p_md, ISNS_Msg * p_rspmsg ); + + int + ISNSdbGetAttr ( ISNS_Msg_Descp * p_md, ISNS_Msg_Descp * md ); + + int + Get_Active_DD_List_From_IFCP_Node (char *nodename, ISNS_DD_LIST p_dlist, + int flag); + + int + SNSdbGetNextOfKey (ISNS_Key * key); + + int + SNSGet_Active_DD_List_From_Src (ISNS_Attr * src_attr, + ISNS_DD_LIST p_dlist_src, int flag); + + int + Get_Active_DD_List_From_ENTITY_Node (char *p_entity_name, + SOIP_Entity * p_entity, + ISNS_DD_LIST p_list, int flag); + + int + SNSdbAddAttrPort (char **attr_indx, char **key_indx, ISNS_Msg_Descp * p_md, + ISNS_Msg * rspmsg); + + + int + SNSdbRemoveAttrISCSI (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, + ISNS_Msg * rspmsg); + + int + SNSdbRemoveAttrNode (char **key_indx, char *src_attr, ISNS_Msg_Descp * p_md, ISNS_Msg * rspmsg); + + int + SNSdbRemoveAttrPortal (char **key_indx, ISNS_Attr *src_attr, ISNS_Msg_Descp * p_md, + ISNS_Msg * rspmsg); + + int + Append_DD_to_List (ISNS_DD_LIST p_dlist, uint32_t id); + #endif |
From: Robert W. <wrw...@us...> - 2006-11-03 18:55:44
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7941 Modified Files: Makefile Log Message: Separate iSNSdb.c into iSNSesi.c, iSNSscn.c, iSNSresponse.c Index: Makefile =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 3 Nov 2006 01:10:24 -0000 1.3 --- Makefile 3 Nov 2006 18:55:41 -0000 1.4 *************** *** 44,47 **** --- 44,50 ---- OBJECTS += iSNSUtil.o OBJECTS += iSNSdb.o + OBJECTS += iSNSscn.o + OBJECTS += iSNSesi.o + OBJECTS += iSNSresponse.o OBJECTS += iSNSquery.o OBJECTS += iSNSreg.o *************** *** 89,92 **** --- 92,104 ---- $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + iSNSresponse.o : $(SRCDIR)iSNSresponse.c + $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + + iSNSscn.o : $(SRCDIR)iSNSscn.c + $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + + iSNSesi.o : $(SRCDIR)iSNSesi.c + $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + iSNSquery.o : $(SRCDIR)iSNSquery.c $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ |
From: Robert W. <wrw...@us...> - 2006-11-03 01:10:31
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30716 Modified Files: Makefile Log Message: Divide into reg,dereg, and query modules Index: Makefile =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 2 Apr 2002 20:56:54 -0000 1.2 --- Makefile 3 Nov 2006 01:10:24 -0000 1.3 *************** *** 44,47 **** --- 44,50 ---- OBJECTS += iSNSUtil.o OBJECTS += iSNSdb.o + OBJECTS += iSNSquery.o + OBJECTS += iSNSreg.o + OBJECTS += iSNSdereg.o OBJECTS += iSNSipc.o OBJECTS += iSNSqueue.o *************** *** 86,89 **** --- 89,101 ---- $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + iSNSquery.o : $(SRCDIR)iSNSquery.c + $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + + iSNSreg.o : $(SRCDIR)iSNSreg.c + $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + + iSNSdereg.o : $(SRCDIR)iSNSdereg.c + $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ + iSNSipc.o : $(SRCDIR)iSNSipc.c $(CC) -I$(INCDIR) $(CFLAGS) -c $< -o $@ |
From: Robert W. <wrw...@us...> - 2006-11-03 01:10:30
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30716/src Modified Files: iSNSdb.c Added Files: iSNSdereg.c iSNSquery.c iSNSreg.c Log Message: Divide into reg,dereg, and query modules --- NEW FILE: iSNSreg.c --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. [...3705 lines suppressed...] DEBUG_1( isns_db_debug & 1, (Sending SCN re-reg msg node = %s), pdata->name.v); /* SRC */ ISNSAppendKey(&p_scn_md->msg, 0, 0, NULL, 0); /* Key */ ISNSAppendKey(&p_scn_md->msg, ISNS_ISCSI_NODE_ID, PAD4(strlen(pdata->name.v)), pdata->name.v, 0); ISNSAppendKey(&p_scn_md->msg, ISNS_DELIMITER, ISNS_DELIMITER_SIZE, NULL, 0); /* Attr */ ISNSAppendKey(&p_scn_md->msg, ISNS_ISCSI_SCN_BITMAP, ISNS_SCN_BITMAP_SIZE, NULL, pdata->bitmap); ISNSSendMsg2Server(&p_scn_md->msg); lnode = GetNextNode(&scn_callback_list, lnode); } return (SUCCESS); } #endif Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** iSNSdb.c 2 Nov 2006 21:19:21 -0000 1.7 --- iSNSdb.c 3 Nov 2006 01:10:24 -0000 1.8 *************** *** 104,111 **** static SOIP_DB_Entry entry; /* top level fetches ONLY */ static SOIP_DB_Entry entry2; /* secondary fetches */ - static SOIP_DB_Entry entry3; - static SOIP_DB_Entry entry4; - static SOIP_DB_Entry entry5; - static SOIP_DB_Entry show_entry; static SOIP_DB_Entry scn_entry; --- 104,107 ---- *************** [...10599 lines suppressed...] ! /******************************************************************** ! ********************************************************************/ ! void ! iSNSDumpStats( void ) ! { ! printf("Entity count: %d\n", iSNS_stats.num_entity); ! printf("Portal count: %d\n", iSNS_stats.num_portals); ! printf("iSCSI count : %d\n", iSNS_stats.num_iscsi); ! printf("iFCP count : %d\n", iSNS_stats.num_ifcp); ! printf("DD count : %d\n", iSNS_stats.num_dd); ! printf("DDS count : %d\n", iSNS_stats.num_dds); } --- 3261,3266 ---- } } ! return ( errorCode ); } --- NEW FILE: iSNSdereg.c --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. [...2589 lines suppressed...] while (SNSdbGetNextOfKey (&key) == SUCCESS) { /* Fetch entity from hash */ if (ISNS_NO_ERR != SNSdbFetchEntity (key.val.entity_key.id, &p_entity, &entry)) { return; } if (p_entity->period == 0) continue; if (secs<(int)p_entity->period+(int)p_entity->timestamp.t_time) continue; /* Period has expired, deregister */ ISNSdbRemoveAttrEntityEntry (p_entity->eid.id, NULL, NULL); } } --- NEW FILE: iSNSquery.c --- /*********************************************************************** Copyright (c) 2001, Nishan Systems, 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 Nishan Systems, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. [...4240 lines suppressed...] { if (p_dlist_node[ii]==0) break; for (jj = 0; jj < MAX_DD_PER_LIST; jj++) { if (p_dlist_node[jj]==0) break; if (p_dlist_src[ii] == p_dlist_node[jj]) return (TRUE); } } if (ddmem[0].type==0) // no discovery domains created - use default return TRUE; return (FALSE); } |
From: Robert W. <wrw...@us...> - 2006-11-02 21:19:50
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5471/src Modified Files: iSNSUtil.c iSNSdb.c Log Message: Provide a higher-level (abstracted) database interface Index: iSNSUtil.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSUtil.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** iSNSUtil.c 25 Oct 2006 21:19:37 -0000 1.5 --- iSNSUtil.c 2 Nov 2006 21:19:20 -0000 1.6 *************** *** 527,531 **** printf("Portal IP: %s\n", dot_no); ! printf("Portal Port: %#x\n", p_lentry->portal_ip_port.ip_port & 0xFFFF); printf("Portal Type: %s\n", (p_lentry->portal_ip_port.ip_port & 0x10000)?"UDP":"TCP"); printf("Portal Idx : %u\n", p_lentry->portal_idx); --- 527,532 ---- printf("Portal IP: %s\n", dot_no); ! //printf("Portal Port: %#x\n", p_lentry->portal_ip_port.ip_port & 0xFFFF); ! printf("Portal Port: %i\n", p_lentry->portal_ip_port.ip_port); printf("Portal Type: %s\n", (p_lentry->portal_ip_port.ip_port & 0x10000)?"UDP":"TCP"); printf("Portal Idx : %u\n", p_lentry->portal_idx); *************** *** 719,723 **** p_entity->prot_ver.ver_max, p_entity->prot_ver.ver_min); printf ("Reg Period : %d\n", p_entity->period); ! ISNSDisplay_IPAddress ((struct IP_address *)p_entity->mgmt_ip_addr.v); printf ("TimeStamp : %s", ctime((time_t *)&p_entity->timestamp.t_time)); --- 720,724 ---- p_entity->prot_ver.ver_max, p_entity->prot_ver.ver_min); printf ("Reg Period : %d\n", p_entity->period); ! //ISNSDisplay_IPAddress ((struct IP_address *)p_entity->mgmt_ip_addr.v); printf ("TimeStamp : %s", ctime((time_t *)&p_entity->timestamp.t_time)); Index: iSNSdb.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSdb.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** iSNSdb.c 25 Oct 2006 21:19:37 -0000 1.6 --- iSNSdb.c 2 Nov 2006 21:19:21 -0000 1.7 *************** *** 220,228 **** ISNSAddESIEntry(IP_Address *p_ip, uint32_t port, char *p_eid); - #if 0 - static int - SNSdbStoreEntity(char *p_entity_id, datum d); - #endif - static int SNSdbGetAttrDD (char **attr_indx, char **key_indx, ISNS_Attr * src_attr, ISNS_Msg_Descp * md, --- 220,223 ---- [...7496 lines suppressed...] } else --- 13240,13256 ---- { /* Save DD record */ entry.data_type = ISNS_DD_ID; ! key.tag = DD_ID_KEY; ! key.val.dd_id = dd_key.id; ! ISNSdbWrite(&key,entry); } else if (recType == DDS_ID_FILE_REC) { /* Save DDS record */ entry.data_type = ISNS_DDS_ID; ! ISNS_Key key; ! key.tag = DDS_ID_KEY; ! key.val.dds_id = dds_key.id; ! ISNSdbWrite(&key,entry); } else |
From: Robert W. <wrw...@us...> - 2006-10-31 19:00:29
|
Update of /cvsroot/linuxisns/isnsNT/isnsserver/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9476/src Modified Files: iSNSLinux.c Log Message: Clean up thread code Index: iSNSLinux.c =================================================================== RCS file: /cvsroot/linuxisns/isnsNT/isnsserver/src/iSNSLinux.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iSNSLinux.c 25 Oct 2006 16:21:35 -0000 1.4 --- iSNSLinux.c 31 Oct 2006 19:00:17 -0000 1.5 *************** *** 30,39 **** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ - /*#include <time.h>*/ - /*#include <sys/time.h>*/ #include <semaphore.h> #include "iSNSLinux.h" - /* Linux.h includes parse.h */ #include "iSNS.h" #include "iSNScomm.h" --- 30,37 ---- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ #include <semaphore.h> + #include <errno.h> #include "iSNSLinux.h" #include "iSNS.h" #include "iSNScomm.h" *************** *** 50,63 **** #endif - /*WSADATA g_WsaData;*/ - typedef u_int64_t __int64; - extern int sns_ready; extern int sns_local_priority; extern int sns_local_version; extern int sns_heartbeat_interval; - extern pthread_cond_t fsm_cond; extern int sns_esi_interval; extern pthread_cond_t esi_cond; int pauseFlag = TRUE; --- 48,67 ---- #endif extern int sns_ready; extern int sns_local_priority; extern int sns_local_version; extern int sns_heartbeat_interval; extern int sns_esi_interval; + extern int sns_request_timeout; + + /* Linux */ extern pthread_cond_t esi_cond; + extern pthread_cond_t fsm_cond; + extern pthread_cond_t resync_cond; + extern pthread_mutex_t sns_request_timer; + extern pthread_cond_t request_cond; + extern pthread_mutex_t sns_resync_timer; + extern pthread_mutex_t sns_fsm_timer; + extern pthread_mutex_t sns_esi_timer; int pauseFlag = TRUE; *************** *** 68,74 **** extern void SNSReqTimeoutHdlr(void); extern void SNSFSMTimeoutHdlr(void); ! /*extern void SNSESITimeoutHdlr(void);*/ ! void NTDebugOn (void); void --- 72,82 ---- extern void SNSReqTimeoutHdlr(void); extern void SNSFSMTimeoutHdlr(void); ! extern void SNSESITimeoutHdlr(void); ! extern int sns_comm_main_port_set; ! ! int TCP_RecvMain (); ! HANDLE init_ipc_rcv (void); ! void DebugOn (void); void *************** *** 84,128 **** } - #if 0 - #define _SECOND 10000000 - LARGE_INTEGER l; - LARGE_INTEGER * - - ConvertTime (int sec, LARGE_INTEGER * pl) - { - __int64 qwDueTime; - qwDueTime = -sec * _SECOND; - - /* Copy the relative time into a LARGE_INTEGER. */ - pl->LowPart = (DWORD) (qwDueTime & 0xFFFFFFFF); - pl->HighPart = (long) (qwDueTime >> 32); - return (pl); - } - - int - wdStart (pthread_mutex_t sns_request_timer, int next_timeout, - void *nptr1, void *nptr2) - { - int results; - int timeout; - timeout = next_timeout; - if (timeout < 1) - timeout = 1; - - results = - SetWaitableTimer ((void *) sns_request_timer, ConvertTime (timeout, &l), - 0, NULL, NULL, FALSE); - return (0); - } - - void - wdCancel (sem_t timer) - { - if (timer) - CancelWaitableTimer ((void *) timer); - /* Linux */ - sem_destroy (&timer); - } - #endif void taskDelete (int task) --- 92,95 ---- *************** *** 133,139 **** if ((void *)task != NULL) { ! /* TerminateThread ((void *)task, 0); */ ! /* Linux */ ! pthread_cancel ((pthread_t) task); } } --- 100,104 ---- if ((void *)task != NULL) { ! pthread_cancel ((pthread_t) task); } } *************** *** 155,183 **** LinuxTaskSpawn (char *taskName, void *funcPtr) { ! int result; ! pthread_t athread; ! /* int result; */ ! /* DWORD junk; */ ! /* result = NULL; */ ! /* result = CreateThread (0, 0, funcPtr, &junk, 0, &junk); */ ! /* Linux */ ! result = (pthread_create (&athread, NULL, (void*) funcPtr, NULL)); ! if (result != 0) ! perror ("taskSpawn"); ! return (result); } - #ifdef SNS_LINUX - int - #else - DWORD WINAPI - #endif - NTtimertaskWrapper () - { - /* Run Task */ - return (0); - } - HANDLE init_ipc_rcv (void); - char Usage[] = "\ Usage: isnss [options] -i IP -b BROADCAST IP\n\ --- 120,131 ---- LinuxTaskSpawn (char *taskName, void *funcPtr) { ! int result; ! pthread_t athread; ! result = (pthread_create (&athread, NULL, (void*) funcPtr, NULL)); ! if (result != 0) ! perror ("taskSpawn"); ! return (result); } char Usage[] = "\ Usage: isnss [options] -i IP -b BROADCAST IP\n\ *************** *** 191,207 **** [-?] Help.\n"; - #ifdef SNS_LINUX - int - #else - DWORD WINAPI - #endif - TCP_RecvMain (); - - extern int sns_comm_main_port_set; int main (int argc, char **argv) { ! pthread_t athread; int c; char sfilename[256] = { 0 }; --- 139,147 ---- [-?] Help.\n"; int main (int argc, char **argv) { ! pthread_t athread; int c; char sfilename[256] = { 0 }; *************** *** 250,254 **** case 'd': ! NTDebugOn(); break; --- 190,194 ---- case 'd': ! DebugOn(); break; *************** *** 275,327 **** sleep (10); ! /* ! if (WSAStartup (MAKEWORD (0x02, 0x00), &g_WsaData) == SOCKET_ERROR) ! { ! return (0); ! } ! */ ! ! /*CreateThread (0, 0, TCP_RecvMain, &junk, 0, &junk);*/ ! if (pthread_create (&athread, NULL, (void*) TCP_RecvMain, NULL) != 0) perror("Creating TCP_RecvMain"); SNSMain (role); - /* Linux */ /* Never should hit this. */ - /*WSACleanup ();*/ exit (-1); } /********************************************************* ! THIS FUNCTION WORKS *********************************************************/ - /* Linux */ - extern pthread_mutex_t sns_request_timer; - extern pthread_cond_t request_cond; - extern int sns_request_timeout; int SNSReqTimeoutThread () { struct timeval now; ! struct timespec timeout; ! printf ("SNSReqTimeoutHdlr Started.\n"); while (1) { ! pthread_mutex_lock(&sns_request_timer); ! gettimeofday(&now, NULL); ! timeout.tv_sec = now.tv_sec + sns_request_timeout; ! timeout.tv_nsec = now.tv_usec * 1000; ! /*results = WaitForSingleObject ((HANDLE)sns_request_timer, INFINITE); */ ! if (0 != pthread_cond_timedwait (&request_cond, &sns_request_timer, &timeout)); ! /*perror ("Timedwaid in Request Timeout");*/ ! pthread_mutex_unlock(&sns_request_timer); ! SNSReqTimeoutHdlr (); if (pauseFlag) ! return (0); } --- 215,256 ---- sleep (10); ! if (pthread_create (&athread, NULL, (void*) TCP_RecvMain, NULL) != 0) perror("Creating TCP_RecvMain"); SNSMain (role); /* Never should hit this. */ exit (-1); } + /********************************************************* ! SNSReqTimeoutThread *********************************************************/ int SNSReqTimeoutThread () { struct timeval now; ! struct timespec timeout; ! int rc; ! printf ("SNSReqTimeoutHdlr Started.\n"); while (1) { ! pthread_mutex_lock(&sns_request_timer); ! gettimeofday(&now, NULL); ! timeout.tv_sec = now.tv_sec + sns_request_timeout; ! timeout.tv_nsec = now.tv_usec * 1000; ! rc = pthread_cond_timedwait (&request_cond,&sns_request_timer,&timeout); ! if (rc != ETIMEDOUT) ! perror ("Error in Timeout Request in SNSReqTimeoutThread"); ! ! pthread_mutex_unlock(&sns_request_timer); ! SNSReqTimeoutHdlr (); if (pauseFlag) ! return (0); } *************** *** 330,361 **** /*********************************************************** ! THIS FUNCTION DOES NOT WORK ***********************************************************/ /* Linux */ - extern pthread_mutex_t sns_fsm_timer; int SNSFSMTimeoutThread () { ! struct timeval now; ! struct timespec timeout; ! printf ("SNSFSMTimeoutHdlr thread started.\n"); ! while (1) { ! pthread_mutex_lock(&sns_fsm_timer); ! gettimeofday(&now, NULL); ! timeout.tv_sec = now.tv_sec + sns_heartbeat_interval; ! timeout.tv_nsec = now.tv_usec * 1000; ! /* The condition is never signaled. This will always time out */ ! if (0 != pthread_cond_timedwait(&fsm_cond, &sns_fsm_timer, &timeout)); ! /*perror ("Timedwait in FSM Timeout");*/ SNSFSMTimeoutHdlr (); ! pthread_mutex_unlock(&sns_fsm_timer); if (pauseFlag) return (0); --- 259,291 ---- /*********************************************************** ! SSNSFSMTimeoutThread ***********************************************************/ /* Linux */ int SNSFSMTimeoutThread () { ! struct timeval now; ! struct timespec timeout; ! int rc; ! printf ("SNSFSMTimeoutHdlr thread started.\n"); ! while (1) { ! pthread_mutex_lock(&sns_fsm_timer); ! gettimeofday(&now, NULL); ! timeout.tv_sec = now.tv_sec + sns_heartbeat_interval; ! timeout.tv_nsec = now.tv_usec * 1000; ! rc = pthread_cond_timedwait(&fsm_cond, &sns_fsm_timer, &timeout); ! if (rc != ETIMEDOUT) ! perror ("Error in Timeout Request in SNSFSMTimeoutThread"); SNSFSMTimeoutHdlr (); ! pthread_mutex_unlock(&sns_fsm_timer); ! if (pauseFlag) return (0); *************** *** 366,382 **** /********************************************************* ! THIS FUNCTION WORKS UNDER THE GDB *********************************************************/ /* Linux */ - extern pthread_mutex_t sns_esi_timer; int SNSESITimeoutThread () { - #if 0 - DWORD results; - #endif struct timeval now; struct timespec timeout; printf ("SNSESITimeoutHdlr thread started.\n"); --- 296,309 ---- /********************************************************* ! SNSESITimeoutThread *********************************************************/ /* Linux */ int SNSESITimeoutThread () { struct timeval now; struct timespec timeout; + int rc; printf ("SNSESITimeoutHdlr thread started.\n"); *************** *** 384,402 **** while (1) { ! pthread_mutex_lock(&sns_esi_timer); ! gettimeofday(&now, NULL); ! timeout.tv_sec = now.tv_sec + sns_esi_interval; ! timeout.tv_nsec = now.tv_usec * 1000; ! #if 0 ! results = WaitForSingleObject ((HANDLE)sns_esi_timer, INFINITE); ! /* Linux */ ! /* The condition is never signaled. This will always time out */ ! if (0 != pthread_cond_timedwait(&esi_cond, &sns_esi_timer, &timeout)) ! perror("Timedwait in ESI Timeout"); ! #endif ! SNSESITimeoutHdlr (); ! pthread_mutex_unlock(&sns_esi_timer); ! if (pauseFlag) ! return (0); } return (0); --- 311,326 ---- while (1) { ! pthread_mutex_lock(&sns_esi_timer); ! gettimeofday(&now, NULL); ! timeout.tv_sec = now.tv_sec + sns_esi_interval; ! timeout.tv_nsec = now.tv_usec * 1000; ! rc = pthread_cond_timedwait(&esi_cond, &sns_esi_timer, &timeout); ! if (rc != ETIMEDOUT) ! perror ("Error in Timeout Request in SNSESITimeoutThread"); ! ! SNSESITimeoutHdlr (); ! pthread_mutex_unlock(&sns_esi_timer); ! if (pauseFlag) ! return (0); } return (0); *************** *** 404,437 **** /*********************************************************** ! THIS FUNCTION DOES NOT WORK ***********************************************************/ - /* Linux */ - extern pthread_mutex_t sns_resync_timer; int SNSResyncTimeoutThread () { - - #if 0 - DWORD results; struct timeval now; struct timespec timeout; ! #endif while (1) { ! #if 0 ! pthread_mutex_lock(&sns_resync_timer); ! gettimeofday(&now, NULL); ! timeout.tv_sec = now.tv_sec + sns_resync_interval; ! timeout.tv_nsec = now.tv_usec * 1000; ! results = WaitForSingleObject ((HANDLE)sns_resync_timer, INFINITE); ! /* Linux */ ! results = sem_wait (&sns_resync_timer); ! results = pthread_cond_timedwait(&sns_resync_timer, &resync_cond, &timeout); ! pthread_mutex_unlock(&sns_resync_timer); ! #endif ! if (pauseFlag){ ! return (0); ! } } --- 328,353 ---- /*********************************************************** ! SNSResyncTimeoutThread ***********************************************************/ int SNSResyncTimeoutThread () { struct timeval now; struct timespec timeout; ! int rc; while (1) { ! pthread_mutex_lock(&sns_resync_timer); ! gettimeofday(&now, NULL); ! timeout.tv_sec = now.tv_sec + 60; //sns_resync_interval; ! timeout.tv_nsec = now.tv_usec * 1000; ! rc = pthread_cond_timedwait(&resync_cond, &sns_resync_timer, &timeout); ! if (rc != ETIMEDOUT) ! perror ("Error in Timeout Request in SNSResyncTimeoutThread"); ! ! pthread_mutex_unlock(&sns_resync_timer); ! if (pauseFlag) ! return (0); } *************** *** 440,450 **** void ! SNSTrap (void) ! { ! } ! /***********************************************/ ! ! void ! NTDebugOn (void) { extern int sns_bcast_debug; --- 356,360 ---- void ! DebugOn (void) { extern int sns_bcast_debug; |