2019-02-14 14:17:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Kernel/Socket.h>
|
|
|
|
#include <Kernel/DoubleBuffer.h>
|
|
|
|
|
2019-02-14 15:17:30 +01:00
|
|
|
class FileDescriptor;
|
|
|
|
|
2019-02-14 14:17:38 +01:00
|
|
|
class LocalSocket final : public Socket {
|
|
|
|
public:
|
|
|
|
static RetainPtr<LocalSocket> create(int type);
|
|
|
|
virtual ~LocalSocket() override;
|
|
|
|
|
2019-02-14 14:38:30 +01:00
|
|
|
virtual bool bind(const sockaddr*, socklen_t, int& error) override;
|
2019-02-14 15:55:19 +01:00
|
|
|
virtual RetainPtr<Socket> connect(const sockaddr*, socklen_t, int& error) override;
|
2019-02-14 15:17:30 +01:00
|
|
|
virtual bool get_address(sockaddr*, socklen_t*) override;
|
2019-02-14 14:38:30 +01:00
|
|
|
|
2019-02-14 14:17:38 +01:00
|
|
|
private:
|
|
|
|
explicit LocalSocket(int type);
|
2019-02-14 15:55:19 +01:00
|
|
|
virtual bool is_local() const override { return true; }
|
2019-02-14 14:17:38 +01:00
|
|
|
|
2019-02-14 15:17:30 +01:00
|
|
|
RetainPtr<FileDescriptor> m_file;
|
2019-02-14 15:55:19 +01:00
|
|
|
RetainPtr<LocalSocket> m_peer;
|
2019-02-14 15:17:30 +01:00
|
|
|
|
|
|
|
bool m_bound { false };
|
2019-02-14 15:55:19 +01:00
|
|
|
bool m_connected { false };
|
2019-02-14 15:17:30 +01:00
|
|
|
sockaddr_un m_address;
|
|
|
|
|
2019-02-14 14:17:38 +01:00
|
|
|
DoubleBuffer m_for_client;
|
|
|
|
DoubleBuffer m_for_server;
|
|
|
|
};
|
|
|
|
|