Пример #1
0
    host_entry::host_entry(struct addrinfo* __ainfo)
    {
        ufc_check_ptr (__ainfo);
        
        for (struct addrinfo* __ai = __ainfo; __ai; __ai = __ai->ai_next)
        {
            if (__ai->ai_canonname)
            {
                _name.assign(__ai->ai_canonname);
            }
            if (__ai->ai_addrlen && __ai->ai_addr)
            {
                switch (__ai->ai_addr->sa_family)
                {
                case AF_INET:
                    _addresses.push_back(ip_address(&reinterpret_cast<struct sockaddr_in*>(__ai->ai_addr)->sin_addr, sizeof(in_addr)));
                    break;
#if defined(ufc_have_ipv6)
                case AF_INET6:
                    _addresses.push_back(ip_address(&reinterpret_cast<struct sockaddr_in6*>(__ai->ai_addr)->sin6_addr, sizeof(in6_addr), reinterpret_cast<struct sockaddr_in6*>(__ai->ai_addr)->sin6_scope_id));
                    break;
#endif
                }
            }
        }
    }
Пример #2
0
void neigh_table_mgr::notify_cb(event *ev)
{
	neigh_mgr_logdbg("");
	// Got event from netlink

	neigh_nl_event* nl_ev = dynamic_cast <neigh_nl_event*> (ev);
	BULLSEYE_EXCLUDE_BLOCK_START
	if (nl_ev == NULL) {
		neigh_mgr_logdbg("Non neigh_nl_event type");
		return;
	}
	BULLSEYE_EXCLUDE_BLOCK_END

	const netlink_neigh_info* nl_info = nl_ev->get_neigh_info();
	struct in_addr in;
	if (1 != inet_pton(AF_INET, (const char *)(nl_info->dst_addr_str.c_str()), &in)) {
		neigh_mgr_logdbg("Ignoring netlink neigh event neigh for IP = %s, not a valid IP", nl_info->dst_addr_str.c_str());
		return;
	}

	in_addr_t neigh_ip = in.s_addr;

	// Search for this neigh ip in cache_table
	m_lock.lock();
	net_dev_lst_t* p_ndv_val_lst = g_p_net_device_table_mgr->get_net_device_val_lst_from_index(nl_info->ifindex);

	//find all neigh entries with an appropriate peer_ip and net_device
	if (p_ndv_val_lst) {
		net_dev_lst_t::iterator itr;
		for (itr = p_ndv_val_lst->begin(); itr != p_ndv_val_lst->end(); ++itr) {
			net_device_val* p_ndev = dynamic_cast <net_device_val *>(*itr);
			if (p_ndev) {
				std::tr1::unordered_map< neigh_key, cache_entry_subject<neigh_key,neigh_val*> *>::iterator cache_itr;
				cache_itr = m_cache_tbl.find(neigh_key(ip_address(neigh_ip), p_ndev));
				if (cache_itr == m_cache_tbl.end()) {
					neigh_mgr_logdbg("Ignoring netlink neigh event for IP = %s if:%s, index=%d, p_ndev=%p", nl_info->dst_addr_str.c_str(), p_ndev->to_str().c_str(), nl_info->ifindex, p_ndev);
				}
				else {

					neigh_entry *p_ne = dynamic_cast <neigh_entry *>(cache_itr->second);

					if (p_ne) {
						// Call the relevant neigh_entry to handle the event
						p_ne->handle_neigh_event(nl_ev);
					}
				}
			} else {
				neigh_mgr_logdbg("could not find ndv_val for ifindex=%d", nl_info->ifindex);
			}

		}
	} else {
		neigh_mgr_logdbg("could not find ndv_val list for ifindex=%d", nl_info->ifindex);
	}
	m_lock.unlock();

	return;
}
Пример #3
0
void update()
{
    struct string ip = ip_address();
    str_trim_right(&ip.ptr);

    url_upload(&ip);

    free(ip.ptr);
}
Пример #4
0
bool tcp_server_socket::on_readable() {
    while( true ) {
        union {
            struct sockaddr sa;
            struct sockaddr_storage ss;
        } addr;
        socklen_t addrlen = sizeof(addr);
#ifdef _GNU_SOURCE
        int s = ::accept4(m_fd, &(addr.sa), &addrlen,
                          SOCK_NONBLOCK|SOCK_CLOEXEC);
#else
        int s = ::accept(m_fd, &(addr.sa), &addrlen);
        if( s != -1 ) {
            int fl = fcntl(s, F_GETFL, 0);
            if( fl == -1 ) fl = 0;
            if( fcntl(s, F_SETFL, fl | O_NONBLOCK) == -1 ) {
                ::close(s);
                throw_unix_error(errno, "fcntl(F_SETFL)");
            }
            fl = fcntl(s, F_GETFD, 0);
            if( fl == -1 ) fl = 0;
            if( fcntl(s, F_SETFD, fl | FD_CLOEXEC) == -1 ) {
                ::close(s);
                throw_unix_error(errno, "fcntl(F_SETFD)");
            }
        }
#endif
        if( s == -1 ) {
            if( errno == EINTR || errno == ECONNABORTED )
                continue;
            if( errno == EMFILE || errno == ENFILE ) {
                logger::error() << "accept: Too many open files.";
                continue;
            }
            if( errno == EAGAIN || errno == EWOULDBLOCK )
                break;
            throw_unix_error(errno, "accept");
        }

        try {
            std::unique_ptr<tcp_socket> t = m_wrapper(s, ip_address(&(addr.sa)));
            if( t.get() == nullptr ) {
                ::close(s);
            } else {
                m_reactor->add_resource( std::move(t),
                                         reactor::EVENT_IN|reactor::EVENT_OUT );
            }

        } catch( ... ) {
            ::close(s);
            throw;
        }
    }
    return true;
}
Пример #5
0
	ip_address make_ip_address_local() {
		//http://tangentsoft.net/wskfaq/examples/ipaddr.html
		unsigned long addr = INADDR_NONE;

		char host_name[80];
		if (::gethostname(host_name, sizeof(host_name)) != SOCKET_ERROR) {
			hostent* he = ::gethostbyname(host_name);
			if (he != nullptr) {
				addr = *((unsigned long*)he->h_addr_list[0]);
			}
		}

		return ip_address(addr);
	}
