V2 llmessage merge, incl. llcommon requisites.

Excluded llareslistener, as that appears to only be present for unit-testing
Excluded new SSL methods because, well, they don't work right reliably in v2 for me
This commit is contained in:
Shyotl
2011-02-25 19:30:59 -06:00
parent 58edba5129
commit f9937d7f8a
53 changed files with 630 additions and 276 deletions

View File

@@ -84,6 +84,7 @@ typedef int socklen_t;
static U32 gsnReceivingIFAddr = INVALID_HOST_IP_ADDRESS; // Address to which datagram was sent
const char* LOOPBACK_ADDRESS_STRING = "127.0.0.1";
const char* BROADCAST_ADDRESS_STRING = "255.255.255.255";
#if LL_DARWIN
// Mac OS X returns an error when trying to set these to 400000. Smaller values succeed.
@@ -171,7 +172,21 @@ char *u32_to_ip_string(U32 ip, char *ip_string)
// Wrapper for inet_addr()
U32 ip_string_to_u32(const char* ip_string)
{
return inet_addr(ip_string);
// *NOTE: Windows doesn't support inet_aton(), so we are using
// inet_addr(). Unfortunately, INADDR_NONE == INADDR_BROADCAST, so
// we have to check whether the input is a broadcast address before
// deciding that @ip_string is invalid.
//
// Also, our definition of INVALID_HOST_IP_ADDRESS doesn't allow us to
// use wildcard addresses. -Ambroff
U32 ip = inet_addr(ip_string);
if (ip == INADDR_NONE
&& strncmp(ip_string, BROADCAST_ADDRESS_STRING, MAXADDRSTR) != 0)
{
llwarns << "ip_string_to_u32() failed, Error: Invalid IP string '" << ip_string << "'" << llendl;
return INVALID_HOST_IP_ADDRESS;
}
return ip;
}
@@ -378,9 +393,10 @@ S32 start_net(S32& socket_out, int& nPort)
LL_DEBUGS("AppInit") << "startNet - send buffer size : " << snd_size << LL_ENDL;
// Setup a destination address
char achMCAddr[MAXADDRSTR] = " "; /* Flawfinder: ignore */
//char achMCAddr[MAXADDRSTR] = " "; /* Flawfinder: ignore */
stDstAddr.sin_family = AF_INET;
stDstAddr.sin_addr.s_addr = inet_addr(achMCAddr);
//stDstAddr.sin_addr.s_addr = inet_addr(achMCAddr);
stDstAddr.sin_addr.s_addr = INVALID_HOST_IP_ADDRESS; //Not so sure about this...
stDstAddr.sin_port = htons(nPort);
socket_out = hSocket;
@@ -659,7 +675,7 @@ S32 start_net(S32& socket_out, int& nPort)
// Setup a destination address
char achMCAddr[MAXADDRSTR] = "127.0.0.1"; /* Flawfinder: ignore */
stDstAddr.sin_family = AF_INET;
stDstAddr.sin_addr.s_addr = inet_addr(achMCAddr);
stDstAddr.sin_addr.s_addr = ip_string_to_u32(achMCAddr);
stDstAddr.sin_port = htons(nPort);
socket_out = hSocket;