56 class PNatMethod  : 
public PObject 
   64       eComponent_Unknown = 255,
 
  138     PNatMethod(
unsigned priority);
 
  162     static PNatMethod * Create(
 
  169     static PString GetNatTypeString(
 
  179     virtual PString GetFriendlyName() 
const;
 
  184     virtual void Activate(
bool active);
 
  189     virtual bool IsAvailable(
 
  196     virtual PString GetServer() 
const = 0;
 
  200     virtual bool GetServerAddress(
 
  204     virtual bool GetServerAddress(
 
  212     __inline NatTypes GetNatType(
 
  216     __inline NatTypes GetNatType()
 const { 
return m_natType; }
 
  223     ) { 
return GetNatTypeString(GetNatType(force)); }
 
  225     PString GetNatTypeName()
 const { 
return GetNatTypeString(GetNatType()); }
 
  230     virtual bool SetServer(
const PString & server);
 
  234     virtual void SetCredentials(
 
  244     bool GetExternalAddress(
 
  248     bool GetExternalAddress(
 
  254     bool GetInterfaceAddress(
 
  266     virtual void Close() { }
 
  286       Component component = eComponent_Unknown
 
  302     virtual bool CreateSocketPair(
 
  319     virtual RTPSupportTypes GetRTPSupport(
 
  333     virtual void SetPortRanges(
 
  336       WORD portPairBase = 0,  
 
  341     bool     IsActive()
    const { 
return m_active; }
 
  342     unsigned GetPriority()
 const { 
return m_priority; }
 
  345     virtual PNATUDPSocket * InternalCreateSocket(Component component, 
PObject * context) = 0;
 
  346     virtual void InternalUpdate() = 0;
 
  353     PNatMethod::NatTypes    m_natType;
 
  363   friend class PNatMethods;
 
  369 class PNatCandidate : 
public PObject 
  381       Types type = EndTypes,
 
  382       PNatMethod::Component component = PNatMethod::eComponent_Unknown,
 
  383       const char * foundation = NULL
 
  386     virtual void PrintOn(ostream & strm) 
const;
 
  388     void CalculatePriority();
 
  391     PNatMethod::Component   m_component;
 
  413       PNatMethod::Component component
 
  417     virtual const char * GetNatName()
 const { 
return "NAT"; }
 
  419     virtual void GetCandidateInfo(PNatCandidate & candidate);
 
  422     PString GetBaseAddress() 
const;
 
  425     PNatMethod::Component GetComponent()
 const 
  426     { 
return m_component; }
 
  431     PNatMethod::Component m_component;
 
  456 class PNatMethod_Fixed  : 
public PNatMethod
 
  460     enum { DefaultPriority = 50 };
 
  461     PNatMethod_Fixed(
unsigned priority = DefaultPriority);
 
  463     static const char * MethodName();
 
  466     virtual PString GetServer() 
const;
 
  467     virtual bool SetServer(
const PString & str);
 
  473     virtual PNATUDPSocket * InternalCreateSocket(Component component, 
PObject * context);
 
  474     virtual void InternalUpdate();
 
  494       bool loadFromFactory = 
false,
 
  508     virtual PNatMethod * GetMethod(
 
  516     virtual PNatMethod * GetMethodByName(
 
  522     virtual bool RemoveMethod(
 
  528     virtual bool SetMethodPriority(
 
  535     virtual bool IsLocalAddress(
 
  552       WORD portPairBase = 0,  
 
  558     PNatMethods & GetNATList() { 
return *
this; }  
 
  562 typedef PNatMethods PNatList;     
 
  563 typedef PNatMethods PNatStrategy; 
 
  574 #define PCREATE_NAT_PLUGIN(name, friendlyName) \ 
  575     PCREATE_PLUGIN(name, PNatMethod, PNatMethod_##name, PPlugin_PNatMethod, \ 
  576       virtual const char * GetFriendlyName() const { return friendlyName; } \ 
  580 #define P_NAT_PARAM(...) ,__VA_ARGS__ 
  593 #define P_NAT_PARAM(...) 
  597 #endif // PTLIB_PNAT_H