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 path_resolver table routing_switch->path_resolver = create_path_resolver(); // 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 ); return routing_switch; }
static sai_status_t initialize_default_objects() { SWSS_LOG_ENTER(); CHECK_STATUS(set_switch_mac_address()); CHECK_STATUS(create_cpu_port()); CHECK_STATUS(create_default_vlan()); CHECK_STATUS(create_default_virtual_router()); CHECK_STATUS(create_default_stp_instance()); CHECK_STATUS(create_default_1q_bridge()); CHECK_STATUS(create_default_trap_group()); CHECK_STATUS(create_ports()); CHECK_STATUS(create_port_list()); CHECK_STATUS(create_bridge_ports()); CHECK_STATUS(create_vlan_members()); CHECK_STATUS(create_acl_entry_min_prio()); CHECK_STATUS(create_ingress_priority_groups()); CHECK_STATUS(create_qos_queues()); CHECK_STATUS(set_maximum_number_of_childs_per_scheduler_group()); CHECK_STATUS(set_number_of_ecmp_groups()); CHECK_STATUS(set_default_notifications()); CHECK_STATUS(create_scheduler_groups()); return SAI_STATUS_SUCCESS; }
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 int init(struct ao *ao) { struct priv *p = ao->priv; struct mp_chmap_sel sel = {0}; jack_options_t open_options; ao->format = AF_FORMAT_FLOATP; switch (p->stdlayout) { case 0: mp_chmap_sel_add_waveext(&sel); break; case 1: mp_chmap_sel_add_alsa_def(&sel); break; default: mp_chmap_sel_add_any(&sel); } if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels)) goto err_chmap; open_options = JackNullOption; if (!p->autostart) open_options |= JackNoStartServer; p->client = jack_client_open(p->cfg_client_name, open_options, NULL); if (!p->client) { MP_FATAL(ao, "cannot open server\n"); goto err_client_open; } if (create_ports(ao, ao->channels.num)) goto err_create_ports; jack_set_process_callback(p->client, process, ao); if (jack_activate(p->client)) { MP_FATAL(ao, "activate failed\n"); goto err_activate; } ao->samplerate = jack_get_sample_rate(p->client); if (p->connect) if (connect_to_outports(ao)) goto err_connect; jack_latency_range_t jack_latency_range; jack_port_get_latency_range(p->ports[0], JackPlaybackLatency, &jack_latency_range); p->jack_latency = (float)(jack_latency_range.max + jack_get_buffer_size(p->client)) / (float)ao->samplerate; if (!ao_chmap_sel_get_def(ao, &sel, &ao->channels, p->num_ports)) goto err_chmap_sel_get_def; return 0; err_chmap_sel_get_def: err_connect: jack_deactivate(p->client); err_activate: err_create_ports: jack_client_close(p->client); err_client_open: err_chmap: return -1; }