|
PTLib
Version 2.10.11
|
This is a base class for clients of the PInterfaceMonitor singleton object. More...
#include <psockbun.h>
Public Types | |
| enum | { DefaultPriority = 50 } |
| typedef PIPSocket::InterfaceEntry | InterfaceEntry |
Public Types inherited from PObject | |
| enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
Result of the comparison operation performed by the Compare() function. More... | |
Public Member Functions | |
| PInterfaceMonitorClient (PINDEX priority=DefaultPriority) | |
| ~PInterfaceMonitorClient () | |
| virtual PStringArray | GetInterfaces (bool includeLoopBack=false, const PIPSocket::Address &destination=PIPSocket::GetDefaultIpAny()) |
| Get an array of all current interface descriptors, possibly including the loopback (127.0.0.1) interface. More... | |
| virtual PBoolean | GetInterfaceInfo (const PString &iface, InterfaceEntry &info) const |
| Return information about an active interface given the descriptor string. More... | |
| PINDEX | GetPriority () const |
| Returns the priority of this client. More... | |
Public Member Functions inherited from PSafeObject | |
| PSafeObject (PSafeObject *indirectLock=NULL) | |
| Create a thread safe object. More... | |
| PBoolean | SafeReference () |
| Increment the reference count for object. More... | |
| PBoolean | SafeDereference () |
| Decrement the reference count for object. More... | |
| PBoolean | LockReadOnly () const |
| Lock the object for Read Only access. More... | |
| void | UnlockReadOnly () const |
| Release the read only lock on an object. More... | |
| PBoolean | LockReadWrite () |
| Lock the object for Read/Write access. More... | |
| void | UnlockReadWrite () |
| Release the read/write lock on an object. More... | |
| void | SafeRemove () |
| Set the removed flag. More... | |
| PBoolean | SafelyCanBeDeleted () const |
| Determine if the object can be safely deleted. More... | |
| virtual bool | GarbageCollection () |
| Do any garbage collection that may be required by the object so that it may be finally deleted. More... | |
Public Member Functions inherited from PObject | |
| virtual | ~PObject () |
| virtual PObject * | Clone () const |
| Create a copy of the class on the heap. More... | |
| virtual PINDEX | HashFunction () const |
This function yields a hash value required by the PDictionary class. More... | |
| virtual Comparison | Compare (const PObject &obj) const |
| Compare the two objects and return their relative rank. More... | |
| virtual Comparison | CompareObjectMemoryDirect (const PObject &obj) const |
| Determine the byte wise comparison of two objects. More... | |
| bool | operator== (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator!= (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator< (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator> (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator<= (const PObject &obj) const |
| Compare the two objects. More... | |
| bool | operator>= (const PObject &obj) const |
| Compare the two objects. More... | |
| virtual const char * | GetClass (unsigned ancestor=0) const |
| Get the current dynamic type of the object instance. More... | |
| PBoolean | IsClass (const char *cls) const |
| virtual PBoolean | InternalIsDescendant (const char *clsName) const |
| Determine if the dynamic type of the current instance is a descendent of the specified class. More... | |
| virtual void | PrintOn (ostream &strm) const |
| Output the contents of the object to the stream. More... | |
| virtual void | ReadFrom (istream &strm) |
| Input the contents of the object from the stream. More... | |
Protected Member Functions | |
| virtual void | OnAddInterface (const InterfaceEntry &entry)=0 |
| Call back function for when an interface has been added to the system. More... | |
| virtual void | OnRemoveInterface (const InterfaceEntry &entry)=0 |
| Call back function for when an interface has been removed from the system. More... | |
| virtual void | OnRemoveNatMethod (const PNatMethod *) |
| Called when a NAT method is about to be destroyed. More... | |
Protected Member Functions inherited from PObject | |
| PObject () | |
| Constructor for PObject, made protected so cannot ever create one on its own. More... | |
Protected Attributes | |
| PINDEX | priority |
Additional Inherited Members | |
Static Public Member Functions inherited from PObject | |
| static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size) |
| Internal function caled from CompareObjectMemoryDirect() More... | |
| static const char * | Class () |
| Get the name of the class as a C string. More... | |
This is a base class for clients of the PInterfaceMonitor singleton object.
The OnAddInterface() and OnRemoveInterface() functions are called in the context of a thread that is monitoring interfaces. The client object is locked for Read/Write before these functions are called.
| PInterfaceMonitorClient::PInterfaceMonitorClient | ( | PINDEX | priority = DefaultPriority | ) |
| PInterfaceMonitorClient::~PInterfaceMonitorClient | ( | ) |
|
virtual |
Return information about an active interface given the descriptor string.
Note that when searchin the descriptor may be a partial match e.g. "10.0.1.11" or "%eth0" may be used.
| iface | Interface desciptor name |
| info | Information on the interface |
|
virtual |
Get an array of all current interface descriptors, possibly including the loopback (127.0.0.1) interface.
Note the names are of the form ipname, eg "10.0.1.11%3Com 3C90x Ethernet Adapter" or "192.168.0.10%eth0". If destination is not 'any' and a filter is set, filters the interface list before returning it.
| includeLoopBack | Flag for if loopback is to included in list |
| destination | Optional destination for selecting specific interface |
Reimplemented in PSingleMonitoredSocket, and PMonitoredSocketBundle.
|
inline |
Returns the priority of this client.
A higher value means higher priority. Higher priority clients get their callback functions called first. Clients with the same priority get called in the order of their insertion.
|
protectedpure virtual |
Call back function for when an interface has been added to the system.
Implemented in PSingleMonitoredSocket, and PMonitoredSocketBundle.
|
protectedpure virtual |
Call back function for when an interface has been removed from the system.
Implemented in PSingleMonitoredSocket, and PMonitoredSocketBundle.
|
inlineprotectedvirtual |
Called when a NAT method is about to be destroyed.
Reimplemented in PMonitoredSockets.
|
protected |