|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
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). | |
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.
| void(* mdl_net_vtable_t::destroy) (void *ctx) |
Release the backend-private state (called by mdl_net_destroy).
| [in] | ctx | Backend-private state (never NULL). |
| 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.
| [in] | ctx | Backend-private state (never NULL). |
| [in] | url | Absolute, scheme-validated http/https URL. |
| [in] | req | Session parameters (never NULL). |
| [in,out] | sink | Caller-owned bounded body sink (never NULL). |
| [out] | out_len | Bytes written. May be NULL. |
| [out] | resp | Response metadata (status + Retry-After). May be NULL. |
| 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).
| [in] | ctx | Backend-private state (never NULL). |
| [in] | url | Absolute, scheme-validated http/https URL. |
| [in] | req | Session parameters (never NULL). |
| [out] | buf | Destination buffer (never NULL). |
| [in] | cap | Capacity of buf in bytes (never 0). |
| [out] | out_len | Bytes written (excluding any NUL). May be NULL. |
| [out] | resp | Response metadata (status + Retry-After). May be NULL. |