ZealOS/src/Home/Net/Tests/DHCPTest2.CC
TomAwezome b1a9e0785d Fix some broken DolDoc links.
Change Who() symbol link width from 20 to 40.
2021-07-23 19:21:07 -04:00

40 lines
819 B
C++
Executable File

U8 src[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xC0, 0xDE};
U8 dst[6] = {0xF0, 0x0D, 0xBE, 0xAD, 0xDE, 0xAF};
U0 DHCPTest()
{
CUDPSocket *udp_socket = UDPSocket(AF_INET);
U32 your_ip;
U32 dns_ip;
U32 router_ip;
U32 subnet_mask;
U8 *packet_buffer;
I64 de_index;
if (ipv4_globals.local_ip != 0)
{
"\nThis test will only work on unconfigured network.\n";
"To force for testing, comment out $FG,0$NetConfigure;$FG$ in $LK,"Run.CC",A="FF:C:/Home/Net/Run.CC,NetConfigure"$.\n\n";
return;
}
DHCPInnerConfigure(udp_socket, &your_ip, &dns_ip, &router_ip, &subnet_mask);
UDPSocketClose(udp_socket);
while (TRUE)
{
de_index = EthernetFrameAllocate(&packet_buffer, src, dst, 0x0000, 8);
*(packet_buffer(U64 *)) = EndianU64(0xDEADBEEFC0DEFADE);
EthernetFrameFinish(de_index);
Sleep(300);
}
}
DHCPTest;