ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_net_vtable_t Struct Reference

Method table one network backend registers (Dependency Inversion). More...

#include <mdl_net.h>

Data Fields

ra8_err_t(* get_buf )(void *ctx, const char *url, const mdl_net_req_t *req, char *buf, size_t cap, size_t *out_len, mdl_net_resp_t *resp)
 GET url fully into a caller buffer (used for HTML pages).
ra8_err_t(* get_body )(void *ctx, const char *url, const mdl_net_req_t *req, mdl_net_body_sink_t *sink, size_t *out_len, mdl_net_resp_t *resp)
 GET url and stream the body through an injected sink.
void(* destroy )(void *ctx)
 Release the backend-private state (called by mdl_net_destroy).

Detailed Description

Method table one network backend registers (Dependency Inversion).

The concrete backend (libcurl on the host, NetX/Mbed on the device, or a scripted fake in tests) fills one immutable, statically-allocated table of these four function pointers. Callers never see it: they hold a mdl_net_iface_t and go through the dispatchers, which forward to the table passing the backend's opaque ctx. Every pointer receives that ctx as its first argument so one table serves many independent handles.

Invariant
All three function pointers are non-NULL in any table handed to mdl_net_iface_t. The dispatchers refuse a NULL get_* method.
See also
mdl_net_iface_t
mdl_net_get_buf()
Since
0.1.0

Definition at line 186 of file mdl_net.h.

Field Documentation

◆ destroy

void(* mdl_net_vtable_t::destroy) (void *ctx)

Release the backend-private state (called by mdl_net_destroy).

Parameters
[in]ctxBackend-private state (never NULL).

Definition at line 227 of file mdl_net.h.

◆ get_body

ra8_err_t(* mdl_net_vtable_t::get_body) (void *ctx, const char *url, const mdl_net_req_t *req, mdl_net_body_sink_t *sink, size_t *out_len, mdl_net_resp_t *resp)

GET url and stream the body through an injected sink.

Parameters
[in]ctxBackend-private state (never NULL).
[in]urlAbsolute, scheme-validated http/https URL.
[in]reqSession parameters (never NULL).
[in,out]sinkCaller-owned bounded body sink (never NULL).
[out]out_lenBytes written. May be NULL.
[out]respResponse metadata (status + Retry-After). May be NULL.
Returns
An ra8_err_t per the mdl_net_get_body contract.

Definition at line 216 of file mdl_net.h.

◆ get_buf

ra8_err_t(* mdl_net_vtable_t::get_buf) (void *ctx, const char *url, const mdl_net_req_t *req, char *buf, size_t cap, size_t *out_len, mdl_net_resp_t *resp)

GET url fully into a caller buffer (used for HTML pages).

Parameters
[in]ctxBackend-private state (never NULL).
[in]urlAbsolute, scheme-validated http/https URL.
[in]reqSession parameters (never NULL).
[out]bufDestination buffer (never NULL).
[in]capCapacity of buf in bytes (never 0).
[out]out_lenBytes written (excluding any NUL). May be NULL.
[out]respResponse metadata (status + Retry-After). May be NULL.
Returns
An ra8_err_t per the mdl_net_get_buf contract.

Definition at line 198 of file mdl_net.h.


The documentation for this struct was generated from the following file: