![]() |
Max OS 0.3
|
A TCP socket. Allows for sending and receiving data over TCP at a port. More...
#include <tcp.h>
Public Member Functions | |
| TCPSocket (TransmissionControlProtocolHandler *transmission_control_protocol_handler) | |
| Construct a new TCP Socket object. | |
| virtual void | send (uint8_t *data, uint16_t size) |
| send data over the socket | |
| virtual void | disconnect () |
| disconnect the socket | |
| void | disconnected () |
| Raise the disconnected event. | |
| void | connected () |
| Raise the connected event. | |
| bool | handle_transmission_control_protocol_payload (uint8_t *data, uint16_t size) |
| Handle the TCP message (socket end) | |
Public Member Functions inherited from MaxOS::common::EventManager< TCPPayloadHandlerEvents > | |
| void | connect_event_handler (EventHandler< TCPPayloadHandlerEvents > *handler) |
| connect an event handler to the event manager if it is not already connected | |
| void | disconnect_event_handler (EventHandler< TCPPayloadHandlerEvents > *handler) |
| disconnect an event handler from the event manager if it is connected | |
| Vector< Event< TCPPayloadHandlerEvents > * > | raise_event (Event< TCPPayloadHandlerEvents > *event) |
| Calls the on_event function of all the event m_handlers connected to the event manager and returns a list of the results. | |
Protected Attributes | |
| uint16_t | remotePort = 0 |
| The port on the external device. | |
| uint32_t | remote_ip = 0 |
| The IP address of the external device. | |
| uint16_t | local_port = 0 |
| The port on this device. | |
| uint32_t | local_ip = 0 |
| The IP address of this device. | |
| uint32_t | sequence_number = 0 |
| The current order number of the data being sent. | |
| uint32_t | acknowledgement_number = 0 |
| The number used to keep track of what has been received, incremented by 1 each time. | |
| TransmissionControlProtocolHandler * | transmission_control_protocol_handler |
| The TCP handler this socket is using. | |
| TCPSocketState | state |
| The state of the socket. | |
Protected Attributes inherited from MaxOS::common::EventManager< TCPPayloadHandlerEvents > | |
| Vector< EventHandler< TCPPayloadHandlerEvents > * > | m_handlers |
Friends | |
| class | TransmissionControlProtocolHandler |
| class | TransmissionControlProtocolPortListener |
A TCP socket. Allows for sending and receiving data over TCP at a port.
|
explicit |
Construct a new TCP Socket object.
| transmission_control_protocol_handler | the TCP handler the socket is associated with |
Definition at line 83 of file tcp.cpp.
References state, and transmission_control_protocol_handler.
| void TCPSocket::connected | ( | ) |
Raise the connected event.
Definition at line 143 of file tcp.cpp.
References MaxOS::memory::MemoryManager::kfree(), and MaxOS::common::EventManager< TCPPayloadHandlerEvents >::raise_event().
Referenced by MaxOS::net::TransmissionControlProtocolHandler::handle_internet_protocol_payload().
|
virtual |
disconnect the socket
Definition at line 126 of file tcp.cpp.
References MaxOS::net::TransmissionControlProtocolHandler::disconnect(), and transmission_control_protocol_handler.
| void TCPSocket::disconnected | ( | ) |
Raise the disconnected event.
Definition at line 133 of file tcp.cpp.
References MaxOS::memory::MemoryManager::kfree(), and MaxOS::common::EventManager< TCPPayloadHandlerEvents >::raise_event().
Referenced by MaxOS::net::TransmissionControlProtocolHandler::handle_internet_protocol_payload().
Handle the TCP message (socket end)
| data | The datah |
| size | The size of the data |
Definition at line 100 of file tcp.cpp.
References MaxOS::memory::MemoryManager::kfree(), and MaxOS::common::EventManager< TCPPayloadHandlerEvents >::raise_event().
Referenced by MaxOS::net::TransmissionControlProtocolHandler::handle_internet_protocol_payload().
send data over the socket
| data | The data to send |
| size | The size of the data |
Definition at line 113 of file tcp.cpp.
References MaxOS::net::TransmissionControlProtocolHandler::send_transmission_control_protocol_packet(), state, and transmission_control_protocol_handler.
|
friend |
|
protected |
The number used to keep track of what has been received, incremented by 1 each time.
Definition at line 185 of file tcp.h.
Referenced by MaxOS::net::TransmissionControlProtocolHandler::handle_internet_protocol_payload(), and MaxOS::net::TransmissionControlProtocolHandler::send_transmission_control_protocol_packet().
|
protected |
The IP address of this device.
Definition at line 183 of file tcp.h.
Referenced by MaxOS::net::TransmissionControlProtocolHandler::send_transmission_control_protocol_packet().
|
protected |
The port on this device.
Definition at line 182 of file tcp.h.
Referenced by MaxOS::net::TransmissionControlProtocolHandler::send_transmission_control_protocol_packet().
|
protected |
The IP address of the external device.
Definition at line 181 of file tcp.h.
Referenced by MaxOS::net::TransmissionControlProtocolHandler::handle_internet_protocol_payload(), and MaxOS::net::TransmissionControlProtocolHandler::send_transmission_control_protocol_packet().
|
protected |
The port on the external device.
Definition at line 180 of file tcp.h.
Referenced by MaxOS::net::TransmissionControlProtocolHandler::connect(), MaxOS::net::TransmissionControlProtocolHandler::handle_internet_protocol_payload(), and MaxOS::net::TransmissionControlProtocolHandler::send_transmission_control_protocol_packet().
|
protected |
The current order number of the data being sent.
Definition at line 184 of file tcp.h.
Referenced by MaxOS::net::TransmissionControlProtocolHandler::disconnect(), MaxOS::net::TransmissionControlProtocolHandler::handle_internet_protocol_payload(), and MaxOS::net::TransmissionControlProtocolHandler::send_transmission_control_protocol_packet().
|
protected |
The state of the socket.
Definition at line 188 of file tcp.h.
Referenced by MaxOS::net::TransmissionControlProtocolHandler::disconnect(), MaxOS::net::TransmissionControlProtocolHandler::handle_internet_protocol_payload(), MaxOS::net::TransmissionControlProtocolHandler::listen(), send(), and TCPSocket().
|
protected |
The TCP handler this socket is using.
Definition at line 187 of file tcp.h.
Referenced by disconnect(), send(), and TCPSocket().