## 4 Proposed Scheme
### Identity, Route, and Location Privacy (IRL)
An example IRL routing scenario is shown in Figure 3.  
```
1:\(next_{hop}\leftarrow\emptyset\);
2:\(M_{temp}=\emptyset\)
3:if Signature of new packet already exists in buffer then
4:\(M_{temp}=\{M_{temp}\}+LasttimePrev_{hop}\)
5:\(M_{temp}=\{M_{temp}\}+LasttimeNext_{hop}\)
6: Set \(counter\) = \(timesReceivedBefore\) + 1;
7: Remove signature from buffer;
8:if\(counter\) = 3 then
9: Drop packet and exit;
10:endif
11:endif
12:\(M_{temp}=\{M_{temp}\}+prev_{hop}\)
13:if\((M(t_{F})-\{M(t_{F})\bigcap M_{temp}\})\
eq\emptyset\)then
14:\(next_{hop}(k)\) = Rand(\(M(t_{F})-\{M(t_{F})\bigcap M_{temp}\}\));
15:else
16:if packet came from \(B_{r}\)then
17:\(M_{temp1}\) = \(M(t_{B_{l}})\cup M(t_{B_{m}})\)
18:if\(M_{temp1}\
eq\emptyset\)then
19:\(next_{hop}(k)\) = Rand(\(M_{temp1}\));
20:elseif\(M(t_{B_{r}})\
eq\emptyset\)then
21:\(next_{hop}(k)\) = Rand(\(M(t_{B_{r}})-\{M(t_{B_{r}})\bigcap M_{temp}\}\));
22:else
23: Drop packet and Exit;
24:endif
25:else if packet came from \(B_{l}\)then
26:\(M_{temp2}\) = \(M(t_{B_{r}})\cup M(t_{B_{m}})\)
27:if\(M_{temp2}\
eq\emptyset\)then
28:\(next_{hop}(k)\) = Rand(\(M_{temp2}-\{M_{temp2}\bigcap M_{temp}\}\));
29:else if\(M(t_{B_{l}})\
eq\emptyset\)then
30:\(next_{hop}(k)\) = Rand(\(M(t_{B_{l}})-\{M(t_{B_{l}})\bigcap M_{temp}\}\));
31:else
32: Drop packet and Exit;
33:endif
34:else
35:\(M_{temp3}\) = \(M(t_{B_{r}})\cup M(t_{B_{l}})\)
36:if\(M_{temp3}\
eq\emptyset\)then
37:\(next_{hop}(k)\) = Rand(\(M_{temp3}-\{M_{temp3}\bigcap M_{temp}\}\));
38:else if\(M(t_{B_{m}})\
eq\emptyset\)then
39:\(next_{hop}(k)\) = Rand(\(M(t_{B_{m}})-\{M(t_{B_{m}})\bigcap M_{temp}\}\));
40:else
41: Drop packet and Exit;
42:endif
43:endif
44:endif
45: Rest is same as Algorithm 1 from lines 13:21;This routing strategy may result in the creation of a cycle (loop). However, due to the randomness in the selection of the next-hop and the presence of the different four direction sets, the probability of creation of any cycle is very low. Nevertheless, in order to fully avoid the occurrence of the cycles, each node (prior to forwarding of a packet) will save the signature of the packet in the buffer for the \(\delta t\) time, that is:

\[\delta t=2\left(\frac{D}{d}\times p_{t}\right) \tag{6}\]

where \(D\) is the distance between the forwarding node and the base station, \(d\) is the distance between the forwarding node and the next hop, and \(p_{t}\) is the propagation transfer time between the forwarding node and the next hop. This signature consists of two fields: (1) sequence number of the packet, and (2) the payload. The potential of the signature to compare and identify the same packet is detailed in the later section. Corresponding to this signature, three more fields are also stored in the buffer: (1) previous hop identity, (2) next hop identity where the packet is forwarded, and (3) counter, that tells how many times the same packet is received by the node. This information will later be used to get rid of any cycle. The size of the buffer is mainly dependent on the network traffic conditions. However, it is expected to be low due because the sensor nodes sent data either in periodic intervals or upon the occurrence of some event. If the node received the packet whose signature exists in the buffer (Algorithm 2, Lines 3:11), then including the previous hop node (Line 12), two other nodes will also be excluded from the selection of

Figure 4: Three sample cycle detection and prevention scenarios. Figure 3: Sample routing scenario of IRL scheme. the next hop process: 1) the node from which last time the packet was received (Line 4) and 2) the node from which last time the packet was forwarded (line 5). If the same packet is received three times by the same node (Line 8) then the packet will be dropped (Line 9). Three sample scenarios of the loop creation, detection and prevention are shown in Figure 4. Creation of loops and traversing of the packets in the backward direction is not a completely negative effect.