Skip to content

File espos_net_sm.h

FileList > espos_net > include > espos_net_sm.h

Go to the source code of this file

  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>
  • #include "esp_err.h"
  • #include "espos_net.h"

Classes

Type Name
struct espos_net_sm_if_t
struct espos_net_sm_port_t
struct espos_net_sm_t

Public Types

Type Name
enum espos_net_edge_t

Public Functions

Type Name
void espos_net_sm_init (espos_net_sm_t * sm, const espos_net_sm_port_t * port, void * ctx)
espos_net_edge_t espos_net_sm_report (espos_net_sm_t * sm, espos_net_if_t iface, bool up, const char * ip, const char * netmask, const char * gateway, int8_t rssi, bool * changed)
Record a transport's report and re-select the default route.
espos_net_if_t espos_net_sm_select (const espos_net_sm_t * sm)
The preference rule on its own — which up interface would carry the route.
void espos_net_sm_status (const espos_net_sm_t * sm, espos_net_status_t * out)
The route half of espos_net_status_t : up, iface, addresses, rssi (0 unless the route is the WiFi station), up_count, up_since_ms as a duration.

Public Types Documentation

enum espos_net_edge_t

enum espos_net_edge_t {
    ESPOS_NET_EDGE_NONE = 0,
    ESPOS_NET_EDGE_UP = 1,
    ESPOS_NET_EDGE_DOWN = 2,
    ESPOS_NET_EDGE_CHANGED = 3,
    ESPOS_NET_EDGE_MAX = 4
};

Public Functions Documentation

function espos_net_sm_init

void espos_net_sm_init (
    espos_net_sm_t * sm,
    const espos_net_sm_port_t * port,
    void * ctx
) 

function espos_net_sm_report

Record a transport's report and re-select the default route.

espos_net_edge_t espos_net_sm_report (
    espos_net_sm_t * sm,
    espos_net_if_t iface,
    bool up,
    const char * ip,
    const char * netmask,
    const char * gateway,
    int8_t rssi,
    bool * changed
) 

Returns the edge; changed (optional) is set when any stored field differs from before — true for an RSSI refresh too, which is not an edge but is worth a status push. NULL strings read as "". An iface of NONE or ≥ MAX is ignored (NONE edge, no change).


function espos_net_sm_select

The preference rule on its own — which up interface would carry the route.

espos_net_if_t espos_net_sm_select (
    const espos_net_sm_t * sm
) 

Exposed for tests.


function espos_net_sm_status

The route half of espos_net_status_t : up, iface, addresses, rssi (0 unless the route is the WiFi station), up_count, up_since_ms as a duration.

void espos_net_sm_status (
    const espos_net_sm_t * sm,
    espos_net_status_t * out
) 

The identity fields (mac, hostname, ip6_ll) are zeroed; espos_net.c fills them.



The documentation for this class was generated from the following file espos_net/include/espos_net_sm.h