ladybird/Kernel/Net/UDPSocket.h

24 lines
858 B
C
Raw Normal View History

#pragma once
#include <Kernel/Net/IPv4Socket.h>
class UDPSocket final : public IPv4Socket {
public:
static NonnullRefPtr<UDPSocket> create(int protocol);
virtual ~UDPSocket() override;
static SocketHandle<UDPSocket> from_port(u16);
static void for_each(Function<void(UDPSocket&)>);
private:
explicit UDPSocket(int protocol);
2019-05-03 20:42:43 +02:00
virtual const char* class_name() const override { return "UDPSocket"; }
static Lockable<HashMap<u16, UDPSocket*>>& sockets_by_port();
virtual int protocol_receive(const KBuffer&, void* buffer, size_t buffer_size, int flags) override;
virtual int protocol_send(const void*, int) override;
virtual KResult protocol_connect(FileDescription&, ShouldBlock) override { return KSuccess; }
virtual int protocol_allocate_local_port() override;
virtual KResult protocol_bind() override;
};