10#define MAXOS_NET_TCP_H
101 } tcp_pseudo_header_t;
107 class TransmissionControlProtocolHandler;
177 friend class TransmissionControlProtocolPortListener;
193 virtual void send(uint8_t* data, uint16_t size);
Manages the m_handlers for a type of event, raises events and calls the m_handlers.
Used to store information about an event, has a type and a return value.
A stream that strings can be written to.
Stores the left, top, width and height of a rectangle.
Event for when a TCP socket is connected.
TCPSocket * socket
The socket that is connected.
Event for when data is received on a TCP socket.
uint16_t size
The size of the data received.
TCPSocket * socket
The socket that received the data.
uint8_t * data
The data received.
Event for when a TCP socket is disconnected.
TCPSocket * socket
The socket that is disconnected.
Handles the payload of a specific IP protocol.
InternetProtocolHandler * internet_protocol_handler
The Internet protocol handler this payload handler is connected to.
Handles IPv4 packets over Ethernet frames.
Handler for TCP payloads.
virtual void disconnected(TCPSocket *socket)
Handle a TCP disconnection on the socket.
virtual void connected(TCPSocket *socket)
Handle a new TCP connection on the socket.
TCPPayloadHandler()
Handler///
common::Event< TCPPayloadHandlerEvents > * on_event(common::Event< TCPPayloadHandlerEvents > *event) override
Handle an event occurring on the TCP payload handler.
virtual void handle_transmission_control_protocol_payload(TCPSocket *socket, uint8_t *data, uint16_t size)
Handle TCP data received on the socket.
A TCP socket. Allows for sending and receiving data over TCP at a port.
uint32_t acknowledgement_number
The number used to keep track of what has been received, incremented by 1 each time.
virtual void send(uint8_t *data, uint16_t size)
send data over the socket
TransmissionControlProtocolHandler * transmission_control_protocol_handler
The TCP handler this socket is using.
uint16_t local_port
The port on this device.
void disconnected()
Raise the disconnected event.
uint32_t local_ip
The IP address of this device.
virtual void disconnect()
disconnect the socket
bool handle_transmission_control_protocol_payload(uint8_t *data, uint16_t size)
Handle the TCP message (socket end)
void connected()
Raise the connected event.
uint16_t remotePort
The port on the external device.
uint32_t sequence_number
The current order number of the data being sent.
TCPSocketState state
The state of the socket.
uint32_t remote_ip
The IP address of the external device.
Handles TCP packets and manages TCP sockets.
void disconnect(TCPSocket *socket)
Begin the disconnect process.
common::OutputStream * error_messages
Where to write error messages.
static TransmissionControlProtocolPort free_ports
The next free port to use for new sockets.
TCPSocket * connect(InternetProtocolAddress ip, TransmissionControlProtocolPort port)
connect to a remote host through the TCP protocol
void send_transmission_control_protocol_packet(TCPSocket *socket, const uint8_t *data, uint16_t size, uint16_t flags=0)
send a packet (Throught the provider)
bool handle_internet_protocol_payload(net::InternetProtocolAddress source_ip, net::InternetProtocolAddress destination_ip, uint8_t *payload_data, uint32_t size) override
Handle the TCP message (provider end)
common::Vector< TCPSocket * > sockets
The list of connected sockets.
virtual void bind(TCPSocket *socket, TCPPayloadHandler *handler)
bind a data handler to this socket
virtual TCPSocket * listen(uint16_t port)
Begin listening on a port.
Defines classes and structures for handling Internet Protocol version 4 (IPv4) packets.
uint32_t InternetProtocolAddress
An IPv4 address.
Defines a MemoryManager class for handling memory allocation and deallocation.
TCPPayloadHandlerEvents
Events for the TCPPayloadHandler.
uint16_t TransmissionControlProtocolPort
TCP port.
TCPFlag
The flags in a TCP header.
TCPSocketState
The state of a TCP socket.