2#if defined(HAVE_CONFIG_H)
18#define RESIPROCATE_SUBSYSTEM ReTurnSubsystem::RETURN
21#include <openssl/hmac.h>
33#define MAX_USERNAME_BYTES 512
34#define MAX_PASSWORD_BYTES 512
35#define MAX_REALM_BYTES 763
36#define MAX_NONCE_BYTES 763
37#define MAX_SOFTWARE_BYTES 763
38#define MAX_ERRORCODE_REASON_BYTES 763
40#define STUN_CRC_FINAL_XOR 0x5354554e
72 char* buf,
unsigned int bufLen) :
73 mLocalTuple(localTuple),
74 mRemoteTuple(remoteTuple),
79 mIsValid = stunParseMessage(buf, bufLen);
319 if (&in != &out) memcpy(&out, &in,
sizeof(out));
324 for (
int i = 0; i < 4; i++)
361 asio::ip::address_v6::bytes_type bytes;
362 memcpy(bytes.data(), &address.
addr.
ipv6, bytes.size());
363 asio::ip::address_v6 addr(bytes);
369 asio::ip::address_v4 addr(address.
addr.
ipv4);
375StunMessage::stunParseAtrXorAddress(
char* body,
unsigned int hdrLen, StunAtrAddress& result)
377 bool ret = stunParseAtrAddress(body, hdrLen, result);
386StunMessage::stunParseAtrAddress(
char* body,
unsigned int hdrLen, StunAtrAddress& result)
388 if (hdrLen != 8 && hdrLen != 20 )
394 result.family = *body++;
397 memcpy(&nport, body, 2); body += 2;
398 result.port = ntohs(nport);
400 if (result.family ==
IPv4Family && hdrLen == 8)
404 result.addr.ipv4 = ntohl(naddr);
408 else if (result.family ==
IPv6Family && hdrLen == 20)
410 memcpy(&result.addr.ipv6, body,
sizeof(result.addr.ipv6)); body +=
sizeof(result.addr.ipv6);
416 WarningLog(<<
"bad address family/length: family=" <<
int(result.family) <<
" hdrLen=" << hdrLen);
423StunMessage::stunParseAtrEvenPort(
char* body,
unsigned int hdrLen, TurnAtrEvenPort& result)
430 result.propType = *body & 0x80;
436StunMessage::stunParseAtrUInt32(
char* body,
unsigned int hdrLen,
uint32_t& result)
440 WarningLog(<<
"hdrLen wrong for UInt32 attribute");
445 memcpy(&result, body, 4);
446 result = ntohl(result);
452StunMessage::stunParseAtrUInt64(
char* body,
unsigned int hdrLen,
uint64_t& result)
456 WarningLog(<<
"hdrLen wrong for UInt64 attribute");
461 memcpy(&result, body, 8);
468StunMessage::stunParseAtrError(
char* body,
unsigned int hdrLen,
StunAtrError& result)
471 if (hdrLen < 4)
return false;
483StunMessage::stunParseAtrUnknown(
char* body,
unsigned int hdrLen,
StunAtrUnknown& result)
485 if (hdrLen >=
sizeof(result))
487 WarningLog(<<
"hdrLen wrong for Unknown attribute or too many unknown attributes present");
492 if (hdrLen % 2 != 0)
return false;
496 memcpy(&result.
attrType[i], body, 2); body += 2;
504StunMessage::stunParseAtrIntegrity(
char* body,
unsigned int hdrLen,
StunAtrIntegrity& result)
508 WarningLog(<<
"hdrLen wrong for message integrity");
513 memcpy(&result.
hash, body, hdrLen);
519StunMessage::stunParseAtrIntegritySha256(
char* body,
unsigned int hdrLen, StunAtrIntegritySha256& result)
525 WarningLog(<<
"hdrLen wrong for message integrity sha256 (only full 32-byte value supported)");
530 memcpy(&result.hash, body, hdrLen);
538StunMessage::stunParseMessage(
char* buf,
unsigned int bufLen)
540 StackLog(<<
"Received stun message: " << bufLen <<
" bytes");
544 WarningLog(<<
"Bad message, bufLen=" << bufLen);
566 StackLog(<<
"stun magic cookie not found.");
573 StackLog(<<
"bytes after header = " << size);
579 WarningLog(<<
"Bad message, " << size <<
" bytes left is too short for an attribute header");
585 unsigned int attrLen = ntohs(attr->
length);
587 unsigned int attrLenPad = attrLen % 4 == 0 ? 0 : 4 - (attrLen % 4);
588 int atrType = ntohs(attr->
type);
590 StackLog(<<
"Found attribute type=" << atrType <<
" length=" << attrLen);
591 if (attrLen + attrLenPad + 4 > size)
593 WarningLog(<<
"claims attribute is larger than size of message " <<
"(attribute type=" << atrType <<
")");
608 WarningLog(<<
"problem parsing MappedAddress");
615 WarningLog(<<
"Duplicate MappedAddress in message - ignoring.");
625 WarningLog(<<
"problem parsing ResponseAddress");
632 WarningLog(<<
"Duplicate ResponseAddress in message - ignoring.");
642 WarningLog(<<
"problem parsing ChangeRequest");
649 WarningLog(<<
"Duplicate ChangeRequest in message - ignoring.");
659 WarningLog(<<
"problem parsing SourceAddress");
666 WarningLog(<<
"Duplicate SourceAddress in message - ignoring.");
676 WarningLog(<<
"problem parsing ChangedAddress");
683 WarningLog(<<
"Duplicate ChangedAddress in message - ignoring.");
701 WarningLog(<<
"Duplicate Username in message - ignoring.");
719 WarningLog(<<
"Duplicate Password in message - ignoring.");
729 WarningLog(<<
"problem parsing MessageIntegrity");
737 WarningLog(<<
"Duplicate MessageIntegrity in message - ignoring.");
747 WarningLog(<<
"problem parsing MessageIntegritySha256");
754 WarningLog(<<
"Duplicate MessageIntegritySha256 in message - ignoring.");
767 if (stunParseAtrError(body, attrLen,
mErrorCode) ==
false)
777 WarningLog(<<
"Duplicate ErrorCode in message - ignoring.");
787 WarningLog(<<
"problem parsing UnknownAttribute");
794 WarningLog(<<
"Duplicate UnknownAttribute in message - ignoring.");
804 WarningLog(<<
"problem parsing ReflectedFrom");
811 WarningLog(<<
"Duplicate ReflectedFrom in message - ignoring.");
829 WarningLog(<<
"Duplicate Realm in message - ignoring.");
847 WarningLog(<<
"Duplicate Nonce in message - ignoring.");
858 WarningLog(<<
"problem parsing XorMappedAddress");
865 WarningLog(<<
"Duplicate XorMappedAddress in message - ignoring.");
873 if (stunParseAtrUInt32(body, attrLen,
mFingerprint) ==
false)
882 WarningLog(<<
"Duplicate Fingerprint in message - ignoring.");
900 WarningLog(<<
"Duplicate Software in message - ignoring.");
910 WarningLog(<<
"problem parsing AlternateServer");
917 WarningLog(<<
"Duplicate AlternateServer in message - ignoring.");
927 WarningLog(<<
"problem parsing secondaryAddress");
934 WarningLog(<<
"Duplicate SecondaryAddress in message - ignoring.");
945 if (stunParseAtrUInt32(body, attrLen, channelNumber) ==
false)
947 WarningLog(<<
"problem parsing channel number");
955 WarningLog(<<
"Duplicate TurnChannelNumber in message - ignoring.");
963 if (stunParseAtrUInt32(body, attrLen,
mTurnLifetime) ==
false)
965 WarningLog(<<
"problem parsing turn lifetime");
972 WarningLog(<<
"Duplicate TurnLifetime in message - ignoring.");
982 WarningLog(<<
"problem parsing turn bandwidth");
989 WarningLog(<<
"Duplicate TurnBandwidth in message - ignoring.");
998 WarningLog(<<
"problem parsing turn peer address");
1006 WarningLog(<<
"Duplicate TurnXorPeerAddress in message - ignoring.");
1019 WarningLog(<<
"Duplicate TurnData in message - ignoring.");
1029 WarningLog(<<
"problem parsing turn relay address");
1036 WarningLog(<<
"Duplicate TurnXorRelayedAddress in message - ignoring.");
1044 if (stunParseAtrEvenPort(body, attrLen,
mTurnEvenPort) ==
false)
1046 WarningLog(<<
"problem parsing turn even port");
1053 WarningLog(<<
"Duplicate TurnEvenPort in message - ignoring.");
1062 if (stunParseAtrUInt32(body, attrLen, requestedTransport) ==
false)
1064 WarningLog(<<
"problem parsing turn requested transport");
1072 WarningLog(<<
"Duplicate TurnRequestedTransport in message - ignoring.");
1082 WarningLog(<<
"invalid attribute length for DontFragment attribute");
1085 StackLog(<<
"Turn Dont Fragement = <exists>");
1089 WarningLog(<<
"Duplicate TurnDontFragment in message - ignoring.");
1099 WarningLog(<<
"problem parsing turn reservation token");
1106 WarningLog(<<
"Duplicate TurnReservationToken in message - ignoring.");
1116 WarningLog(<<
"problem parsing turn connect stat");
1123 WarningLog(<<
"Duplicate TurnConnectStat in message - ignoring.");
1132 if (stunParseAtrUInt32(body, attrLen,
mIcePriority) ==
false)
1134 WarningLog(<<
"problem parsing ICE priority");
1141 WarningLog(<<
"Duplicate IcePriority in message - ignoring.");
1151 WarningLog(<<
"invalid attribute length for IceUseCandidate attribute");
1154 StackLog(<<
"Ice UseCandidate = <exists>");
1158 WarningLog(<<
"Duplicate IceUseCandidate in message - ignoring.");
1168 WarningLog(<<
"problem parsing ICE controlled");
1175 WarningLog(<<
"Duplicate IceControlled in message - ignoring.");
1185 WarningLog(<<
"problem parsing ICE controlling");
1192 WarningLog(<<
"Duplicate IceControlling in message - ignoring.");
1197 if (atrType <= 0x7FFF)
1203 WarningLog(<<
"Unknown comprehension required attribute: " << atrType);
1207 InfoLog(<<
"Ignoring unknown comprehension optional attribute: " << atrType);
1211 body += attrLen + attrLenPad;
1212 size -= attrLen + attrLenPad;
1222 for (
int i = 1; i < 4; i++)
1235 asio::ip::address_v6::bytes_type bytes = {};
1236 memcpy(bytes.data(), &addr.
addr.
ipv6, bytes.size());
1237 asio::ip::address_v6 addrv6(bytes);
1239 strm <<
"[" << addrv6.to_string() <<
"]:" << addr.
port;
1244 strm << ((int)(ip >> 24) & 0xFF) <<
".";
1245 strm << ((int)(ip >> 16) & 0xFF) <<
".";
1246 strm << ((int)(ip >> 8) & 0xFF) <<
".";
1247 strm << ((int)(ip >> 0) & 0xFF);
1249 strm <<
":" << addr.
port;
1259 bool outputMethod =
true;
1267 os <<
"Indication: ";
1268 outputMethod =
false;
1278 os <<
"Unknown ind method (" << int(h.
msgType & 0x000F) <<
")";
1283 os <<
"Success Response: ";
1286 os <<
"Error Response: ";
1289 os <<
"Unknown class (" << int(h.
msgType & 0x0110) <<
"): ";
1300 os <<
"SharedSecret";
1309 os <<
"CreatePermission";
1312 os <<
"ChannelBind";
1315 os <<
"Unknown method (" << int(h.
msgType & 0x000F) <<
")";
1323 for (
unsigned int i = 0; i < 4; i++) {
1332StunMessage::encode16(
char* buf,
uint16_t data)
1335 memcpy(buf,
reinterpret_cast<void*
>(&ndata),
sizeof(
uint16_t));
1340StunMessage::encode32(
char* buf,
uint32_t data)
1343 memcpy(buf,
reinterpret_cast<void*
>(&ndata),
sizeof(
uint32_t));
1348StunMessage::encode64(
char* buf,
const uint64_t data)
1351 memcpy(buf,
reinterpret_cast<void*
>(&ndata),
sizeof(
uint64_t));
1356StunMessage::encode(
char* buf,
const char* data,
unsigned int length)
1358 memcpy(buf, data, length);
1359 return buf + length;
1363StunMessage::encodeTurnData(
char* ptr,
const resip::Data* td)
1369 memcpy(ptr, td->
data(), td->
size());
1371 memset(ptr, 0, padsize);
1372 return ptr + padsize;
1378 ptr = encode16(ptr, type);
1379 ptr = encode16(ptr, 4);
1380 ptr = encode32(ptr, value);
1387 ptr = encode16(ptr, type);
1388 ptr = encode16(ptr, 8);
1389 ptr = encode64(ptr, value);
1394StunMessage::encodeAtrXorAddress(
char* ptr,
uint16_t type,
const StunAtrAddress& atr)
1396 StunAtrAddress xorAtr;
1398 return encodeAtrAddress(ptr, type, xorAtr);
1402StunMessage::encodeAtrAddress(
char* ptr,
uint16_t type,
const StunAtrAddress& atr)
1404 ptr = encode16(ptr, type);
1405 ptr = encode16(ptr, atr.family ==
IPv6Family ? 20 : 8);
1407 *ptr++ = atr.family;
1408 ptr = encode16(ptr, atr.port);
1412 memcpy(ptr, &atr.addr.ipv6,
sizeof(atr.addr.ipv6));
1413 ptr +=
sizeof(atr.addr.ipv6);
1418 ptr = encode32(ptr, atr.addr.ipv4);
1425StunMessage::encodeAtrError(
char* ptr,
const StunAtrError& atr)
1428 uint16_t padsize = (
unsigned int)atr.
reason->size() % 4 == 0 ? 0 : 4 - ((
unsigned int)atr.
reason->size() % 4);
1432 ptr = encode16(ptr, 0);
1435 ptr = encode(ptr, atr.
reason->data(), (
unsigned int)atr.
reason->size());
1436 memset(ptr, 0, padsize);
1437 return ptr + padsize;
1441StunMessage::encodeAtrUnknown(
char* ptr,
const StunAtrUnknown& atr)
1448 ptr = encode16(ptr, atr.
attrType[i]);
1450 return ptr + padsize;
1458 uint16_t padsize = size % 4 == 0 ? 0 : 4 - (size % 4);
1460 ptr = encode16(ptr, type);
1461 ptr = encode16(ptr, size);
1462 ptr = encode(ptr, atr->
data(), size);
1463 memset(ptr, 0, padsize);
1464 return ptr + padsize;
1471 ptr = encode16(ptr, 20);
1472 ptr = encode(ptr, atr.
hash,
sizeof(atr.
hash));
1477StunMessage::encodeAtrIntegritySha256(
char* ptr,
const StunAtrIntegritySha256& atr)
1480 ptr = encode16(ptr, 32);
1481 ptr = encode(ptr, atr.hash,
sizeof(atr.hash));
1486StunMessage::encodeAtrEvenPort(
char* ptr,
const TurnAtrEvenPort& atr)
1489 ptr = encode16(ptr, 1);
1490 *ptr++ = atr.propType;
1492 ptr = encode16(ptr, 0);
1511 char* lengthp = ptr;
1512 ptr = encode16(ptr, 0);
1564 StackLog(<<
"Encoding UnknownAttribute: ???");
1628 StackLog(<<
"Encoding TurnData (not shown)");
1648 StackLog(<<
"Encoding Turn DontFragment: <exists>");
1650 ptr = encode16(ptr, 0);
1674 StackLog(<<
"Encoding ICE UseCandidate: <exists>");
1676 ptr = encode16(ptr, 0);
1700 int len = (int)(ptr - buf);
1701 StackLog(<<
"Adding message integrity: buffer size=" << len <<
", hmacKey=" <<
mHmacKey.
hex());
1704 ptr = encodeAtrIntegrity(ptr, integrity);
1713 int len = (int)(ptr - buf);
1714 StackLog(<<
"Adding message integrity (SHA256): buffer size=" << len <<
", hmacKey=" <<
mHmacKey.
hex());
1717 ptr = encodeAtrIntegritySha256(ptr, integrity);
1725 encode16(lengthp, msgSize);
1731 StackLog(<<
"Calculating fingerprint for data of size " << ptr - buf);
1733 ptr = encodeAtrUInt32(ptr,
Fingerprint, fingerprint);
1736 return int(ptr - buf);
1748 memcpy(&buf[2], (
void*)&frameSize, 2);
1754StunMessage::computeHmac(
char* hmac,
const char* input,
int length,
const char* key,
int sizeKey)
1758 const int blockSize = 64;
1760 unsigned char paddedKey[blockSize];
1761 memset(paddedKey, 0,
sizeof(paddedKey));
1762 if (sizeKey > blockSize)
1766 keyHash.
update(std::string(key, sizeKey));
1768 memcpy(paddedKey, hashedKey.
data(),
1769 hashedKey.
size() <
static_cast<size_t>(blockSize) ? hashedKey.
size() : blockSize);
1771 else if (sizeKey > 0)
1773 memcpy(paddedKey, key, sizeKey);
1776 unsigned char ipad[blockSize];
1777 unsigned char opad[blockSize];
1778 for (
int i = 0; i < blockSize; ++i)
1780 ipad[i] = paddedKey[i] ^ 0x36;
1781 opad[i] = paddedKey[i] ^ 0x5c;
1786 inner.
update(std::string(
reinterpret_cast<const char*
>(ipad), blockSize));
1787 inner.
update(std::string(input, length));
1792 outer.
update(std::string(
reinterpret_cast<const char*
>(opad), blockSize));
1793 outer.
update(std::string(innerDigest.
data(), innerDigest.
size()));
1797 memcpy(hmac, outerDigest.
data(), 20);
1801StunMessage::computeHmac(
char* hmac,
const char* input,
int length,
const char* key,
int sizeKey)
1805 unsigned int resultSize = 20;
1808 reinterpret_cast<const unsigned char*
>(input), length,
1809 reinterpret_cast<unsigned char*
>(hmac), &resultSize);
1816StunMessage::computeHmacSha256(
char* hmac,
const char* input,
int length,
const char* key,
int sizeKey)
1818 unsigned int resultSize = 32;
1821 reinterpret_cast<const unsigned char*
>(input), length,
1822 reinterpret_cast<unsigned char*
>(hmac), &resultSize);
1831 time -= (time % 20 * 60);
1854 char hmac[20] = { 0 };
1878 char hmac[20] = { 0 };
1881 password =
Data(hmac,
sizeof(hmac)).
hex();
1895 asio::ip::address_v6::bytes_type bytes;
1896 memcpy(bytes.data(), addressPart.
data(), bytes.size());
1897 asio::ip::address_v6 addressv6(bytes);
1903 memcpy(&port, portPart.
data(),
sizeof(port));
1910 asio::ip::address_v4::bytes_type bytes;
1911 memcpy(bytes.data(), addressPart.
data(), bytes.size());
1912 asio::ip::address_v4 addressv4(bytes);
1918 memcpy(&port, portPart.
data(),
sizeof(port));
1957 r << username <<
":" << realm <<
":" << longtermAuthenticationPassword;
1960 StackLog(<<
"calculateHmacKey: '" << username <<
":" << realm <<
":" << longtermAuthenticationPassword <<
"' = '" << hmacKey.
hex() <<
"'");
1968 unsigned char hmac[20] = { 0 };
1973 memcpy(&originalLength, lengthposition, 2);
1977 memcpy(lengthposition, &tempLength, 2);
1982 computeHmac((
char*)hmac,
mBuffer.
data(), iHMACBufferSize, hmacKey.
c_str(), (
int)hmacKey.
size());
1985 memcpy(lengthposition, &originalLength, 2);
1988 unsigned char diff = 0;
1989 for (
int i = 0; i < 20; ++i)
2008 unsigned char hmac[32] = { 0 };
2013 memcpy(&originalLength, lengthposition, 2);
2017 memcpy(lengthposition, &tempLength, 2);
2022 computeHmacSha256((
char*)hmac,
mBuffer.
data(), iHMACBufferSize, hmacKey.
c_str(), (
int)hmacKey.
size());
2025 memcpy(lengthposition, &originalLength, 2);
2028 unsigned char diff = 0;
2029 for (
int i = 0; i < 32; ++i)
uint32_t crc32_fast(const void *data, size_t length, uint32_t previousCrc32)
compute CRC32 using the fastest algorithm for large datasets on modern CPUs
#define WarningLog(args_)
#define resip_assert(x)
This file needs to work for both C and C++ code.
#define STUN_CRC_FINAL_XOR
#define MAX_USERNAME_BYTES
#define MAX_SOFTWARE_BYTES
#define MAX_PASSWORD_BYTES
static const Data PASSWORD_KEY("stunServerPasswordKey")
#define MAX_ERRORCODE_REASON_BYTES
static const Data USERNAME_KEY("stunServerUsernameKey")
#define TURN_MAX_XOR_PEER_ADDR
#define STUN_MAX_UNKNOWN_ATTRIBUTES
uint64_t mIceControlledTieBreaker
static const uint16_t AlternateServer
bool mHasTurnChannelNumber
static const uint8_t IPv4Family
define stun address families
static const uint16_t StunClassSuccessResponse
static const uint16_t SharedSecretMethod
static const uint16_t BindMethod
bool mHasTurnRequestedTransport
void createUsernameAndPassword()
uint64_t mIceControllingTieBreaker
StunAtrAddress mMappedAddress
static const uint16_t UnknownAttribute
static const uint16_t TurnBandwidth
bool checkMessageIntegritySha256(const resip::Data &hmacKey)
static const uint16_t IceUseCandidate
void setTurnData(const char *data, unsigned int len)
void setPassword(const char *password)
uint16_t mMessageIntegritySha256MsgLength
static const uint16_t TurnDontFragment
void createHeader(uint16_t stunclass, uint16_t method)
static const uint16_t XorMappedAddress
StunAtrAddress mSecondaryAddress
void getTupleFromUsername(StunTuple &tuple)
void generateShortTermPasswordForUsername(resip::Data &password)
void setIceUseCandidate()
static const uint16_t MessageIntegritySha256
bool mHasUnknownAttributes
static const uint16_t Realm
static const uint16_t SecondaryAddress
static const uint16_t TurnSendMethod
StunAtrUnknown mUnknownAttributes
uint64_t mTurnReservationToken
static const uint16_t Username
bool mHasTurnXorRelayedAddress
uint8_t mTurnRequestedTransport
StunAtrUnknown mUnknownRequiredAttributes
void applyXorToAddress(const StunAtrAddress &in, StunAtrAddress &out)
uint16_t mMessageIntegrityMsgLength
static const uint16_t XorMappedAddress_old
static const uint16_t TurnReservationToken
uint16_t mTurnRequestedAddressFamily
static const uint16_t TurnEvenPort
static const uint16_t StunClassErrorResponse
StunAtrAddress mChangedAddress
static const uint16_t TurnCreatePermissionMethod
void setRealm(const char *realm)
static const uint16_t TurnXorRelayedAddress
unsigned int stunEncodeFramedMessage(char *buf, unsigned int bufLen)
static const uint16_t IcePriority
void setUsername(const char *username)
static const uint16_t TurnData
static const uint16_t Software
uint16_t mTurnChannelNumber
static const uint16_t StunClassRequest
static const uint16_t ChangeRequest
StunAtrAddress mTurnXorPeerAddress[TURN_MAX_XOR_PEER_ADDR]
void calculateHmacKey(resip::Data &hmacKey, const resip::Data &longtermAuthenticationPassword)
static const uint16_t TurnAllocateMethod
StunAtrAddress mReflectedFrom
static const uint16_t SourceAddress
StunAtrAddress mXorMappedAddress
bool mHasTurnRequestedAddressFamily
bool checkMessageIntegrity(const resip::Data &hmacKey)
bool mHasSecondaryAddress
void setSoftware(const char *software)
void setErrorCode(unsigned short errorCode, const char *reason)
bool mHasMessageIntegritySha256
static const uint16_t MessageIntegrity
static const uint16_t TurnLifetime
StunAtrAddress mAlternateServer
static const uint16_t Fingerprint
StunAtrIntegritySha256 mMessageIntegritySha256
StunMessage & operator=(const StunMessage &rhs)
static const uint16_t Password
uint32_t mTurnConnectStat
static const uint16_t ErrorCode
bool mHasMessageIntegrity
StunAtrAddress mResponseAddress
static const uint16_t TurnChannelNumber
static const uint16_t TurnDataMethod
static const uint16_t TurnRequestedTransport
StunAtrIntegrity mMessageIntegrity
static const uint16_t TurnXorPeerAddress
static void setStunAtrAddressFromTuple(StunAtrAddress &address, const StunTuple &tuple)
bool mHasTurnDontFragment
static const uint8_t IPv6Family
static const uint32_t StunMagicCookie
int mCntTurnXorPeerAddress
bool mHasTurnReservationToken
unsigned int stunEncodeMessage(char *buf, unsigned int bufLen)
static const uint16_t TurnConnectStat
void calculateHmacKeyForHa1(resip::Data &hmacKey, const resip::Data &ha1)
static const uint16_t MappedAddress
void setNonce(const char *nonce)
static const uint16_t TurnRefreshMethod
static const uint16_t ReflectedFrom
static const uint16_t IceControlled
static const uint16_t IceControlling
static const uint16_t Nonce
static const uint16_t TurnRequestedAddressFamily
void setIcePriority(uint32_t priority)
StunAtrAddress mTurnXorRelayedAddress
static const uint16_t TurnChannelBindMethod
StunAtrAddress mSourceAddress
static const uint16_t ResponseAddress
static const uint16_t ChangedAddress
TurnAtrEvenPort mTurnEvenPort
static const uint16_t StunClassIndication
bool mHasXorMappedAddress
static void setTupleFromStunAtrAddress(StunTuple &tuple, const StunAtrAddress &address)
const asio::ip::address & getAddress() const
unsigned int getPort() const
void setPort(unsigned int port)
void setAddress(const asio::ip::address &address)
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Data base64decode() const
Performs RFC 3548 Base 64 decoding of the contents of this data.
const char * c_str() const
Returns a null-terminated string representing.
@ Share
The Data instance will use the buffer in a read-only mode.
Data base64encode(bool useUrlSafe=false) const
Performs RFC 3548 Base 64 encoding of the contents of this data.
Data & append(const char *str, size_type len)
Appends the specified number of bytes to the end of this Data.
size_type size() const noexcept
Returns the number of bytes in this Data.
const char * begin() const noexcept
Returns a pointer to the beginning of the buffer used by the Data.
Data hex() const
Returns a hexadecimal representation of the contents of this Data.
Data & clear()
Clears the contents of this Data.
const char * data() const noexcept
Returns a pointer to the contents of this Data.
Used to accumlate data written to the stream in a DigestBuffer and convert the data to Digest.
static int getCryptoRandom()
static Data getCryptoRandomHex(unsigned int numBytes)
void update(const std::string &s)
static uint64_t getTimeSecs()
Returns the current clock time in seconds.
This file is used to handle compatibility fixes/tweaks so reSIProcate can function on multiple platfo...
bool operator==(const UInt128 &lhs, const UInt128 &rhs)
bool operator<(const UInt128 &lhs, const UInt128 &rhs)
EncodeStream & operator<<(EncodeStream &strm, const UInt128 &r)
dcm! – add UnusedChecking(_enum) below;
uint64_t ntoh64(const uint64_t input)
uint64_t hton64(const uint64_t input)
unsigned __int64 uint64_t
union reTurn::StunMessage::StunAtrAddress::@29 addr
uint16_t attrType[STUN_MAX_UNKNOWN_ATTRIBUTES]
UInt128 magicCookieAndTid
char reason[STUN_MAX_STRING]
uint16_t attrType[STUN_MAX_UNKNOWN_ATTRIBUTES]