# Application-Aware SDN-Based Iterative Reconfigurable Routing Protocol for Internet of Things (IoT)
## 5 Proposal of SADFIR
### Network Forwarding Phase (NFP) of SADFIR  
After settling the reconfigurations of forwarding rules for FECHs and non-FECHs in NSP, the Network Forwarding Phase (NFP) initiates the actual communication for traffic transportation in the network. In the beginning, all the sensor nodes receive the digital environmental reports generated by MCU by using the feature of multi-sensing utilities. As we have deployed the SDN controller, therefore the sensor nodes are self reprogrammable and can configure their preferences according to the application requirement. These deployed SDN controllers are programmed to check the characteristics of applications during the exchange of hello packets. In the meanwhile, the SDN controller sets a threshold for routing analytical operation based on nodes sensitivity. To this end, a random number is generated, which is then compared with the given threshold value chosen by the network administrator. All the sensor nodes produce the environmental reports according to this threshold value. As we have mentioned earlier that the proposed SADFIR supports the multi-application by self-reconfiguration; therefore, we deploy our network to sense three different parameters to get the environmental reports; temperature, pressure, and humidity. The following equations show the logical operations of application awareness based on the given threshold value:  
\[App-Thresh=\left\{ \begin{aligned} & Temperature&& If \qquad Ran-Num<1 stlevel\\ & Pressure&& If\qquad 1 stlevel<Ran-Num>2 ndlevel\\ & Humindity&& If\qquad Ran-Num>2 ndlevel \\ \end{aligned} \right. \tag{19}\]```
Input : All Sensor Nodes \(N\) Output :FECHs and non-FECHs
1 Initialisation:
2 q=j
3 Calculate Average Residual Energy (ARE);
4 if\(E_{i}\geq ARE\)then
5 Selects EFECH
6 else
7 Member Node
8 elseif Calculate Clustered distribution = Threshold =\(\frac{p}{1-P(qmod\frac{1}{p})\times d\in G}\)then
9\(CC=\frac{\phi_{SD}EFECH}{\phi_{SD}}\)
10 end if
11
12 end if
13 if\(CC\geq CTH\)then
14 EFECHs = FECHs
15 else
16 Member Node
17
18 end if
19 Calculate Reconfiguration Threshold;
20 if\(TP\) = Normalthen
21\(\text{q}=\text{j}=[0,1,2,3,\ldots.\text{n}]\)\(Threshold=\frac{p}{1-P(qmod\frac{1}{p})}\)
22 else
23 j = 9
24 end if
25 ifThreshold = 1 then
26 Reconfigure Routing Policy;
27
28 else
29 Repeat the calculation of threshold
30
31 end if
32 if\(TP\) = Criticalthen
33\(\text{q}=9\); \(Threshold=\frac{p}{1-P(qmod\frac{1}{p})}\)
34
35 else
36 Reconfigure the routing path;
37
38 end if
```

**Algorithm 1**Network settling phase of the proposed SADFIR routing protocol

Similarly, the proposed SADFIR measures the critical data based on environmental attributes such as temperature and pressure and directly transmits this critical data immediately after sensing without any significant delay. It is attributed to the fact that the critical threshold value is set in the SDN controller, which is calculated by the following equation:

\[App-Thresh=\left\{ \begin{aligned} & Critical& If& Ran-Num<1 stlevel\\ & Temperature& If& 1 stlevel<Ran-Num>2 ndlevel\\ & Pressure& If& Ran-Num>2 ndlevel\end{aligned} \right. \tag{20}\]

The proposed SADFIR is designed with a unique characteristic, where it utilizes the multi-path inter-cluster communication for all the existing types of environmental reports. Also, the proposed SADFIR is capable of self-trigger in case of critical data and enables transmission directly to avoid delay. These priorities of the threshold for application-specific reports are reconfigured through the SDN controller during the NSP. In contrast, NFP can also be called a transmission phase, which is mainly guided by the SDN controller at the control layer. The complete structure of the proposed model is summarized in the Flowchart, as shown in Figure 7.

## 6 Simulation Results and Discussion

In this section, we first briefly explain the simulation environment, and then we present the simulation results to show the achieved performance of the proposed model SADFIR.