Factorized a bit more, and update fStatus in some place it was missing
but make sense. Please review. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39612 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5bbbdc9182
commit
de739bbef3
@ -274,6 +274,7 @@ BNetworkAddress::SetTo(in_addr_t inetAddress, uint16 port)
|
|||||||
fAddress.ss_len = sizeof(sockaddr_in);
|
fAddress.ss_len = sizeof(sockaddr_in);
|
||||||
SetAddress(inetAddress);
|
SetAddress(inetAddress);
|
||||||
SetPort(port);
|
SetPort(port);
|
||||||
|
|
||||||
fStatus = B_OK;
|
fStatus = B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,12 +307,8 @@ BNetworkAddress::SetToBroadcast(int family, uint16 port)
|
|||||||
if (family != AF_INET)
|
if (family != AF_INET)
|
||||||
return fStatus = B_NOT_SUPPORTED;
|
return fStatus = B_NOT_SUPPORTED;
|
||||||
|
|
||||||
memset(&fAddress, 0, sizeof(sockaddr_storage));
|
SetTo(INADDR_BROADCAST, port);
|
||||||
fAddress.ss_family = family;
|
return B_OK;
|
||||||
fAddress.ss_len = sizeof(sockaddr_in);
|
|
||||||
SetAddress(INADDR_BROADCAST);
|
|
||||||
SetPort(port);
|
|
||||||
return fStatus = B_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -319,7 +316,7 @@ status_t
|
|||||||
BNetworkAddress::SetToLocal()
|
BNetworkAddress::SetToLocal()
|
||||||
{
|
{
|
||||||
// TODO: choose a local address from the network interfaces
|
// TODO: choose a local address from the network interfaces
|
||||||
return B_NOT_SUPPORTED;
|
return fStatus = B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -375,10 +372,10 @@ BNetworkAddress::SetToMask(int family, uint32 prefixLength)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return B_NOT_SUPPORTED;
|
return fStatus = B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return fStatus = B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -387,24 +384,18 @@ BNetworkAddress::SetToWildcard(int family, uint16 port)
|
|||||||
{
|
{
|
||||||
switch (family) {
|
switch (family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
memset(&fAddress, 0, sizeof(sockaddr_storage));
|
SetTo(INADDR_ANY, port);
|
||||||
fAddress.ss_len = sizeof(sockaddr_in);
|
|
||||||
SetAddress(INADDR_ANY);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
memset(&fAddress, 0, sizeof(sockaddr_storage));
|
SetTo(in6addr_any, port);
|
||||||
fAddress.ss_len = sizeof(sockaddr_in6);
|
|
||||||
SetAddress(in6addr_any);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return B_NOT_SUPPORTED;
|
return fStatus = B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
fAddress.ss_family = family;
|
return B_OK;
|
||||||
SetPort(port);
|
|
||||||
return fStatus = B_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user