39#include "blocxx/BLOCXX_config.h"
41#if !defined(BLOCXX_WIN32) && !defined(BLOCXX_NETWARE)
45#ifdef BLOCXX_HAVE_UNISTD_H
53#ifdef BLOCXX_HAVE_SYS_SOCKET_H
54 #include <sys/socket.h>
60#ifdef BLOCXX_GNU_LINUX
61 #include <sys/ioctl.h>
65#elif defined (BLOCXX_OPENSERVER)
69 #include <netinet/in.h>
71 #include <arpa/inet.h>
76#elif defined (BLOCXX_DARWIN)
78 #include <sys/ioctl.h>
81 #ifdef BLOCXX_HAVE_STROPTS_H
86 #include <netinet/in.h>
88 #if defined (BLOCXX_HAVE_SYS_SOCKIO_H)
89 #include <sys/sockio.h>
150#ifdef BLOCXX_GNU_LINUX
245 ifc.ifc_buf =
new char[
ifc.ifc_len];
249 p =
new char[
ifc.ifc_len];
251 delete []
ifc.ifc_buf;
274 for (
n = 0;
n <
ifc.ifc_len;
n +=
sizeof(
struct ifreq))
277 if (ioctl(sockfd, SIOCGIFFLAGS, &ifrcopy) < 0)
280 appliesTo =
"ioctl:SIOCGIFFLAGS";
283#ifdef BLOCXX_GNU_LINUX
284 if ((ifrcopy.ifr_flags & IFF_UP) && !(ifrcopy.ifr_flags & (IFF_LOOPBACK | IFF_DYNAMIC)))
286 if ((ifrcopy.ifr_flags & IFF_UP))
289 m_name = ifr->ifr_name;
298 delete []
ifc.ifc_buf;
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
String getIPAddressString()
unsigned long m_bcastAddr
unsigned long getBroadcastAddress()
String getBroadcastAddressString()
String getNetmaskString()
unsigned long getNetmask()
void getInterfaceName(SocketHandle_t sockfd)
bool sameNetwork(unsigned long addr)
static unsigned long stringToAddress(const String &straddr)
unsigned long getIPAddress()
This String class is an abstract data type that represents as NULL terminated string of characters.
const char * c_str() const
String inetAddrToString(UInt64 addr)
bool operator==(const Array< T > &x, const Array< T > &y)