Exemplo n.º 1
0
sizeint GetIpAddrList(string_v& vsOutIpAddrList)
{
	START_FUNCTION();
	string_v vsIpAddrList;

	string sHostName;
	if (!GetHostName(sHostName)) {
		break;
	}

	struct hostent *pheHostEntry = gethostbyname(sHostName.c_str());
	if (!pheHostEntry) {
		break;
	}

	struct in_addr addr;
	for (int idx = 0; pheHostEntry->h_addr_list[idx] != 0; ++idx) 
	{
		memcpy(&addr, pheHostEntry->h_addr_list[idx], sizeof(struct in_addr));
		vsIpAddrList.push_back(inet_ntoa(addr));
	}

	vsOutIpAddrList.swap(vsIpAddrList);
	END_FUNCTION_RET(vsOutIpAddrList.size());
}
Exemplo n.º 2
0
type TypeRef::clone_and_bind_params(string_v &formal, type_v &actual)
{
  assert(real_type.is_null());

  for (unsigned int i=0 ; i < formal.size() ; i++)
    if (formal[i] == type_name)
      return actual[i];

  return type(new TypeRef(type_name));
}