39 std::cout <<
"-- dtnconvert (IBR-DTN) --" << std::endl;
40 std::cout <<
"Syntax: dtnconvert [options]" << std::endl;
41 std::cout << std::endl;
42 std::cout <<
"* parameters *" << std::endl;
43 std::cout <<
" -h display this text" << std::endl;
44 std::cout <<
" -r read bundle data and print out some information" << std::endl;
45 std::cout <<
" -c create a bundle with stdin as payload" << std::endl;
46 std::cout << std::endl;
47 std::cout <<
"* options when creating a bundle *" << std::endl;
48 std::cout <<
" -s source EID of the bundle" << std::endl;
49 std::cout <<
" -d destination EID of the bundle" << std::endl;
50 std::cout <<
" -l lifetime of the bundle in seconds (default: 3600)" << std::endl;
53 int main(
int argc,
char** argv)
59 size_t _lifetime = 3600;
61 while((opt = getopt(argc, argv,
"hrcs:d:l:")) != -1)
78 _lifetime = atoi(optarg);
82 _source = std::string(optarg);
86 _destination = std::string(optarg);
90 std::cout <<
"unknown command" << std::endl;
95 if (working_mode == 0)
101 switch (working_mode)
109 std::cout <<
"flags: " << std::hex << std::setw( 2 ) << std::setfill(
'0' ) << b.
procflags.
toString() << std::dec << std::endl;
110 std::cout <<
"source: " << b.source.getString() << std::endl;
111 std::cout <<
"destination: " << b.destination.getString() << std::endl;
112 std::cout <<
"timestamp: " << b.timestamp.toString() << std::endl;
113 std::cout <<
"sequence number: " << b.sequencenumber.toString() << std::endl;
114 std::cout <<
"lifetime: " << b.lifetime.toString() << std::endl;
122 std::cout <<
"payload size: " << stream.
size() << std::endl;
142 (*stream) << std::cin.rdbuf();