mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-17 00:23:00 +00:00
IPv4: Begin fleshing out TCP support.
This commit is contained in:
parent
ef5d0a397c
commit
c588653f76
Notes:
sideshowbarker
2024-07-19 15:04:02 +09:00
Author: https://github.com/awesomekling
Commit: c588653f76
4 changed files with 112 additions and 6 deletions
|
@ -93,7 +93,11 @@ KResult IPv4Socket::connect(const sockaddr* address, socklen_t address_size)
|
|||
if (address->sa_family != AF_INET)
|
||||
return KResult(-EINVAL);
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
auto& ia = *(const sockaddr_in*)address;
|
||||
m_destination_address = IPv4Address((const byte*)&ia.sin_addr.s_addr);
|
||||
m_destination_port = ntohs(ia.sin_port);
|
||||
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
void IPv4Socket::attach_fd(SocketRole)
|
||||
|
@ -177,9 +181,11 @@ ssize_t IPv4Socket::sendto(const void* data, size_t data_length, int flags, cons
|
|||
return -EAFNOSUPPORT;
|
||||
}
|
||||
|
||||
auto& ia = *(const sockaddr_in*)addr;
|
||||
m_destination_address = IPv4Address((const byte*)&ia.sin_addr.s_addr);
|
||||
m_destination_port = ntohs(ia.sin_port);
|
||||
if (addr) {
|
||||
auto& ia = *(const sockaddr_in*)addr;
|
||||
m_destination_address = IPv4Address((const byte*)&ia.sin_addr.s_addr);
|
||||
m_destination_port = ntohs(ia.sin_port);
|
||||
}
|
||||
|
||||
allocate_source_port_if_needed();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue