radcli_dae_process3
Validate a caller-supplied packet, without a radcli-owned socket the l0 counterpart of radcli_ctx_dispatch(), running the identical validation pipeline (req-dae-net-003) on a buffer and source address the caller supplies instead of reading them from radcli_dae_start()'s socket. a request this produces is otherwise indistinguishable from one radcli_ctx_dispatch() would have delivered to a handler.
Usage
#include <radcli/>
int radcli_dae_process(
radcli_dae *dae,
const void *buf,
size_t len,
const struct sockaddr *from,
socklen_t fromlen,
radcli_dae_request **req
);
Overview
Parameters
dae-
a listener from radcli_dae_new() (radcli_dae_start() need never have been called: this function reads no socket). Rejected outright (-1) if dae is following serv-type=tls/dtls (RadSec): that transport trusts the record's origin entirely to the already-verified TLS/DTLS session (REQ-DAE-SEC-015), which this buffer/address pair is not, and has no source-address check of its own to apply to it.
buf-
the received packet, header included.
len-
buf's length.
from-
the packet's source address, for the dae-server authorization check.
fromlen-
from's length. Must be at least sizeof(struct sockaddr_in) and at most sizeof(struct sockaddr_storage), and consistent with the family from->sa_family declares (AF_INET or AF_INET6 only, matching what dae-server can authorize) an application relaying from and fromlen from an untrusted producer (e.g. over IPC from a privileged listener) must not assume this function corrects a mismatch; it only rejects one.
req-
set to the validated request on success (RADCLI_DAE_NEW or RADCLI_DAE_DUPLICATE), left NULL on failure.
Return value
RADCLI_DAE_NEW or RADCLI_DAE_DUPLICATE on success, -1 if the packet failed validation (discarded silently, exactly as radcli_ctx_dispatch() would), dae is a RadSec listener, or any argument is invalid.