|
LibJuno 1.0.4
LibJuno is a lightweight C11 library designed specifically for embedded systems.
|
Vtable defining the UDP socket module interface. More...
#include <udp_api.h>
Data Fields | |
| JUNO_STATUS_T(* | Send )(JUNO_UDP_ROOT_T *ptRoot, const UDP_THREAD_MSG_T *ptMsg) |
Send exactly one UDP_THREAD_MSG_T datagram. | |
| JUNO_STATUS_T(* | Receive )(JUNO_UDP_ROOT_T *ptRoot, UDP_THREAD_MSG_T *ptMsg) |
Receive exactly one UDP_THREAD_MSG_T datagram. | |
| JUNO_STATUS_T(* | Free )(JUNO_UDP_ROOT_T *ptRoot) |
| Release all resources held by the module (RAII cleanup). | |
Vtable defining the UDP socket module interface.
Every concrete UDP implementation (Linux POSIX, test double) provides a statically allocated JUNO_UDP_API_T whose function pointers are wired into a root by JunoUdp_LinuxInit. All operations take the module root as their first argument and return JUNO_STATUS_T for uniform error propagation.
This vtable expresses capabilities only (the "Rust trait" pattern). Resource acquisition (socket open) is performed by the platform init function (JunoUdp_LinuxInit) via RAII; it is not part of the vtable.
| JUNO_STATUS_T(* JUNO_UDP_API_TAG::Free) (JUNO_UDP_ROOT_T *ptRoot) |
Release all resources held by the module (RAII cleanup).
Closes the socket and resets the internal socket descriptor. Idempotent: safe to call even if the socket was never opened or has already been freed. Returns JUNO_STATUS_SUCCESS in that case.
| ptRoot | Module root instance; must be non-NULL. |
JUNO_STATUS_SUCCESS on success; non-zero on failure. | JUNO_STATUS_T(* JUNO_UDP_API_TAG::Receive) (JUNO_UDP_ROOT_T *ptRoot, UDP_THREAD_MSG_T *ptMsg) |
Receive exactly one UDP_THREAD_MSG_T datagram.
| ptRoot | Module root instance; socket must be open. |
| ptMsg | Output buffer; must be non-NULL. |
JUNO_STATUS_SUCCESS on success; JUNO_STATUS_TIMEOUT_ERROR on timeout (normal condition, failure handler not invoked); non-zero on other failures. | JUNO_STATUS_T(* JUNO_UDP_API_TAG::Send) (JUNO_UDP_ROOT_T *ptRoot, const UDP_THREAD_MSG_T *ptMsg) |
Send exactly one UDP_THREAD_MSG_T datagram.
| ptRoot | Module root instance; socket must be open. |
| ptMsg | Message to send; must be non-NULL and valid for the call. |
JUNO_STATUS_SUCCESS on success; non-zero on failure.