The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
udp.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * @file udp.h
5 * @brief UDP (RFC 768): datagrams between ports.
6 */
7
8#include "ipv4.h"
9
10#define UDP_HEADER_SIZE 8
11
12/**
13 * a received UDP datagram (net_lock held): checks it and gives it to the
14 * socket for its port, or answers "port unreachable".
15 */
16void udp_receive(netif_t *netif, const ipv4_header_t *ip, const uint8_t *datagram,
17 uint32_t length);
18
19/**
20 * send a datagram (net_lock held). the first UDP_HEADER_SIZE bytes of
21 * datagram are the room for the header, which this fills in.
22 * @param source the source address, or 0 for the address of the
23 * interface the datagram goes out on.
24 * @param length the length with the header.
25 */
26bool udp_send(uint32_t source, uint16_t source_port, uint32_t dst, uint16_t dst_port,
27 uint8_t *datagram, uint32_t length);
IPv4 (RFC 791): the header, the checks, and where a packet goes.
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
unsigned short uint16_t
Definition stdint.h:13
struct netif netif_t
Definition inet_internal.h:14
Definition netif.h:37
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,...
Definition udp.c:14
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).
Definition udp.c:45