The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
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
*/
16
void
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
*/
26
bool
udp_send
(
uint32_t
source,
uint16_t
source_port,
uint32_t
dst,
uint16_t
dst_port,
27
uint8_t
*
datagram
,
uint32_t
length);
ipv4.h
IPv4 (RFC 791): the header, the checks, and where a packet goes.
uint32_t
unsigned int uint32_t
Definition
fb.h:17
uint8_t
unsigned char uint8_t
Definition
fb.h:18
uint16_t
unsigned short uint16_t
Definition
stdint.h:13
netif_t
struct netif netif_t
datagram
Definition
inet_internal.h:14
netif
Definition
netif.h:37
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,...
Definition
udp.c:14
udp_send
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
src
kernel
net
udp.h
Generated by
1.18.0