## 3 CENTERA: Our Centralized Trust-Based Efficient Routing Protocol with Authentication
### Nodes Analysis and Metrics Calculations Block  
After the BS collects and verifies the neighbor/activity reports of all the nodes, the Nodes Attributes and Quality Metrics Calculations Block is initiated. The BS saves the neighbors of each node with the respective counter values as sent by each node and performs a series of checks to detect all discrepancies and misbehaviors in the network. The BS in this block either flags misbehaving nodes as bad or put them on DL probation (indicating a problem with its DL) or UL probation (indicating a problem with an UL node) or neighborhood probation (indicating a problem with a neighbor). A node is put on probation when the BS decides to give the node the benefit of the doubt and give it another chance under different circumstances (different UL or DL). Definitely a node that reaches the maximum allowed number of probations as set by the administrator is flagged as bad; note that the maximum number of probations is a parameter set by the administrator in the Initialization Block based on the network environment and the sensitivity of the exchanged data. Note that if any node is considered bad for any reason, _i.e._, falsely manipulating counters or sending illogical data or reached limit of probations, the BS neglects its report and included counters in its calculations and checks. First, the BS verifies neighborhoods of each node. It keeps tracks of nodes removing and then adding their neighbors and flags them as bad after a specific number of unexplained changes. A neighborhood is considered good if it is confirmed by the two neighboring nodes. After that, the BS validates the reports and counter values. It flags as bad each node declaring forwarding packets through a non-DL neighbor or forwarding packets for a non-UL neighbor. Then the BS calculates the actual packets initiated by each node as the difference between its pcounter to its DL and the rest of the pcounters. If the number of initiated packets is negative, the node is directly flagged as bad. After those checks, the BS analyzes the nodes and detects potential misbehaving nodes such as packet droppers, lying nodes, colluding nodes, _etc._ It assesses the values of all the counters by comparing them to its received packet numbers and crossing them among all neighboring nodes in the network. So, the BS calculates \(\underline{Dnb}\) as the difference between every node's claimed number of forwarded/sent packets and what was actually received by the BS from it. Then the BS calculates the difference _diff_ between every node's claimed number of forwarded/sent packets and its DL's claimed number of forwarded packets for this node. The nodes are evaluated as follows:  
* if \(\text{Dnb}=0\),
* if \(\text{diff}=0\) the node is good
* if \(\text{diff}\
eq 0\) then increment the DL probation of the node and the UL probation of its DL; because of three possible cases, 1- DL maybe lying, 2- the node has a colluding partner down the path dropping its extra undeclared packets, or 3- the node has a clone with dual personality down the path initiating packets in its name
* if \(\text{Dnb}<0\),
* flag node as bad--node is lying since it is declaring less packets than what was actually received by the BS. * if \(\text{Dnb}>0\),
* if \(\text{diff}\
eq 0\) then increment the DL probation of the node and the UL probation of its DL; since node may be manipulating its counters, or its DL is dropping packets, or the link is noisy between the two nodes
* if \(\text{diff}=0\), node is considered as good since its DL has confirmed its declaration at its own responsibility, to be accounted for in later iterations  
The BS then approximates the battery life of every node based on its activity estimated by the number of received packets. The BS accounts for the number of transmitted/received packets, signed/verified packets, and encrypted/decrypted signatures. The BS then calculates the different quality metrics for each. Note that all the quality metrics assume values between 0 and 1.