|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Private response-validation seams for the media RPC client. More...
#include <stddef.h>#include "ra8_attributes.h"#include "ra8_c6link_mdl.h"#include "ra8_media_download.pb-c.h"Go to the source code of this file.
Functions | |
| bool | ra8_c6link_mdl_http_field_valid_test (const char *text, size_t cap) |
| Judge one decoded HTTP header exactly as the client does. | |
| bool | ra8_c6link_mdl_http_response_valid_test (const Ra8__Mdl__Chunk *msg) |
| Judge one decoded response's HTTP metadata exactly as the client does. | |
| bool | ra8_c6link_mdl_chunk_semantics_valid_test (const Ra8__Mdl__Chunk *msg) |
| Judge one decoded response's state semantics exactly as the client does. | |
| ra8_err_t | ra8_c6link_mdl_take_cancelled_test (ra8_c6link_t *link, ra8_mdl_session_t *session, const uint8_t *packed, size_t len) |
| Judge one cancellation acknowledgement exactly as the client does. | |
Private response-validation seams for the media RPC client.
Exposes the three pure predicates that judge a decoded response to focused host tests. Transport, correlation, and session ownership all remain private to ra8_c6link_mdl.c; nothing here changes what production runs.
Definition in file ra8_c6link_mdl_internal.h.
| bool ra8_c6link_mdl_chunk_semantics_valid_test | ( | const Ra8__Mdl__Chunk * | msg | ) |
Judge one decoded response's state semantics exactly as the client does.
Forwards unchanged to the module-private predicate that enforces the data/digest/status combination each state permits, plus the overflow-safe relationship between offset, data length, and declared total.
| [in] | msg | Decoded generated chunk. |
| true | State, size, status, and digest fields are mutually coherent. |
| false | A state-specific rule or the total-covers-data rule is broken. |
msg is non-null and decoded into a live bounded arena. Definition at line 464 of file ra8_c6link_mdl.c.
References internal_mdl_chunk_semantics_valid(), and RA8_TEST_HELPER.
| bool ra8_c6link_mdl_http_field_valid_test | ( | const char * | text, |
| size_t | cap ) |
Judge one decoded HTTP header exactly as the client does.
Forwards unchanged to the module-private predicate, so a focused test drives the shipped bound and line-discipline logic rather than a copy. An absent header is valid; the C6 service sends the empty string for one it did not observe.
| [in] | text | Candidate decoded protobuf string, or null for absent. |
| [in] | cap | Maximum extent including the terminating NUL. |
| true | Absent, or terminates before cap with no CR or LF. |
| false | The header is unterminated or carries a header-injection byte. |
cap is nonzero. text is readable for at least cap bytes. Definition at line 454 of file ra8_c6link_mdl.c.
References internal_mdl_http_field_valid(), and RA8_TEST_HELPER.
| bool ra8_c6link_mdl_http_response_valid_test | ( | const Ra8__Mdl__Chunk * | msg | ) |
Judge one decoded response's HTTP metadata exactly as the client does.
Forwards unchanged to the module-private predicate that separates a non-terminal response, which must carry no metadata at all, from a COMPLETE response, whose status must be HTTP-shaped and whose four selected headers must each be bounded single-line text.
| [in] | msg | Decoded generated chunk. |
| true | The metadata matches what this response's state permits. |
| false | A status or header rule for that state is violated. |
msg is non-null and decoded into a live bounded arena. Definition at line 459 of file ra8_c6link_mdl.c.
References internal_mdl_http_response_valid(), and RA8_TEST_HELPER.
| ra8_err_t ra8_c6link_mdl_take_cancelled_test | ( | ra8_c6link_t * | link, |
| ra8_mdl_session_t * | session, | ||
| const uint8_t * | packed, | ||
| size_t | len ) |
Judge one cancellation acknowledgement exactly as the client does.
Builds the fields of the take context the cancelled path reads and runs the identical decode-and-correlate path, so a test observes the client's real acceptance rule rather than a reimplementation of it.
| [in,out] | link | Open link whose bounded arena decodes the message. |
| [in,out] | session | Caller session the acknowledgement must correlate to. |
| [in] | packed | Packed generated Cancelled bytes. |
| [in] | len | Valid bytes at packed. |
| k_ra8_ok | A matching acknowledgement deactivated session. |
| k_ra8_err_protocol_error | Decode or correlation validation failed. |
link is open and session carries the expected job identity. packed is readable for len bytes. session inactive; failure preserves its state. session or to the caller. Definition at line 445 of file ra8_c6link_mdl.c.
References internal_mdl_take_cancelled(), k_mdl_take_cancelled, and RA8_TEST_HELPER.