apps/dtnrespond/dtnrespond_pseudo
changeset 1 44c5e3fa6d30
equal deleted inserted replaced
0:2b3e5ec03512 1:44c5e3fa6d30
       
     1 DTNRESPOND
       
     2 
       
     3 - inputs
       
     4     - listen eid (req)
       
     5     - config file (req)
       
     6     - number of bundles to receive
       
     7     - bundle expiry time
       
     8     - help
       
     9     - verbose
       
    10 
       
    11 - outputs
       
    12     - 0: success
       
    13     - 1: error
       
    14 
       
    15 --------------------------------------------------------------------------------
       
    16 
       
    17 - main
       
    18     - parse cmd line args
       
    19         - validate cmd line args
       
    20             - if invalid, print usage & exit
       
    21 
       
    22     - parse config file - format: {encoding, pathname}
       
    23         - validate config file
       
    24     
       
    25     - create matcher
       
    26         - set encoding from config
       
    27         - set path from config
       
    28  
       
    29     - create registration
       
    30         - validate response
       
    31     - open handle
       
    32         - validate response
       
    33 
       
    34     - do_recv
       
    35         - validate response
       
    36 
       
    37     - close handle
       
    38         - validate response
       
    39 - end main
       
    40 
       
    41 --------------------------------------------------------------------------------
       
    42 
       
    43 - do_recv
       
    44     - create bundle_spec
       
    45 
       
    46     - loop forever or until received enough bundles
       
    47         - (re)initialize bundle_spec
       
    48 
       
    49         - dtn_recv()
       
    50             - assert response
       
    51 
       
    52         - extract bpq matching rule
       
    53         - extract bpq query
       
    54 
       
    55         - match query using matcher
       
    56         - if found
       
    57             - do_send_response
       
    58         - else
       
    59             - do nothing for now
       
    60 - end do_recv
       
    61 
       
    62 --------------------------------------------------------------------------------
       
    63 
       
    64 - do_send_response
       
    65     - create & initialize bundle_spec, response payload, bundle_id, bpq_ext
       
    66     - set src = current eid
       
    67     - set dest = bpq source eid
       
    68     - set payload = file at 'found location'
       
    69 
       
    70     - dtn_send()
       
    71         - assert response
       
    72 - end do_send
       
    73 
       
    74 --------------------------------------------------------------------------------
       
    75 
       
    76 - match
       
    77     - create list of files in 'path'
       
    78     - match based on matching rule
       
    79     - if found
       
    80         - update location
       
    81         - return 0
       
    82     - else
       
    83         - return 1
       
    84