20#ifndef PROTOCORE_PHYSICAL_H
21#define PROTOCORE_PHYSICAL_H
35#define PC_PHYSICAL_HAS_BACKEND 1
37#define PC_PHYSICAL_HAS_BACKEND 0
208typedef void (*
pc_phy_frame_fn)(
const uint8_t *frame, uint16_t len, int8_t rssi, uint8_t channel);
Layer 3 (Network) - a family-tagged IP address (IPv4 or IPv6) with RFC-faithful text parsing,...
bool pc_phy_ps_set(pc_phy_ps mode)
Apply a power-save mode.
void pc_phy_monitor_set_channel(uint8_t channel)
Retune monitor mode to channel.
bool pc_net_mac(uint8_t out[6])
Copy the WiFi station interface MAC (6 bytes) into out.
bool pc_ipv6_ready(void)
True once the interface has a global IPv6 address (see net_global_ipv6()).
void(* pc_phy_frame_fn)(const uint8_t *frame, uint16_t len, int8_t rssi, uint8_t channel)
One received frame, delivered in neutral terms.
pc_iface pc_net_classify_ip(uint32_t egress_ip, uint32_t sta_ip, uint32_t ap_ip)
Classify an egress IPv4 against the WiFi station / softAP IPs (pure helper, exposed for unit testing)...
uint32_t pc_net_egress_ip(void)
IPv4 (network byte order) of the current egress interface, or 0 if none.
pc_phy_ps pc_phy_ps_get(void)
Read the active power-save mode (PC_PHY_PS_NONE when unsupported).
bool eth_ready(void)
True if the Ethernet link is up and an IP is assigned.
bool init_wifi_radio_physical(uint8_t channel)
Bring the WiFi radio up in station mode WITHOUT associating to an AP.
bool pc_phy_monitor_begin(uint8_t channel, pc_phy_frame_fn cb)
Enter monitor mode on channel, delivering frames to cb.
size_t pc_net_ssid(char *out, size_t cap)
Copy the associated SSID (null-terminated) into out.
bool wifi_ready()
True if the WiFi station link is up (associated + an IP is assigned).
int8_t pc_net_rssi(void)
Station link RSSI in dBm, or 0 if not associated (and on host builds).
bool init_wifi_physical(const char *ssid, const char *password)
Connect to a WiFi access point.
void pc_phy_monitor_end(void)
Leave monitor mode.
uint32_t pc_net_ap_ip(void)
softAP IPv4 (network byte order), or 0 if the softAP is not up (and on host builds).
bool init_wifi_ap_physical(const char *ssid, const char *password)
Bring up a softAP, enabling AP+STA coexistence so a station link can run alongside it.
bool init_ipv6_physical(void)
Enable IPv6 (dual-stack) on the Wi-Fi interface (PC_ENABLE_IPV6).
pc_phy_ps
Radio power-save mode, in the library's own vocabulary.
@ PC_PHY_PS_MIN_MODEM
Wake on every DTIM beacon.
@ PC_PHY_PS_NONE
Radio always on: lowest latency, highest average draw.
@ PC_PHY_PS_MAX_MODEM
Wake on a longer listen interval: lowest draw, highest latency.
bool net_global_ipv6(pc_ip *out)
The interface's global (routable) IPv6 address, if it has one.
bool init_eth_physical(void)
Bring up a wired Ethernet link (PC_ENABLE_ETHERNET).
pc_iface pc_net_egress(void)
Which interface currently carries outbound traffic.
bool pc_phy_tx_power_set(int8_t dbm)
Cap transmit power.
uint8_t pc_net_channel(void)
Station WiFi channel (1..14), or 0 if not associated (and on host builds).
bool pc_net_egress_mac(uint8_t out[6])
Copy the MAC of the current egress interface (the live default-route netif) into out.
User-facing configuration for ProtoCore.
pc_iface
Network interface a connection arrived on (for per-route filtering).
A v4 or v6 address in network (big-endian) byte order.