Updated network related code so now it should work as expected

This commit is contained in:
Alex
2023-01-09 03:32:17 +02:00
parent ad16d361dc
commit 4f6c7e8a0d
20 changed files with 603 additions and 246 deletions

View File

@ -49,21 +49,21 @@ namespace NetworkUDP
UDP(NetworkIPv4::IPv4 *ipv4, NetworkInterfaceManager::DeviceInterface *Interface);
~UDP();
virtual Socket *Connect(InternetProtocol4 IP, uint16_t Port);
virtual Socket *Connect(InternetProtocol IP, uint16_t Port);
virtual Socket *Listen(uint16_t Port);
virtual void Disconnect(Socket *Socket);
virtual void Send(Socket *Socket, uint8_t *Data, uint64_t Length);
virtual void Bind(Socket *Socket, UDPEvents *EventHandler);
virtual bool OnIPv4PacketReceived(InternetProtocol4 SourceIP, InternetProtocol4 DestinationIP, uint8_t *Data, uint64_t Length);
virtual bool OnIPv4PacketReceived(InternetProtocol SourceIP, InternetProtocol DestinationIP, uint8_t *Data, uint64_t Length);
};
class Socket
{
public:
InternetProtocol4 LocalIP = {.Address = {0xFF, 0xFF, 0xFF, 0xFF}};
InternetProtocol LocalIP;
uint16_t LocalPort = 0;
InternetProtocol4 RemoteIP = {.Address = {0xFF, 0xFF, 0xFF, 0xFF}};
InternetProtocol RemoteIP;
uint16_t RemotePort = 0;
bool Listening = false;
UDPEvents *EventHandler = nullptr;