示例#1
0
HRESULT	avcUnitNotifyAdd(LM_CONTEXT* notifyList, UNION_NOTIFY *notify, PB *packetBlock, BOOL bUsePacketBlock)
{
    HRESULT				hResult = NO_ERROR;
    uint32				notifyAddr = 0;

    notify->notifyComm.bUsePacketBlock = bUsePacketBlock;

    hResult = pbGetPacketSrcNodeAddr (packetBlock, &notifyAddr);
    if (hResult != NO_ERROR) return hResult;

    // determine if there is a notify from same nodeAddr
    hResult = avcUnitNotifyRemoveOld(notifyList, notifyAddr);
    if (hResult != NO_ERROR) return hResult;

    if (bUsePacketBlock)
    {
        // copy packetBlock, and add it to our list of Notifications
        hResult = pbCreateDuplicatePacket(packetBlock, &notify->notifyComm.packetBlock, NULL, PB_CREATE_AVC_CB);
        if (hResult != NO_ERROR) return hResult;
    }
    else
    {
        NODEHANDLE handle = 0;

        lalGetHandleFromNodeAddr(notifyAddr, &handle);
        notify->notifyComm.handle = handle;
    }

    hResult = lmAddElement(notifyList, notify, NULL);
    if (hResult != NO_ERROR)
    {
        avcUnitNotifyRemoveComm(notify);
        return hResult;
    }


#ifdef _SYSDEBUG
    if (sysDebugIsEnabled(SYSDEBUG_TRACE_AVC & SYSDEBUG_TRACE_ERRORS)) //SYSDEBUG_TRACE_AVC
    {
        sysPrintCurTime();
        sysDebugPrintf("avcUnitNotify insert new notify\n\r");
    }
#endif //_SYSDEBUG

    return hResult;
}
示例#2
0
HRESULT avcCreateResponsePacket(PB *packetBlock, PB **respPacket, BOOL bNewPayloadSize, uint32 payloadSize)
{
	HRESULT		hResult = NO_ERROR;	

	if (bNewPayloadSize)
	{
		hResult = pbCreateDuplicatePacketWithSize(packetBlock, respPacket, (uint16) payloadSize, NULL, PB_CREATE_AVC_SEND_RSP);
		if (hResult != NO_ERROR) return hResult;
	}
	else
	{
		hResult = pbCreateDuplicatePacket(packetBlock, respPacket, NULL, PB_CREATE_AVC_SEND_RSP);
		if (hResult != NO_ERROR) return hResult;
	}

#if 1 
	pbSwapSrcDstNodeAddr(*respPacket);
#endif

	return hResult;
}