PNatStrategy Class Reference

PNatStrategy The main container for all NAT traversal Strategies. More...

`#include <pnat.h>`

Inheritance diagram for PNatStrategy:

## Public Member Functions

Construction
| PNatStrategy ()
| Default Contructor. More...
| ~PNatStrategy ()
| Deconstructor. 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...

## Method Handling

void | AddMethod (PNatMethod *method)
| AddMethod This function is used to add the required NAT Traversal Method. More...
PNatMethod * | GetMethod (const PIPSocket::Address &address=PIPSocket::GetDefaultIpAny())
| GetMethod This function retrieves the first available NAT Traversal Method. More...
PNatMethod * | GetMethodByName (const PString &name)
| GetMethodByName This function retrieves the NAT Traversal Method with the given name. More...
PBoolean | RemoveMethod (const PString &meth)
| RemoveMethod This function removes a NAT method from the NATlist matching the supplied method name. More...
void | SetPortRanges (WORD portBase, WORD portMax=0, WORD portPairBase=0, WORD portPairMax=0)
| Set the port ranges to be used on local machine. More...
PNatList & | GetNATList ()
| Get Loaded NAT Method List. More...
PNatMethod * | LoadNatMethod (const PString &name)
static PStringArray | GetRegisteredList ()

## Additional Inherited Members

Public Types inherited from PObject
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
| Result of the comparison operation performed by the `Compare()` function. More...
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...
Protected Member Functions inherited from PObject
| PObject ()
| Constructor for PObject, made protected so cannot ever create one on its own. More...

## Detailed Description

PNatStrategy The main container for all NAT traversal Strategies.

## Constructor & Destructor Documentation

## PNatStrategy()

PNatStrategy::PNatStrategy | ( |  | ) |

Default Contructor.

## ~PNatStrategy()

PNatStrategy::~PNatStrategy | ( |  | ) |

Deconstructor.

## Member Function Documentation

## AddMethod()

void PNatStrategy::AddMethod | ( | PNatMethod * | method | ) |

AddMethod This function is used to add the required NAT Traversal Method.

The Order of Loading is important The first added has the highest priority.

## GetMethod()

PNatMethod* PNatStrategy::GetMethod | ( | const PIPSocket::Address & | address = `PIPSocket::GetDefaultIpAny()` | ) |

GetMethod This function retrieves the first available NAT Traversal Method.

If no available NAT Method is found then NULL is returned.

## GetMethodByName()

PNatMethod* PNatStrategy::GetMethodByName | ( | const PString & | name | ) |

GetMethodByName This function retrieves the NAT Traversal Method with the given name.

If it is not found then NULL is returned.

## GetNATList()

PNatList& PNatStrategy::GetNATList | ( |  | ) |

inline

Get Loaded NAT Method List.

## GetRegisteredList()

static PStringArray PNatStrategy::GetRegisteredList | ( |  | ) |

static

## LoadNatMethod()

PNatMethod* PNatStrategy::LoadNatMethod | ( | const PString & | name | ) |

## RemoveMethod()

PBoolean PNatStrategy::RemoveMethod | ( | const PString & | meth | ) |

RemoveMethod This function removes a NAT method from the NATlist matching the supplied method name.

## SetPortRanges()

void PNatStrategy::SetPortRanges | ( | WORD | portBase,
|  | WORD | portMax = `0`,
|  | WORD | portPairBase = `0`,
|  | WORD | portPairMax = `0`
| ) |  |

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.

Parameters

  portBase | Single socket port number base
  portMax | Single socket port number max
  portPairBase | Socket pair port number base
  portPairMax | Socket pair port number max

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

- pnat.h