EXPORT void CleanIndicatorsList(List **ppList)
{
	ListItem* handle;
	IndicatorSubscribers *pTempInd = NULL;	

	handle = CreateIterator(*ppList);

	//for each indicator struct- clean the subscribers list and free the IndicatorSubscribers struct:
	handle = Iterator_GetNext(*ppList, handle, (void**)&pTempInd);
	while (handle != NULL)
	{		
		List_Clear(&(pTempInd->subscribersList));
		List_Finalize(&(pTempInd->subscribersList));
		free(pTempInd);
		pTempInd = NULL;
		handle = Iterator_GetNext(*ppList, handle, (void**)&pTempInd);
	}

	FreeIterator(*ppList);
	List_Clear(*ppList);

	List_Finalize(*ppList);
	free(*ppList);
	(*ppList) = NULL;
}
示例#2
0
void
SharedStringList_Finalize(SharedStringList *self)
{
    SharedStringListItem *item;

    item = SharedStringList_First(self);
    while (item != NULL) {
        if (item->mStr != NULL)
            SharedString_DelRef(item->mStr);
        item = SharedStringList_Next(self, item);
    }
    List_Finalize(&self->mBase);
}
示例#3
0
void
HashTableSlot_Finalize(HashTableSlot *self)
{
    List_Finalize(&self->mBase);
}
// This  function go over the specific list (L4 SS or status SS) and send all its registered targets the indication.
// Can be used as the InternalHandler with Messenger_PostRequest
EXPORT void SendIndicationToSubscribers( UINT32 internalRequestID, void *_buffer, UINT32 bufferLength )
{
	SendIndData *buffer = _buffer;
	ListItem* handle;
	L5_TARGET_ID targetID;
	// Instead of storing a pointer in the 'pData' field of the ListItem, the indicator ID is stored there.
	// Since the size of a pointer may be larger than the size of an L5_TARGET_ID, a pointer needs to be used
	// with Iterator_GetNext() to store the indicator ID, before copying the value to an L5_TARGET_ID.
	void *data;
	L5_RESULT res;
	IndicatorSubscribers *indSubscribers;
	List tempList;
	
	UNREFERENCED_PARAMETER(bufferLength);
	
	//TODO: use FailedDeliveryIndication if available to notify on send failure.

	// go over the list and send indications to all targets
	indSubscribers = GetIndicatorSubscribers(buffer->pSubscribersList, buffer->indication_id, FALSE);

	TRACE(TR_MOD_WRAPPER_LOGS, TR_SEV_DEBUG,"SendIndicationToSubscribers(IN) - internalRequestID=%d, indSubscribers=%d, pSubscribersList=%d, indication_id=%d",
									internalRequestID ,indSubscribers, buffer->pSubscribersList, buffer->indication_id);
	if ((NULL != indSubscribers) && (0 != List_Length(&(indSubscribers->subscribersList))))
	{		
		// Build temp list
		List_Init(&tempList, FALSE);
		handle = CreateIterator(&(indSubscribers->subscribersList));
		handle = Iterator_GetNext(&(indSubscribers->subscribersList), handle, (void**)(&data));
		while (handle != NULL)
		{
			List_AddItem(&tempList, data);
			handle = Iterator_GetNext(&(indSubscribers->subscribersList), handle, (void**)(&data));
		}

		FreeIterator(&(indSubscribers->subscribersList));

		//iterate the temp list and send the targets indication:
		handle = CreateIterator(&tempList);
		handle = Iterator_GetNext(&tempList, handle, (void**)(&data));
		while (handle != NULL)
		{
			targetID = (L5_TARGET_ID) data;

			//in case we are working with remote DnD, we want to send the trace and monitor indications 
			//only to the DnD agent
			if(((L3_L4_OPCODE_REPORT_MONITOR_EVACUATE != wimaxll_le16_to_cpu(*((UINT16 *)buffer->indication_buffer))) &&
				(L3_L4_OPCODE_REPORT_TRACE_EVACUATE != wimaxll_le16_to_cpu(*((UINT16 *)buffer->indication_buffer)))) ||
				(L5_TARGET_DND_AGENT == targetID))
			{
				TRACE(TR_MOD_WRAPPER_LOGS, TR_SEV_DEBUG,"SendIndicationToSubscribers - senderL5Conn=0x%x, targetID=%d, internalRequestID=%d",
													buffer->senderL5Conn, targetID, internalRequestID);
				res = buffer->pSenderFuncs->pfnSendReceiveMessage(
										buffer->senderL5Conn,  
										targetID, 
										internalRequestID, 
										buffer->indication_buffer, buffer->indication_buffer_size, 
										NULL, NULL, NULL);

				if ( L5_RESULT_ID_NOT_FOUND == res)
				{
					Indications_RemoveSubscriber(indSubscribers , targetID);
				}

			}

			handle = Iterator_GetNext(&tempList, handle, (void**)(&data));

			// TODO - XXX - check L5_COMMON_UTILS_IsTargetNotExist
			// TODO - XXX - check res
			// TODO - XXX - check responseID
		}

		FreeIterator(&tempList);

		//free the temp list items:
		List_Clear(&tempList);
		List_Finalize(&tempList);
	}
	else
	{
		TRACE(TR_MOD_WRAPPER_LOGS, TR_SEV_DEBUG,"SendIndicationToSubscribers - no subscribers");
	}
}