ANSC_STATUS AnscLpccoAddPartyAddr ( ANSC_HANDLE hThisObject, ANSC_HANDLE party_addr ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PANSC_LPC_CONNECTOR_OBJECT pMyObject = (PANSC_LPC_CONNECTOR_OBJECT)hThisObject; PANSC_LPC_PARTY_ADDR pPartyAddr = (PANSC_LPC_PARTY_ADDR )party_addr; char* pPartyName = (char* )pPartyAddr->PartyName; ULONG ulHashIndex = AnscHashString(pPartyName, AnscSizeOfString(pPartyName), ANSC_LPCCO_PARTY_TABLE_SIZE); if ( pMyObject->GetPartyAddr ( (ANSC_HANDLE)pMyObject, pPartyName ) != (ANSC_HANDLE)NULL ) { AnscTrace ( "[AnscLpccoAddPartyAddr] collison found, failed to add party <%s> from %d.%d.%d.%d (%d)\n", pPartyAddr->PartyName, pPartyAddr->PartyAddr.Dot[0], pPartyAddr->PartyAddr.Dot[1], pPartyAddr->PartyAddr.Dot[2], pPartyAddr->PartyAddr.Dot[3], pPartyAddr->PartyPort ); return ANSC_STATUS_COLLISION; } AnscAcquireLock (&pMyObject->PartyTableLock); AnscQueuePushEntry(&pMyObject->PartyTable[ulHashIndex], &pPartyAddr->Linkage); AnscReleaseLock (&pMyObject->PartyTableLock); AnscTrace ( "[AnscLpccoAddPartyAddr] party <%s> from %d.%d.%d.%d (%d) has been added.\n", pPartyAddr->PartyName, pPartyAddr->PartyAddr.Dot[0], pPartyAddr->PartyAddr.Dot[1], pPartyAddr->PartyAddr.Dot[2], pPartyAddr->PartyAddr.Dot[3], pPartyAddr->PartyPort ); return ANSC_STATUS_SUCCESS; }
BOOL AnscLpccoImcIsPartyConnected ( ANSC_HANDLE hThisObject, char* party_name, BOOL bOutgoingConn ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PANSC_LPC_CONNECTOR_OBJECT pMyObject = (PANSC_LPC_CONNECTOR_OBJECT)hThisObject; PANSC_LPC_PARTY_ADDR pPartyAddr = (PANSC_LPC_PARTY_ADDR )NULL; pPartyAddr = (PANSC_LPC_PARTY_ADDR)pMyObject->GetPartyAddr ( (ANSC_HANDLE)pMyObject, party_name ); if ( !pPartyAddr ) { return FALSE; } else if ( bOutgoingConn ) { if ( pPartyAddr->PartyState & ANSC_LPC_PARTY_STATE_connectedOut ) { return TRUE; } } else { if ( pPartyAddr->PartyState & ANSC_LPC_PARTY_STATE_connectedIn ) { return TRUE; } } return FALSE; }