39 std::cout <<
"-- dtnconvert (IBR-DTN) --" << std::endl;
40 std::cout <<
"Syntax: dtnconvert [options]" << std::endl << endl;
41 std::cout <<
"* optional parameters *" << std::endl;
42 std::cout <<
" -h Display this text" << std::endl;
43 std::cout <<
" -r Read bundle data and print out some information" << std::endl;
44 std::cout <<
" -c Create a bundle with stdin as payload" << std::endl;
45 std::cout << std::endl;
46 std::cout <<
"* options when creating a bundle *" << std::endl;
47 std::cout <<
" -s Source EID of the bundle" << std::endl;
48 std::cout <<
" -d Destination EID of the bundle" << std::endl;
49 std::cout <<
" -l Lifetime of the bundle in seconds (default: 3600)" << std::endl;
52 int main(
int argc,
char** argv)
58 size_t _lifetime = 3600;
60 while((opt = getopt(argc, argv,
"hrcs:d:l:")) != -1)
77 _lifetime = atoi(optarg);
81 _source = std::string(optarg);
85 _destination = std::string(optarg);
89 std::cout <<
"unknown command" << std::endl;
94 if (working_mode == 0)
100 switch (working_mode)
108 std::cout <<
"flags: " << std::hex << std::setw( 2 ) << std::setfill(
'0' ) << b.
procflags.
toString() << std::dec << std::endl;
109 std::cout <<
"source: " << b.source.getString() << std::endl;
110 std::cout <<
"destination: " << b.destination.getString() << std::endl;
111 std::cout <<
"timestamp: " << b.timestamp.toString() << std::endl;
112 std::cout <<
"sequence number: " << b.sequencenumber.toString() << std::endl;
113 std::cout <<
"lifetime: " << b.lifetime.toString() << std::endl;
116 std::cout <<
"fragment offset: " << b.fragmentoffset.toString() << std::endl;
117 std::cout <<
"app data length: " << b.appdatalength.toString() << std::endl;
124 std::cout <<
"payload size: " << ref.
size() << std::endl;
143 (*stream) << std::cin.rdbuf();