Пример #6
0
void ribi::gtst::DebugDialog::OnUploadDone()
{
  boost::shared_ptr<Parameters> parameters(new Parameters(m_server));
  assert(parameters);
  try
  {
    parameters->ReadFromFile(m_fileupload->spoolFileName());
  }
  catch (std::runtime_error& e)
  {
    m_label_state_upload->setText(e.what());
    return;
  }

  m_label_state_upload->setText("OK: parameter file loaded");
  m_server->Reset();
  m_server->SetParameters(parameters);

  //Create the Participant dialogs

  ///Remove all ParticipantDialogs from Wt::WContainerWidget and std::vector
  this->clear();
  m_dialogs.resize(0);

  const int n_participants = m_server->GetGroups()->CollectParticipants().size();

  //Display the dialogs in a random order
  std::vector<int> indices(n_participants);
  std::iota(indices.begin(),indices.end(),0);
  std::random_shuffle(indices.begin(),indices.end());

  for (int dialog_index=0; dialog_index!=n_participants; ++dialog_index)
  {
    const int i = indices[dialog_index];
    std::string ip_address_str
      = "000.000.000."
      + std::to_string(i);
    boost::scoped_ptr<SafeIpAddress> ip_address(
      new SafeIpAddress(ip_address_str));
    ParticipantDialog* const dialog = new ParticipantDialog(m_server,ip_address.get());
    m_dialogs.push_back(dialog);

    Wt::WGroupBox * const box = new Wt::WGroupBox;
    box->addWidget(dialog);
    addWidget(new Wt::WBreak);
    addWidget(new Wt::WBreak);
    addWidget(box);
  }
}
Пример #7
0
void neigh_table_mgr::notify_cb(event *ev)
{
	neigh_mgr_logdbg("");
	// Got event from netlink

	neigh_nl_event* nl_ev = dynamic_cast <neigh_nl_event*> (ev);
	BULLSEYE_EXCLUDE_BLOCK_START
	if (nl_ev == NULL) {
		neigh_mgr_logdbg("Non neigh_nl_event type");
		return;
	}
	BULLSEYE_EXCLUDE_BLOCK_END

	const netlink_neigh_info* nl_info = nl_ev->get_neigh_info();
	struct in_addr in;
	if (1 != inet_pton(AF_INET, (const char *)(nl_info->dst_addr_str.c_str()), &in)) {
		neigh_mgr_logdbg("Ignoring netlink neigh event neigh for IP = %s, not a valid IP", nl_info->dst_addr_str.c_str());
		return;
	}

	in_addr_t neigh_ip = in.s_addr;

	// Search for this neigh ip in cache_table
	m_lock.lock();
	net_device_val* p_ndev = g_p_net_device_table_mgr->get_net_device_val(nl_info->ifindex);

	//find all neigh entries with an appropriate peer_ip and net_device
	if (p_ndev) {
		neigh_entry *p_ne = dynamic_cast <neigh_entry *>(get_entry(neigh_key(ip_address(neigh_ip), p_ndev)));
		if (p_ne) {
			// Call the relevant neigh_entry to handle the event
			p_ne->handle_neigh_event(nl_ev);
		} else {
			neigh_mgr_logdbg("Ignoring netlink neigh event for IP = %s if:%s, index=%d, p_ndev=%p", nl_info->dst_addr_str.c_str(), p_ndev->to_str().c_str(), nl_info->ifindex, p_ndev);
		}
	} else {
		neigh_mgr_logdbg("could not find ndv_val for ifindex=%d", nl_info->ifindex);
	}
	m_lock.unlock();

	return;
}
Пример #8
0
int ip(char * Buffer,struct Global *g )
{
 int rc ;
 char arg0[80],arg1[80],arg2[80],arg3[80],arg4[80] ;

  bzero(arg1,sizeof(arg1));
  bzero(arg2,sizeof(arg2));
  bzero(arg3,sizeof(arg3));
  sscanf(Buffer,"%s %s %s\n",arg1,arg2,arg3 ) ;

 if (!strcmp(arg2,"address") )
        rc = ip_address(Buffer,g) ;
  else if (!strcmp(arg2,"route") )
        rc = ip_route( Buffer, g) ;
else
  {
    fprintf(stderr,"Erreur de syntaxe  arg 2 ou arg3 \n" ) ;
    printf("Erreur de syntaxe arg 2 ou arg3\n") ;
    rc = 0 ;
   }
return (rc) ;
}
Пример #9
0
bool NetworkClient::Open(const str& local_address) {
	ScopeLock lock(&lock_);

	SendDisconnect();
	Stop();

	bool ok = !is_socket_connecting_;
	if (!ok) {
		log_.Warning("Already connecting (from some other thread?)...");
		deb_assert(false);
	}
	SocketAddress _local_address;
	uint16 end_port = 0;
	if (ok) {
		ok = _local_address.ResolveRange(local_address, end_port);
		if (!ok) {
			log_.Warning("Unable to resolve public local address, network down?");
			ok = true;
			uint8 ipv4[] = {0,0,0,0};
			IPAddress ip_address(ipv4, sizeof(ipv4));
			_local_address.Set(ip_address, 1025);
			end_port = 65534;
		}
	}
	if (ok) {
		//ScopeLock lock(&lock_);
		for (; _local_address.GetPort() <= end_port; _local_address.SetPort(_local_address.GetPort()+1)) {
			SetMuxSocket(new MuxSocket("Client ", _local_address, false));
			if (mux_socket_->IsOpen()) {
				break;
			}
			delete (mux_socket_);
			mux_socket_ = 0;
		}
		ok = (mux_socket_ != 0);
	}
	return (ok);
}
Пример #10
0
void igmp_mgr::process_igmp_packet(struct iphdr* p_ip_h, in_addr_t local_if)
{
	igmp_mgr_logfunc("");
	igmp_handler* p_igmp_hdlr = NULL;
	uint16_t ip_h_hdr_len = (int)(p_ip_h->ihl)*4;
	struct igmphdr* p_igmp_h = (struct igmphdr*)(((uint8_t*)p_ip_h) + ip_h_hdr_len);

	net_device_val* p_ndvl = g_p_net_device_table_mgr->get_net_device_val(local_if);
	BULLSEYE_EXCLUDE_BLOCK_START
	if (!p_ndvl){
		igmp_mgr_logerr("Failed getting relevant net device");
		return;
	}
	BULLSEYE_EXCLUDE_BLOCK_END

	igmp_key key(ip_address(p_igmp_h->group), p_ndvl);
	p_igmp_hdlr = get_igmp_handler(key, p_igmp_h->code);
	BULLSEYE_EXCLUDE_BLOCK_START
	if (!p_igmp_hdlr){
		igmp_mgr_logerr("Failed getting relevant igmp_handler");
		return;
	}
	BULLSEYE_EXCLUDE_BLOCK_END

	switch (p_igmp_h->type) {
	case IGMP_HOST_MEMBERSHIP_QUERY:
		p_igmp_hdlr->handle_query(p_igmp_h->code);
		break;

	case IGMP_HOST_MEMBERSHIP_REPORT:
	case IGMPV2_HOST_MEMBERSHIP_REPORT:
		p_igmp_hdlr->handle_report();
		break;

	default:
		break;
	}
}
Пример #11
0
    host_entry::host_entry(struct hostent* __entry)
    {
        ufc_check_ptr (__entry);

        _name = __entry->h_name;  
        char** alias = __entry->h_aliases;
        if (alias)
        {
            while (*alias)
            {
                _aliases.push_back(string(*alias));
                ++alias;
            }
        }
        char** address = __entry->h_addr_list;
        if (address)
        {
            while (*address)
            {
                _addresses.push_back(ip_address(*address, __entry->h_length));
                ++address;
            }
        }
    }
