The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
udp.h File Reference

UDP (RFC 768): datagrams between ports. More...

#include "ipv4.h"

Go to the source code of this file.

Macros

#define UDP_HEADER_SIZE   8

Functions

void udp_receive (netif_t *netif, const ipv4_header_t *ip, const uint8_t *datagram, uint32_t length)
 a received UDP datagram (net_lock held): checks it and gives it to the socket for its port, or answers "port unreachable".
bool udp_send (uint32_t source, uint16_t source_port, uint32_t dst, uint16_t dst_port, uint8_t *datagram, uint32_t length)
 send a datagram (net_lock held).

Detailed Description

UDP (RFC 768): datagrams between ports.

Macro Definition Documentation

◆ UDP_HEADER_SIZE

#define UDP_HEADER_SIZE   8

Function Documentation

◆ udp_receive()

void udp_receive ( netif_t * netif,
const ipv4_header_t * ip,
const uint8_t * datagram,
uint32_t length )

a received UDP datagram (net_lock held): checks it and gives it to the socket for its port, or answers "port unreachable".

◆ udp_send()

bool udp_send ( uint32_t source,
uint16_t source_port,
uint32_t dst,
uint16_t dst_port,
uint8_t * datagram,
uint32_t length )

send a datagram (net_lock held).

the first UDP_HEADER_SIZE bytes of datagram are the room for the header, which this fills in.

Parameters
sourcethe source address, or 0 for the address of the interface the datagram goes out on.
lengththe length with the header.