mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Remove almost all uses of NetAddress.
This probably has a bunch of bugs because of Network Order/Host Order issues. If we intend to actually support BE architectures, these problems are going to get much much worse :(
This commit is contained in:
@ -57,7 +57,7 @@ plNetAddress::plNetAddress(uint32_t addr, uint16_t port)
|
||||
SetPort(port);
|
||||
}
|
||||
|
||||
plNetAddress::plNetAddress(const char * addr, uint16_t port)
|
||||
plNetAddress::plNetAddress(const char* addr, uint16_t port)
|
||||
{
|
||||
Clear();
|
||||
SetHost(addr);
|
||||
@ -103,6 +103,11 @@ plString plNetAddress::GetHostString() const
|
||||
}
|
||||
|
||||
uint32_t plNetAddress::GetHost() const
|
||||
{
|
||||
return ntohl(fAddr.sin_addr.s_addr);
|
||||
}
|
||||
|
||||
uint32_t plNetAddress::GetHostBE() const
|
||||
{
|
||||
return fAddr.sin_addr.s_addr;
|
||||
}
|
||||
@ -122,6 +127,13 @@ bool plNetAddress::SetHost(const char* hostname)
|
||||
}
|
||||
|
||||
bool plNetAddress::SetHost(uint32_t addr)
|
||||
{
|
||||
fAddr.sin_addr.s_addr = htonl(addr);
|
||||
fAddr.sin_family = AF_INET;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool plNetAddress::SetHostBE(uint32_t addr)
|
||||
{
|
||||
memcpy(&fAddr.sin_addr, &addr,sizeof(addr));
|
||||
fAddr.sin_family = AF_INET;
|
||||
|
@ -95,8 +95,10 @@ public:
|
||||
bool SetPort(uint16_t port);
|
||||
|
||||
uint32_t GetHost() const;
|
||||
uint32_t GetHostBE() const;
|
||||
bool SetHost(const char* hostname);
|
||||
bool SetHost(uint32_t ip4addr);
|
||||
bool SetHostBE(uint32_t addr);
|
||||
|
||||
const AddressType& GetAddressInfo() const { return fAddr; }
|
||||
AddressType& GetAddressInfo() { return fAddr; }
|
||||
|
Reference in New Issue
Block a user