ProtoCore
v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
udp.h
Go to the documentation of this file.
1
// ProtoCore v1.0.16 - Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2
// SPDX-License-Identifier: AGPL-3.0-or-later
3
4
/**
5
* @file udp.h
6
* @brief Layer 4 (Transport), connectionless: the two sides of UDP, joined.
7
*
8
* One module with two halves. The listener binds a port, receives on it, and answers from it; the
9
* client sends from an ephemeral port and receives nothing. They are the same datagram service seen
10
* from either end, so they sit together and a caller reaches whichever it needs through @ref Udp
11
* rather than knowing two modules.
12
*
13
* Both halves own their stack plumbing (`udp_pcb`, `pbuf`) and hand out framed rings instead, so no
14
* stack type reaches a layer above this one.
15
*
16
* Every send here takes a `protocore_ip`, never a name or its text. A caller that starts from either turns
17
* it into an address once, where it enters, and keeps that: resolving a name or parsing a string
18
* per datagram puts that work on the send path of every call.
19
*
20
* Each half is reached through its own handle: ::UdpListener and ::UdpClient. The halves are pointers
21
* rather than values because a table in one translation unit is not a constant expression in
22
* another, so a by-value member could not be initialized from here.
23
*
24
* @author Douglas Quigg (dstroy0)
25
* @date 2026
26
*/
27
28
#ifndef PROTOCORE_UDP_H
29
#define PROTOCORE_UDP_H
30
31
#include "
protocore_config.h
"
// the entry point: the enable gate below, and the widths
32
33
#if PROTOCORE_ENABLE_UDP
34
35
#include "
network_drivers/transport/udp/client/client.h
"
// UdpClientNs: the sending half
36
#include "
network_drivers/transport/udp/server/server.h
"
// UdpListenerNs: the receiving half
37
38
PROTOCORE_BEGIN_DECLS
39
40
/**
41
* @brief The datagram service.
42
*
43
* @var UdpNs::listener bound ports: receiving, replying, and sending from the bound endpoint
44
* @var UdpNs::client an ephemeral source port: sending only
45
*/
46
typedef
struct
47
{
48
UdpListenerNs
*
const
listener;
49
UdpClientNs
*
const
client;
50
} UdpNs;
51
52
/** @brief The one symbol this module exports. */
53
extern
UdpNs Udp;
54
55
PROTOCORE_END_DECLS
56
57
#endif
// PROTOCORE_ENABLE_UDP
58
59
#endif
// PROTOCORE_UDP_H
protocore_config.h
UdpClientNs
The entries.
Definition
client.h:65
UdpListenerNs
The entries.
Definition
server.h:123
client.h
Layer 4 UDP, the sending side: datagrams to an arbitrary destination.
server.h
Layer 4 UDP, the receiving side: bound ports, their receive rings, and the drain.
PROTOCORE_BEGIN_DECLS
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
Definition
types.h:96
PROTOCORE_END_DECLS
#define PROTOCORE_END_DECLS
Definition
types.h:97
src
network_drivers
transport
udp
udp.h
Generated by
1.9.8