apps/dtnrespond/dtnrespond_pseudo
changeset 1 44c5e3fa6d30
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/dtnrespond/dtnrespond_pseudo	Tue Apr 26 14:43:43 2011 +0100
@@ -0,0 +1,84 @@
+DTNRESPOND
+
+- inputs
+    - listen eid (req)
+    - config file (req)
+    - number of bundles to receive
+    - bundle expiry time
+    - help
+    - verbose
+
+- outputs
+    - 0: success
+    - 1: error
+
+--------------------------------------------------------------------------------
+
+- main
+    - parse cmd line args
+        - validate cmd line args
+            - if invalid, print usage & exit
+
+    - parse config file - format: {encoding, pathname}
+        - validate config file
+    
+    - create matcher
+        - set encoding from config
+        - set path from config
+ 
+    - create registration
+        - validate response
+    - open handle
+        - validate response
+
+    - do_recv
+        - validate response
+
+    - close handle
+        - validate response
+- end main
+
+--------------------------------------------------------------------------------
+
+- do_recv
+    - create bundle_spec
+
+    - loop forever or until received enough bundles
+        - (re)initialize bundle_spec
+
+        - dtn_recv()
+            - assert response
+
+        - extract bpq matching rule
+        - extract bpq query
+
+        - match query using matcher
+        - if found
+            - do_send_response
+        - else
+            - do nothing for now
+- end do_recv
+
+--------------------------------------------------------------------------------
+
+- do_send_response
+    - create & initialize bundle_spec, response payload, bundle_id, bpq_ext
+    - set src = current eid
+    - set dest = bpq source eid
+    - set payload = file at 'found location'
+
+    - dtn_send()
+        - assert response
+- end do_send
+
+--------------------------------------------------------------------------------
+
+- match
+    - create list of files in 'path'
+    - match based on matching rule
+    - if found
+        - update location
+        - return 0
+    - else
+        - return 1
+