38 #include <ptbuildopts.h>
199 type = (WORD)newType;
223 { InitStringAttr(newType, str); }
229 type = (WORD)newType;
231 memcpy(m_string, (
const char *)str,
length);
234 bool IsValidStringAttr(
Types checkType)
const
236 return (
type == checkType) && (
length == strlen(m_string));
251 SetChangeIP(changeIP);
252 SetChangePort(changePort);
259 memset(flags, 0,
sizeof(flags));
265 void SetChangeIP(
bool on) {
if (on) flags[3] |= 4;
else flags[3] &= ~4; }
277 { Initialise(data); }
279 void Initialise(
const BYTE * data = NULL)
284 memset(hmac, 0,
sizeof(hmac));
286 memcpy(hmac, data,
sizeof(hmac));
304 void SetErrorCode(
int code,
const PString & reason);
325 BYTE transactionId[16];
344 PNatCandidate GetCandidateInfo();
372 BindingRequest = 0x0001,
373 BindingResponse = 0x0101,
374 BindingError = 0x0111,
376 SharedSecretRequest = 0x0002,
377 SharedSecretResponse = 0x0102,
378 SharedSecretError = 0x0112,
381 AllocateResponse = 0x0103,
382 AllocateError = 0x0113,
387 CreatePermission = 0x0008,
388 ChannelBind = 0x0009,
395 void SetType(MsgType newType,
const BYTE *
id = NULL);
396 MsgType GetType()
const;
398 const BYTE * GetTransactionID()
const;
412 {
return static_cast<Type *
>(FindAttribute(type)); }
422 void InsertMessageIntegrity(BYTE * credentialsHash, PINDEX credentialsHashLen);
423 void InsertMessageIntegrity(BYTE * credentialsHash, PINDEX credentialsHashLen,
PSTUNMessageIntegrity * mi);
425 bool CheckMessageIntegrity(BYTE * credentialsHash, PINDEX credentialsHashLen);
426 void CalculateMessageIntegrity(BYTE * credentialsHash, PINDEX credentialsHashLen,
PSTUNMessageIntegrity * mi, BYTE * hmac);
446 static PString GetNatMethodName();
447 virtual PString GetName()
const;
462 virtual PString GetServer()
const;
464 virtual bool GetServerAddress(
468 virtual bool GetExternalAddress(
473 virtual bool GetInterfaceAddress(
485 virtual void Close();
488 NatTypes FindNatType(
524 virtual bool CreateSocketPair(
533 virtual NatTypes InternalGetNatType(
bool forced,
const PTimeInterval & maxAge);
540 PINDEX numSocketsForPairing;
553 ProtocolUDP = IPPROTO_UDP,
554 ProtocolTCP = IPPROTO_TCP
562 { Initialise(protocol); }
564 void Initialise(BYTE protocol = ProtocolUDP);
575 : m_lifetime(lifetime)
594 bool IsEven()
const {
return (m_bits & 1) != 0; }
619 virtual bool Close();
621 virtual PNatCandidate GetCandidateInfo();
661 static PString GetNatMethodName();
662 virtual PString GetName()
const;
684 bool CreateSocketPair(
693 virtual RTPSupportTypes GetRTPSupport(
699 virtual bool RefreshAllocation(DWORD lifetime = 600);
706 #endif // PTLIB_PSTUN_H