Пример #12
0
	ip_address make_ip_address_any() {
		return ip_address(htonl(INADDR_ANY));
	}
//---------------------------------------------------------------------------
void ribi::gtst::Test::TestParticipant()
{
  //Create a GroupAssigner
  const int expected_group = 1 + (std::rand() % 256);
  boost::shared_ptr<GroupAssigner> group_assigner(
    new GroupAssignerPredetermined(expected_group));
  {
    //Test the GroupAssigner
    /*
    for (int i=0; i!=10; ++i)
    {
      const int dummy_id = std::rand();
      assert(group_assigner->Assign(dummy_id) == expected_group
        && "Assume GroupAssignerPredetermined always produces the same integer");
    }
    */
  }


  boost::shared_ptr<Participant> p(
    new Participant(
      //chat_tag,
      group_assigner,m_server));
  {
    //assert(!p->CanGetGroup());
    assert(!p->CanGetId());
    assert(p->GetActions().empty());
    assert(p->GetVotes().empty());
    assert(!p->CanGetIpAddress());
  }
  //Assign an ID
  {
    const int id = 1 + (std::rand() % 256);
    p->AssignId(id);
    assert(p->CanGetId());
    assert(p->GetId() == id);
  }
  //Assign an IP address
  {
    boost::shared_ptr<SafeIpAddress> ip_address(
      new SafeIpAddress("123.123.123.123"));
    p->SetIpAddress(ip_address);
    assert(p->CanGetIpAddress());
    assert(p->GetIpAddress()->Get()  == ip_address.get()->Get());
  }
  //Assign a group
  {
    //p->AssignGroup();
    //assert(p->CanGetGroup());
    //assert(p->GetGroup() == expected_group);
  }
  //Chat #1
  {
    boost::shared_ptr<ChatMessage> chat_message(
      new ChatMessage(
        p,
        std::string("chat") + std::to_string(std::rand())));
    assert(p->GetChatLog().empty());
    //std::clog << "p has not yet chatted, not even close\n";
    //assert(!p->HasChatted());
    p->StartChat();
    assert(!p->GetChatLog().empty());
    assert(p->GetChatLog().back().empty());
    //assert(!p->CanGetLastChat());
    //std::clog << "p has not yet chatted\n";
    //assert(!p->HasChatted());
    p->AppendChat(chat_message);
    //assert(p->CanGetLastChat());
    //std::clog << "p has chatted\n";
    assert(!p->GetChatLog().empty());
    assert(!p->GetChatLog().back().empty());
    //assert(p->HasChatted());
    //std::clog << "p should not have an empty chat log\n";
    //assert(!p->GetLastChat().empty());
    //std::clog << "p should not have a chat log with one message\n";
    assert(p->GetChatLog().back().size() == 1);
    //std::clog << "p should not have a chat log with the one message chatted\n";
    assert(p->GetChatLog().back()[0] == chat_message);
  }
  //Voting #1
  {
    //const int vote = std::rand();
    //assert(!p->CanGetLastVote());
    //std::clog << "p has not yet voted, not even close\n";
    //assert(p->HasVoted());
    //p->StartVoting();
    //assert(!p->CanGetLastVote());
    //assert(!p->HasVoted());
    assert(p->GetVotes().empty());
    p->Vote(boost::shared_ptr<VotingOption>(
      new VotingOption(0.5,0.1,"Test")));
    assert(!p->GetVotes().empty());
    //assert(p->CanGetLastVote());
    //assert(p->HasVoted());
    //assert(p->GetLastVote() == vote);
  }
  //Choose action #1
  /*
  {
    const int action = std::rand();
    //assert(!p->CanGetLastAction());
    //assert(p->HasChosenAction());
    //p->StartChooseAction();
    //assert(!p->CanGetLastAction());
    //assert(!p->HasChosenAction());
    assert(p->GetActions().empty());
    p->ChooseAction(action);
    assert(!p->GetActions().empty());
    //assert(p->CanGetLastAction());
    //assert(p->HasChosenAction());
    //assert(p->GetLastChosenAction() == action);
  }
  */
  //Voting #2
  {
    //const int vote = std::rand();
    //assert(p->CanGetLastVote());
    //assert(p->HasVoted());
    //p->StartVoting();
    //assert(p->CanGetLastVote());
    //assert(!p->HasVoted());
    p->Vote(boost::shared_ptr<VotingOption>(
      new VotingOption(0.5,0.1,"Test2")));
    assert(p->GetVotes().size() == 2);
    //assert(p->CanGetLastVote());
    //assert(p->HasVoted());
    //assert(p->GetLastVote() == vote);
  }
  //Choose action #2
  /*
  {
    const int action = std::rand();
    //assert(p->CanGetLastAction());
    //assert(p->HasChosenAction());
    //p->StartChooseAction();
    //assert(p->CanGetLastAction());
    //assert(!p->HasChosenAction());
    p->ChooseAction(action);
    assert(p->GetActions().size() == 2);
    //assert(p->CanGetLastAction());
    //assert(p->HasChosenAction());
    //assert(p->GetLastChosenAction() == action);
  }
  */
  //Chat #2
  {
    boost::shared_ptr<ChatMessage> chat_message(
      new ChatMessage(
        p,
        std::string("chat") + std::to_string(std::rand())));
    //assert(p->CanGetLastChat());
    //assert(p->HasChatted());
    assert(p->GetChatLog().size() == 1);
    p->StartChat();
    assert(p->GetChatLog().size() == 2);
    assert(p->GetChatLog().back().empty());
    //assert(!p->CanGetLastChat());
    //assert(!p->HasChatted());
    p->AppendChat(chat_message);
    assert(!p->GetChatLog().back().empty());
    //assert(p->CanGetLastChat());
    //assert(p->HasChatted());
    //assert(!p->GetLastChat().empty());
    //assert(p->GetLastChat().size() == 1);
    assert(p->GetChatLog().back()[0] == chat_message);
  }
  ///Check the default Participant creation
  {
    boost::shared_ptr<Parameters> parameters(
      new Parameters(m_server));
    boost::shared_ptr<Participant> p1
      = parameters->CreateDefaultParticipant();
    boost::shared_ptr<Participant> p2
      = parameters->CreateDefaultParticipant();
    assert(p1->GetChatShape() != p2->GetChatShape());

  }
}
Пример #14
0
		static ip_address string_to_address(const std::string& addr)
		{
			int32 _addr = ::htonl(::inet_addr(addr.c_str()));
			return ip_address(_addr);
		}
