Source Code Analysis
Author Final revision Date Hao Zhuang, Guojun Wang 1.5 Summary... 3 1. C/C++ DTN2 Services Client... 4 1.1 dtnhttpsqs... 4 1.2 dtnmail... 4 2. PHP Client Application... 5 2.1 PHP Web Interface... 5 2.1.1 WSN... 5 2.1.2 SSA... 6 2.2 PHP Mail Server... 7 3. Python Client for DTN Management Tool... 8 4. Java Client WSN Core-Engine onvoyage... 8 5. Java Code on Sun SPOT Motes... 8 6. Database SQL Script... 9 7. Performance Test Shell Script... 9
Summary This document gives the analysis of source codes.
1. C/C++ DTN2 Services Client 1.1 dtnhttpsqs dtnhttpsqs client provides basic services over DTN network including dtnsend, dtnrecv, dtncp and dtncpd. dtnhttpcp.h dtnhttpcp.c dtnhttpcpd.h dtnhttpcpd.c dtnhttprecv.h dtnhttprecv.c dtnhttpsend.h dtnhttpsend.c dtnhttpsqs.h dtnhttpsqs.c HandleRequest.h HandleRequest.cpp httpsqsclient.h httpsqsclient.c HttpsqsMessage.h HttpsqsMessage.cpp HttpsqsMessageHandler.h HttpsqsMessageHandler.cpp includes.h QueueManager.h QueueManager.cpp util.h util.cpp make.sh clean.sh copy a bundle to a valid destination eid and return the filename to the middleware receive a bundle and return the file path to the middleware receive a bundle on a registration and return the received message to the middleware sends a bundle with payload of file, tmpfile, message, or date and return the status if the messages send successfully Main method analyze the request message and process the request C/C++ client for httpsqs which put and get the messages to middleware HttpsqsMessage class Marshall and unmarshall the HttpsqsMessage to XML string Contains all the include header file Queue manager to manage the different queues Utility class Make script the compile the source code Clean script to clean the file 1.2 dtnmail DTN Mail is a C/C++ client application for both DTN2 and DSAM. It is responsible for receiving bundles and if the bundles are special for email, it will forward to Email Server in the city network. This application runs on the city gateway. dtnmail.h dtnmail.c httpsqsclient.h httpsqsclient.c includes.h make.sh clean.sh receive the bundles and forward message to Email Server C/C++ client for httpsqs which put and get the messages to middleware Contains all the include header file Make script the compile the source code Clean script to clean the file
2. PHP Client Application 2.1 PHP Web Interface 2.1.1 WSN PHP web client runs in the gateway either in the remote or city area. It is designed to serve as web interfac to the user to control the WSN and DTN service. amline amline_example amline_original css download httpsqs images js mail addroute.php Collecthistory.php collectionmanage.php Datacontrol.php Datamanage.php Dbmanage.php Delroute.php Dtncontrol.php Dtncpd.php Dtncpdcontrol.php Dtncpres.php Dtnheader.html Dtnhome.html Dtnmail.php Dtnmailres.php Dtnstart.php Footer..html gatewaymanager.php Graph.php Graphxml.php Header.html Index.html routeinfo.php routemanage.php Sendemail.php Sunspot.php Amline to graph the data css file The file is put in the download folder Contains the httpsqs client for php Contains all the images Javascript Mail message Add route information to DTN2 Show the collect history process the request from wsncontrol.php process the request from the datacontrol.php start to manage the data for distribute, download and graph data To init the database tables delete a route start or stop the dtn; list bundles info and bundle stats start to receive the file process the request of dtncpd.php Response page for dtncp.php Dtn header file Dtn home page Send email over DTN through web pages Response to email service action, deal with the request from dtncontrol.php page footer list all the gateway information graph the data on the picture dynamic generate the xml file as a data source Header file Index main page display the route information for DTN2 process the request from addroute.php and routemanage.php Send mail which read mail from /var/www/wsn/mail folder updte sunspot information
Sunspotlist.php list all the sunspot connected to a gateway. updategatewayinfo.php update the gateway information Wsncontrol.php start the wsn engine to collect environment data Wsnheader.php Wsn page header Wsnhome.html Wsn home page 2.1.2 SSA The goal of the SSA is to provide a facility to report medical related data such as the level of the stock of medical drugs or number of patients in a village to a healthcare authority located in another remote region such as a city by using the Bytewalla DTN network. ssahome.html register1.php insert.php login.php home page of the ssa user registration code patient registration code code for logging in of registered users logout.php user session ends with this code member.php small code for running the log in session query.php search the patient info. in database feedback.php Feedback to patient, stored in database casedetail.php display the searched cases exportdata.php export the searched cases to text file dtncpres.php Response page for dtncp.php dtncpd.php start to receive the file dtncpdcontrol.php process the request of dtncpd.php string.txt httpsqs floder css floder images floder download floder sql commands for creating tables Contains the httsqs client for php contains styling and layout files for website contains images used for the website All the exported data are saved in this file.
js floder header.php footer.php javascript for animation for website header for the website footer for the website 2.2 PHP Mail Server PHP Mail Proxy runs on the Email Server to send the email to the Internet. dtnemail.php get the message from the HTTPSQS middleware and send the message out with mailto function httpsqs_client.php php client for HTTPSQS
3. Python Client for DTN Management Tool DTN Management Tool is to provide a user-friendly management tool for application users including start and stop DTN2, route and bundle information configuration. dtnconctroller.py Analyze and process the requests for dtn2 management dtnmanagement.py Start, stop DTN2 and get bundle and route information httpsqs_client.py Python client API for put and get message 4. Java Client WSN Core-Engine onvoyage Java client on Voyage Gataeway are connected to base station which is used to receive the data that is broadcasted / multicasted by the WSN Mote(s). build The folder contains the object class after compilation. jdbc-driver Contains the external jar library such as jdbc and jdom build.properties Properties file for a Sun Spot Host Application main.class= give the path of main class main.args= give the path of external library Src Contains all the Java source code com.dtn.wsn.dao Contains Data Access Object(DAO) to access the database com.dtn.wsn.database ConnectionPool to manage the database connections com.dtn.wsn.demo WSNApplication and main method com.dtn.wsn.entity entity classes com.dtn.wsn.filemanager File operation like compress and uncompress the files com.dtn.wsn.httpsqs Java client for httpsqs to send and receive the messages com.dtn.wsn.middleware Contains httpsqsmessage handler to marshal and unmarshal the XML message com.dtn.wsn.sunspot Contains sunspot connection, data store and data analysis 5. Java Code on Sun SPOT Motes build j2meclasses nbproject src build.properties The folder contains the object class after compilation. The class file created from the compilation Containing project specific IDE settings and metadata of the project to be created Containing the source code of this application Properties file for a Sun Spot Host Application main.class= give the path of main class main.args= give the path of external library
6. Database SQL Script The SQL script contains two parts: wsn and ssa. The scripts excute in mysql. In our project, all the database username is root and password is bytewalla5. 7. Performance Test Shell Script This contains two shell script when we conduct the power consumption analysis. It is used to send different size of bundles automatically.