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

Network interface type definitions and API. More...

#include <idfxx/chrono>
#include <idfxx/error>
#include <idfxx/event>
#include <idfxx/flags>
#include <idfxx/mac>
#include <idfxx/net>
#include <array>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "sdkconfig.h"

Go to the source code of this file.

Classes

class  idfxx::netif::error_category
 Error category for network interface errors. More...
 
struct  idfxx::netif::ip4_event_data
 Information about an acquired IPv4 address. More...
 
struct  idfxx::netif::ip6_event_data
 Information about an acquired IPv6 address. More...
 
struct  idfxx::netif::ap_sta_ip4_assigned_event_data
 Information about an IP assigned to a station connected to an AP. More...
 
struct  idfxx::netif::dns_info
 DNS server information. More...
 
class  idfxx::netif::interface
 Network interface handle. More...
 

Namespaces

namespace  idfxx
 
namespace  idfxx::netif
 
namespace  idfxx::netif::sntp
 

Typedefs

typedef struct esp_netif_obj esp_netif_t
 

Enumerations

enum class  idfxx::netif::dhcp_option_id : int {
  idfxx::netif::subnet_mask = 1 ,
  idfxx::netif::domain_name_server = 6 ,
  idfxx::netif::router_solicitation_address = 32 ,
  idfxx::netif::requested_ip_address = 50 ,
  idfxx::netif::ip_address_lease_time = 51 ,
  idfxx::netif::ip_request_retry_time = 52 ,
  idfxx::netif::vendor_class_identifier = 60 ,
  idfxx::netif::vendor_specific_info = 43 ,
  idfxx::netif::captiveportal_uri = 114
}
 DHCP option identifiers. More...
 
enum class  idfxx::netif::dns_type : int {
  idfxx::netif::main = 0 ,
  idfxx::netif::backup = 1 ,
  idfxx::netif::fallback = 2
}
 DNS server type. More...
 
enum class  idfxx::netif::flag : uint32_t {
  idfxx::netif::dhcp_client = 1u << 0 ,
  idfxx::netif::dhcp_server = 1u << 1 ,
  idfxx::netif::autoup = 1u << 2 ,
  idfxx::netif::garp = 1u << 3 ,
  idfxx::netif::event_ip_modified = 1u << 4 ,
  idfxx::netif::is_ppp = 1u << 5 ,
  idfxx::netif::is_bridge = 1u << 6 ,
  idfxx::netif::mldv6_report = 1u << 7 ,
  idfxx::netif::ipv6_autoconfig_enabled = 1u << 8
}
 Network interface flags. More...
 
enum class  idfxx::netif::ip_event_id : int32_t {
  idfxx::netif::sta_got_ip4 = 0 ,
  idfxx::netif::sta_lost_ip4 = 1 ,
  idfxx::netif::ap_sta_ip4_assigned = 2 ,
  idfxx::netif::got_ip6 = 3 ,
  idfxx::netif::eth_got_ip4 = 4 ,
  idfxx::netif::eth_lost_ip4 = 5 ,
  idfxx::netif::ppp_got_ip4 = 6 ,
  idfxx::netif::ppp_lost_ip4 = 7
}
 IP event IDs. More...
 
enum class  idfxx::netif::errc : esp_err_t {
  idfxx::netif::invalid_params = 0x5001 ,
  idfxx::netif::if_not_ready = 0x5002 ,
  idfxx::netif::dhcpc_start_failed = 0x5003 ,
  idfxx::netif::dhcp_already_started = 0x5004 ,
  idfxx::netif::dhcp_already_stopped = 0x5005 ,
  idfxx::netif::no_mem = 0x5006 ,
  idfxx::netif::dhcp_not_stopped = 0x5007 ,
  idfxx::netif::driver_attach_failed = 0x5008 ,
  idfxx::netif::init_failed = 0x5009 ,
  idfxx::netif::dns_not_configured = 0x500A ,
  idfxx::netif::mld6_failed = 0x500B ,
  idfxx::netif::ip6_addr_failed = 0x500C ,
  idfxx::netif::dhcps_start_failed = 0x500D ,
  idfxx::netif::tx_failed = 0x500E
}
 Network interface error codes. More...
 

Functions

const netif::error_categoryidfxx::netif_category () noexcept
 Returns a reference to the netif error category singleton.
 
std::unexpected< std::error_code > idfxx::netif_error (esp_err_t e)
 Creates an unexpected error from an ESP-IDF error code, mapping to netif error codes where possible.
 
std::error_code idfxx::netif::make_error_code (errc e) noexcept
 Creates an error code from an idfxx::netif::errc value.
 
void idfxx::netif::init ()
 Initializes the TCP/IP stack and network interface subsystem.
 
void idfxx::netif::deinit ()
 Deinitializes the network interface subsystem.
 
result< voididfxx::netif::try_init ()
 Initializes the TCP/IP stack and network interface subsystem.
 
result< voididfxx::netif::try_deinit ()
 Deinitializes the network interface subsystem.
 
size_t idfxx::netif::get_nr_of_ifs ()
 Returns the number of registered network interfaces.
 
std::optional< interfaceidfxx::netif::get_default ()
 Returns a non-owning handle to the default network interface.
 
void idfxx::netif::set_default (interface &iface)
 Sets the given interface as the default network interface.
 
std::optional< interfaceidfxx::netif::find_by_key (const char *key)
 Finds a network interface by its key string.
 
std::string idfxx::to_string (netif::dns_type t)
 Returns the string representation of a DNS server type.
 

Variables

const event_base< ip_event_ididfxx::netif::ip_events
 IP event base.
 
constexpr idfxx::event< ip_event_id, ip4_event_dataidfxx::netif::sta_got_ip4 {ip_event_id::sta_got_ip4}
 Station received IPv4 address event with IP details.
 
constexpr idfxx::event< ip_event_ididfxx::netif::sta_lost_ip4 {ip_event_id::sta_lost_ip4}
 Station lost IPv4 address event.
 
constexpr idfxx::event< ip_event_id, ap_sta_ip4_assigned_event_dataidfxx::netif::ap_sta_ip4_assigned
 Soft-AP assigned IP to a connected station event.
 
constexpr idfxx::event< ip_event_id, ip6_event_dataidfxx::netif::got_ip6 {ip_event_id::got_ip6}
 Received IPv6 address event.
 
constexpr idfxx::event< ip_event_id, ip4_event_dataidfxx::netif::eth_got_ip4 {ip_event_id::eth_got_ip4}
 Ethernet received IPv4 address event with IP details.
 
constexpr idfxx::event< ip_event_ididfxx::netif::eth_lost_ip4 {ip_event_id::eth_lost_ip4}
 Ethernet lost IPv4 address event.
 
constexpr idfxx::event< ip_event_id, ip4_event_dataidfxx::netif::ppp_got_ip4 {ip_event_id::ppp_got_ip4}
 PPP interface received IPv4 address event with IP details.
 
constexpr idfxx::event< ip_event_ididfxx::netif::ppp_lost_ip4 {ip_event_id::ppp_lost_ip4}
 PPP interface lost IPv4 address event.
 

Detailed Description

Network interface type definitions and API.

Definition in file netif.hpp.