LibJuno 1.0.4
LibJuno is a lightweight C11 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
udp_linux.h
Go to the documentation of this file.
1/*
2 MIT License
3
4 Copyright (c) 2025 Robin A. Onsay
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files
8 (the "Software"), to deal in the Software without restriction,
9 including without limitation the rights to use, copy, modify, merge,
10 publish, distribute, sublicense, and/or sell copies of the Software,
11 and to permit persons to whom the Software is furnished to do so,
12 subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be
15 included in all copies or substantial portions of the Software.
16*/
17
46#ifndef JUNO_UDP_LINUX_H
47#define JUNO_UDP_LINUX_H
48
49#include "udp_api.h"
50#include <sys/socket.h>
51#include <netinet/in.h>
52
53#ifdef __cplusplus
54extern "C"
55{
56#endif
57
58/* --------------------------------------------------------------------------
59 * JUNO_UDP_LINUX_T — Linux/POSIX derivation
60 * -------------------------------------------------------------------------- */
61
79// @{"req": ["REQ-UDP-001", "REQ-UDP-014"]}
80struct JUNO_UDP_LINUX_TAG JUNO_MODULE_DERIVE(JUNO_UDP_ROOT_T,
82 int _iSockFd;
84 struct sockaddr_in _tAddr;
85);
86typedef struct JUNO_UDP_LINUX_TAG JUNO_UDP_LINUX_T;
87
88/* --------------------------------------------------------------------------
89 * JUNO_UDP_T — module union (complete definition)
90 * -------------------------------------------------------------------------- */
91
106 JUNO_UDP_LINUX_T tLinux;
107);
108
109/* --------------------------------------------------------------------------
110 * Platform init function
111 * -------------------------------------------------------------------------- */
112
141// @{"req": ["REQ-UDP-003", "REQ-UDP-004", "REQ-UDP-005", "REQ-UDP-016"]}
143 JUNO_UDP_T *ptUdp,
144 const JUNO_UDP_CFG_T *ptCfg,
145 JUNO_FAILURE_HANDLER_T pfcnFailureHandler,
146 void *pvFailureUserData
147);
148
149#ifdef __cplusplus
150}
151#endif
152
153#endif /* JUNO_UDP_LINUX_H */
#define JUNO_MODULE(API_T, ROOT_T,...)
Define a module union consisting of the root and all derivations.
Definition module.h:112
#define JUNO_MODULE_DERIVE(ROOT_T,...)
Implement a derived module embedding the root as the first member.
Definition module.h:161
void(* JUNO_FAILURE_HANDLER_T)(JUNO_STATUS_T tStatus, const char *pcCustomMessage, JUNO_USER_DATA_T *pvUserData)
Failure handler callback signature.
Definition status.h:110
int32_t JUNO_STATUS_T
Canonical status type for LibJuno functions.
Definition status.h:51
Vtable defining the UDP socket module interface.
Definition udp_api.h:159
Configuration passed to JunoUdp_LinuxInit to open and configure a UDP socket.
Definition udp_api.h:131
Freestanding C11 interface for the UDP socket module (udp-threads example).
struct JUNO_UDP_ROOT_TAG JUNO_UDP_ROOT_T
Forward declaration of the UDP module root type.
Definition udp_api.h:71
struct JUNO_UDP_LINUX_TAG JUNO_UDP_LINUX_T
Forward declaration of the Linux derivation type.
Definition udp_api.h:74
union JUNO_UDP_TAG JUNO_UDP_T
Forward declaration of the UDP module union type.
Definition udp_api.h:81
JUNO_STATUS_T JunoUdp_LinuxInit(JUNO_UDP_T *ptUdp, const JUNO_UDP_CFG_T *ptCfg, JUNO_FAILURE_HANDLER_T pfcnFailureHandler, void *pvFailureUserData)
Initialise a Linux UDP module instance and open the socket (RAII).
Definition linux_udp_impl.cpp:264