Exemplo n.º 1
0
void get_new_nicname(char **dest, char *br, char *pid)
{
	int i = 0;
	// TODO - speed this up.  For large installations we won't
	// want n stats for every nth container startup.
	while (1) {
		sprintf(*dest, "lxcuser-%d", i);
		if (!nic_exists(*dest) && create_nic(*dest, br, pid))
			return;
		i++;
	}
}
Exemplo n.º 2
0
void c_osi2_switch::connect_with(c_osi2_nic &target, c_world &world, t_osi2_cost cost)
{
	create_nic(); // create a new NIC card (it will be at end)
	c_osi2_nic & my_new_port = * m_nic.back(); // get this new card
	
	// create the cable (it will be owned by the networld world) that connects this target to my new port
	c_osi2_cable_direct & cable = world.new_cable_between( target , my_new_port , cost );
	
	// actually plug in the created table to both ends:
	my_new_port.plug_in_cable(cable); 
	target.plug_in_cable(cable);
	
	// as result, the target NIC has access to our NIC and to us, and vice-versa
	
	_dbg2("In " << world << " connected the target " << target << " to my port " << my_new_port );
}
Exemplo n.º 3
0
c_osi2_nic &c_osi2_switch::use_nic(unsigned int nr)
{
	while (! ( nr < m_nic.size() ) ) create_nic();
	if (nr < m_nic.size()) return * m_nic[nr];
	throw std::runtime_error("Internal error in creating nodes in use_nic"); // assert
}