AlteriomPainlessMesh v2.1.1
Easy ESP32/ESP8266 mesh networking with Alteriom IoT extensions
Loading...
Searching...
No Matches
Classes | Functions
painlessmesh::layout Namespace Reference

Classes

class  Layout
 
class  Neighbour
 

Functions

bool contains (protocol::NodeTree nodeTree, uint32_t nodeId)
 
bool forget (protocol::NodeTree &tree, uint32_t nodeId)
 
size_t forgetAll (protocol::NodeTree &tree, const protocol::NodeTree &elsewhere)
 
uint32_t fingerprint (const protocol::NodeTree &tree, uint32_t hash=2166136261u)
 
protocol::NodeTree excludeRoute (protocol::NodeTree &&tree, uint32_t exclude)
 
template<class T >
size_t liveSubs (const Layout< T > &layout)
 
template<class T >
void syncLayout (Layout< T > &layout, uint32_t changedId)
 
uint32_t size (protocol::NodeTree nodeTree)
 
bool isRoot (protocol::NodeTree nodeTree)
 
bool isRooted (protocol::NodeTree nodeTree)
 
std::list< uint32_t > asList (protocol::NodeTree nodeTree, bool includeSelf=true)
 

Function Documentation

◆ asList()

std::list< uint32_t > painlessmesh::layout::asList ( protocol::NodeTree  nodeTree,
bool  includeSelf = true 
)
inline

Return all nodes in a list container

◆ contains()

bool painlessmesh::layout::contains ( protocol::NodeTree  nodeTree,
uint32_t  nodeId 
)
inline

Whether the tree contains the given nodeId

◆ excludeRoute()

protocol::NodeTree painlessmesh::layout::excludeRoute ( protocol::NodeTree &&  tree,
uint32_t  exclude 
)
inline

◆ fingerprint()

uint32_t painlessmesh::layout::fingerprint ( const protocol::NodeTree &  tree,
uint32_t  hash = 2166136261u 
)
inline

A short identity for what a tree says: which nodes, in which order, which of them root or time authority. Never 0, so 0 can mean "nothing presented yet".

A neighbour's sync is news only when this differs from its last one.

◆ forget()

bool painlessmesh::layout::forget ( protocol::NodeTree &  tree,
uint32_t  nodeId 
)
inline

Remove the subtree rooted at nodeId from wherever it sits below tree.

Only that node and what hangs under it go; the nodes on the way to it stay. Used when a node turns up on a fresh direct connection while a neighbour's tree still remembers its old place: a station has one uplink, so the old place is stale, and routing to it would send packets down a path that ends at a link that no longer exists.

Returns
true if the node was found and removed.

◆ forgetAll()

size_t painlessmesh::layout::forgetAll ( protocol::NodeTree &  tree,
const protocol::NodeTree &  elsewhere 
)
inline

Remove from tree every node that appears anywhere in elsewhere.

A node is in one place. When a neighbour's sync presents the nodes below it, whatever another neighbour's cached tree still says about those nodes is older, and a packet routed by the older copy goes down a branch that ends at a link that no longer exists.

Returns
how many nodes were removed.

◆ isRoot()

bool painlessmesh::layout::isRoot ( protocol::NodeTree  nodeTree)
inline

Whether the top node in the tree is also the root of the mesh

◆ isRooted()

bool painlessmesh::layout::isRooted ( protocol::NodeTree  nodeTree)
inline

Whether any node in the tree is also root of the mesh

◆ liveSubs()

template<class T >
size_t painlessmesh::layout::liveSubs ( const Layout< T > &  layout)

How many of this node's connections are up.

Zero means the node is out of the mesh: it has no route to anywhere, and nothing it is told about the topology can be acted on. A closed connection stays in subs until eraseClosedConnections() next runs, and a count of subs therefore says a node is connected when it is not – which is the same trap findRoute() was fixed for.

◆ size()

uint32_t painlessmesh::layout::size ( protocol::NodeTree  nodeTree)
inline

The size of the mesh (the number of nodes)

◆ syncLayout()

template<class T >
void painlessmesh::layout::syncLayout ( Layout< T > &  layout,
uint32_t  changedId 
)