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

UDP (see udp.h). More...

#include "udp.h"
#include "byteorder.h"
#include "checksum.h"
#include "common/memory.h"
#include "icmp.h"
#include "inet_socket.h"

Functions

void udp_receive (netif_t *netif, const ipv4_header_t *ip, const uint8_t *d, 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 *d, uint32_t length)
 send a datagram (net_lock held).

Detailed Description

UDP (see udp.h).

Function Documentation

◆ udp_receive()

void udp_receive ( netif_t * netif,
const ipv4_header_t * ip,
const uint8_t * d,
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.