diff options
author | Conrad Pankoff <deoxxa@fknsrs.biz> | 2019-08-06 23:40:38 +1000 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-08-06 16:21:17 +0200 |
commit | 73c998dbfc8ecd87c6abde6c5b313453cd7baf71 (patch) | |
tree | 1e2ecf52dd48c4273c7550a938bc8176e70b1917 /Kernel/Net/Socket.h | |
parent | c973a51a23536030d943ecc42bbf4607e6412670 (diff) | |
download | serenity-73c998dbfc8ecd87c6abde6c5b313453cd7baf71.zip |
Kernel: Refactor TCP/IP stack
This has several significant changes to the networking stack.
* Significant refactoring of the TCP state machine. Right now it's
probably more fragile than it used to be, but handles quite a lot
more of the handshake process.
* `TCPSocket` holds a `NetworkAdapter*`, assigned during `connect()` or
`bind()`, whichever comes first.
* `listen()` is now virtual in `Socket` and intended to be implemented
in its child classes
* `listen()` no longer works without `bind()` - this is a bit of a
regression, but listening sockets didn't work at all before, so it's
not possible to observe the regression.
* A file is exposed at `/proc/net_tcp`, which is a JSON document listing
the current TCP sockets with a bit of metadata.
* There's an `ETHERNET_VERY_DEBUG` flag for dumping packet's content out
to `kprintf`. It is, indeed, _very debug_.
Diffstat (limited to 'Kernel/Net/Socket.h')
-rw-r--r-- | Kernel/Net/Socket.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h index bbfef8e90b..9094f7dd63 100644 --- a/Kernel/Net/Socket.h +++ b/Kernel/Net/Socket.h @@ -1,8 +1,8 @@ #pragma once #include <AK/HashTable.h> -#include <AK/RefPtr.h> #include <AK/RefCounted.h> +#include <AK/RefPtr.h> #include <AK/Vector.h> #include <Kernel/FileSystem/File.h> #include <Kernel/KResult.h> @@ -35,10 +35,10 @@ public: bool can_accept() const { return !m_pending.is_empty(); } RefPtr<Socket> accept(); bool is_connected() const { return m_connected; } - KResult listen(int backlog); virtual KResult bind(const sockaddr*, socklen_t) = 0; virtual KResult connect(FileDescription&, const sockaddr*, socklen_t, ShouldBlock) = 0; + virtual KResult listen(int) = 0; virtual bool get_local_address(sockaddr*, socklen_t*) = 0; virtual bool get_peer_address(sockaddr*, socklen_t*) = 0; virtual bool is_local() const { return false; } @@ -73,6 +73,9 @@ protected: void load_receive_deadline(); void load_send_deadline(); + int backlog() const { return m_backlog; } + void set_backlog(int backlog) { m_backlog = backlog; } + virtual const char* class_name() const override { return "Socket"; } private: |