1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00

Kernel: Actually send things between the socket endpoints.

This commit is contained in:
Andreas Kling 2019-02-14 16:01:08 +01:00
parent b20a7aca61
commit eb1c721ef3
5 changed files with 53 additions and 3 deletions

View file

@ -7,6 +7,8 @@
#include <AK/Vector.h>
#include <Kernel/UnixTypes.h>
enum class SocketRole { None, Accepted, Connected };
class Socket : public Retainable<Socket> {
public:
static RetainPtr<Socket> create(int domain, int type, int protocol, int& error);
@ -27,6 +29,11 @@ public:
virtual bool get_address(sockaddr*, socklen_t*) = 0;
virtual bool is_local() const { return false; }
virtual bool can_read(SocketRole) const = 0;
virtual ssize_t read(SocketRole, byte*, size_t) = 0;
virtual ssize_t write(SocketRole, const byte*, size_t) = 0;
virtual bool can_write(SocketRole) const = 0;
protected:
Socket(int domain, int type, int protocol);