Stun Server
Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
|
#include <stunreader.h>
Public Types | |
enum | ReaderParseState { HeaderNotRead, HeaderValidated, BodyValidated, ParseError } |
Private Types | |
typedef FastHash< uint16_t, StunAttribute, MAX_NUM_ATTRIBUTES, 53 > | AttributeHashTable |
Private Member Functions | |
HRESULT | ReadHeader () |
HRESULT | ReadBody () |
HRESULT | GetAddressHelper (uint16_t attribType, CSocketAddress *pAddr) |
HRESULT | ValidateMessageIntegrity (uint8_t *key, size_t keylength) |
Private Attributes | |
CDataStream | _stream |
bool | _fAllowLegacyFormat |
bool | _fMessageIsLegacyFormat |
ReaderParseState | _state |
AttributeHashTable | _mapAttributes |
int | _indexFingerprint |
int | _indexMessageIntegrity |
int | _countAttributes |
StunTransactionId | _transactionid |
uint16_t | _msgTypeNormalized |
StunMessageClass | _msgClass |
uint16_t | _msgLength |
Static Private Attributes | |
static const size_t | MAX_NUM_ATTRIBUTES = 30 |
Definition at line 30 of file stunreader.h.
|
private |
Definition at line 51 of file stunreader.h.
Enumerator | |
---|---|
HeaderNotRead | |
HeaderValidated | |
BodyValidated | |
ParseError |
Definition at line 33 of file stunreader.h.
CStunMessageReader::CStunMessageReader | ( | ) |
Definition at line 42 of file stunreader.cpp.
CStunMessageReader::ReaderParseState CStunMessageReader::AddBytes | ( | const uint8_t * | pData, |
uint32_t | size | ||
) |
Definition at line 750 of file stunreader.cpp.
|
private |
Definition at line 489 of file stunreader.cpp.
HRESULT CStunMessageReader::GetAttributeByIndex | ( | int | index, |
StunAttribute * | pAttribute | ||
) |
Definition at line 346 of file stunreader.cpp.
HRESULT CStunMessageReader::GetAttributeByType | ( | uint16_t | attributeType, |
StunAttribute * | pAttribute | ||
) |
Definition at line 362 of file stunreader.cpp.
int CStunMessageReader::GetAttributeCount | ( | ) |
Definition at line 379 of file stunreader.cpp.
HRESULT CStunMessageReader::GetBuffer | ( | CRefCountedBuffer * | pRefBuffer | ) |
Definition at line 844 of file stunreader.cpp.
HRESULT CStunMessageReader::GetChangeRequest | ( | StunChangeRequestAttribute * | pChangeRequest | ) |
Definition at line 407 of file stunreader.cpp.
HRESULT CStunMessageReader::GetErrorCode | ( | uint16_t * | pErrorNumber | ) |
Definition at line 461 of file stunreader.cpp.
HRESULT CStunMessageReader::GetMappedAddress | ( | CSocketAddress * | pAddress | ) |
Definition at line 505 of file stunreader.cpp.
StunMessageClass CStunMessageReader::GetMessageClass | ( | ) |
Definition at line 834 of file stunreader.cpp.
uint16_t CStunMessageReader::GetMessageType | ( | ) |
Definition at line 839 of file stunreader.cpp.
HRESULT CStunMessageReader::GetOtherAddress | ( | CSocketAddress * | pAddress | ) |
Definition at line 513 of file stunreader.cpp.
HRESULT CStunMessageReader::GetPaddingAttributeSize | ( | uint16_t * | pSizePadding | ) |
Definition at line 442 of file stunreader.cpp.
HRESULT CStunMessageReader::GetResponseOriginAddress | ( | CSocketAddress * | pAddress | ) |
Definition at line 548 of file stunreader.cpp.
HRESULT CStunMessageReader::GetResponsePort | ( | uint16_t * | pPort | ) |
Definition at line 384 of file stunreader.cpp.
CStunMessageReader::ReaderParseState CStunMessageReader::GetState | ( | ) |
Definition at line 820 of file stunreader.cpp.
CDataStream & CStunMessageReader::GetStream | ( | ) |
Definition at line 855 of file stunreader.cpp.
HRESULT CStunMessageReader::GetStringAttributeByType | ( | uint16_t | attributeType, |
char * | pszValue, | ||
size_t | size | ||
) |
Definition at line 565 of file stunreader.cpp.
void CStunMessageReader::GetTransactionId | ( | StunTransactionId * | pTransId | ) |
Definition at line 825 of file stunreader.cpp.
HRESULT CStunMessageReader::GetXorMappedAddress | ( | CSocketAddress * | pAddress | ) |
Definition at line 529 of file stunreader.cpp.
bool CStunMessageReader::HasFingerprintAttribute | ( | ) |
Definition at line 93 of file stunreader.cpp.
bool CStunMessageReader::HasMessageIntegrityAttribute | ( | ) |
Definition at line 140 of file stunreader.cpp.
uint16_t CStunMessageReader::HowManyBytesNeeded | ( | ) |
Definition at line 76 of file stunreader.cpp.
bool CStunMessageReader::IsFingerprintAttributeValid | ( | ) |
Definition at line 99 of file stunreader.cpp.
bool CStunMessageReader::IsMessageLegacyFormat | ( | ) |
Definition at line 71 of file stunreader.cpp.
|
private |
Definition at line 654 of file stunreader.cpp.
|
private |
Definition at line 586 of file stunreader.cpp.
void CStunMessageReader::Reset | ( | ) |
Definition at line 47 of file stunreader.cpp.
void CStunMessageReader::SetAllowLegacyFormat | ( | bool | fAllowLegacyFormat | ) |
Definition at line 66 of file stunreader.cpp.
|
private |
Definition at line 145 of file stunreader.cpp.
HRESULT CStunMessageReader::ValidateMessageIntegrityLong | ( | const char * | pszUser, |
const char * | pszRealm, | ||
const char * | pszPassword | ||
) |
Definition at line 282 of file stunreader.cpp.
HRESULT CStunMessageReader::ValidateMessageIntegrityShort | ( | const char * | pszPassword | ) |
Definition at line 277 of file stunreader.cpp.
|
private |
Definition at line 58 of file stunreader.h.
|
private |
Definition at line 44 of file stunreader.h.
|
private |
Definition at line 45 of file stunreader.h.
|
private |
Definition at line 56 of file stunreader.h.
|
private |
Definition at line 57 of file stunreader.h.
|
private |
Definition at line 53 of file stunreader.h.
|
private |
Definition at line 63 of file stunreader.h.
|
private |
Definition at line 64 of file stunreader.h.
|
private |
Definition at line 62 of file stunreader.h.
|
private |
Definition at line 47 of file stunreader.h.
|
private |
Definition at line 42 of file stunreader.h.
|
private |
Definition at line 61 of file stunreader.h.
|
staticprivate |
Definition at line 49 of file stunreader.h.