void VtoCallbackTest::OnVtoDataReceived(const VtoData& arData) { size_t aLength = arData.GetSize(); assert(this->size + aLength <= sizeof(received)); memcpy(&this->received[this->size], arData.mpData, aLength); this->size += aLength; this->lastOnVtoDataReceived = aLength; ++this->numOnVtoDataReceived; }
void EnhancedVto::ReadVtoData(const VtoData& arData, bool& arLocalVtoConnectionOpened, boost::uint8_t& arChannelId) { if(arData.GetSize() != (2 + MAGIC_BYTES_SIZE)) throw Exception(LOCATION, "Unexpected size in enhanced vto frame"); if(memcmp(arData.mpData + 2, MAGIC_BYTES, MAGIC_BYTES_SIZE) != 0) throw Exception(LOCATION, "Enhanced vto frame did not include the control sequence"); arChannelId = arData.mpData[0]; arLocalVtoConnectionOpened = (arData.mpData[1] == 0); }
void VtoRouter::OnVtoDataReceived(const VtoData& arData) { LOG_BLOCK(LEV_DEBUG, "GotRemoteData: " << arData.GetSize() << " Type: " << ToString(arData.GetType())); if(this->CheckIncomingVtoData(arData)) { /* * Each physical layer action is processed serially, so we can take * advantage of the FIFO structure to keep things simple. */ this->mPhysLayerTxBuffer.push(arData); this->CheckForPhysWrite(); } }
void VtoRouter::OnVtoDataReceived(const VtoData& arData) { // this callback may be coming from another strand (i.e. a stack) and therefore must be synchronized mpPhys->GetExecutor()->Post([this, arData]() { LOG_BLOCK(LEV_DEBUG, "GotRemoteData: " << arData.GetSize() << " Type: " << ToString(arData.GetType())); if(this->CheckIncomingVtoData(arData)) { /* * Each physical layer action is processed serially, so we can take * advantage of the FIFO structure to keep things simple. */ this->mPhysLayerTxBuffer.push(arData); this->CheckForPhysWrite(); } }); }