#include <pnat.h>
Inheritance diagram for PNatMethod:
General Functions | |
enum | RTPSupportTypes { RTPSupported, RTPIfSendMedia, RTPUnsupported, RTPUnknown, NumRTPSupportTypes } |
virtual PString | GetName () const =0 |
virtual PString | GetServer () const |
virtual bool | GetServerAddress (PIPSocket::Address &address, WORD &port) const =0 |
virtual PBoolean | GetExternalAddress (PIPSocket::Address &externalAddress, const PTimeInterval &maxAge=1000)=0 |
virtual bool | GetInterfaceAddress (PIPSocket::Address &internalAddress) const =0 |
virtual PBoolean | CreateSocket (PUDPSocket *&socket, const PIPSocket::Address &binding=PIPSocket::GetDefaultIpAny(), WORD localPort=0)=0 |
virtual PBoolean | CreateSocketPair (PUDPSocket *&socket1, PUDPSocket *&socket2, const PIPSocket::Address &binding=PIPSocket::GetDefaultIpAny())=0 |
virtual bool | IsAvailable (const PIPSocket::Address &binding=PIPSocket::GetDefaultIpAny())=0 |
virtual RTPSupportTypes | GetRTPSupport (PBoolean force=PFalse)=0 |
virtual void | SetPortRanges (WORD portBase, WORD portMax=0, WORD portPairBase=0, WORD portPairMax=0) |
static PNatMethod * | Create (const PString &name, PPluginManager *pluginMgr=NULL) |
Public Member Functions | |
Construction | |
PNatMethod () | |
~PNatMethod () | |
Overrides from PObject | |
virtual void | PrintOn (ostream &strm) const |
Protected Attributes | |
PNatMethod::PortInfo | singlePortInfo |
PNatMethod::PortInfo | pairedPortInfo |
Classes | |
struct | PortInfo |
PNatMethod::PNatMethod | ( | ) |
Default Contructor
PNatMethod::~PNatMethod | ( | ) |
Deconstructor
static PNatMethod* PNatMethod::Create | ( | const PString & | name, | |
PPluginManager * | pluginMgr = NULL | |||
) | [static] |
Factory Create
name | Feature Name Expression |
pluginMgr | Plugin Manager |
virtual PBoolean PNatMethod::CreateSocket | ( | PUDPSocket *& | socket, | |
const PIPSocket::Address & | binding = PIPSocket::GetDefaultIpAny() , |
|||
WORD | localPort = 0 | |||
) | [pure virtual] |
Create a single socket. The NAT traversal protocol is used to create a socket for which the external IP address and port numbers are known. A PUDPSocket descendant is returned which will, in response to GetLocalAddress() return the externally visible IP and port rather than the local machines IP and socket.
The will create a new socket pointer. It is up to the caller to make sure the socket is deleted to avoid memory leaks.
The socket pointer is set to NULL if the function fails and returns PFalse.
Implemented in PSTUNClient.
virtual PBoolean PNatMethod::CreateSocketPair | ( | PUDPSocket *& | socket1, | |
PUDPSocket *& | socket2, | |||
const PIPSocket::Address & | binding = PIPSocket::GetDefaultIpAny() | |||
) | [pure virtual] |
Create a socket pair. The NAT traversal protocol is used to create a pair of sockets with adjacent port numbers for which the external IP address and port numbers are known. PUDPSocket descendants are returned which will, in response to GetLocalAddress() return the externally visible IP and port rather than the local machines IP and socket.
The will create new socket pointers. It is up to the caller to make sure the sockets are deleted to avoid memory leaks.
The socket pointers are set to NULL if the function fails and returns PFalse.
Implemented in PSTUNClient.
virtual PBoolean PNatMethod::GetExternalAddress | ( | PIPSocket::Address & | externalAddress, | |
const PTimeInterval & | maxAge = 1000 | |||
) | [pure virtual] |
GetExternalAddress Get the acquired External IP Address.
maxAge | External address of router Maximum age for caching |
Implemented in PSTUNClient.
virtual bool PNatMethod::GetInterfaceAddress | ( | PIPSocket::Address & | internalAddress | ) | const [pure virtual] |
Return the interface NAT router is using.
Implemented in PSTUNClient.
virtual PString PNatMethod::GetName | ( | ) | const [pure virtual] |
Get the NAT traversal method Name
Implemented in PSTUNClient.
virtual RTPSupportTypes PNatMethod::GetRTPSupport | ( | PBoolean | force = PFalse |
) | [pure virtual] |
Return an indication if the current STUN type supports RTP Use the force variable to guarantee an up to date test
force | Force a new check |
Implemented in PSTUNClient.
virtual PString PNatMethod::GetServer | ( | ) | const [virtual] |
Get the current server address name. Defaults to be "address:port" string form.
virtual bool PNatMethod::GetServerAddress | ( | PIPSocket::Address & | address, | |
WORD & | port | |||
) | const [pure virtual] |
Get the current server address and port being used.
address | Address of server |
port | Port server is using. |
Implemented in PSTUNClient.
virtual bool PNatMethod::IsAvailable | ( | const PIPSocket::Address & | binding = PIPSocket::GetDefaultIpAny() |
) | [pure virtual] |
Returns whether the Nat Method is ready and available in assisting in NAT Traversal. The principal is function is to allow the EP to detect various methods and if a method is detected then this method is available for NAT traversal The Order of adding to the PNstStrategy determines which method is used
binding | Interface to see if NAT is available on |
Implemented in PSTUNClient.
virtual void PNatMethod::PrintOn | ( | ostream & | strm | ) | const [virtual] |
Output the contents of the object to the stream. The exact output is dependent on the exact semantics of the descendent class. This is primarily used by the standard operator<< function.
The default behaviour is to print the class name.
Reimplemented from PObject.
virtual void PNatMethod::SetPortRanges | ( | WORD | portBase, | |
WORD | portMax = 0 , |
|||
WORD | portPairBase = 0 , |
|||
WORD | portPairMax = 0 | |||
) | [virtual] |
Set the port ranges to be used on local machine. Note that the ports used on the NAT router may not be the same unless some form of port forwarding is present.
If the port base is zero then standard operating system port allocation method is used.
If the max port is zero then it will be automatically set to the port base + 99.
portMax | Single socket port number base |
portPairBase | Single socket port number max |
portPairMax | Socket pair port number base Socket pair port number max |
struct PNatMethod::PortInfo PNatMethod::pairedPortInfo [protected] |
struct PNatMethod::PortInfo PNatMethod::singlePortInfo [protected] |