Add rest query get.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-05-12 18:28:17 +02:00
parent 45017a514e
commit b3c91f068d
2 changed files with 13 additions and 0 deletions

View File

@@ -419,3 +419,15 @@ rest_route_handler_t rest_background_job_pop(void) {
}
return NULL;
}
rest_query_t *rest_query_get(const rest_request_t *request, const char *key) {
if (request == NULL || key == NULL) {
return NULL;
}
for (size_t i = 0; i < request->query_count; i++) {
if (request->query[i].key != NULL && strcmp(request->query[i].key, key) == 0) {
return &request->query[i];
}
}
return NULL;
}

View File

@@ -190,6 +190,7 @@ extern int rest_session_cleanup_expired(time_t expiration_time);
extern void rest_session_clear_all(void);
extern int rest_session_derive_key(const rest_session_t *session, uint8_t sk[32]);
extern int rest_session_derive_shared(const rest_session_t *session, uint8_t derived_key[32]);
extern rest_query_t *rest_query_get(const rest_request_t *request, const char *key);
#if DEBUG_APDU
extern void rest_debug_dump_payload(const char *tag, const char *buffer, size_t len);