static routing_switch * create_routing_switch( const char *topology_service, const routing_switch_options *options ) { assert( topology_service != NULL ); assert( options != NULL ); // Allocate routing_switch object routing_switch *routing_switch = xmalloc( sizeof( struct routing_switch ) ); routing_switch->idle_timeout = options->idle_timeout; routing_switch->switches = NULL; routing_switch->fdb = NULL; info( "idle_timeout is set to %u", routing_switch->idle_timeout ); // Create forwarding database routing_switch->fdb = create_fdb(); // Initialize port database routing_switch->switches = create_outbound_ports( &routing_switch->switches ); // Initialize libraries init_libtopology( topology_service ); // Ask topology manager to notify any topology change events. // after_subscribed() will be called subscribe_topology( after_subscribed, routing_switch ); return routing_switch; }
static sliceable_switch * create_sliceable_switch( const char *topology_service, const switch_options *options ) { assert( topology_service != NULL ); assert( options != NULL ); // Allocate sliceable_switch object sliceable_switch *instance = xmalloc( sizeof( sliceable_switch ) ); instance->idle_timeout = options->idle_timeout; instance->handle_arp_with_packetout = options->handle_arp_with_packetout; instance->setup_reverse_flow = options->setup_reverse_flow; instance->switches = NULL; instance->fdb = NULL; instance->pathresolver = NULL; instance->second_stage_down = false; instance->last_stage_down = false; info( "idle_timeout is set to %u [sec].", instance->idle_timeout ); if ( instance->handle_arp_with_packetout ) { info( "Handle ARP with packetout" ); } // Create pathresolver table instance->pathresolver = create_pathresolver(); // Create forwarding database instance->fdb = create_fdb(); // Initialize port database instance->switches = create_ports( &instance->switches ); // Initialize libraries init_libtopology( topology_service ); // Ask topology manager to notify any topology change events. // after_subscribed() will be called subscribe_topology( after_subscribed, instance ); // Initialize filter init_filter( options->filter_db_file ); // Initialize multiple slices support init_slice( options->slice_db_file, options->mode, instance ); // Initialize redirector init_redirector(); return instance; }
static broadcast_helper * create_broadcast_helper( const char *topology_service ) { assert( topology_service != NULL ); // Allocate broadcast_helper object broadcast_helper *broadcast_helper = xmalloc( sizeof( broadcast_helper ) ); broadcast_helper->switches = NULL; // Initialize port database broadcast_helper->switches = create_ports( &broadcast_helper->switches ); // Initialize libraries init_libtopology( topology_service ); // Ask topology manager to notify any topology change events. // after_subscribed() will be called subscribe_topology( after_subscribed, broadcast_helper ); return broadcast_helper; }
static routing_switch * create_routing_switch( const char *topology_service, const routing_switch_options *options ) { assert( topology_service != NULL ); assert( options != NULL ); // Allocate routing_switch object routing_switch *routing_switch = xmalloc( sizeof( struct routing_switch ) ); routing_switch->idle_timeout = options->idle_timeout; routing_switch->switches = NULL; routing_switch->fdb = NULL; routing_switch->second_stage_down = false; routing_switch->last_stage_down = false; info( "idle_timeout is set to %u [sec].", routing_switch->idle_timeout ); // Create pathresolver table routing_switch->pathresolver = create_pathresolver(); // Create forwarding database routing_switch->fdb = create_fdb(); // Initialize port database routing_switch->switches = create_ports( &routing_switch->switches ); // Initialize libraries init_libtopology( topology_service ); // Ask topology manager to notify any topology change events. // after_subscribed() will be called subscribe_topology( after_subscribed, routing_switch ); // Initialize authenticator init_authenticator( options->authorized_host_db ); // Initialize redirector init_redirector(); return routing_switch; }