| 375 | } |
| 376 | |
| 377 | bool 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 | |
| 419 | void NetAdapter::InternalSignalReceived() |
| 420 | { |
nothing calls this directly
no test coverage detected