2021-01-12 15:56:02 +00:00
|
|
|
#include "acutest.h"
|
2021-01-12 21:29:09 +00:00
|
|
|
#include <cassert>
|
2021-01-12 15:56:02 +00:00
|
|
|
#include <cstring>
|
2021-01-12 21:29:09 +00:00
|
|
|
#include <src/types.h>
|
|
|
|
#include <uspi.h>
|
|
|
|
|
2021-01-12 15:56:02 +00:00
|
|
|
#include <src/net-arp.h>
|
2021-01-12 21:29:09 +00:00
|
|
|
#include <src/net-ipv4.h>
|
|
|
|
|
|
|
|
uint8_t uspiBuffer[USPI_FRAME_BUFFER_SIZE];
|
2021-01-12 15:56:02 +00:00
|
|
|
|
2021-01-12 21:29:09 +00:00
|
|
|
extern "C" int USPiSendFrame(const void* pBuffer, unsigned nLength)
|
|
|
|
{
|
|
|
|
assert(nLength <= USPI_FRAME_BUFFER_SIZE);
|
|
|
|
memcpy(uspiBuffer, pBuffer, nLength);
|
|
|
|
return nLength;
|
|
|
|
}
|
2021-01-12 15:56:02 +00:00
|
|
|
|
|
|
|
extern "C" void USPiGetMACAddress(unsigned char Buffer[6])
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < 6; i++)
|
|
|
|
{
|
|
|
|
Buffer[i] = i << 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "net-arp.h"
|
|
|
|
#include "net-utils.h"
|
|
|
|
|
|
|
|
TEST_LIST = {
|
|
|
|
{"Net::Utils::InternetChecksum", TestNetUtilsInternetChecksum},
|
|
|
|
{"Net::Utils::Crc32", TestNetUtilsCrc32},
|
|
|
|
{"Net::Utils::GetMacAddress", TestNetUtilsGetMacAddress},
|
|
|
|
{"Net::Arp::Packet", TestNetArpPacket},
|
2021-01-12 21:29:09 +00:00
|
|
|
{"Net::Arp::SendPacket", TestNetArpSendPacket},
|
|
|
|
{"Net::Arp::SendRequest", TestNetArpSendRequest},
|
|
|
|
{"Net::Arp::SendReply", TestNetArpSendReply},
|
|
|
|
{"Net::Arp::SendAnnouncement", TestNetArpSendAnnouncement},
|
2021-01-12 15:56:02 +00:00
|
|
|
{nullptr, nullptr},
|
|
|
|
};
|