diff options
author | Shannon Booth <shannon.ml.booth@gmail.com> | 2020-03-15 11:41:10 +1300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-14 23:56:12 +0100 |
commit | 5dc5b8a2b643d906390fab1d1423208113079f00 (patch) | |
tree | d7fc2fd72142c538400c59d2d6ffb2b431949fd5 /Libraries | |
parent | 149a9ba5d7699198421b8cc5ca648e1f9206ff45 (diff) | |
download | serenity-5dc5b8a2b643d906390fab1d1423208113079f00.zip |
LibCore: Rename Udp classes to UDP
The kernel was already using the UDP prefix, and the TCP LibCore classes
are also uppercased. Let's rename for consistency.
Also order the LibCore Makefile alphabetically, because everywhere else
seems to be doing that :)
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibCore/Forward.h | 4 | ||||
-rw-r--r-- | Libraries/LibCore/Makefile | 38 | ||||
-rw-r--r-- | Libraries/LibCore/UDPServer.cpp (renamed from Libraries/LibCore/UdpServer.cpp) | 18 | ||||
-rw-r--r-- | Libraries/LibCore/UDPServer.h (renamed from Libraries/LibCore/UdpServer.h) | 10 | ||||
-rw-r--r-- | Libraries/LibCore/UDPSocket.cpp (renamed from Libraries/LibCore/UdpSocket.cpp) | 10 | ||||
-rw-r--r-- | Libraries/LibCore/UDPSocket.h (renamed from Libraries/LibCore/UdpSocket.h) | 10 |
6 files changed, 45 insertions, 45 deletions
diff --git a/Libraries/LibCore/Forward.h b/Libraries/LibCore/Forward.h index b857acafa1..9d15634050 100644 --- a/Libraries/LibCore/Forward.h +++ b/Libraries/LibCore/Forward.h @@ -54,8 +54,8 @@ class TCPServer; class TCPSocket; class Timer; class TimerEvent; -class UdpServer; -class UdpSocket; +class UDPServer; +class UDPSocket; enum class TimerShouldFireWhenNotVisible; diff --git a/Libraries/LibCore/Makefile b/Libraries/LibCore/Makefile index 10557fe393..10c243b503 100644 --- a/Libraries/LibCore/Makefile +++ b/Libraries/LibCore/Makefile @@ -1,33 +1,33 @@ OBJS = \ ArgsParser.o \ + ConfigFile.o \ DateTime.o \ - IODevice.o \ - File.o \ - SocketAddress.o \ - Socket.o \ - LocalSocket.o \ - LocalServer.o \ - TCPSocket.o \ - TCPServer.o \ - UdpSocket.o \ - UdpServer.o \ + DirIterator.o \ ElapsedTimer.o \ - MimeData.o \ - Notifier.o \ + Event.o \ + EventLoop.o \ + File.o \ + Gzip.o \ + HttpJob.o \ HttpRequest.o \ HttpResponse.o \ - HttpJob.o \ + IODevice.o \ + LocalServer.o \ + LocalSocket.o \ + MimeData.o \ NetworkJob.o \ NetworkResponse.o \ + Notifier.o \ Object.o \ - Timer.o \ - EventLoop.o \ - ConfigFile.o \ - Event.o \ ProcessStatisticsReader.o \ - DirIterator.o \ + Socket.o \ + SocketAddress.o \ + TCPServer.o \ + TCPSocket.o \ + Timer.o \ + UDPServer.o \ + UDPSocket.o \ UserInfo.o \ - Gzip.o \ puff.o LIBRARY = libcore.a diff --git a/Libraries/LibCore/UdpServer.cpp b/Libraries/LibCore/UDPServer.cpp index a1b9bd8a8d..7b230d63e5 100644 --- a/Libraries/LibCore/UdpServer.cpp +++ b/Libraries/LibCore/UDPServer.cpp @@ -27,25 +27,25 @@ #include <AK/IPv4Address.h> #include <AK/Types.h> #include <LibCore/Notifier.h> -#include <LibCore/UdpServer.h> -#include <LibCore/UdpSocket.h> +#include <LibCore/UDPServer.h> +#include <LibCore/UDPSocket.h> #include <stdio.h> #include <sys/socket.h> namespace Core { -UdpServer::UdpServer(Object* parent) +UDPServer::UDPServer(Object* parent) : Object(parent) { m_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0); ASSERT(m_fd >= 0); } -UdpServer::~UdpServer() +UDPServer::~UDPServer() { } -bool UdpServer::listen(const IPv4Address& address, u16 port) +bool UDPServer::listen(const IPv4Address& address, u16 port) { if (m_listening) return false; @@ -68,7 +68,7 @@ bool UdpServer::listen(const IPv4Address& address, u16 port) return true; } -RefPtr<UdpSocket> UdpServer::accept() +RefPtr<UDPSocket> UDPServer::accept() { ASSERT(m_listening); sockaddr_in in; @@ -79,10 +79,10 @@ RefPtr<UdpSocket> UdpServer::accept() return nullptr; } - return UdpSocket::construct(accepted_fd); + return UDPSocket::construct(accepted_fd); } -Optional<IPv4Address> UdpServer::local_address() const +Optional<IPv4Address> UDPServer::local_address() const { if (m_fd == -1) return {}; @@ -95,7 +95,7 @@ Optional<IPv4Address> UdpServer::local_address() const return IPv4Address(address.sin_addr.s_addr); } -Optional<u16> UdpServer::local_port() const +Optional<u16> UDPServer::local_port() const { if (m_fd == -1) return {}; diff --git a/Libraries/LibCore/UdpServer.h b/Libraries/LibCore/UDPServer.h index a9a022459f..055a4cdb0d 100644 --- a/Libraries/LibCore/UdpServer.h +++ b/Libraries/LibCore/UDPServer.h @@ -33,15 +33,15 @@ namespace Core { -class UdpServer : public Object { - C_OBJECT(UdpServer) +class UDPServer : public Object { + C_OBJECT(UDPServer) public: - virtual ~UdpServer() override; + virtual ~UDPServer() override; bool is_listening() const { return m_listening; } bool listen(const IPv4Address& address, u16 port); - RefPtr<UdpSocket> accept(); + RefPtr<UDPSocket> accept(); Optional<IPv4Address> local_address() const; Optional<u16> local_port() const; @@ -49,7 +49,7 @@ public: Function<void()> on_ready_to_accept; private: - explicit UdpServer(Object* parent = nullptr); + explicit UDPServer(Object* parent = nullptr); int m_fd { -1 }; bool m_listening { false }; diff --git a/Libraries/LibCore/UdpSocket.cpp b/Libraries/LibCore/UDPSocket.cpp index ae66eaf26e..39d73412e7 100644 --- a/Libraries/LibCore/UdpSocket.cpp +++ b/Libraries/LibCore/UDPSocket.cpp @@ -24,23 +24,23 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <LibCore/UdpSocket.h> +#include <LibCore/UDPSocket.h> #include <errno.h> #include <sys/socket.h> namespace Core { -UdpSocket::UdpSocket(int fd, Object* parent) +UDPSocket::UDPSocket(int fd, Object* parent) : Socket(Socket::Type::UDP, parent) { - // NOTE: This constructor is used by UdpServer::accept(), so the socket is already connected. + // NOTE: This constructor is used by UDPServer::accept(), so the socket is already connected. m_connected = true; set_fd(fd); set_mode(IODevice::ReadWrite); set_error(0); } -UdpSocket::UdpSocket(Object* parent) +UDPSocket::UDPSocket(Object* parent) : Socket(Socket::Type::UDP, parent) { int fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0); @@ -53,7 +53,7 @@ UdpSocket::UdpSocket(Object* parent) } } -UdpSocket::~UdpSocket() +UDPSocket::~UDPSocket() { } diff --git a/Libraries/LibCore/UdpSocket.h b/Libraries/LibCore/UDPSocket.h index e5a4223e0e..35c0d4ee75 100644 --- a/Libraries/LibCore/UdpSocket.h +++ b/Libraries/LibCore/UDPSocket.h @@ -30,14 +30,14 @@ namespace Core { -class UdpSocket final : public Socket { - C_OBJECT(UdpSocket) +class UDPSocket final : public Socket { + C_OBJECT(UDPSocket) public: - virtual ~UdpSocket() override; + virtual ~UDPSocket() override; private: - UdpSocket(int fd, Object* parent = nullptr); - explicit UdpSocket(Object* parent = nullptr); + UDPSocket(int fd, Object* parent = nullptr); + explicit UDPSocket(Object* parent = nullptr); }; } |