# Private and Secure Distribution of Targeted Advertisements to Mobile Phones
## 5 Detailed System Description
### Requester Meets an Agent
#### 5.3.1 Calculation of Agent's DT  
The opportunist network that we use operates as follows. A Requester sends ARMs to an Agent who forwards them to the Ad-Dealer when the two come within range. The Agent then receives from the Ad-Dealer ads that he/she conveys back to the Requester the next time they meet. For this scheme to be efficient, it is important that the Requester only uses the services of Agents who can deliver ads quicker than he/she would normally need to collect by himself/herself by visiting the Ad-Dealer. The system adopts a history-based approach to determine the probability of the Requester receiving ads quicker if he/she were to use an Agent. This approach uses three metrics. The first metric is named Time To Ad-Dealer of a user (\(TTA_{user}\)), and it represents the approximate delay until the user is expected to appear again within the range of an Ad-Dealer. The \(TTA_{user}\) can be estimated by calculating the average time between successive encounters of the user with and the Ad-Dealers and subtracting from it the time that has passed since their last meeting (e.g., if the user encounters an Ad-Dealer every 24 h on average and it has been 4 h since the last encounter, then the \(TTA_{user}\) is \(TTA_{user}=24-4=20\) h). The second metric is the Encounter Average \(EA_{(u1,u2)}\) of two users, \(u1\) and \(u2\), and it denotes the average meeting time between successive encounters for a pair of users. It is obvious that since both users record the same meetings, \(EA_{(u1,u2)}\) is expected to be equal to \(EA_{(u2,u1)}\). These two first metrics are calculated by both the Requester and the Agent with information that can be found in their own log files. The last metric is the Delivery Time of Agent (\(DT_{Agent}\)) and expresses the estimated period needed for a particular Agent to deliver an ARM to an Ad-Dealer  
Figure 2: User handshake protocol for user authentication. and then convey back the requested advert. The \(DT_{Agent}\) is calculated only by the Requester, but also requires input from the Agent. The Requester initiates the operation by sending a message to express his/her intent to request ads. The Agent who receives the message first checks his/her availability by looking at different parameters such as his/her free buffer space and then responds either with a negative or positive reply that is also accompanied with his/her \(TTA_{Agent}\) and the total number of requests that he/she is willing to take. Upon receiving the \(TTA_{Agent}\), the Requester can use it in combination with the \(EA_{(Requester,Agent)}\) (\(EA_{(R,A)}\) for short) that he/she already possesses, to calculate an \(DT_{Agent}\). The \(DT_{Agent}\) can be calculated as follows: if the current time is \(T_{0}=0\), the Requester can assume that his/her future encounters with the Agent are expected to occur between intervals of time that are equal to \(EA_{(R,A)}\). We can therefore approximate the time of expected future encounters as \(T_{1}=T_{0}+EA_{(R,A)}\), \(T_{2}=T_{1}+EA_{(R,A)}\),..., \(T_{n}=T_{(n-1)}+EA_{(R,A)}\). Delivery will occur upon one of these encounters and more specifically upon the encounter that will take place right after the Agent has visited the Ad-Dealer. The \(DT_{Agent}\) is therefore equal to \(T_{n}>TTA_{Agent}\) when \(T_{(n-1)}<TTA_{Agent}\). Time \(T_{(n-1)}\) is when the Requester and the Agent meet for the last time before the Agent collects ads from the Ad-Dealer; therefore, it is smaller than \(TTA_{Agent}\), which is the time that the collection is expected to take place. Time \(T_{n}\) is the time when the Requester and the Agent first meet after the Agent has made the collection; therefore \(T_{n}\) is greater than \(TTA_{Agent}\). Note that if \(EA_{(R,A)}\) is greater than \(TTA_{Agent}\), then \(T_{(n-1)}=T_{0}\) and delivery is expected to occur on the following meeting (\(DT_{Agent}=T_{1}\)). In the scenario in Figure 3, an encounter between the Requester and the Agent takes place at \(T_{0}=0\).