# Context-Aware Pending Interest Table Management Scheme for NDN-Based VANETs
## 5 Context-Aware Pending Information Table Entry Management (CPITEM) Scheme
### Non-Safety PITE Priority
#### 5.2.4. PITE Priority  
By taking both \(Utility_{PITE_{i}}\) and the popularity of the application \((Utility_{\_}{App}t_{i}^{\text{t}})\), the priority of the \(PITE_{i}\) is computed using Equation (4). \(Priority_{PITE_{i}}\) considers both application utility and \(PITE\) utility. If two PIT entries have the same size and application utility, then in the event of overload, the \(PITE\) that rested in PIT for a shorter period of time will be chosen for replacement. \[Priority_{PITE_{i}}=Utility_{PITE_{i}}+Utility_{\_}{App}t_{i}^{\text{t}} \tag{4}\]  
Furthermore, the following algorithms (Algorithms 1-3) related to the CPITEM scheme are presented, which are executed at the reception of Interest messages. ```
1//Interest message (IntMsg) include content name (CACN)
2 Upon Receiving IntMs
3\(nocre\)\(\leftarrow\)IntMsg.Nocre
4\(intersName\)\(\leftarrow\)IntMsg.Name
5\(Fac\)\(\leftarrow\)IntMsg.InFace
6\(ApplD\)\(\leftarrow\)GetPMPL(\(intersName\))
7 If (ValidPTTEExistsIn PIT(\(intersName\)) == False)
8\(/\)Associate time t with new entry related to Application
9\(Update\)\(ApplD\)(\(\mathit{ArtpID}\),\(\mathit{CurrentTime}\)(\(\mathit{),t}\))
10 If ((\(\mathit{ContentLocate}\)(\(intersName\)) == False))
11\(/\)\(PITSE\)(\(\mathit{PITS}\)=\(\mathit{PITS}\))
12\(\mathit{AddPITE}\)(\(\mathit{IntMsg}\))
13 Set IntMsg to Forward
14\(\mathit{Else}\)
15\(\mathit{Contextaware\_PITE\_Replacement}\)(IntMsg)
16\(\mathit{Else}\)
17\(\mathit{Construct\ Data\ message and forward}\)
18\(\mathit{Else}\)
19\(\mathit{If}\)(\(PITEExistsin\)PIT(\(intersName\)) == True)
20\(\mathit{PITE}\)\(\leftarrow\)SearchPITE(IntMsg)
21\(/\)\(\mathit{If}\)(ValidInRecord(\(intersName\),\(\mathit{None}\),\(\mathit{Face}\),\(PITE\)) == True)
22\(\mathit{AddIntRecToPITE}\)(\(PITE\))
23\(/\)Associate time with new entry related to Application and add it to related time window
24\(\mathit{Update\)\(ApplD\)(\(\mathit{ArtpID}\),\(\mathit{CurrentTime}\)),t
```  
**Algorithm 1**Context-aware PIT Entry Management (CPITEM) Protocol  
When an Interest is received, its Nonce and name are checked in the DeadNonceList. If the matching entry is found, the loop is suspected and the Interest is considered invalid. If a matching Nonce is not found in the DeadNonceList, it searches PIT for the existing entry (Line 7, Algorithm 1). When a valid Interest is received for which no \(PITE\) already exists and related content is not present in the cache, the PIT size is checked. If the PIT size is less than a predefined threshold, the \(PITE\) is created and stored in the PIT. Otherwise, the Contextaware_PITE_Replacement method (Algorithm 2) is executed. If the required content is found in the cache, the Data message is forwarded with the relevant content, and finally, \(PITE\) is removed. For each valid Interest, the corresponding application window is also updated by adding a time-bound application-related tuple (Line 9, Algorithm 1). If the \(PITE\) already exists, the incoming interest Nonce and face is checked against the existing \(PITE\) before it is processed further. If a similar Nonce is not found, the Interest is considered as a new valid Interest and InRecord will be added to the corresponding \(PITE\) (Lines 21-22, Algorithm 1). When a new valid Interest is received, its application ID (AppID) is checked from CACN. Afterwards, after associating the time t, the tuple is added to the relevant application time window. The tuple will be removed from the corresponding time window after the expiry of time. If the content type is safety, low priority non-safety \(PITE\) is searched in the PIT (Line 5, Algorithm 2). In our proposed CPITEM scheme, in the event of PIT overload (PIT size is greater than a certain threshold), if the received valid safety Interest \(PITE\) does not already exist in the PIT, the \(PITE\) will be replaced with the existing non-safety \(PITE_{i}\) in the PIT having thelowest priority.