Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::net::IPV4PayloadHandler Class Reference

Handles the payload of a specific IP protocol. More...

#include <ipv4.h>

Inheritance diagram for MaxOS::net::IPV4PayloadHandler:
MaxOS::net::InternetControlMessageProtocol MaxOS::net::TransmissionControlProtocolHandler MaxOS::net::UserDatagramProtocolHandler

Public Member Functions

 IPV4PayloadHandler (InternetProtocolHandler *internet_protocol_handler, uint8_t protocol)
 Construct a new IPV4 Payload Handler object and register it with the Internet Protocol Handler.
 
virtual bool handle_internet_protocol_payload (net::InternetProtocolAddress src_ip_be, net::InternetProtocolAddress dst_ip_be, uint8_t *internetprotocol_payload, uint32_t size)
 Called when an IP packet is received. (Deafult, does nothing, overide for use)
 
void send (InternetProtocolAddress destination_ip, uint8_t *payload_data, uint32_t size)
 Sends an IP packet.
 

Protected Attributes

InternetProtocolHandlerinternet_protocol_handler
 The Internet protocol handler this payload handler is connected to.
 
uint8_t ip_protocol
 The IP protocol this handler handles.
 

Friends

class InternetProtocolHandler
 

Detailed Description

Handles the payload of a specific IP protocol.

Definition at line 66 of file ipv4.h.

Constructor & Destructor Documentation

◆ IPV4PayloadHandler()

IPV4PayloadHandler::IPV4PayloadHandler ( InternetProtocolHandler internet_protocol_handler,
uint8_t  protocol 
)

Construct a new IPV4 Payload Handler object and register it with the Internet Protocol Handler.

Parameters
internet_protocol_handlerThe Internet Protocol Handler to register with
protocolThe IP protocol to handle

Definition at line 57 of file ipv4.cpp.

57 {
58
59 // Store vars
60 this->internet_protocol_handler = internet_protocol_handler;
61 this->ip_protocol = protocol;
62
63 //Register handler
65
66}
uint8_t ip_protocol
The IP protocol this handler handles.
Definition ipv4.h:71
InternetProtocolHandler * internet_protocol_handler
The Internet protocol handler this payload handler is connected to.
Definition ipv4.h:70
void connect_ipv_4_payload_handler(IPV4PayloadHandler *ipv_4_payload_handler)
Connects an IP protocol payload handler.
Definition ipv4.cpp:363

References MaxOS::net::InternetProtocolHandler::connect_ipv_4_payload_handler(), internet_protocol_handler, and ip_protocol.

Member Function Documentation

◆ handle_internet_protocol_payload()

bool IPV4PayloadHandler::handle_internet_protocol_payload ( net::InternetProtocolAddress  src_ip_be,
net::InternetProtocolAddress  dst_ip_be,
uint8_t internetprotocol_payload,
uint32_t  size 
)
virtual

Called when an IP packet is received. (Deafult, does nothing, overide for use)

Parameters
src_ip_beThe source IP address.
dst_ip_beThe destination IP address.
internetprotocol_payloadThe payload of the IP packet.
sizeThe size of the IP packet.
Returns
True if the packet was handled, false otherwise.

Reimplemented in MaxOS::net::TransmissionControlProtocolHandler, MaxOS::net::UserDatagramProtocolHandler, and MaxOS::net::InternetControlMessageProtocol.

Definition at line 79 of file ipv4.cpp.

82 {
83 return false;
84}

◆ send()

void IPV4PayloadHandler::send ( InternetProtocolAddress  destination_ip,
uint8_t payload_data,
uint32_t  size 
)

Sends an IP packet.

Parameters
destination_ipThe destination IP address.
payload_dataThe payload of the IP packet.
sizeThe size of the IP packet.

Definition at line 93 of file ipv4.cpp.

93 {
94
95
96 //Pass to backend
98
99}
Stores the left, top, width and height of a rectangle.
Definition rectangle.h:22
void send_internet_protocol_packet(uint32_t dst_ip_be, uint8_t protocol, const uint8_t *data, uint32_t size)
Sends an IP packet.
Definition ipv4.cpp:190

References internet_protocol_handler, ip_protocol, and MaxOS::net::InternetProtocolHandler::send_internet_protocol_packet().

Referenced by MaxOS::net::InternetControlMessageProtocol::request_echo_reply(), MaxOS::net::UserDatagramProtocolHandler::send(), and MaxOS::net::TransmissionControlProtocolHandler::send_transmission_control_protocol_packet().

Friends And Related Symbol Documentation

◆ InternetProtocolHandler

friend class InternetProtocolHandler
friend

Definition at line 67 of file ipv4.h.

Member Data Documentation

◆ internet_protocol_handler

InternetProtocolHandler* MaxOS::net::IPV4PayloadHandler::internet_protocol_handler
protected

◆ ip_protocol

uint8_t MaxOS::net::IPV4PayloadHandler::ip_protocol
protected

The IP protocol this handler handles.

Definition at line 71 of file ipv4.h.

Referenced by IPV4PayloadHandler(), and send().


The documentation for this class was generated from the following files: