forked from ravinet/mahimahi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelayshell.cc
35 lines (25 loc) · 968 Bytes
/
delayshell.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* -*-mode:c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include "delay_queue.hh"
#include "packetshell.cc"
using namespace std;
int main( int argc, char *argv[] )
{
try {
/* clear environment while running as root */
char ** const user_environment = environ;
environ = nullptr;
check_requirements( argc, argv );
if ( argc != 2 ) {
throw Exception( "Usage", string( argv[ 0 ] ) + " propagation-delay [in milliseconds]" );
}
const uint64_t delay_ms = myatoi( argv[ 1 ] );
PacketShell<DelayQueue> delay_shell_app( "delay" );
delay_shell_app.start_uplink( "[delay " + to_string( delay_ms ) + " ms] ", user_environment, delay_ms );
delay_shell_app.start_downlink( delay_ms );
return delay_shell_app.wait_for_exit();
} catch ( const Exception & e ) {
e.perror();
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}