int
main( int argc, char *argv[] ) {
  // Check if this application runs with root privilege
  if ( geteuid() != 0 ) {
    printf( "Redirectable routing switch must be run with root privilege.\n" );
    exit( EXIT_FAILURE );
  }

  // Initialize Trema world
  init_trema( &argc, &argv );
  routing_switch_options options;
  init_routing_switch_options( &options, &argc, &argv );
  init_topology_service_interface_options( &argc, &argv );

  // Initialize routing_switch
  routing_switch *routing_switch = create_routing_switch( get_topology_service_interface_name(), &options );

  // Main loop
  start_trema();

  // Finalize routing_switch
  delete_routing_switch( routing_switch );

  return 0;
}
Esempio n. 2
0
int
main( int argc, char *argv[] ) {
  // Initialize Trema world
  init_trema( &argc, &argv );
  routing_switch_options options;
  init_routing_switch_options( &options, &argc, &argv );
  init_topology_service_interface_options( &argc, &argv );

  // Initialize routing_switch
  routing_switch *routing_switch = create_routing_switch( get_topology_service_interface_name(), &options );

  // Main loop
  start_trema();

  // Finalize routing_switch
  delete_routing_switch( routing_switch );

  return 0;
}