mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibCore: Put all classes in the Core namespace and remove the leading C
I've been wanting to do this for a long time. It's time we start being consistent about how this stuff works. The new convention is: - "LibFoo" is a userspace library that provides the "Foo" namespace. That's it :^) This was pretty tedious to convert and I didn't even start on LibGUI yet. But it's coming up next.
This commit is contained in:
parent
b7e3810b5c
commit
2d39da5405
265 changed files with 1380 additions and 1167 deletions
|
@ -32,24 +32,26 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
CTCPServer::CTCPServer(CObject* parent)
|
||||
: CObject(parent)
|
||||
namespace Core {
|
||||
|
||||
TCPServer::TCPServer(Object* parent)
|
||||
: Object(parent)
|
||||
{
|
||||
m_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
|
||||
ASSERT(m_fd >= 0);
|
||||
}
|
||||
|
||||
CTCPServer::~CTCPServer()
|
||||
TCPServer::~TCPServer()
|
||||
{
|
||||
}
|
||||
|
||||
bool CTCPServer::listen(const IPv4Address& address, u16 port)
|
||||
bool TCPServer::listen(const IPv4Address& address, u16 port)
|
||||
{
|
||||
if (m_listening)
|
||||
return false;
|
||||
|
||||
int rc;
|
||||
auto socket_address = CSocketAddress(address, port);
|
||||
auto socket_address = SocketAddress(address, port);
|
||||
auto in = socket_address.to_sockaddr_in();
|
||||
rc = ::bind(m_fd, (const sockaddr*)&in, sizeof(in));
|
||||
ASSERT(rc == 0);
|
||||
|
@ -58,7 +60,7 @@ bool CTCPServer::listen(const IPv4Address& address, u16 port)
|
|||
ASSERT(rc == 0);
|
||||
m_listening = true;
|
||||
|
||||
m_notifier = CNotifier::construct(m_fd, CNotifier::Event::Read);
|
||||
m_notifier = Notifier::construct(m_fd, Notifier::Event::Read);
|
||||
m_notifier->on_ready_to_read = [this] {
|
||||
if (on_ready_to_accept)
|
||||
on_ready_to_accept();
|
||||
|
@ -66,7 +68,7 @@ bool CTCPServer::listen(const IPv4Address& address, u16 port)
|
|||
return true;
|
||||
}
|
||||
|
||||
RefPtr<CTCPSocket> CTCPServer::accept()
|
||||
RefPtr<TCPSocket> TCPServer::accept()
|
||||
{
|
||||
ASSERT(m_listening);
|
||||
sockaddr_in in;
|
||||
|
@ -77,10 +79,10 @@ RefPtr<CTCPSocket> CTCPServer::accept()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return CTCPSocket::construct(accepted_fd);
|
||||
return TCPSocket::construct(accepted_fd);
|
||||
}
|
||||
|
||||
Optional<IPv4Address> CTCPServer::local_address() const
|
||||
Optional<IPv4Address> TCPServer::local_address() const
|
||||
{
|
||||
if (m_fd == -1)
|
||||
return {};
|
||||
|
@ -93,7 +95,7 @@ Optional<IPv4Address> CTCPServer::local_address() const
|
|||
return IPv4Address(address.sin_addr.s_addr);
|
||||
}
|
||||
|
||||
Optional<u16> CTCPServer::local_port() const
|
||||
Optional<u16> TCPServer::local_port() const
|
||||
{
|
||||
if (m_fd == -1)
|
||||
return {};
|
||||
|
@ -105,3 +107,5 @@ Optional<u16> CTCPServer::local_port() const
|
|||
|
||||
return ntohs(address.sin_port);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue