Kernel: Make IPv4Socket::protocol_send() use a size_t for buffer size

This commit is contained in:
Andreas Kling 2020-01-29 12:27:42 +01:00
parent 9ce4ef2dd3
commit 03837e37a3
Notes: sideshowbarker 2024-07-19 09:45:17 +09:00
5 changed files with 7 additions and 7 deletions

View File

@ -94,7 +94,7 @@ protected:
virtual KResult protocol_bind() { return KSuccess; }
virtual KResult protocol_listen() { return KSuccess; }
virtual int protocol_receive(const KBuffer&, void*, size_t, int) { return -ENOTIMPL; }
virtual int protocol_send(const void*, int) { return -ENOTIMPL; }
virtual int protocol_send(const void*, size_t) { return -ENOTIMPL; }
virtual KResult protocol_connect(FileDescription&, ShouldBlock) { return KSuccess; }
virtual int protocol_allocate_local_port() { return 0; }
virtual bool protocol_is_disconnected() const { return false; }

View File

@ -158,13 +158,13 @@ int TCPSocket::protocol_receive(const KBuffer& packet_buffer, void* buffer, size
return payload_size;
}
int TCPSocket::protocol_send(const void* data, int data_length)
int TCPSocket::protocol_send(const void* data, size_t data_length)
{
send_tcp_packet(TCPFlags::PUSH | TCPFlags::ACK, data, data_length);
return data_length;
}
void TCPSocket::send_tcp_packet(u16 flags, const void* payload, int payload_size)
void TCPSocket::send_tcp_packet(u16 flags, const void* payload, size_t payload_size)
{
auto buffer = ByteBuffer::create_zeroed(sizeof(TCPPacket) + payload_size);
auto& tcp_packet = *(TCPPacket*)(buffer.data());

View File

@ -147,7 +147,7 @@ public:
u32 packets_out() const { return m_packets_out; }
u32 bytes_out() const { return m_bytes_out; }
void send_tcp_packet(u16 flags, const void* = nullptr, int = 0);
void send_tcp_packet(u16 flags, const void* = nullptr, size_t = 0);
void send_outgoing_packets();
void receive_tcp_packet(const TCPPacket&, u16 size);
@ -171,7 +171,7 @@ private:
static NetworkOrdered<u16> compute_tcp_checksum(const IPv4Address& source, const IPv4Address& destination, const TCPPacket&, u16 payload_size);
virtual int protocol_receive(const KBuffer&, void* buffer, size_t buffer_size, int flags) override;
virtual int protocol_send(const void*, int) override;
virtual int protocol_send(const void*, size_t) override;
virtual KResult protocol_connect(FileDescription&, ShouldBlock) override;
virtual int protocol_allocate_local_port() override;
virtual bool protocol_is_disconnected() const override;

View File

@ -88,7 +88,7 @@ int UDPSocket::protocol_receive(const KBuffer& packet_buffer, void* buffer, size
return udp_packet.length() - sizeof(UDPPacket);
}
int UDPSocket::protocol_send(const void* data, int data_length)
int UDPSocket::protocol_send(const void* data, size_t data_length)
{
auto routing_decision = route_to(peer_address(), local_address());
if (routing_decision.is_zero())

View File

@ -42,7 +42,7 @@ private:
static Lockable<HashMap<u16, UDPSocket*>>& sockets_by_port();
virtual int protocol_receive(const KBuffer&, void* buffer, size_t buffer_size, int flags) override;
virtual int protocol_send(const void*, int) override;
virtual int protocol_send(const void*, size_t) override;
virtual KResult protocol_connect(FileDescription&, ShouldBlock) override;
virtual int protocol_allocate_local_port() override;
virtual KResult protocol_bind() override;