23 #ifndef __ccxx_NetworkInterface_hxx 24 #define __ccxx_NetworkInterface_hxx 82 {
return(_broadcastAddr); }
86 {
return(_destAddr); }
94 {
return(_prefixLength); }
102 {
return((_flags & FLAG_UP) != 0); }
106 {
return((_flags & FLAG_BROADCAST) != 0); }
110 {
return((_flags & FLAG_MULTICAST) != 0); }
114 {
return((_flags & FLAG_LOOPBACK) != 0); }
118 {
return((_flags & FLAG_PPP) != 0); }
122 {
return((_flags & FLAG_RUNNING) != 0); }
136 inline void setName(
const String& name)
142 inline void setHardwareAddress(
const MACAddress& addr)
145 inline void setBroadcastAddress(
const InetAddress& addr)
146 { _broadcastAddr = addr; }
148 inline void setDestAddress(
const InetAddress& addr)
149 { _destAddr = addr; }
153 inline void setUp(
bool flag)
154 { flag ? _flags |= FLAG_UP : _flags &= ~FLAG_UP; }
156 inline void setBroadcastSupported(
bool flag)
157 { flag ? _flags |= FLAG_BROADCAST : _flags &= ~FLAG_BROADCAST; }
159 inline void setLoopback(
bool flag)
160 { flag ? _flags |= FLAG_LOOPBACK : _flags &= ~FLAG_LOOPBACK; }
162 inline void setPPP(
bool flag)
163 { flag ? _flags |= FLAG_PPP : _flags &= ~FLAG_PPP; }
165 inline void setRunning(
bool flag)
166 { flag ? _flags |= FLAG_RUNNING : _flags &= ~FLAG_RUNNING; }
168 inline void setMulticastSupported(
bool flag)
169 { flag ? _flags |= FLAG_MULTICAST : _flags &= ~FLAG_MULTICAST; }
171 inline void setFlags(
int flags)
172 { _flags = flags & FLAG_MASK; }
174 inline void setMTU(
int mtu)
177 inline void setMetric(
int metric)
178 { _metric = metric; }
194 #endif // __ccxx_NetworkInterface_hxx A network hardware (MAC) address.
Definition: MACAddress.h++:37
static const uint32_t FLAG_BROADCAST
A flag indicating that an interface has broadcast capability.
Definition: NetworkInterface.h++:48
String getName() const
Get the interface name.
Definition: NetworkInterface.h++:69
int getMTU() const
Get the maximum transmission unit (MTU).
Definition: NetworkInterface.h++:125
InetAddress getNetMask() const
Get the netmask.
Definition: NetworkInterface.h++:89
static const uint32_t FLAG_RUNNING
A flag indicating that an interface is running.
Definition: NetworkInterface.h++:57
bool isRunning() const
Test if the interface is running.
Definition: NetworkInterface.h++:121
An aggregation of information about a network interface.
Definition: NetworkInterface.h++:38
static const uint32_t FLAG_MASK
Flag mask (all flag bits set).
Definition: NetworkInterface.h++:63
static const uint32_t FLAG_LOOPBACK
A flag identifying an interface as a loopback interface.
Definition: NetworkInterface.h++:51
bool isUp() const
Test if the interface is up.
Definition: NetworkInterface.h++:101
unsigned int uint_t
An alias for unsigned int.
Definition: Integers.h++:74
int getMetric() const
Get the routing metric.
Definition: NetworkInterface.h++:129
uint32_t getFlags() const
Get the interface flags.
Definition: NetworkInterface.h++:97
static const uint32_t FLAG_PPP
A flag identifying an interface as a Point-to-Point link interface.
Definition: NetworkInterface.h++:54
static const uint32_t FLAG_MULTICAST
A flag indicating that an interface has multicast capability.
Definition: NetworkInterface.h++:60
InetAddress getAddress() const
Get the unicast address.
Definition: NetworkInterface.h++:73
InetAddress getBroadcastAddress() const
Get the broadcast address.
Definition: NetworkInterface.h++:81
bool isBroadcastSupported() const
Test if the interface has broadcast capability.
Definition: NetworkInterface.h++:105
#define COMMONCPP_API
Definition: Common.h++:126
A flexible, reference counted, copy-on-write, thread-safe, nullable string.
Definition: String.h++:50
Network-related routines.
Definition: Network.h++:54
bool isMulticastSupported() const
Test if the interface has multicast capability.
Definition: NetworkInterface.h++:109
bool isLoopback() const
Test if the interface is a loopback interface.
Definition: NetworkInterface.h++:113
InetAddress getDestAddress() const
Get the destination address.
Definition: NetworkInterface.h++:85
bool isPPP() const
Test if the interface is a PPP interface.
Definition: NetworkInterface.h++:117
An IPv4 Internet address.
Definition: InetAddress.h++:64
MACAddress getHardwareAddress() const
Get the hardware (MAC) address.
Definition: NetworkInterface.h++:77
Definition: AllocationMap.c++:25
static const uint32_t FLAG_UP
A flag indicating that an interface is up.
Definition: NetworkInterface.h++:45
uint_t getPrefixLength() const
Get the subnet prefix length.
Definition: NetworkInterface.h++:93