|
AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
|
Shared Gateway Mode configuration for painlessMesh. More...
#include "Arduino.h"#include "painlessmesh/configuration.hpp"#include "painlessmesh/logger.hpp"#include "painlessmesh/plugin.hpp"#include "painlessmesh/protocol.hpp"#include "painlessmesh/validation.hpp"#include <functional>#include <map>#include <vector>

Go to the source code of this file.
Classes | |
| struct | painlessmesh::gateway::MeshChannelCandidate |
| One occurrence of the mesh SSID seen by an all-channel scan. More... | |
| struct | painlessmesh::gateway::ValidationResult |
| Validation result structure for SharedGatewayConfig. More... | |
| struct | painlessmesh::gateway::SharedGatewayConfig |
| Configuration structure for Shared Gateway Mode. More... | |
| struct | painlessmesh::gateway::InternetStatus |
| Structure to hold Internet connectivity check results. More... | |
| class | painlessmesh::gateway::InternetHealthChecker |
| Internet Health Checker class for periodic connectivity monitoring. More... | |
| class | painlessmesh::gateway::GatewayDataPackage |
| Gateway Data Package for routing Internet requests through mesh. More... | |
| struct | painlessmesh::gateway::HttpRequestOutcome |
| The outcome of a gateway HTTP request, classified for the ack. More... | |
| class | painlessmesh::gateway::ResponseExcerpt |
| The start and the end of a response body, read a byte at a time. More... | |
| class | painlessmesh::gateway::ChunkedBodyDecoder |
| Removes HTTP/1.1 chunked transfer framing from a body read a byte at a time, and passes the content on to a ResponseExcerpt. More... | |
| class | painlessmesh::gateway::NegativeDnsCache |
| A few hosts that recently failed to resolve, and when. More... | |
| class | painlessmesh::gateway::GatewayAckPackage |
| Gateway Acknowledgment Package for delivery confirmations. More... | |
Namespaces | |
| namespace | painlessmesh |
| namespace | painlessmesh::gateway |
Macros | |
| #define | GATEWAY_HTTP_TIMEOUT_MS ((NODE_TIMEOUT) / TASK_MILLISECOND / 5) |
| #define | GATEWAY_CAPTIVE_PORTAL_TIMEOUT_MS ((NODE_TIMEOUT) / TASK_MILLISECOND / 10) |
| #define | GATEWAY_DNS_TIMEOUT_MS ((NODE_TIMEOUT) / TASK_MILLISECOND / 10) |
| #define | GATEWAY_CONNECTIVITY_CACHE_MS 60000UL |
Typedefs | |
| typedef std::function< void(bool available)> | painlessmesh::gateway::InternetChangedCallback_t |
| Callback type for Internet connectivity change events. | |
Functions | |
| constexpr bool | painlessmesh::gateway::isValidMeshChannel (uint8_t channel) |
| constexpr bool | painlessmesh::gateway::shouldFollowBridgeChannel (uint32_t localNodeId, uint32_t electedBridgeId, uint8_t currentChannel, uint8_t announcedChannel) |
| uint8_t | painlessmesh::gateway::pickMeshChannel (const std::vector< MeshChannelCandidate > &candidates, uint8_t avoidChannel, uint8_t routerChannel=0) |
| Where a node that has lost the mesh should go. | |
| bool | painlessmesh::gateway::transportErrorMayHaveReachedServer (int rawCode) |
| Can a request that failed with this transport error have reached the server? | |
| bool | painlessmesh::gateway::responseContains (const TSTRING &haystack, const char *needle) |
| TSTRING | painlessmesh::gateway::summarizeResponseBody (const TSTRING &body, size_t maxLen=GATEWAY_RESPONSE_REASON_MAX) |
| Reduce a response body to one line fit for a log or an error string. | |
| bool | painlessmesh::gateway::transferEncodingIsChunked (const TSTRING &value) |
| uint32_t | painlessmesh::gateway::parseRetryAfterMs (const TSTRING &value) |
| The delay a Retry-After header asks for, in milliseconds. | |
| TSTRING | painlessmesh::gateway::requestIdFor (uint32_t originNode, uint32_t messageId, uint32_t requestNonce=0) |
| The identifier the gateway sends with a request, as both X-Request-Id and Idempotency-Key. | |
| uint32_t | painlessmesh::gateway::newRequestNonce () |
| HttpRequestOutcome | painlessmesh::gateway::classifyHttpResult (int rawCode, const TSTRING &body=TSTRING()) |
| Classify an HTTPClient result for the gateway acknowledgment. | |
| TSTRING | painlessmesh::gateway::hostFromUrl (const TSTRING &url) |
| The host of an http(s) URL, without scheme, port, path or query. | |
| bool | painlessmesh::gateway::looksLikeIpLiteral (const TSTRING &host) |
| constexpr unsigned long | painlessmesh::gateway::gatewayBlockingBudgetMs () |
| Wall-clock ceiling of the gateway's blocking calls on the GATEWAY_DATA path, in milliseconds (issue #416). | |
| template<typename T > | |
| bool | painlessmesh::gateway::reserveGatewayBlockingBudget (T &connection) |
| template<typename T > | |
| size_t | painlessmesh::gateway::refreshPeerWatchdogs (T &mesh, unsigned long stalledMs) |
| Give every peer's running watchdog back the time a blocking call hid. | |
Shared Gateway Mode configuration for painlessMesh.
This file defines the SharedGatewayConfig structure which provides configuration for the Shared Gateway Mode functionality. This feature allows any node in the mesh to become a gateway to the Internet when configured with router credentials.
The SharedGatewayConfig structure has an estimated memory footprint of:
For ESP8266 with ~80KB RAM, this represents <0.5% of available memory. For ESP32 with ~320KB RAM, this represents <0.1% of available memory.
All time-based fields are stored in milliseconds for consistency with the Alteriom time field naming convention. Default values are chosen for reliable operation in typical home/office mesh deployments.
| #define GATEWAY_CAPTIVE_PORTAL_TIMEOUT_MS ((NODE_TIMEOUT) / TASK_MILLISECOND / 10) |
Socket timeout, in milliseconds, for the captive-portal probe. Counted twice in the blocking budget, same as GATEWAY_HTTP_TIMEOUT_MS.
| #define GATEWAY_CONNECTIVITY_CACHE_MS 60000UL |
How long, in milliseconds, a connectivity probe result stays cached.
Both the DNS reachability check and the captive-portal probe are network round trips. Running them per message would put an Internet round trip in front of every single mesh->Internet send.
| #define GATEWAY_DNS_TIMEOUT_MS ((NODE_TIMEOUT) / TASK_MILLISECOND / 10) |
Timeout, in milliseconds, for the DNS reachability probe (issue #416).
Only the ESP8266 core exposes a hostByName() overload with a timeout parameter; on ESP32 the probe is skipped entirely (the captive-portal probe, which is an HTTP round trip bounded by GATEWAY_CAPTIVE_PORTAL_TIMEOUT_MS, establishes reachability instead). The budget counts this term unconditionally, which is conservative on ESP32.
| #define GATEWAY_HTTP_TIMEOUT_MS ((NODE_TIMEOUT) / TASK_MILLISECOND / 5) |
Socket timeout, in milliseconds, for a gateway Internet request.
An HTTPClient call chain can wait on the socket twice — once sending the request/reading the headers and once reading the body — so the blocking budget below counts this value twice (issue #416). That is why the default is NODE_TIMEOUT/5 rather than the pre-2.0 NODE_TIMEOUT/2: the wall-clock worst case of the request, not one socket wait, has to fit inside the mesh watchdog. Endpoints that genuinely need longer must raise NODE_TIMEOUT along with this (the static_assert below enforces that).