MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / InternalServerSend

Method InternalServerSend

pcsx2/DEV9/net.cpp:377–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377bool NetAdapter::InternalServerSend(NetPacket* pkt)
378{
379 EthernetFrame frame(pkt);
380 if (frame.protocol == static_cast<u16>(EtherType::IPv4))
381 {
382 PayloadPtr* payload = static_cast<PayloadPtr*>(frame.GetPayload());
383 IP_Packet ippkt(payload->data, payload->GetLength());
384
385 if (ippkt.protocol == static_cast<u16>(IP_Type::UDP))
386 {
387 IP_PayloadPtr* ipPayload = static_cast<IP_PayloadPtr*>(ippkt.GetPayload());
388 UDP_Packet udppkt(ipPayload->data, ipPayload->GetLength());
389
390 if (udppkt.destinationPort == 67)
391 {
392 //Send DHCP
393 if (dhcpOn)
394 return dhcpServer.Send(&udppkt);
395 }
396 }
397
398 if (ippkt.destinationIP == internalIP)
399 {
400 if (ippkt.protocol == static_cast<u16>(IP_Type::UDP))
401 {
402 ps2IP = ippkt.sourceIP;
403
404 IP_PayloadPtr* ipPayload = static_cast<IP_PayloadPtr*>(ippkt.GetPayload());
405 UDP_Packet udppkt(ipPayload->data, ipPayload->GetLength());
406
407 if (udppkt.destinationPort == 53)
408 {
409 //Send DNS
410 return dnsServer.Send(&udppkt);
411 }
412 }
413 return true;
414 }
415 }
416 return false;
417}
418
419void NetAdapter::InternalSignalReceived()
420{

Callers

nothing calls this directly

Calls 3

GetPayloadMethod · 0.45
GetLengthMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected