Amazon Kinesis Webrtc C SDK
Stun.c File Reference
#include "../Include_i.h"
Include dependency graph for Stun.c:

Macros

#define LOG_CLASS   "Stun"
 

Functions

STATUS stunPackageIpAddr (PStunHeader pStunHeader, STUN_ATTRIBUTE_TYPE type, PKvsIpAddress pAddress, PBYTE pBuffer, PUINT32 pDataLen)
 
STATUS serializeStunPacket (PStunPacket pStunPacket, PBYTE password, UINT32 passwordLen, BOOL generateMessageIntegrity, BOOL generateFingerprint, PBYTE pBuffer, PUINT32 pSize)
 
STATUS deserializeStunPacket (PBYTE pStunBuffer, UINT32 bufferSize, PBYTE password, UINT32 passwordLen, PStunPacket *ppStunPacket)
 
STATUS freeStunPacket (PStunPacket *ppStunPacket)
 
STATUS createStunPacket (STUN_PACKET_TYPE stunPacketType, PBYTE transactionId, PStunPacket *ppStunPacket)
 
STATUS appendStunAddressAttribute (PStunPacket pStunPacket, STUN_ATTRIBUTE_TYPE addressAttributeType, PKvsIpAddress pAddress)
 
STATUS appendStunUsernameAttribute (PStunPacket pStunPacket, PCHAR userName)
 
STATUS getStunAttribute (PStunPacket pStunPacket, STUN_ATTRIBUTE_TYPE attributeType, PStunAttributeHeader *ppStunAttribute)
 
STATUS xorIpAddress (PKvsIpAddress pAddress, PBYTE pTransactionId)
 
STATUS appendStunPriorityAttribute (PStunPacket pStunPacket, UINT32 priority)
 
STATUS appendStunFlagAttribute (PStunPacket pStunPacket, STUN_ATTRIBUTE_TYPE attrType)
 
STATUS appendStunLifetimeAttribute (PStunPacket pStunPacket, UINT32 lifetime)
 
STATUS appendStunChangeRequestAttribute (PStunPacket pStunPacket, UINT32 changeFlag)
 
STATUS appendStunRequestedTransportAttribute (PStunPacket pStunPacket, UINT8 protocol)
 
STATUS appendStunRealmAttribute (PStunPacket pStunPacket, PCHAR realm)
 
STATUS appendStunNonceAttribute (PStunPacket pStunPacket, PBYTE nonce, UINT16 nonceLen)
 
STATUS updateStunNonceAttribute (PStunPacket pStunPacket, PBYTE nonce, UINT16 nonceLen)
 
STATUS appendStunErrorCodeAttribute (PStunPacket pStunPacket, PCHAR errorPhrase, UINT16 errorCode)
 
STATUS appendStunIceControllAttribute (PStunPacket pStunPacket, STUN_ATTRIBUTE_TYPE attributeType, UINT64 tieBreaker)
 
STATUS appendStunDataAttribute (PStunPacket pStunPacket, PBYTE data, UINT16 dataLen)
 
STATUS appendStunChannelNumberAttribute (PStunPacket pStunPacket, UINT16 channelNumber)
 
UINT16 getPackagedStunAttributeSize (PStunAttributeHeader pStunAttributeHeader)
 
STATUS getFirstAvailableStunAttribute (PStunPacket pStunPacket, PStunAttributeHeader *ppStunAttribute)
 

Macro Definition Documentation

◆ LOG_CLASS

#define LOG_CLASS   "Stun"

Function Documentation

◆ appendStunAddressAttribute()

STATUS appendStunAddressAttribute ( PStunPacket  pStunPacket,
STUN_ATTRIBUTE_TYPE  addressAttributeType,
PKvsIpAddress  pAddress 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunChangeRequestAttribute()

STATUS appendStunChangeRequestAttribute ( PStunPacket  pStunPacket,
UINT32  changeFlag 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunChannelNumberAttribute()

STATUS appendStunChannelNumberAttribute ( PStunPacket  pStunPacket,
UINT16  channelNumber 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunDataAttribute()

STATUS appendStunDataAttribute ( PStunPacket  pStunPacket,
PBYTE  data,
UINT16  dataLen 
)
Here is the call graph for this function:

◆ appendStunErrorCodeAttribute()

STATUS appendStunErrorCodeAttribute ( PStunPacket  pStunPacket,
PCHAR  errorPhrase,
UINT16  errorCode 
)
Here is the call graph for this function:

◆ appendStunFlagAttribute()

STATUS appendStunFlagAttribute ( PStunPacket  pStunPacket,
STUN_ATTRIBUTE_TYPE  attrType 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunIceControllAttribute()

STATUS appendStunIceControllAttribute ( PStunPacket  pStunPacket,
STUN_ATTRIBUTE_TYPE  attributeType,
UINT64  tieBreaker 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunLifetimeAttribute()

STATUS appendStunLifetimeAttribute ( PStunPacket  pStunPacket,
UINT32  lifetime 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunNonceAttribute()

STATUS appendStunNonceAttribute ( PStunPacket  pStunPacket,
PBYTE  nonce,
UINT16  nonceLen 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunPriorityAttribute()

STATUS appendStunPriorityAttribute ( PStunPacket  pStunPacket,
UINT32  priority 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunRealmAttribute()

STATUS appendStunRealmAttribute ( PStunPacket  pStunPacket,
PCHAR  realm 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunRequestedTransportAttribute()

STATUS appendStunRequestedTransportAttribute ( PStunPacket  pStunPacket,
UINT8  protocol 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendStunUsernameAttribute()

STATUS appendStunUsernameAttribute ( PStunPacket  pStunPacket,
PCHAR  userName 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createStunPacket()

STATUS createStunPacket ( STUN_PACKET_TYPE  stunPacketType,
PBYTE  transactionId,
PStunPacket ppStunPacket 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deserializeStunPacket()

STATUS deserializeStunPacket ( PBYTE  pStunBuffer,
UINT32  bufferSize,
PBYTE  password,
UINT32  passwordLen,
PStunPacket ppStunPacket 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeStunPacket()

STATUS freeStunPacket ( PStunPacket ppStunPacket)
Here is the caller graph for this function:

◆ getFirstAvailableStunAttribute()

STATUS getFirstAvailableStunAttribute ( PStunPacket  pStunPacket,
PStunAttributeHeader ppStunAttribute 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPackagedStunAttributeSize()

UINT16 getPackagedStunAttributeSize ( PStunAttributeHeader  pStunAttributeHeader)
Here is the caller graph for this function:

◆ getStunAttribute()

STATUS getStunAttribute ( PStunPacket  pStunPacket,
STUN_ATTRIBUTE_TYPE  attributeType,
PStunAttributeHeader ppStunAttribute 
)

check if PStunPacket has an attribute of type STUN_ATTRIBUTE_TYPE. If so, return the first occurrence through PStunAttributeHeader*

Returns
STATUS of operations
Here is the caller graph for this function:

◆ serializeStunPacket()

STATUS serializeStunPacket ( PStunPacket  pStunPacket,
PBYTE  password,
UINT32  passwordLen,
BOOL  generateMessageIntegrity,
BOOL  generateFingerprint,
PBYTE  pBuffer,
PUINT32  pSize 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stunPackageIpAddr()

STATUS stunPackageIpAddr ( PStunHeader  pStunHeader,
STUN_ATTRIBUTE_TYPE  type,
PKvsIpAddress  pAddress,
PBYTE  pBuffer,
PUINT32  pDataLen 
)

Mapped address attribute structure https://tools.ietf.org/html/rfc5389#section-15.1

  • 2 byte attribute type
  • 2 byte attribute data len
  • 2 byte address family
  • 2 byte port
  • 4 byte or 16 byte ip address
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateStunNonceAttribute()

STATUS updateStunNonceAttribute ( PStunPacket  pStunPacket,
PBYTE  nonce,
UINT16  nonceLen 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xorIpAddress()

STATUS xorIpAddress ( PKvsIpAddress  pAddress,
PBYTE  pTransactionId 
)

xor an ip address in place

Here is the caller graph for this function: