idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches

Classes

class  client
 HTTP client with blocking and streaming request support. More...
 
struct  event_data
 Data passed to HTTP event callbacks. More...
 
class  request
 Non-owning view of an HTTP request. More...
 
class  server
 HTTP server with URI handler registration and RAII lifecycle. More...
 
class  ssl_server
 HTTPS server with TLS support. More...
 

Enumerations

enum class  method : int {
  get = 0 ,
  post = 1 ,
  put = 2 ,
  patch = 3 ,
  delete_ = 4 ,
  head = 5 ,
  notify = 6 ,
  subscribe = 7 ,
  unsubscribe = 8 ,
  options = 9 ,
  copy = 10 ,
  move = 11 ,
  lock = 12 ,
  unlock = 13 ,
  propfind = 14 ,
  proppatch = 15 ,
  mkcol = 16 ,
  report = 17
}
 HTTP request methods. More...
 
enum class  auth_type : int {
  none = 0 ,
  basic = 1 ,
  digest = 2
}
 HTTP authentication types. More...
 
enum class  transport : int {
  unknown = 0 ,
  tcp = 1 ,
  ssl = 2
}
 HTTP transport types. More...
 
enum class  event_id : int {
  error = 0 ,
  on_connected = 1 ,
  headers_sent = 2 ,
  on_header = 3 ,
  on_data = 4 ,
  on_finish = 5 ,
  disconnected = 6 ,
  redirect = 7
}
 HTTP client event identifiers. More...
 

Functions

const client::error_categoryhttp_client_category () noexcept
 Returns a reference to the HTTP client error category singleton.
 
std::error_code make_error_code (client::errc e) noexcept
 Creates an error code from an idfxx::http::client::errc value.
 
std::unexpected< std::error_code > http_client_error (esp_err_t e)
 Creates an unexpected error from an ESP-IDF error code, mapping to HTTP client error codes where possible.
 
const server::error_categoryhttp_server_category () noexcept
 Returns a reference to the HTTP server error category singleton.
 
std::error_code make_error_code (server::errc e) noexcept
 Creates an error code from an idfxx::http::server::errc value.
 
std::unexpected< std::error_code > http_server_error (esp_err_t e)
 Creates an unexpected error from an ESP-IDF error code, mapping to HTTP server error codes where possible.
 

Enumeration Type Documentation

◆ auth_type

HTTP authentication types.

Enumerator
none 

No authentication.

basic 

HTTP Basic authentication.

digest 

HTTP Digest authentication.

Definition at line 56 of file types.hpp.

◆ event_id

HTTP client event identifiers.

Enumerator
error 

An error occurred during the HTTP operation.

on_connected 

Connected to the server.

headers_sent 

All request headers have been sent.

on_header 

Received a response header.

on_data 

Received response body data.

on_finish 

Finished a complete HTTP session.

disconnected 

Disconnected from the server.

redirect 

Intercepting a redirect.

Definition at line 43 of file client.hpp.

◆ method

HTTP request methods.

Enumerator
get 

GET.

post 

POST.

put 

PUT.

patch 

PATCH.

delete_ 

DELETE (trailing underscore — C++ keyword)

head 

HEAD.

notify 

NOTIFY.

subscribe 

SUBSCRIBE.

unsubscribe 

UNSUBSCRIBE.

options 

OPTIONS.

copy 

COPY.

move 

MOVE.

lock 

LOCK.

unlock 

UNLOCK.

propfind 

PROPFIND.

proppatch 

PROPPATCH.

mkcol 

MKCOL.

report 

REPORT.

Definition at line 29 of file types.hpp.

◆ transport

HTTP transport types.

Enumerator
unknown 

Unknown transport.

tcp 

Plain TCP (HTTP)

ssl 

SSL/TLS (HTTPS)

Definition at line 68 of file types.hpp.

Function Documentation

◆ http_client_category()

const client::error_category & idfxx::http::http_client_category ( )
noexcept

Returns a reference to the HTTP client error category singleton.

Returns
Reference to the singleton client::error_category instance.

Referenced by make_error_code().

◆ http_client_error()

std::unexpected< std::error_code > idfxx::http::http_client_error ( esp_err_t  e)

Creates an unexpected error from an ESP-IDF error code, mapping to HTTP client error codes where possible.

Converts the ESP-IDF error code to an HTTP client-specific error code if a mapping exists, otherwise falls back to the default IDFXX error category.

Parameters
eThe ESP-IDF error code.
Returns
An unexpected value suitable for returning from result-returning functions.

◆ http_server_category()

const server::error_category & idfxx::http::http_server_category ( )
noexcept

Returns a reference to the HTTP server error category singleton.

Returns
Reference to the singleton server::error_category instance.

Referenced by make_error_code().

◆ http_server_error()

std::unexpected< std::error_code > idfxx::http::http_server_error ( esp_err_t  e)

Creates an unexpected error from an ESP-IDF error code, mapping to HTTP server error codes where possible.

Converts the ESP-IDF error code to an HTTP server-specific error code if a mapping exists, otherwise falls back to the default IDFXX error category.

Parameters
eThe ESP-IDF error code.
Returns
An unexpected value suitable for returning from result-returning functions.

◆ make_error_code() [1/2]

std::error_code idfxx::http::make_error_code ( client::errc  e)
inlinenoexcept

Creates an error code from an idfxx::http::client::errc value.

Definition at line 616 of file client.hpp.

References http_client_category().

◆ make_error_code() [2/2]

std::error_code idfxx::http::make_error_code ( server::errc  e)
inlinenoexcept

Creates an error code from an idfxx::http::server::errc value.

Definition at line 950 of file server.hpp.

References http_server_category().