PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PTURNClient Class Reference

`#include <pstun.h>`

Inheritance diagram for PTURNClient:
[legend]
Collaboration diagram for PTURNClient:
[legend]

## Public Member Functions
virtual PString | GetName () const
| PTURNClient ()
virtual bool | Open (const PIPSocket::Address &iface)
virtual void | SetCredentials (const PString &username, const PString &password, const PString &realm)
bool | CreateSocket (Component component, PUDPSocket *&socket, const PIPSocket::Address &=PIPSocket::GetDefaultIpAny(), WORD port=0)
bool | CreateSocketPair (PUDPSocket *&socket1, PUDPSocket *&socket2, const PIPSocket::Address &binding)
| Create a socket pair. More...
virtual RTPSupportTypes | GetRTPSupport (bool force=false)
| Return an indication if the current STUN type supports RTP Use the force variable to guarantee an up to date test. More...
Public Member Functions inherited from PSTUNClient
| PSTUNClient ()
| ~PSTUNClient ()
bool | SetServer (const PString &server)
| Set the STUN server to use. More...
virtual PString | GetServer () const
| Get the current server address name. More...
virtual bool | GetServerAddress (PIPSocketAddressAndPort &serverAddressAndPort) const
virtual bool | GetExternalAddress (PIPSocket::Address &externalAddress, const PTimeInterval &maxAge=1000)
virtual bool | GetInterfaceAddress (PIPSocket::Address &internalAddress) const
bool | IsAvailable (const PIPSocket::Address &binding)
virtual void | Close ()
NatTypes | FindNatType (const PIPSocket::Address &binding)
bool | CreateSocket (Component component, PUDPSocket *&socket, const PIPSocket::Address &=PIPSocket::GetDefaultIpAny(), WORD port=0)
| Create a single socket. More...
bool | InternalOpenSocket (Component component, const PIPSocket::Address &binding, PSTUNUDPSocket &socket, PortInfo &portInfo)
Public Member Functions inherited from PSTUN
| PSTUN ()
virtual | ~PSTUN ()
virtual PNatMethod::NatTypes | DoRFC3489Discovery (PSTUNUDPSocket *socket, const PIPSocketAddressAndPort &serverAddress, PIPSocketAddressAndPort &baseAddressAndPort, PIPSocketAddressAndPort &externalAddressAndPort)
| Determine the NAT type using RFC3489 discovery method. More...
virtual PNatMethod::NatTypes | FinishRFC3489Discovery (PSTUNMessage &responseI, PSTUNUDPSocket *socket, PIPSocketAddressAndPort &externalAddressAndPort)
virtual int | MakeAuthenticatedRequest (PSTUNUDPSocket *socket, PSTUNMessage &request, PSTUNMessage &response)
virtual bool | GetFromBindingResponse (const PSTUNMessage &response, PIPSocketAddressAndPort &externalAddress)
virtual void | AppendMessageIntegrity (PSTUNMessage &message)
virtual const PTimeInterval | GetTimeout () const
| Get the timeout for responses from STUN server. More...
virtual void | SetTimeout (const PTimeInterval &timeout)
| Set the timeout for responses from STUN server. More...
virtual PINDEX | GetRetries () const
| Get the number of retries for responses from STUN server. More...
virtual void | SetRetries (PINDEX retries)
| Set the number of retries for responses from STUN server. More...

## Static Public Member Functions
static PString | GetNatMethodName ()
| Get the NAT Method Name. More...
Static Public Member Functions inherited from PSTUNClient
static PString | GetNatMethodName ()
| Get the NAT Method Name. More...

## Protected Member Functions
virtual bool | RefreshAllocation (DWORD lifetime=600)
Protected Member Functions inherited from PSTUNClient
virtual NatTypes | InternalGetNatType (bool forced, const PTimeInterval &maxAge)

## Protected Attributes
PString | m_password
Protected Attributes inherited from PSTUNClient
PSTUNUDPSocket * | m_socket
PMutex | m_mutex

## Additional Inherited Members
Public Types inherited from PSTUN
enum | { DefaultPort = 3478 }
enum | { MinChannelNumber = 0x4000, MaxChannelNumber = 0x7ffe }
Public Attributes inherited from PSTUN
PNatMethod::NatTypes | m_natType
PINDEX | m_pollRetries
PTime | m_timeAddressObtained
PString | m_userName
PString | m_realm
PString | m_nonce
PBYTEArray | m_credentialsHash
PIPSocket::Address | m_interface
PIPSocketAddressAndPort | m_serverAddress
PTimeInterval | replyTimeout

## Constructor & Destructor Documentation

PTURNClient::PTURNClient | ( |  | ) |

## Member Function Documentation

bool PTURNClient::CreateSocket | ( | Component | component,
|  | PUDPSocket *& | socket,
|  | const PIPSocket::Address & | = `PIPSocket::GetDefaultIpAny()`,
|  | WORD | port = `0`
| ) |  |

bool PTURNClient::CreateSocketPair | ( | PUDPSocket *& | socket1,
|  | PUDPSocket *& | socket2,
|  | const PIPSocket::Address & |
| ) |  |
| virtual

Create a socket pair.

The STUN 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 false.

Reimplemented from PSTUNClient.

virtual PString PTURNClient::GetName | ( |  | ) | const
| virtual

Reimplemented from PSTUNClient.

static PString PTURNClient::GetNatMethodName | ( |  | ) |
| static

Get the NAT Method Name.

virtual RTPSupportTypes PTURNClient::GetRTPSupport | ( | bool | force = `false` | ) |
| virtual

Return an indication if the current STUN type supports RTP Use the force variable to guarantee an up to date test.

Parameters

  force | Force a new check

virtual bool PTURNClient::Open | ( | const PIPSocket::Address & | iface | ) |
| virtual

Reimplemented from PSTUNClient.

virtual bool PTURNClient::RefreshAllocation | ( | DWORD | lifetime = `600` | ) |
| protected virtual

virtual void PTURNClient::SetCredentials | ( | const PString & | username,
|  | const PString & | password,
|  | const PString & | realm
| ) |  |
| virtual

Reimplemented from PSTUN.

## Member Data Documentation

PString PTURNClient::m_password
| protected

The documentation for this class was generated from the following file:

- pstun.h