mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
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 :)
This commit is contained in:
parent
149a9ba5d7
commit
5dc5b8a2b6
Notes:
sideshowbarker
2024-07-19 08:18:11 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/5dc5b8a2b64 Pull-request: https://github.com/SerenityOS/serenity/pull/1462
7 changed files with 47 additions and 47 deletions
|
@ -54,8 +54,8 @@ class TCPServer;
|
|||
class TCPSocket;
|
||||
class Timer;
|
||||
class TimerEvent;
|
||||
class UdpServer;
|
||||
class UdpSocket;
|
||||
class UDPServer;
|
||||
class UDPSocket;
|
||||
|
||||
enum class TimerShouldFireWhenNotVisible;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {};
|
|
@ -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 };
|
|
@ -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()
|
||||
{
|
||||
}
|
||||
|
|
@ -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);
|
||||
};
|
||||
|
||||
}
|
|
@ -35,7 +35,7 @@
|
|||
#include <LibCore/File.h>
|
||||
#include <LibCore/LocalServer.h>
|
||||
#include <LibCore/LocalSocket.h>
|
||||
#include <LibCore/UdpSocket.h>
|
||||
#include <LibCore/UDPSocket.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -176,7 +176,7 @@ Vector<String> LookupServer::lookup(const String& hostname, bool& did_timeout, u
|
|||
|
||||
auto buffer = request.to_byte_buffer();
|
||||
|
||||
auto udp_socket = Core::UdpSocket::construct();
|
||||
auto udp_socket = Core::UDPSocket::construct();
|
||||
udp_socket->set_blocking(true);
|
||||
|
||||
struct timeval timeout {
|
||||
|
|
Loading…
Add table
Reference in a new issue