rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
wifi_req.h File Reference

The page server's request headers, as the guard (wa_guard.h) and the access code check read them. More...

#include <stdbool.h>
#include <stddef.h>
#include "esp_err.h"
#include "esp_http_server.h"
#include "wa_guard.h"

Go to the source code of this file.

Data Structures

struct  wifi_req_bufs_t
 Where wifi_req_guard() reads a request's headers into. More...

Functions

const char * wifi_req_hdr (httpd_req_t *r, const char *key, char *out, size_t cap)
 Header key of r into out.
bool wifi_req_guard (httpd_req_t *r, wa_req_kind_t kind, const char *name, wifi_req_bufs_t *bufs, esp_err_t *e)
 wa_guard() over r: the Host, the body's size, a write's Origin or Referer and the upload's header.

Detailed Description

The page server's request headers, as the guard (wa_guard.h) and the access code check read them.

SPDX-License-Identifier: MIT

Function Documentation

◆ wifi_req_guard()

bool wifi_req_guard ( httpd_req_t * r,
wa_req_kind_t kind,
const char * name,
wifi_req_bufs_t * bufs,
esp_err_t * e )

wa_guard() over r: the Host, the body's size, a write's Origin or Referer and the upload's header.

The panel's address is the IPv4 address the connection came in on: the access point's in AP, the station's in JOIN. A refusal is answered here, with no body and the connection closed, so a body not read is never read: httpd_req_delete() would read one to its end, a receive timeout at a time.

Parameters
rthe request
kindwhat it is
namethe panel's name, "rcbench-1A2B"
bufsthe header buffers
etakes the handler's return on a refusal
Returns
true when the request may be answered

◆ wifi_req_hdr()

const char * wifi_req_hdr ( httpd_req_t * r,
const char * key,
char * out,
size_t cap )

Header key of r into out.

Parameters
rthe request
keythe header's name
outtakes the value
capbytes of out
Returns
out; out holding "" for a value of cap bytes or more, which matches nothing; NULL for a header not sent or empty