# Geo-DMP: A DTN-Based Mobile Prototype for Geospatial Data Retrieval
## 3 Geo-DMP Mobile System
### System Framework  
As illustrated in Figure 3, the framework of Geo-DMP consists of three main modules: content agent, DTN stack, and map adaptor. The content agent is our own implementation to realize the \"gateway-based model\". It is deployed on gateway nodes and interacts with DTN on behalf of application and thereby makes DTN transparent to the user. The heart of the content agent is the proxy module. It is implemented with anyproxy [92], an open-sourced javascript-written proxy tool. With the main feature of anyproxy, which is to intercept the incoming HTTP requests and construct new HTTP responses, we developed the transformation between HTTP messages and DTN bundles, as well as the utilization of local caches. Preceding received contents are stored in local cache both for immediate provision for recurring local requests and responding to requests from other nodes in the near future. The DTN stack we use in our work is DTN2 [93]. DTN2 is an open-sourced reference implementation of the full protocol stack of DTN, consistent with RFC documents [94; 95; 96] and developed by DTNRG in C++. As a promising proposal, the code implementation of the BPQ mechanism is also incorporated in the latest version of DTN2. We benefit from this work and employ it for content naming and matching. Two data structures form the core of the BPQ definition: BPQ block and BPQ Cache. BPQ block is an extension block in the bundle header. It mainly records the name of content and specifies the type of bundle so as to support content naming and pub/sub communication model. To distinguish the bundles with BPQ block from the normal bundles, two distinct bundle types are newly defined: query  
Figure 3: The framework of Geo-DMP. and response. As their names suggest, the former one conveys what content the requester wants, while the latter one carries the content back to the requester. As this block is not mandatory, BPQ-enabled bundles can co-exist with normal bundles and can be routed according to endpoint ID as usual, hence, the compatibility is guaranteed. BPQ Cache manages content resources that BPQ can take advantage of, that is, it contains all information of response bundles. It should be noted that although the query bundle is also a member of the BPQ-enabled bundle, it is not included in BPQ Cache as it does not have any payload data. Moreover, the normal bundle is excluded from the BPQ Cache, too. This is because its payload does not have a name, so it could not be used by BPQ. DTN Daemon is the pivot of DTN2, which serves as a central controller and scheduler. It is responsible for handling all incoming events and dispatching jobs to other dedicated components. Bundle List is the place that maintains all local bundles, including normal bundles and BPQ-enabled bundles. In other words, BPQ Cache is a subset of Bundle List. The \"Trace Reader\" and \"Link Emulator\" are two modules that involve emulation. The former one emulates the GPS of the mobile node. Upon the request of location, it reports the GPS coordinates from a pre-generated trace file. This module can be substituted with a real GPS receiver when the implementation is ported to actual devices, leaving other parts in the upper layers unchanged. The latter one controls the establishments and disconnections of links. Periodically, the real-time location is derived from the trace reader and broadcast in a beacon packet. When receiving a beacon packet from another node, the link emulator records the distance between them to the table named \"Neighbor Distances\". With this table, the local node can judge whether it resides in the preset communication range with the source of an incoming normal packet, and drop it or make it pass accordingly. As this module works on the network layer in Linux kernel space, the filtration is transparent to DTN. To make generalized BPQ-based content retrieval adapt better to realistic map-based scenarios, we present the map adaptor module. It is comprised of a local database of map segmentation results and an interface.