mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-07-28 23:16:15 -04:00
34 lines
559 B
C++
34 lines
559 B
C++
#include "IPAddress.h"
|
|
|
|
#if defined(WIN32)
|
|
#include <winsock.h>
|
|
typedef int socklen_t;
|
|
#else // for non-windows platforms (linux)
|
|
#include <arpa/inet.h>
|
|
#include <sys/socket.h>
|
|
#include <string.h>
|
|
#endif
|
|
|
|
#ifdef EXTERNAL_DISTRO
|
|
namespace NAMESPACE
|
|
{
|
|
#endif
|
|
|
|
IPAddress::IPAddress(unsigned int ip)
|
|
: m_IP(ip)
|
|
{
|
|
}
|
|
|
|
char *IPAddress::GetAddress(char *buffer) const
|
|
{
|
|
struct sockaddr_in addr;
|
|
addr.sin_addr.s_addr = m_IP;
|
|
strcpy(buffer, inet_ntoa(addr.sin_addr));
|
|
return(buffer);
|
|
}
|
|
|
|
|
|
#ifdef EXTERNAL_DISTRO
|
|
};
|
|
#endif
|