File syn_udp.c¶
Go to the source code of this file
Zero-Alloc Native UDP Demuxing Engine & Task-Blocking Layer Implementation.
#include "syntropic/net/syn_udp.h"#include "syntropic/sched/syn_sched.h"#include "syntropic/sched/syn_task.h"#include "syntropic/util/syn_pack.h"#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| SYN_UdpSocket * | syn_udp_bind (SYN_UDP * udp, uint16_t local_port) Bind UDP socket to local port. |
| uint16_t | syn_udp_checksum (uint32_t src_ip, uint32_t dst_ip, const uint8_t * udp_seg, size_t len) Compute UDP 16-bit 1's complement checksum over pseudo-header and segment. |
| SYN_Status | syn_udp_init (SYN_UDP * udp, SYN_ETH * eth) Initialize UDP Stack. |
| SYN_Status | syn_udp_process_packet (SYN_UDP * udp, const uint8_t * ip_packet, size_t len) Process incoming UDP IPv4 packet. |
| int | syn_udp_sendto (SYN_UDP * udp, uint16_t src_port, uint32_t dst_ip, uint16_t dst_port, const uint8_t * data, size_t data_len, uint8_t * tx_out, size_t * tx_len) Construct outbound UDP packet into frame output buffer. |
| void | syn_udp_unbind (SYN_UdpSocket * sock) Unbind and release a UDP socket slot. |
Public Functions Documentation¶
function syn_udp_bind¶
Bind UDP socket to local port.
Parameters:
udpPointer to UDP stack instance.local_portPort number to bind.
Returns:
Pointer to allocated UDP socket slot, or NULL if capacity exceeded.
function syn_udp_checksum¶
Compute UDP 16-bit 1's complement checksum over pseudo-header and segment.
Parameters:
src_ipSource 32-bit IPv4 address.dst_ipDestination 32-bit IPv4 address.udp_segPointer to raw UDP segment bytes.lenUDP segment length in bytes.
Returns:
Computed 16-bit UDP checksum.
function syn_udp_init¶
Initialize UDP Stack.
Parameters:
udpPointer to UDP stack instance.ethPointer to Ethernet interface instance.
Returns:
SYN_OK on success.
function syn_udp_process_packet¶
Process incoming UDP IPv4 packet.
Parameters:
udpPointer to UDP stack instance.ip_packetPointer to raw IPv4 packet.lenIPv4 packet byte length.
Returns:
SYN_OK on success.
function syn_udp_sendto¶
Construct outbound UDP packet into frame output buffer.
int syn_udp_sendto (
SYN_UDP * udp,
uint16_t src_port,
uint32_t dst_ip,
uint16_t dst_port,
const uint8_t * data,
size_t data_len,
uint8_t * tx_out,
size_t * tx_len
)
Parameters:
udpPointer to UDP stack.src_portSource UDP port.dst_ipDestination IPv4 address.dst_portDestination UDP port.dataPointer to payload data buffer.data_lenPayload byte length.tx_outOutput Ethernet frame buffer.tx_lenPointer to receive final Ethernet frame length.
Returns:
SYN_OK on success.
function syn_udp_unbind¶
Unbind and release a UDP socket slot.
Parameters:
sockPointer to UDP socket slot.
The documentation for this class was generated from the following file src/syntropic/net/syn_udp.c