# PNatStrategy Class Reference

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

`#include <pnat.h>`

Inheritance diagram for PNatStrategy:

List of all members.

## Method Handling

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

## Public Member Functions

Construction
| PNatStrategy ()
| Default Contructor.
| ~PNatStrategy ()
| Deconstructor.

## Detailed Description

PNatStrategy The main container for all NAT traversal Strategies.

## Constructor & Destructor Documentation

PNatStrategy::PNatStrategy | ( |  | ) |

Default Contructor.

PNatStrategy::~PNatStrategy | ( |  | ) |

Deconstructor.

## Member Function Documentation

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.

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.

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.

PNatList& PNatStrategy::GetNATList | ( |  | ) | `[inline]`

Get Loaded NAT Method List.

static PStringArray PNatStrategy::GetRegisteredList | ( |  | ) | `[static]`

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

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

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

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