src/Cedar/VLanWin32.c
// Read the next sent packet from the driver

Read the next sent packet from the driver
Read the next sent packet from the driver
bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size)
{
	if (v == NULL || buf == NULL || size == NULL)
	{
		return false;
	}
	if (v->Halt)
	{
		return false;
	}
	PROBE_STR("VLanGetNextPacket");
	while (true)
	{
		if (v->CurrentPacketCount < NEO_NUM_PACKET(v->GetBuffer))
		{
			*size = NEO_SIZE_OF_PACKET(v->GetBuffer, v->CurrentPacketCount);
			*buf = MallocFast(*size);
			Copy(*buf, NEO_ADDR_OF_PACKET(v->GetBuffer, v->CurrentPacketCount), *size);
			v->CurrentPacketCount++;
			return true;
		}
		else
		{
			if (VLanGetPacketsFromDriver(v) == false)
			{
				return false;
			}
			if (NEO_NUM_PACKET(v->GetBuffer) == 0)
			{
				*buf = NULL;
				*size = 0;
				return true;
			}
			v->CurrentPacketCount = 0;
		}
	}
}
bool VLanGetNextPacket ( VLAN * v , void * * buf , UINT * size ) { if ( v == NULL || buf == NULL || size == NULL ) { return false ; } if ( v -> Halt ) { return false ; } PROBE_STR ( " " ) ; while ( true ) { if ( v -> CurrentPacketCount < NEO_NUM_PACKET ( v -> GetBuffer ) ) { * size = NEO_SIZE_OF_PACKET ( v -> GetBuffer , v -> CurrentPacketCount ) ; * buf = MallocFast ( * size ) ; Copy ( * buf , NEO_ADDR_OF_PACKET ( v -> GetBuffer , v -> CurrentPacketCount ) , * size ) ; v -> CurrentPacketCount ++ ; return true ; } else { if ( VLanGetPacketsFromDriver ( v ) == false ) { return false ; } if ( NEO_NUM_PACKET ( v -> GetBuffer ) == 0 ) { * buf = NULL ; * size = 0 ; return true ; } v -> CurrentPacketCount = 0 ; } } }
Read the next sent packet from the driver
Read the next sent packet from the driver
// Validate arguments
 // There are still packets that have been read already
 // Increment the packet number
 // Read the next packet from the driver
 // Packet is not received currently
