# Design of a Technique for Accelerating the WSN Convergence Process
## 3 Theoretical Principles Used in Research
### Bidirectional Forwarding Detection (BFD)  
The BFD mechanism is designed for quick detection of line outages in the network. The mechanism works independently of the routing protocol used in the given network, thanks to which BFD can detect a fault in the network in a uniform time. Using this mechanism makes the most sense for protocols where outage detection time is long or outage detection is nonexistent. The messages of the BFD mechanism are called \"Hello messages\". The principle of BDF is a three-way mechanism, where a pair of nodes periodically send each other BFD messages. If one of the nodes stops receiving messages, it marks this connection as broken. BFD can operate in two modes:  
* Asynchronous mode: Based on the constant periodic sending of control messages, and in case of their nondelivery, the connection is cancelled;
* Demand mode: Messages are sent only in case of a request from another node, when the status of the neighboring node is verified [59; 60].  
Both modes can also work in Echo mode. If the Echo function is enabled, a stream of BFD packets is sent to the neighbor, which sends these packets back unchanged. All that is needed is signaling to which session these BFD packets belong. If a certain number of BFD packets are not forwarded back, the session is considered unavailable (down) [60]. If this function fulfills the role of detection, the interval between the periodic sending of BFD packets can be longer (in the case of Asynchronous mode) or completely disabled (in the case of Polling mode) [59].  
Pure Asynchronous mode has the advantage of needing half the amount of BFD packets to achieve a specific detection time compared with Echo. It is also suitable for deployments where the Echo function cannot be supported for certain reasons.  
The echo function has the advantage that it only really tests the path to the neighboring router. Such an approach can reduce round trip jitter and thus speed up the detection time. The Echo function can be turned on for each direction individually.  
Query mode is useful in situations where the overhead of periodic logs is difficult, such as a system with many BFD sessions. It is also useful when the Echo function is switched on symmetrically. The Query mode has a disadvantage in the detection time because it depends on the heuristics of the implementation, and the BFD protocol itself has no idea about it. The Polling mode cannot be deployed if the round-trip time is greater than the required detection time [59].  
A BFD session can be initialized in two ways:  
* Active role--a system with such a role must establish a BFD session by sending a BFD packet to a neighboring node. It does not matter whether the BFD packet of the given session has already been received.
* Passive role--a system with this role must not start sending BFD packets for a given session unless it receives a BFD packet from a neighboring system. BFD creates a session only when it receives a BFD packet.  
To successfully establish a BFD session, at least one system between which the BFD session is being established must have an active role. Once the session is established, the systems begin sending slow, periodic BFD control packets. After three-step verification, the session becomes fully enabled, \"UP\". In this state, it is possible to turn on the query mode or the additional Echo function.