Пример #15
0
route_table_mgr::route_table_mgr() : cache_table_mgr<ip_address,route_val*>("route_table_mgr")
{
	rt_mgr_logdbg("");

	m_pid = getpid();
	m_buff_size = MSG_BUFF_SIZE;
	m_seq_num = 0;

	// Create Socket
	BULLSEYE_EXCLUDE_BLOCK_START
	if ((m_fd = orig_os_api.socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) {
		rt_mgr_logerr("NL socket Creation: ");
		return;
	}
	BULLSEYE_EXCLUDE_BLOCK_END

	//save the routing table
	rt_mgr_update_tbl();

	// create route_entry for each net_dev- needed for receiving port up/down events for net_dev_entry
	route_val *p_rtv;
	for (int i = 0; i < m_rt_tab.entries_num; i++)
	{
		p_rtv = &m_rt_tab.rtv[i];
		in_addr_t src_addr = p_rtv->get_src_addr();
		std::tr1::unordered_map<in_addr_t, route_entry*>::iterator iter = m_rte_list_for_each_net_dev.find(src_addr);
		// if src_addr of interface exists in the map, no need to create another route_entry
		if (iter == m_rte_list_for_each_net_dev.end()) {
			m_rte_list_for_each_net_dev.insert(pair<in_addr_t, route_entry*> (src_addr, create_new_entry(ip_address(src_addr), NULL)));
		}
	}

	print_route_tbl();

	// register to netlink event
	g_p_netlink_handler->register_event(nlgrpROUTE, this);
	rt_mgr_logdbg("Registered to g_p_netlink_handler");

	rt_mgr_logdbg("Done");
}
Пример #16
0
net_device_entry::net_device_entry(in_addr_t local_ip, net_device_val* ndv) : cache_entry_subject<ip_address,net_device_val*>(ip_address(local_ip))
{
	nde_logdbg("");
	m_val = ndv;
	m_is_valid = false;
	m_cma_id_bind_trial_count = 0;
	m_timer_handle = NULL;
	timer_count = -1;
	m_bond = net_device_val::NO_BOND;

	BULLSEYE_EXCLUDE_BLOCK_START
	if (!m_val) {
		nde_logdbg("ERROR: received m_val = NULL");
		return;
	}
	BULLSEYE_EXCLUDE_BLOCK_END

	m_is_valid = true;
	m_bond = ndv->get_is_bond();
	if(m_bond != net_device_val::NO_BOND) {
		m_timer_handle = g_p_event_handler_manager->register_timer_event(SLAVE_CHECK_TIMER_PERIOD_MSEC, this, PERIODIC_TIMER, 0);
	}
	if(ndv->get_is_bond() == net_device_val::LAG_8023ad) {
		ndv->register_to_ibverbs_events(this);
	}
	nde_logdbg("Done");
}
Пример #17
0
///Parse a line in a Parameter file.
void ribi::gtst::Parameters::Parse(const std::string& s)
{
  if (s.empty()) return;
  if (s.size() > 0 && s.substr(0,1) == "#") return;
  if (s.size() > 1 && s.substr(0,2) == "//") return;

  ///Parameters starting with finished_ are parsed by ParametersFinished
  if (s.size() > 9 && s.substr(0,9) == "finished_")
  {
    const std::string t = s.substr(9,s.size()-9);
    this->GetFinished()->Parse(t);
    return;
  }

  ///Parameters starting with finished_ are parsed by ParametersGroupReAssign
  if (s.size() > 13 && s.substr(0,13) == "group_assign_")
  {
    const std::string t = s.substr(13,s.size()-13);
    this->GetGroupAssign()->Parse(t);
    return;
  }

  ///Parameters starting with finished_ are parsed by ParametersGroupReAssign
  if (s.size() > 15 && s.substr(0,15) == "group_reassign_")
  {
    const std::string t = s.substr(15,s.size()-15);
    this->GetGroupReAssign()->Parse(t);
    return;
  }

  ///Parameters starting with finished_ are parsed by ParametersGroupReAssign
  if (s.size() > 14 && s.substr(0,14) == "assign_payoff_")
  {
    const std::string t = s.substr(14,s.size()-14);
    this->GetAssignPayoff()->Parse(t);
    return;
  }

  ///Parameters starting with finished_ are parsed by ParametersViewResultsGroup
  if (s.size() > 20 && s.substr(0,20) == "view_results_voting_")
  {
    const std::string t = s.substr(20,s.size()-20);
    this->GetViewResultsVoting()->Parse(t);
    return;
  }

  ///Parameters starting with finished_ are parsed by ParametersViewResultsGroup
  if (s.size() > 19 && s.substr(0,19) == "view_results_group_")
  {
    const std::string t = s.substr(19,s.size()-19);
    this->GetViewResultsGroup()->Parse(t);
    return;
  }

  ///Parameters starting with finished_ are parsed by ParametersViewResultsGroup
  if (s.size() > 14 && s.substr(0,14) == "assign_payoff_")
  {
    const std::string t = s.substr(14,s.size()-14);
    this->GetAssignPayoff()->Parse(t);
    return;
  }

  if (s.size() > 14 && s.substr(0,14) == "choose_action_")
  {
    const std::string t = s.substr(14,s.size()-14);
    this->GetChooseAction()->Parse(t);
    return;
  }

  if (s.size() > 5 && s.substr(0,5) == "chat_")
  {
    const std::string t = s.substr(5,s.size()-5);
    this->GetChat()->Parse(t);
    return;
  }

  if (s.size() > 7 && s.substr(0,7) == "voting_")
  {
    const std::string t = s.substr(7,s.size()-7);
    this->GetVoting()->Parse(t);
    return;
  }

  //Participants
  if (s.size() > 12 && s.substr(0,12) == "participant=")
  {
    const std::string t = s.substr(12,s.size() - 12);
    const std::vector<std::string> v = SeperateString(t,',');
    if (v.size() != 2)
    {
      throw std::runtime_error((std::string("Incorrectly formed participant line: ") + s).c_str());;
    }
    assert(v.size() == 2 && "Participant must have two elements");

    boost::shared_ptr<GroupAssigner> group_assigner
      = GroupAssigner::CreateAssigner(v[0]);

    const std::string ip_address_str = v[1];


    boost::shared_ptr<Participant> participant(
     new Participant(group_assigner,m_server)
      );
    if (ip_address_str!="*")
    {
      try
      {
        boost::shared_ptr<SafeIpAddress> ip_address(new SafeIpAddress(ip_address_str));
        participant->SetIpAddress(ip_address);
      }
      catch (std::logic_error&)
      {
        throw std::runtime_error((std::string("Incorrectly formed IP address: ") + ip_address_str).c_str());
      }
    }

    m_participants.push_back(participant);
    return;
  }
  throw std::runtime_error((std::string("Unparsable parameter file line: ") + s).c_str());
}