Files
Hodor/main/cam_auth.h
T
Aida_Lashkari 72a2d714ab Add : RTSP audio/video with back channel, and auth
- cam_stream: shared JPEG feed for /pic, /stream and RTSP; RTSP server
  (port 554, TCP) with MJPEG video, G.711 mic audio and an ONVIF-style
  back channel to the speaker
- cam_auth: RTSP Digest login and HTTP Basic / ?key= check on all endpoints
- Mic task feeds HTTP and RTSP with a sticky channel choice
2026-10-08 14:12:48 +03:30

23 lines
910 B
C

#pragma once
#include <stdbool.h>
#include "esp_http_server.h"
#define CAM_AUTH_REALM "ESP32-Cam"
/* Set the single account used by every service (RTSP, /pic, /stream, /mic, /spk, /vol).
* user NULL or "" disables authentication completely.
* Use letters and digits only in the password, it also travels inside URLs. */
void cam_auth_init(const char *user, const char *pass);
bool cam_auth_enabled(void);
/* ---------- HTTP ----------
* Accepts either "Authorization: Basic ..." or "?key=<password>" in the URL.
* On failure it sends 401 itself and returns false, so a handler does:
* if (!cam_http_check(req)) return ESP_OK; */
bool cam_http_check(httpd_req_t *req);
/* ---------- RTSP (Digest, MD5, no qop) ---------- */
void cam_rtsp_make_nonce(char out[33]);
bool cam_rtsp_digest_ok(const char *method, const char *authz_header_value, const char *nonce);