Index: TL_Marshaller.c =================================================================== --- TL_Marshaller.c (revision 5683) +++ TL_Marshaller.c (working copy) @@ -104,9 +104,9 @@ ******************************************************************************/ static int32_t MsDriverOpen( MARSHALLER_TL_T* ptInfo) { - int32_t lRet = CIFX_NO_ERROR; - uint8_t* pbRecvData = NULL; - MARSHALLER_DATA_FRAME_HEADER_T tDriverOpen = {{{0}}}; + int32_t lRet = CIFX_NO_ERROR; + MARSHALLER_DATA_FRAME_HEADER_T* ptCnf = NULL; + MARSHALLER_DATA_FRAME_HEADER_T tDriverOpen = {{{0}}}; /* not yet initialized */ if (ptInfo->tDriverInfo.ulDriverHandle == 0) @@ -120,14 +120,12 @@ ptInfo->tDriverInfo.fSequenceNrSupport, ptInfo->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptInfo->hTransport, &tDriverOpen, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptInfo->hTransport, &tDriverOpen, &ptCnf, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - MARSHALLER_DATA_FRAME_HEADER_T* ptCnf = (MARSHALLER_DATA_FRAME_HEADER_T*)pbRecvData; - lRet = VerifyTransferResult(&tDriverOpen, ptCnf); - OS_Memfree(pbRecvData); + OS_Memfree(ptCnf); } return lRet; } @@ -155,10 +153,10 @@ ******************************************************************************/ int32_t APIENTRY DriverClose(CIFXHANDLE hDriver) { - int32_t lRet = CIFX_NO_ERROR; - uint8_t* pbRecvData = NULL; - MARSHALLER_DATA_FRAME_HEADER_T tCloseDriver = {{{0}}}; - MARSHALLER_TL_T* ptInfo = (MARSHALLER_TL_T*)hDriver; + int32_t lRet = CIFX_NO_ERROR; + MARSHALLER_DATA_FRAME_HEADER_T* ptCnf = NULL; + MARSHALLER_DATA_FRAME_HEADER_T tCloseDriver = {{{0}}}; + MARSHALLER_TL_T* ptInfo = (MARSHALLER_TL_T*)hDriver; GenerateHeader( &tCloseDriver, ptInfo->tDriverInfo.ulDriverHandle, @@ -168,18 +166,16 @@ ptInfo->tDriverInfo.fSequenceNrSupport, ptInfo->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptInfo->hTransport, &tCloseDriver, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptInfo->hTransport, &tCloseDriver, &ptCnf, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - MARSHALLER_DATA_FRAME_HEADER_T* ptCnf = (MARSHALLER_DATA_FRAME_HEADER_T*)pbRecvData; - if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tCloseDriver, ptCnf)) ) { ptInfo->tDriverInfo.ulDriverHandle = 0; } - OS_Memfree(pbRecvData); + OS_Memfree(ptCnf); } return lRet; } @@ -583,10 +579,10 @@ PFN_RECV_PKT_CALLBACK pfnRecvPktCallback, void* pvUser) { - int32_t lRet = CIFX_INVALID_HANDLE; - uint8_t* pbRecvData = NULL; - PMARSH_CHANNEL_INFO_T ptSysDevice = (PMARSH_CHANNEL_INFO_T)hSysdevice; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptSysDevice->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + PMARSH_CHANNEL_INFO_T ptSysDevice = (PMARSH_CHANNEL_INFO_T)hSysdevice; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptSysDevice->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptSysDevice); @@ -611,10 +607,10 @@ tFindFirst.tData.ulUser = PTR2LONG(pvUser); OS_Memcpy( &tFindFirst.tData.szFilename, &ptDirectoryInfo->szFilename, sizeof(ptDirectoryInfo->szFilename)); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tFindFirst, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tFindFirst, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PSYSDEV_FIND_FIRSTFILE_CNF_T ptCnf = (PSYSDEV_FIND_FIRSTFILE_CNF_T)pbRecvData; + PSYSDEV_FIND_FIRSTFILE_CNF_T ptCnf = (PSYSDEV_FIND_FIRSTFILE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tFindFirst.tHeader, &ptCnf->tHeader)) ) { @@ -625,7 +621,7 @@ OS_Memset( &ptDirectoryInfo->szFilename, 0, sizeof(ptDirectoryInfo->szFilename)); OS_Memcpy( &ptDirectoryInfo->szFilename, &ptCnf->tData.szFilename, sizeof(ptDirectoryInfo->szFilename)); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } } else { @@ -647,11 +643,11 @@ tFindFirst.tData.ulUser = PTR2LONG(pvUser); OS_Memcpy( &tFindFirst.tData.szFilename, &ptDirectoryInfo->szFilename, sizeof(ptDirectoryInfo->szFilename)); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tFindFirst, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tFindFirst, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_FIND_FIRSTFILE_CNF_T ptCnf = (PCHANNEL_FIND_FIRSTFILE_CNF_T)pbRecvData; + PCHANNEL_FIND_FIRSTFILE_CNF_T ptCnf = (PCHANNEL_FIND_FIRSTFILE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tFindFirst.tHeader, &ptCnf->tHeader)) ) { @@ -662,7 +658,7 @@ OS_Memset( &ptDirectoryInfo->szFilename, 0, sizeof(ptDirectoryInfo->szFilename)); OS_Memcpy( &ptDirectoryInfo->szFilename, &ptCnf->tData.szFilename, sizeof(ptDirectoryInfo->szFilename)); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } } return lRet; @@ -683,10 +679,10 @@ PFN_RECV_PKT_CALLBACK pfnRecvPktCallback, void* pvUser) { - int32_t lRet = CIFX_INVALID_HANDLE; - uint8_t* pbRecvData = NULL; - PMARSH_CHANNEL_INFO_T ptSysDevice = (PMARSH_CHANNEL_INFO_T)hSysdevice; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptSysDevice->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + PMARSH_CHANNEL_INFO_T ptSysDevice = (PMARSH_CHANNEL_INFO_T)hSysdevice; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptSysDevice->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptSysDevice); @@ -711,10 +707,10 @@ tFindNext.tData.ulUser = PTR2LONG(pvUser); OS_Memcpy( &tFindNext.tData.szFilename, &ptDirectoryInfo->szFilename, sizeof(ptDirectoryInfo->szFilename)); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tFindNext, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tFindNext, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PSYSDEV_FIND_NEXTFILE_CNF_T ptCnf = (PSYSDEV_FIND_NEXTFILE_CNF_T)pbRecvData; + PSYSDEV_FIND_NEXTFILE_CNF_T ptCnf = (PSYSDEV_FIND_NEXTFILE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tFindNext.tHeader, &ptCnf->tHeader)) ) { @@ -725,7 +721,7 @@ OS_Memset( &ptDirectoryInfo->szFilename, 0, sizeof(ptDirectoryInfo->szFilename)); OS_Memcpy( &ptDirectoryInfo->szFilename, &ptCnf->tData.szFilename, sizeof(ptDirectoryInfo->szFilename)); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } } else { @@ -747,11 +743,11 @@ tFindNext.tData.ulUser = PTR2LONG(pvUser); OS_Memcpy( &tFindNext.tData.szFilename, &ptDirectoryInfo->szFilename, sizeof(ptDirectoryInfo->szFilename)); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tFindNext, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tFindNext, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_FIND_NEXTFILE_CNF_T ptCnf = (PCHANNEL_FIND_NEXTFILE_CNF_T)pbRecvData; + PCHANNEL_FIND_NEXTFILE_CNF_T ptCnf = (PCHANNEL_FIND_NEXTFILE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tFindNext.tHeader, &ptCnf->tHeader)) ) { @@ -762,7 +758,7 @@ OS_Memset( &ptDirectoryInfo->szFilename, 0, sizeof(ptDirectoryInfo->szFilename)); OS_Memcpy( &ptDirectoryInfo->szFilename, &ptCnf->tData.szFilename, sizeof(ptDirectoryInfo->szFilename)); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } } return lRet; @@ -1038,11 +1034,11 @@ uint32_t ulSize, CIFX_PACKET* ptRecvPkt) { - int32_t lRet = CIFX_INVALID_HANDLE; - uint8_t* pbRecvData = NULL; - CHANNEL_GET_SENDPACKET_REQ_T tGetSendPkt = {{{{0}}}}; - PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + CHANNEL_GET_SENDPACKET_REQ_T tGetSendPkt = {{{{0}}}}; + PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptChannel); @@ -1056,15 +1052,14 @@ tGetSendPkt.tData.ulSize = ulSize; - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tGetSendPkt, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tGetSendPkt, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PMARSHALLER_DATA_FRAME_HEADER_T ptMarshHeader = (PMARSHALLER_DATA_FRAME_HEADER_T)pbRecvData; - CIFX_PACKET* ptPacket = (CIFX_PACKET*)(ptMarshHeader + 1); + CIFX_PACKET* ptPacket = (CIFX_PACKET*)(ptRecvData + 1); - uint32_t ulCopySize = ptMarshHeader->ulDataSize; + uint32_t ulCopySize = ptRecvData->ulDataSize; - if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tGetSendPkt.tHeader, ptMarshHeader)) ) + if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tGetSendPkt.tHeader, ptRecvData)) ) { if(ulSize < ulCopySize) { @@ -1073,7 +1068,7 @@ } OS_Memcpy(ptRecvPkt, ptPacket, ulCopySize); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -1089,11 +1084,11 @@ uint32_t ulCmd, uint32_t* pulTrigger) { - int32_t lRet = CIFX_INVALID_HANDLE; - PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; - uint8_t* pbRecvData = NULL; - CHANNEL_WATCHDOG_REQ_T tWatchdogREQ = {{{{0}}}}; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + CHANNEL_WATCHDOG_REQ_T tWatchdogREQ = {{{{0}}}}; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptChannel); @@ -1108,17 +1103,17 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tWatchdogREQ, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tWatchdogREQ, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_WATCHDOG_CNF_T ptCnf = (PCHANNEL_WATCHDOG_CNF_T)pbRecvData; + PCHANNEL_WATCHDOG_CNF_T ptCnf = (PCHANNEL_WATCHDOG_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tWatchdogREQ.tHeader, &ptCnf->tHeader)) ) { *pulTrigger = ptCnf->tData.ulTrigger; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -1136,11 +1131,11 @@ uint32_t* pulState, uint32_t ulTimeout) { - int32_t lRet = CIFX_INVALID_HANDLE; - PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; - uint8_t* pbRecvData = NULL; - CHANNEL_HOSTSTATE_REQ_T tHostStateREQ = {{{{0}}}}; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + CHANNEL_HOSTSTATE_REQ_T tHostStateREQ = {{{{0}}}}; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptChannel); @@ -1157,11 +1152,11 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tHostStateREQ, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, ulTimeout); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tHostStateREQ, &ptRecvData, ulTimeout); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_HOSTSTATE_CNF_T ptCnf = (PCHANNEL_HOSTSTATE_CNF_T)pbRecvData; + PCHANNEL_HOSTSTATE_CNF_T ptCnf = (PCHANNEL_HOSTSTATE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tHostStateREQ.tHeader, &ptCnf->tHeader)) ) { @@ -1169,7 +1164,7 @@ *pulState = ptCnf->tData.ulState; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -1187,11 +1182,11 @@ uint32_t* pulState, uint32_t ulTimeout) { - int32_t lRet = CIFX_INVALID_HANDLE; - PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; - uint8_t* pbRecvData = NULL; - CHANNEL_CONFIG_LOCK_REQ_T tConfigLockREQ = {{{{0}}}}; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + CHANNEL_CONFIG_LOCK_REQ_T tConfigLockREQ = {{{{0}}}}; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptChannel); @@ -1207,11 +1202,11 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tConfigLockREQ, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, ulTimeout); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tConfigLockREQ, &ptRecvData, ulTimeout); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_CONFIG_LOCK_CNF_T ptCnf = (PCHANNEL_CONFIG_LOCK_CNF_T)pbRecvData; + PCHANNEL_CONFIG_LOCK_CNF_T ptCnf = (PCHANNEL_CONFIG_LOCK_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tConfigLockREQ.tHeader, &ptCnf->tHeader)) ) { @@ -1218,7 +1213,7 @@ *pulState = ptCnf->tData.ulState; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -1236,11 +1231,11 @@ uint32_t* pulState, uint32_t ulTimeout) { - int32_t lRet = CIFX_INVALID_HANDLE; - PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; - uint8_t* pbRecvData = NULL; - CHANNEL_BUSSTATE_REQ_T tBusStateREQ = {{{{0}}}}; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + CHANNEL_BUSSTATE_REQ_T tBusStateREQ = {{{{0}}}}; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptChannel); @@ -1257,11 +1252,11 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tBusStateREQ, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, ulTimeout); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tBusStateREQ, &ptRecvData, ulTimeout); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_BUSSTATE_CNF_T ptCnf = (PCHANNEL_BUSSTATE_CNF_T)pbRecvData; + PCHANNEL_BUSSTATE_CNF_T ptCnf = (PCHANNEL_BUSSTATE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tBusStateREQ.tHeader, &ptCnf->tHeader)) ) { @@ -1268,7 +1263,7 @@ if(NULL != pulState) *pulState = ptCnf->tData.ulState; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -1362,11 +1357,11 @@ uint32_t ulSize, void* pvData) { - int32_t lRet = CIFX_INVALID_HANDLE; - PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; - CHANNEL_IOINFO_REQ_T tIOInfoREQ = {{{{0}}}}; - uint8_t* pbRecvData = NULL; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; + CHANNEL_IOINFO_REQ_T tIOInfoREQ = {{{{0}}}}; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptChannel); @@ -1382,24 +1377,22 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tIOInfoREQ, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tIOInfoREQ, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PMARSHALLER_DATA_FRAME_HEADER_T ptMarshHeader = (PMARSHALLER_DATA_FRAME_HEADER_T)pbRecvData; - - if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tIOInfoREQ.tHeader, ptMarshHeader)) ) + if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tIOInfoREQ.tHeader, ptRecvData)) ) { /* Check the user buffer size and copy at least the length of the user buffer */ - uint32_t ulCopySize = ptMarshHeader->ulDataSize; + uint32_t ulCopySize = ptRecvData->ulDataSize; if(ulSize < ulCopySize) { ulCopySize = ulSize; lRet = CIFX_BUFFER_TOO_SHORT; } - OS_Memcpy( pvData, ptMarshHeader + 1, ulCopySize); + OS_Memcpy( pvData, ptRecvData + 1, ulCopySize); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -1421,11 +1414,11 @@ void* pvData, uint32_t ulTimeout) { - int32_t lRet = CIFX_INVALID_HANDLE; - PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; - CHANNEL_IOREAD_REQ_T tIOReadREQ = {{{{0}}}}; - uint8_t* pbRecvData = NULL; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; + CHANNEL_IOREAD_REQ_T tIOReadREQ = {{{{0}}}}; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptChannel); @@ -1442,26 +1435,24 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tIOReadREQ, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, ulTimeout); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tIOReadREQ, &ptRecvData, ulTimeout); if(CIFX_NO_ERROR == lRet) { - PMARSHALLER_DATA_FRAME_HEADER_T ptMarshHeader = (PMARSHALLER_DATA_FRAME_HEADER_T)pbRecvData; - - lRet = VerifyTransferResult(&tIOReadREQ.tHeader, ptMarshHeader); + lRet = VerifyTransferResult(&tIOReadREQ.tHeader, ptRecvData); if ( (CIFX_NO_ERROR == lRet) || (CIFX_DEV_NO_COM_FLAG == lRet) ) { /* Check the user buffer size and copy at least the length of the user buffer */ - uint32_t ulCopySize = ptMarshHeader->ulDataSize; + uint32_t ulCopySize = ptRecvData->ulDataSize; if(ulDataLen < ulCopySize) { ulCopySize = ulDataLen; lRet = CIFX_BUFFER_TOO_SHORT; } - OS_Memcpy( pvData, ptMarshHeader + 1, ulCopySize); + OS_Memcpy( pvData, ptRecvData + 1, ulCopySize); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -1487,7 +1478,7 @@ PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; PMARSHALLER_DATA_FRAME_HEADER_T ptHeader = NULL; uint32_t ulRequestSize = 0; - uint8_t* pbRecvData = NULL; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; uint32_t ulSendOffset = 0; uint8_t* pbData = NULL; MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); @@ -1531,17 +1522,15 @@ OS_Memcpy(&pbData[ulSendOffset], pvWriteData, ulDataLen); ulSendOffset += ulDataLen; - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)ptHeader, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, ulTimeout); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)ptHeader, &ptRecvData, ulTimeout); if(CIFX_NO_ERROR == lRet) { - PMARSHALLER_DATA_FRAME_HEADER_T ptMarshHeader = (PMARSHALLER_DATA_FRAME_HEADER_T)pbRecvData; - - if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(ptHeader, ptMarshHeader)) ) + if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(ptHeader, ptRecvData)) ) { - lRet = ptMarshHeader->ulError; + lRet = ptRecvData->ulError; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } OS_Memfree(ptHeader); return lRet; @@ -1562,11 +1551,11 @@ uint32_t ulDataLen, void* pvData) { - int32_t lRet = CIFX_INVALID_HANDLE; - PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; - uint8_t* pbRecvData = NULL; - CHANNEL_IOREADSENDDATA_REQ_T tReadSendREQ = {{{{0}}}}; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_INVALID_HANDLE; + PMARSH_CHANNEL_INFO_T ptChannel = (PMARSH_CHANNEL_INFO_T)hChannel; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + CHANNEL_IOREADSENDDATA_REQ_T tReadSendREQ = {{{{0}}}}; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); CHECK_REMOTE_HANDLE( ptChannel); @@ -1581,26 +1570,24 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tReadSendREQ, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tReadSendREQ, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PMARSHALLER_DATA_FRAME_HEADER_T ptMarshHeader = (PMARSHALLER_DATA_FRAME_HEADER_T)pbRecvData; - - lRet = VerifyTransferResult(&tReadSendREQ.tHeader, ptMarshHeader); + lRet = VerifyTransferResult(&tReadSendREQ.tHeader, ptRecvData); if ( (CIFX_NO_ERROR == lRet) || (CIFX_DEV_NO_COM_FLAG == lRet) ) { /* Check the user buffer size and copy at least the length of the user buffer */ - uint32_t ulCopySize = ptMarshHeader->ulDataSize; + uint32_t ulCopySize = ptRecvData->ulDataSize; if(ulDataLen < ulCopySize) { ulCopySize = ulDataLen; lRet = CIFX_BUFFER_TOO_SHORT; } - OS_Memcpy( pvData, ptMarshHeader + 1, ulCopySize); + OS_Memcpy( pvData, ptRecvData + 1, ulCopySize); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -1953,7 +1940,7 @@ uint32_t ulSendDataSize = 0; PMARSHALLER_DATA_FRAME_HEADER_T ptHeader = NULL; const uint32_t ulDeviceNameLen = OS_Strlen(szDevice); - uint8_t* pbRecvData = NULL; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; if(ulChannelNr == CIFX_SYSTEM_DEVICE) { @@ -2006,17 +1993,17 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, ptHeader , (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, ptHeader , &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCF_CREATEINSTANCE_CNF_T ptCnf = (PCF_CREATEINSTANCE_CNF_T)pbRecvData; + PCF_CREATEINSTANCE_CNF_T ptCnf = (PCF_CREATEINSTANCE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(ptHeader, &ptCnf->tHeader)) ) { ptChannel->dwRemoteHandle = ptCnf->tData.uHandle.ulHandle; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } OS_Memfree(ptHeader); @@ -2077,10 +2064,10 @@ /*****************************************************************************/ int32_t CloseChannelRequest( PMARSH_CHANNEL_INFO_T ptChannel) { - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); - int32_t lRet = 0; - MARSHALLER_DATA_FRAME_HEADER_T tCloseObject = {{{0}}}; - uint8_t* pbRecvData = NULL; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = 0; + MARSHALLER_DATA_FRAME_HEADER_T tCloseObject = {{{0}}}; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; GenerateHeader( &tCloseObject, ptChannel->dwRemoteHandle, @@ -2090,14 +2077,12 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, &tCloseObject, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, &tCloseObject, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - MARSHALLER_DATA_FRAME_HEADER_T* ptCnf = (MARSHALLER_DATA_FRAME_HEADER_T*)pbRecvData; + lRet = VerifyTransferResult( &tCloseObject, ptRecvData); - lRet = VerifyTransferResult( &tCloseObject, ptCnf); - - OS_Memfree( pbRecvData); + OS_Memfree( ptRecvData); } return lRet; } @@ -2148,7 +2133,7 @@ PMARSHALLER_DATA_FRAME_HEADER_T ptHeader = NULL; uint32_t ulLocalSize = ulSize; uint32_t ulRequestSize = 0; - uint8_t* pbRecvData = NULL; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; uint32_t ulOffset = 0; uint8_t* pbData = NULL; @@ -2176,11 +2161,11 @@ ptTLInfo->tDriverInfo.fSequenceNrSupport, ptTLInfo->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptTLInfo->hTransport, ptHeader, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptTLInfo->hTransport, ptHeader, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_GETMBXSTATE_CNF_T ptCnf = (PCHANNEL_GETMBXSTATE_CNF_T)pbRecvData; + PCHANNEL_GETMBXSTATE_CNF_T ptCnf = (PCHANNEL_GETMBXSTATE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(ptHeader, &ptCnf->tHeader)) ) { @@ -2187,7 +2172,7 @@ OS_Memcpy( pvBoardInfo, &ptCnf->tData, ulSize); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } OS_Memfree(ptHeader); @@ -2212,7 +2197,7 @@ uint32_t ulRequestSize = 0; uint32_t ulOffset = 0; uint8_t* pbData; - uint8_t* pbRecvData = NULL; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; ulRequestSize = sizeof(MARSHALLER_DATA_FRAME_HEADER_T) + sizeof(uint32_t) + /* ulBoard */ @@ -2242,19 +2227,17 @@ ptTLInfo->tDriverInfo.fSequenceNrSupport, ptTLInfo->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptTLInfo->hTransport, ptHeader, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptTLInfo->hTransport, ptHeader, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PMARSHALLER_DATA_FRAME_HEADER_T ptFrame = (PMARSHALLER_DATA_FRAME_HEADER_T)pbRecvData; - - if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(ptHeader, ptFrame)) ) + if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(ptHeader, ptRecvData)) ) { - CHANNEL_INFORMATION* ptChannelInfo = (CHANNEL_INFORMATION*)(ptFrame + 1); + CHANNEL_INFORMATION* ptChannelInfo = (CHANNEL_INFORMATION*)(ptRecvData + 1); OS_Memcpy( pvChannelInfo, ptChannelInfo, ulSize); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } OS_Memfree(ptHeader); @@ -2341,7 +2324,7 @@ if(fCall) { - uint8_t* pbRecvData = NULL; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; GenerateHeader(ptHeader, ptDevice->dwRemoteHandle, @@ -2351,11 +2334,11 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, ptHeader, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, ptHeader, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCF_CREATEINSTANCE_CNF_T ptCnf = (PCF_CREATEINSTANCE_CNF_T)pbRecvData; + PCF_CREATEINSTANCE_CNF_T ptCnf = (PCF_CREATEINSTANCE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(ptHeader, &ptCnf->tHeader)) ) { @@ -2362,7 +2345,7 @@ OS_Memcpy( pvInfo, &ptCnf->tData , ulSize); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } OS_Memfree(ptHeader); @@ -2380,10 +2363,10 @@ /*****************************************************************************/ static int32_t GetMbxState( PMARSH_CHANNEL_INFO_T ptChannel, uint32_t* pulRecvCnt, uint32_t* pulSendCnt) { - int32_t lRet; - uint8_t* pbRecvData = NULL; - MARSHALLER_DATA_FRAME_HEADER_T tGetMbxState = {{{0}}}; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + MARSHALLER_DATA_FRAME_HEADER_T tGetMbxState = {{{0}}}; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); GenerateHeader(&tGetMbxState, ptChannel->dwRemoteHandle, @@ -2394,11 +2377,11 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, &tGetMbxState, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, &tGetMbxState, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_GETMBXSTATE_CNF_T ptCnf = (PCHANNEL_GETMBXSTATE_CNF_T)pbRecvData; + PCHANNEL_GETMBXSTATE_CNF_T ptCnf = (PCHANNEL_GETMBXSTATE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tGetMbxState, &ptCnf->tHeader)) ) { @@ -2405,7 +2388,7 @@ *pulRecvCnt = ptCnf->tData.ulRecvPktCnt; *pulSendCnt = ptCnf->tData.ulSendPktCnt; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -2425,7 +2408,7 @@ uint32_t ulSendDataSize = ptPacket->tHeader.ulLen + sizeof(ptPacket->tHeader); uint32_t ulOffset = 0; uint8_t* pbData = NULL; - uint8_t* pbRecvData = NULL; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); ulRequestSize = sizeof(*ptHeader) + @@ -2456,15 +2439,15 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, ptHeader, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, ulTimeout); + lRet = TransferPacket( ptDLData->hTransport, ptHeader, &ptRecvData, ulTimeout); if(CIFX_NO_ERROR == lRet) { - PCF_CREATEINSTANCE_CNF_T ptCnf = (PCF_CREATEINSTANCE_CNF_T)pbRecvData; + PCF_CREATEINSTANCE_CNF_T ptCnf = (PCF_CREATEINSTANCE_CNF_T)ptRecvData; lRet = VerifyTransferResult(ptHeader, &ptCnf->tHeader); - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } OS_Memfree(ptHeader); @@ -2481,10 +2464,10 @@ /*****************************************************************************/ static int32_t GetPacket( PMARSH_CHANNEL_INFO_T ptChannel, CIFX_PACKET* ptPacket, uint32_t ulPacketLen, uint32_t ulTimeout) { - int32_t lRet = CIFX_NO_ERROR; - CHANNEL_GETPACKET_REQ_T tGetPacket = {{{{0}}}}; - uint8_t* pbRecvData = NULL; - MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); + int32_t lRet = CIFX_NO_ERROR; + CHANNEL_GETPACKET_REQ_T tGetPacket = {{{{0}}}}; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + MARSHALLER_ENDPOINT_DATA_T* ptDLData = netXTransportGetTLDeviceData( ptChannel->ptnetXTransportDev->hNetXTransportDeviceHandle); GenerateHeader( &tGetPacket.tHeader, ptChannel->dwRemoteHandle, @@ -2498,15 +2481,13 @@ tGetPacket.tData.ulSize = ulPacketLen; tGetPacket.tData.ulTimeout = ulTimeout; - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tGetPacket, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, ulTimeout); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tGetPacket, &ptRecvData, ulTimeout); if(CIFX_NO_ERROR == lRet) { - MARSHALLER_DATA_FRAME_HEADER_T* ptCnf = (MARSHALLER_DATA_FRAME_HEADER_T*)pbRecvData; - - if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tGetPacket.tHeader, ptCnf)) ) + if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tGetPacket.tHeader, ptRecvData)) ) { - CIFX_PACKET* ptRecvPacket = (CIFX_PACKET*)(ptCnf + 1); + CIFX_PACKET* ptRecvPacket = (CIFX_PACKET*)(ptRecvData + 1); uint32_t ulCopySize = ptRecvPacket->tHeader.ulLen + sizeof(CIFX_PACKET_HEADER); if(ulPacketLen < ulCopySize) @@ -2517,9 +2498,10 @@ OS_Memcpy(ptPacket, ptRecvPacket, ulCopySize); } + + OS_Memfree(ptRecvData); } - OS_Memfree(pbRecvData); return lRet; } @@ -2600,7 +2582,7 @@ if(fCall) { /* Send reset packet */ - uint8_t* pbRecvData = NULL; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; GenerateHeader(ptHeader, ptDevice->dwRemoteHandle, @@ -2610,7 +2592,7 @@ ptDLData->tDriverInfo.fSequenceNrSupport, ptDLData->tDriverInfo.usSequenceNr); - lRet = TransferPacket( ptDLData->hTransport, ptHeader, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, ulTimeout); + lRet = TransferPacket( ptDLData->hTransport, ptHeader, &ptRecvData, ulTimeout); if(NXT_TRANSACTION_CANCELLED == lRet) { @@ -2619,11 +2601,9 @@ lRet = CIFX_NO_ERROR; }else if(CIFX_NO_ERROR == lRet) { - PMARSHALLER_DATA_FRAME_HEADER_T ptMarshHeader = (PMARSHALLER_DATA_FRAME_HEADER_T)pbRecvData; + lRet = VerifyTransferResult(ptHeader, ptRecvData); - lRet = VerifyTransferResult(ptHeader, ptMarshHeader); - - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } OS_Memfree(ptHeader); } @@ -2654,8 +2634,8 @@ { case CIFX_CMD_READ_DATA: { - CHANNEL_BLOCK_READ_REQ_T tBlockReadReq = {{{{0}}}}; - uint8_t* pbRecvData = NULL; + CHANNEL_BLOCK_READ_REQ_T tBlockReadReq = {{{{0}}}}; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; GenerateHeader( &tBlockReadReq.tHeader, ptChannel->dwRemoteHandle, @@ -2669,11 +2649,11 @@ tBlockReadReq.tData.ulOffset = ulOffset; tBlockReadReq.tData.ulDatalen = ulDataLen; - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tBlockReadReq, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tBlockReadReq, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_BLOCK_READ_CNF_T ptReadCnf = (PCHANNEL_BLOCK_READ_CNF_T)pbRecvData; + PCHANNEL_BLOCK_READ_CNF_T ptReadCnf = (PCHANNEL_BLOCK_READ_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tBlockReadReq.tHeader, &ptReadCnf->tHeader)) ) { @@ -2680,7 +2660,7 @@ OS_Memcpy(pvData, ptReadCnf->tData.abData, ulDataLen); } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } } break; @@ -2687,9 +2667,9 @@ case CIFX_CMD_WRITE_DATA: { - PCHANNEL_BLOCK_WRITE_REQ_T ptBlockWriteReq = {0}; - uint8_t* pbRecvData = NULL; - uint32_t ulDataSendLen = sizeof(*ptBlockWriteReq) + ulDataLen; + PCHANNEL_BLOCK_WRITE_REQ_T ptBlockWriteReq = {0}; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + uint32_t ulDataSendLen = sizeof(*ptBlockWriteReq) + ulDataLen; ptBlockWriteReq = (PCHANNEL_BLOCK_WRITE_REQ_T)OS_Memalloc(ulDataSendLen); @@ -2706,11 +2686,11 @@ ptBlockWriteReq->tData.ulDatalen = ulDataLen; OS_Memcpy(ptBlockWriteReq->tData.abData, pvData, ulDataLen); - lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)ptBlockWriteReq, (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( ptDLData->hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)ptBlockWriteReq, &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCHANNEL_BLOCK_READ_CNF_T ptReadCnf = (PCHANNEL_BLOCK_READ_CNF_T)pbRecvData; + PCHANNEL_BLOCK_READ_CNF_T ptReadCnf = (PCHANNEL_BLOCK_READ_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&ptBlockWriteReq->tHeader, &ptReadCnf->tHeader)) ) { @@ -2717,7 +2697,7 @@ lRet = ptReadCnf->tHeader.ulError; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } OS_Memfree(ptBlockWriteReq); } @@ -2744,9 +2724,9 @@ uint32_t ulObjectType, uint32_t* pulObjectHandle) { - int32_t lRet = CIFX_NO_ERROR; - uint8_t* pbRecvData = NULL; - CF_CREATEINSTANCE_REQ_T tCreateInstance = {{{{0}}}}; + int32_t lRet = CIFX_NO_ERROR; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + CF_CREATEINSTANCE_REQ_T tCreateInstance = {{{{0}}}}; GenerateHeader(&tCreateInstance.tHeader, ulDestHandle, @@ -2758,11 +2738,11 @@ tCreateInstance.tData.ulObjectType = ulObjectType; - lRet = TransferPacket( hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tCreateInstance , (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( hTransport, (PMARSHALLER_DATA_FRAME_HEADER_T)&tCreateInstance , &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCF_CREATEINSTANCE_CNF_T ptCnf = (PCF_CREATEINSTANCE_CNF_T)pbRecvData; + PCF_CREATEINSTANCE_CNF_T ptCnf = (PCF_CREATEINSTANCE_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tCreateInstance.tHeader, &ptCnf->tHeader)) ) { @@ -2769,7 +2749,7 @@ *pulObjectHandle = ptCnf->tData.uHandle.ulHandle; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; } @@ -2781,17 +2761,17 @@ /******************************************************************************/ static int32_t QueryMarshallerVersion( NXTHANDLE hTransport) { - int32_t lRet = CIFX_NO_ERROR; - uint8_t* pbRecvData = NULL; - MARSHALLER_DATA_FRAME_HEADER_T tCFVersion = {{{0}}}; + int32_t lRet = CIFX_NO_ERROR; + PMARSHALLER_DATA_FRAME_HEADER_T ptRecvData = NULL; + MARSHALLER_DATA_FRAME_HEADER_T tCFVersion = {{{0}}}; GenerateHeader(&tCFVersion, 0, MARSHALLER_CF_METHODID_SERVERVERSION, 1, 0, 0, 0); - lRet = TransferPacket( hTransport, &tCFVersion , (PMARSHALLER_DATA_FRAME_HEADER_T*)&pbRecvData, TRANSPORT_TO_TRANSFER); + lRet = TransferPacket( hTransport, &tCFVersion , &ptRecvData, TRANSPORT_TO_TRANSFER); if(CIFX_NO_ERROR == lRet) { - PCF_SERVERVERSION_CNF_T ptCnf = (PCF_SERVERVERSION_CNF_T)(pbRecvData); + PCF_SERVERVERSION_CNF_T ptCnf = (PCF_SERVERVERSION_CNF_T)ptRecvData; if ( CIFX_NO_ERROR == (lRet = VerifyTransferResult(&tCFVersion, &ptCnf->tHeader)) ) { @@ -2798,7 +2778,7 @@ g_ulVersion = ptCnf->tData.ulVersion; } - OS_Memfree(pbRecvData); + OS_Memfree(ptRecvData); } return lRet; }