Commmit the code from Thunder

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2754 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-04-22 18:49:08 +00:00
parent c79d55a7a7
commit 948e4fb61d
15 changed files with 204 additions and 5 deletions

View file

@ -123,5 +123,15 @@ bool isExternalNet(struct in_addr *addr)
return true;
}
bool getIPAddressFromString (const char *addr_str, struct in_addr *addr)
{
if (addr_str && addr) {
hostent *pHost = gethostbyname (addr_str);
if (pHost) {
addr->s_addr = *(unsigned long*) (pHost->h_addr);
return true;
}
}
return false;
}

View file

@ -68,5 +68,7 @@ bool isLoopbackNet(struct in_addr *addr);
bool isPrivateNet(struct in_addr *addr);
bool isExternalNet(struct in_addr *addr);
/* convert addresses */
bool getIPAddressFromString (const char *addr_str, struct in_addr *addr);
#endif /* RS_UNIVERSAL_NETWORK_HEADER */