192 void * userData = NULL
223 WORD portPairBase = 0,
320 WORD portPairBase = 0,
354 #define PDECLARE_NAT_METHOD(method, cls) PFACTORY_CREATE(PFactory<PNatMethod>, cls, #method)
356 #define PCREATE_NAT_PLUGIN(name) \
357 static PNatMethodServiceDescriptor<PNatMethod_##name> PNatMethod_##name##_descriptor; \
358 PCREATE_PLUGIN_STATIC(name, PNatMethod, &PNatMethod_##name##_descriptor)
370 #endif // PTLIB_PNAT_H
virtual bool GetInterfaceAddress(PIPSocket::Address &internalAddress) const =0
Return the interface NAT router is using.
virtual void SetPortRanges(WORD portBase, WORD portMax=0, WORD portPairBase=0, WORD portPairMax=0)
Set the port ranges to be used on local machine.
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:55
PNatMethod * GetMethod(const PIPSocket::Address &address=PIPSocket::GetDefaultIpAny())
GetMethod This function retrieves the first available NAT Traversal Method.
A socket channel that uses the UDP transport on the Internet Protocol.
Definition: udpsock.h:47
Definition: pluginmgr.h:57
STUN client.
Definition: pstun.h:68
virtual PString GetName() const =0
Get the NAT traversal method Name.
PMutex mutex
Definition: pnat.h:237
PNatStrategy The main container for all NAT traversal Strategies.
Definition: pnat.h:263
This is an array collection class of PString objects.
Definition: pstring.h:2024
virtual void Activate(bool active)
Acrivate Activate/DeActivate the NAT Method on a call by call basis Default does notthing.
PNatMethod * LoadNatMethod(const PString &name)
BOOL PBoolean
Definition: object.h:102
virtual PBoolean CreateSocketPair(PUDPSocket *&socket1, PUDPSocket *&socket2, const PIPSocket::Address &binding=PIPSocket::GetDefaultIpAny())=0
Create a socket pair.
RTPSupportTypes
Definition: pnat.h:195
PNatMethod Base Network Address Traversal Method class All NAT Traversal Methods are derived off this...
Definition: pnat.h:49
virtual bool IsAvailable(const PIPSocket::Address &binding=PIPSocket::GetDefaultIpAny())=0
Returns whether the Nat Method is ready and available in assisting in NAT Traversal.
static PStringArray GetRegisteredList()
PLIST(PNatList, PNatMethod)
virtual PBoolean CreateSocket(PUDPSocket *&socket, const PIPSocket::Address &binding=PIPSocket::GetDefaultIpAny(), WORD localPort=0)=0
Create a single socket.
WORD RandomPortPair(unsigned int start, unsigned int end)
RandomPortPair This function returns a random port pair base number in the specified range for the cr...
void AddMethod(PNatMethod *method)
AddMethod This function is used to add the required NAT Traversal Method.
virtual PString GetServer() const
Get the current server address name.
WORD maxPort
Definition: pnat.h:239
PBoolean RemoveMethod(const PString &meth)
RemoveMethod This function removes a NAT method from the NATlist matching the supplied method name...
The character string class.
Definition: pstring.h:108
virtual RTPSupportTypes GetRTPSupport(PBoolean force=false)=0
Return an indication if the current STUN type supports RTP Use the force variable to guarantee an up ...
virtual void SetAlternateAddresses(const PStringArray &addresses, void *userData=NULL)
Set Alternate Candidate (ICE) or probe (H.460.24A) addresses.
virtual PBoolean GetExternalAddress(PIPSocket::Address &externalAddress, const PTimeInterval &maxAge=1000)=0
Get the acquired External IP Address.
PNatStrategy()
Default Contructor.
virtual void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
struct PNatMethod::PortInfo singlePortInfo
struct PNatMethod::PortInfo pairedPortInfo
~PNatStrategy()
Deconstructor.
virtual bool GetServerAddress(PIPSocket::Address &address, WORD &port) const =0
Get the current server address and port being used.
static PIPSocket::Address GetDefaultIpAny()
PNatMethod * GetMethodByName(const PString &name)
GetMethodByName This function retrieves the NAT Traversal Method with the given name.
virtual PStringArray GetDeviceNames(int) const
Definition: pnat.h:348
A class describing an IP address.
Definition: ipsock.h:75
PNatMethod()
Default Contructor.
PortInfo(WORD port=0)
Definition: pnat.h:230
void SetPortRanges(WORD portBase, WORD portMax=0, WORD portPairBase=0, WORD portPairMax=0)
Set the port ranges to be used on local machine.
~PNatMethod()
Deconstructor.
virtual bool ValidateDeviceName(const PString &deviceName, int) const
Definition: pnat.h:349
virtual PObject * CreateInstance(int) const
Definition: pnat.h:347
WORD basePort
Definition: pnat.h:238
WORD currentPort
Definition: pnat.h:240
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
static PNatMethod * Create(const PString &name, PPluginManager *pluginMgr=NULL)
Factory Create.
PFACTORY_LOAD(PSTUNClient)
PNatList & GetNATList()
Get Loaded NAT Method List.
Definition: pnat.h:326