83 uint16_t dataChecksum = 0;
106 bool UDPSocket::onPacketReceived()
118 #if ENABLE_UDPTCP_RX_CHECKSUM
122 ACWARN(
"UDP checksum error");
nint16_t localPort
local TCP or UDP port
virtual void onReceive(uint16_t len)
Called when a datagram has arrived.
static const uint16_t ETHTYPE_IP
Ethernet header protocol type for IP.
static EthBuffer packet
in-memory packet buffer currently being processed.
nint16_t remotePort
remote TCP or UDP port
uint16_t rawValue
provides low level access to the memory containing the network-order integer
static bool verifyUDPTCPChecksum()
Verifies if the UDP or TCP checksum of the current packet is correct.
void tick()
This is a timer function that is called every NETWORK_TIMER_RESOLUTION milliseconds on every service...
bool send()
Sends the packet currently in the outgoing buffer
SharedBuffer buffer
output buffer for this socket
void flush()
Releases all data in this buffer, freeing up space.
static uint16_t calcUDPChecksum(uint16_t dataLength, uint16_t dataChecksum)
Calculates the UDP checksum.
ACROSS_MODULE("UDPSocket")
void prepareUDPPacket(uint16_t dataLength, uint16_t dataChecksum)
Fills out the UDP header and calculates the datagram checksum
static bool sendIPPacket(uint16_t length)
Puts the current in-memory packet in the network
static uint8_t srcPort_L_count
self-incrementing counter for local ports.
uint8_t l
least significant byte
uint8_t h
most significant byte
virtual bool sendPacket()
Sends the packet currently in the shared buffer
static const uint8_t UDP_SRC_PORT_H
Indicates the most significant byte of the source port number that EtherDune will use by default when...
void zero()
sets the variable to 0.
uint16_t fillTxBuffer(uint16_t dstOffset, uint16_t &checksum, uint16_t count=0xFFFF)
Copies up to count fragments to the transmit buffer via DMA, concatenating them starting at given off...
static const uint8_t IP_PROTO_UDP
IP header protocol type for UDP.