## 6 Energy-Efficient, Priority-Based Forwarding (EPF)
### EPF Forwarding Model
```
Require: Node N, Intermediate I, Controller SDN; On Incoming EPF I_pkt; N computes priority using Priority.Naming; if(Content!=PIT&Sortent!=CS)then  PIT.add(EPF I_pkt);  EPF I_pkt sends to SDN enabling C_ID; SDN.search(GIT) and Content found in GIT Then ; SDN calculates shortest path (Dijkstra Algorithm), Keeping energy threshold in calculation; SDN.embeds(shortest path(EPF I_pkt)); SDN.Sends(EPF I_pkt to N); N.broadcasts(EPF I_pkt); else Content!=GIT; Stop EPF I_pkt transmission; Remove EPF I_pkt; end if EPF I_pkt matches the forwarding path; if(forwarding path Matthes)then  Forward packet towards producer; else  Drop(EPF I_pkt); end
```  
**Algorithm 2**Received Interest/Data Packet  
In order to assign priority to Data packets over Interest packets, two adjacent and distinct time windows are used to initialize the defer timers for Interest and Data forwarding. The above said time \begin{table}
\begin{tabular}{c c} \hline \hline
**Packet Type** & **Priority Type** \\ \hline Government & High \\ \hline Emergency & High \\ \hline Police & High \\ \hline Regular Sensing & Low \\ \hline Chat & Low \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Priority Assignment Table. windows are Interest Defer Window (IntDW) and Data Defer Window(DataDW). The range of DataDW is [0, DataDWB] and range of IntDW is [DataDWB, IntDWB]. DataDWB and IntDWB are window bounds for DataDW and IntDW respectively. The sizes of DataDW and IntDW are set according to the the short inter-frame spacing (SIFS) and 802.11 slot time to adapt MAC dynamics quickly. The aim of proposed forwarding scheme is to give High Priority (HP) Interest and Data packets, priority over Low Priority (LP) Interest and Data packets. For this purpose, we further split DataDW and IntDW into two separate sub-windows. In first sub-window of DataDW, only HP data packets can communicate using high priority timer (HPDT) in range of [0, HPDB]. The transmission of LP data packets will take place in second sub-window by selecting low priority timer (LPDT) in the range of [HPDB, DataDWB]. In IntDW, we used same mechanism in which only HP Interest packets can transmit using high priority timer (HPIT) in range of [DataDWB, HPIB] and LP Interst packet transmission will take place in second sub-window by selecting low priority timer (LPIT) in the range of [HPIB, IntDWB]. HPDB and HPIB are the bounds for high priority data and interest packets respectively. The complete defer window mechanism described in Figure 12.  
This is the responsibility of each node to compute HPDB and HPIB dynamically according to the overheard traffic load for each priority level. To compute HPDB and HPIB, each node used to keep the track of total received data bytes of HP and LP. RHP and RLP are the total number of high priority and low priority bytes received. Any node can easily infer the RHP and RLP from packet-size field in NDN packet's header. The bound between high priority and low priority (data packets and Interest packets respectively) in DataDW is dynamically computed as:  
\[HPDB=RHP/RLP+RHP.DataDWB \tag{1}\]  
\[HPIB=RHP/RLP+RHP.IntDWB. \tag{2}\]  
Higher number of HP results in higher HPDB and HPIB. We can compute the LPDB and LPIB analogously. After computation of defer window bounds each node needs to calculate (HPDT, HPIT, LPDT and LPIT for high priority and low priority Data and Interest packets respectively), whenever a node wants to forward the packet. If we use the aforementioned defer timer scheme then we can forward the high priority data and Interest packets earlier than the low priority ones. This mechanism reduces the unnecessary delay in forwarding of high priority packets. Figure 13 shows the Complete Forwarding flow of EPF. Figure 12: Priority defer Window.