LibJuno 1.0.4
LibJuno is a lightweight C11 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
juno_udp_init.cpp File Reference

Implementation of JunoUdp_Init for the udp-threads example. More...

#include "udp_api.h"
#include "juno/macros.h"
Include dependency graph for juno_udp_init.cpp:

Functions

JUNO_STATUS_T JunoUdp_Init (JUNO_UDP_ROOT_T *ptRoot, const JUNO_UDP_API_T *ptApi, JUNO_FAILURE_HANDLER_T pfcnFailureHandler, void *pvFailureUserData)
 Initialise a UDP module root with a concrete vtable and failure handler.
 

Detailed Description

Implementation of JunoUdp_Init for the udp-threads example.

This translation unit implements the module initialisation function for the UDP socket module. It is intentionally free of POSIX headers; all platform-specific code lives in linux_udp_impl.cpp.

Including udp_api.h (which wraps its declarations in extern "C") gives JunoUdp_Init C linkage automatically when compiled as C++.

Function Documentation

◆ JunoUdp_Init()

JUNO_STATUS_T JunoUdp_Init ( JUNO_UDP_ROOT_T ptRoot,
const JUNO_UDP_API_T ptApi,
JUNO_FAILURE_HANDLER_T  pfcnFailureHandler,
void *  pvFailureUserData 
)

Initialise a UDP module root with a concrete vtable and failure handler.

Type-safe polymorphic handle for a UDP module instance.

Wires ptApi into ptRoot->ptApi and stores the optional failure handler and user data. Must be called before any vtable operation on the root. Platform-specific socket state (fd, address) is owned by the derivation (JUNO_UDP_LINUX_T) and initialised in JunoUdp_LinuxInit.

Parameters
ptRootCaller-owned root storage; must be non-NULL.
ptApiVtable (Linux implementation or test double); must be non-NULL.
pfcnFailureHandlerDiagnostic callback invoked before any error return; may be NULL.
pvFailureUserDataOpaque user data pointer threaded to the failure handler; may be NULL.
Returns
JUNO_STATUS_SUCCESS on success; JUNO_STATUS_NULLPTR_ERROR if ptRoot or ptApi is NULL.