mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
d6abfbdc5a
Now that CObject is fully ref-counted, just use RefPtr everywhere! :^)
27 lines
566 B
C++
27 lines
566 B
C++
#pragma once
|
|
|
|
#include <AK/IPv4Address.h>
|
|
#include <LibCore/CNotifier.h>
|
|
#include <LibCore/CObject.h>
|
|
|
|
class CTCPSocket;
|
|
|
|
class CTCPServer : public CObject {
|
|
C_OBJECT(CTCPServer)
|
|
public:
|
|
virtual ~CTCPServer() override;
|
|
|
|
bool is_listening() const { return m_listening; }
|
|
bool listen(const IPv4Address& address, u16 port);
|
|
|
|
RefPtr<CTCPSocket> accept();
|
|
|
|
Function<void()> on_ready_to_accept;
|
|
|
|
private:
|
|
explicit CTCPServer(CObject* parent = nullptr);
|
|
|
|
int m_fd { -1 };
|
|
bool m_listening { false };
|
|
RefPtr<CNotifier> m_notifier;
|
|
};
|