36 std::cout <<
"-- dtnstream (IBR-DTN) --" << std::endl;
37 std::cout <<
"Syntax: dtnstream [options]" << std::endl;
38 std::cout <<
"" << std::endl;
39 std::cout <<
"* optional parameters *" << std::endl;
40 std::cout <<
" -h Display this text" << std::endl;
41 std::cout <<
" -U <socket> Connect to UNIX domain socket API" << std::endl;
42 std::cout <<
" -s <identifier> Set the source identifier (e.g. stream)" << std::endl;
43 std::cout <<
"" << std::endl;
44 std::cout <<
"* send options *" << std::endl;
45 std::cout <<
" -d <destination> Set the destination eid (e.g. dtn://node/stream)" << std::endl;
46 std::cout <<
" -G Destination is a group" << std::endl;
47 std::cout <<
" -C <bytes> Set the max. chunk size (max. size of each bundle)" << std::endl;
48 std::cout <<
" -c <bytes> Set the min. chunk size (min. size of each bundle)" << std::endl;
49 std::cout <<
" -p <0..2> Set the bundle priority (0 = low, 1 = normal, 2 = high)" << endl;
50 std::cout <<
" -l <seconds> Set the lifetime of stream chunks default: 30" << std::endl;
51 std::cout <<
" -E Request encryption on the bundle layer" << std::endl;
52 std::cout <<
" -S Request signature on the bundle layer" << std::endl;
53 std::cout <<
" -f Enable flow-control using Status Reports" << std::endl;
54 std::cout <<
"" << std::endl;
55 std::cout <<
"* receive options *" << std::endl;
56 std::cout <<
" -g <group> Join a destination group" << std::endl;
57 std::cout <<
" -t <seconds> Set the timeout of the buffer" << std::endl;
58 std::cout <<
" -w Wait for the bundle with seqno zero" << std::endl;
59 std::cout <<
"" << std::endl;
62 int main(
int argc,
char *argv[])
66 std::string _source =
"stream";
68 unsigned int _lifetime = 30;
69 unsigned int _receive_timeout = 0;
71 size_t _min_chunk_size = 4096;
72 size_t _max_chunk_size = 512000;
75 bool _bundle_encryption =
false;
76 bool _bundle_signed =
false;
77 bool _bundle_group =
false;
78 bool _wait_seq_zero =
false;
79 bool _flow_control =
false;
82 while((opt = getopt(argc, argv,
"hg:Gd:t:s:c:C:p:l:ESU:wf")) != -1)
91 _destination = std::string(optarg);
95 _group = std::string(optarg);
107 _min_chunk_size = atoi(optarg);
111 _max_chunk_size = atoi(optarg);
115 _receive_timeout = atoi(optarg);
119 _priority = atoi(optarg);
123 _lifetime = atoi(optarg);
127 _bundle_encryption =
true;
131 _bundle_signed =
true;
139 _wait_seq_zero =
true;
143 _flow_control =
true;
147 std::cout <<
"unknown command" << std::endl;
172 BundleStream bs(conn, _min_chunk_size, _max_chunk_size, _source, _group, _wait_seq_zero);
193 std::ostream stream(&bs.
rdbuf());
194 stream << std::cin.rdbuf() << std::flush;
199 std::istream stream(&bs.
rdbuf());
200 std::cout << stream.rdbuf() << std::flush;
207 std::cerr <<
"Can not connect to the daemon. Does it run?" << std::endl;
209 }
catch (
const std::exception&) {