10#define MAXOS_NET_UDP_H
48 class UserDatagramProtocolHandler;
104 virtual void send(uint8_t* data, uint16_t size);
131 void send(
UDPSocket* socket,
const 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.
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.
Event fired when data is received on a UDP socket.
UDPSocket * socket
The socket that received the data.
uint16_t size
The size of the data received.
uint8_t * data
The data received.
Handles the payload of a UDP packet.
UDPPayloadHandler()
Handler
common::Event< UDPEvents > * on_event(common::Event< UDPEvents > *event) override
Event handler for UDP payload events.
virtual void handle_user_datagram_protocol_message(UDPSocket *socket, uint8_t *data, uint16_t size)
Handle the recivement of a UDP message.
uint32_t remote_ip
The IP of the remote device.
uint16_t remote_port
The port on the remote device.
virtual void disconnect()
disconnect the UDP socket
uint16_t local_port
The port on this device.
UserDatagramProtocolHandler * user_datagram_protocol_handler
The UDP handler this socket is connected to.
virtual void send(uint8_t *data, uint16_t size)
send data through the UDP socket
bool listening
Wether the port is waiting for incoming connections.
uint32_t local_ip
The IP of this device.
virtual void handle_user_datagram_protocol_payload(uint8_t *data, uint16_t size)
Handle the recivement of a UDP payload.
Handles the UDP protocol.
static UserDatagramProtocolPort free_ports
The next free port number.
void disconnect(UDPSocket *socket)
Disconnects the socket from the remote IP and port.
UDPSocket * connect(uint32_t ip, uint16_t port)
common::Vector< UDPSocket * > sockets
The list of UDP sockets.
UDPSocket * listen(uint16_t port)
Listens for incoming packets on the port.
static void bind(UDPSocket *socket, UDPPayloadHandler *udp_payload_handler)
Binds a handler to the socket.
bool handle_internet_protocol_payload(net::InternetProtocolAddress source_ip, net::InternetProtocolAddress destination_ip, uint8_t *payload_data, uint32_t size) override
Handle the recivement of an UDP packet.
common::OutputStream * errorMessages
Where to write error messages.
void send(UDPSocket *socket, const uint8_t *data, uint16_t size)
Sends a packet to the remote IP and port.
Defines classes for handling events and event managers.
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.
uint16_t UserDatagramProtocolPort
UDP port.
UDPEvents
The events that can be fired by the UDP protocol.