Amazon Kinesis Webrtc C SDK
Loading...
Searching...
No Matches
Stun.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  StunHeader
struct  StunAttributeHeader
struct  StunAttributeAddress
struct  StunAttributeUsername
struct  StunAttributeFingerprint
struct  StunAttributePriority
struct  StunAttributeFlag
struct  StunAttributeMessageIntegrity
struct  StunAttributeLifetime
struct  StunAttributeRequestedTransport
struct  StunAttributeRealm
struct  StunAttributeAllocationAddressFamily
struct  StunAttributeNonce
struct  StunAttributeErrorCode
struct  StunAttributeIceControl
struct  StunAttributeData
struct  StunAttributeChannelNumber
struct  StunAttributeChangeRequest
struct  StunPacket

Macros

#define STUN_HEADER_LEN   (UINT16) 20
#define STUN_HEADER_TYPE_LEN   (UINT16) 2
#define STUN_HEADER_DATA_LEN   (UINT16) 2
#define STUN_HEADER_MAGIC_COOKIE   (UINT32) 0x2112A442
#define STUN_HEADER_MAGIC_COOKIE_LE   (UINT32) 0x42A41221
#define STUN_HEADER_MAGIC_COOKIE_LEN   SIZEOF(STUN_HEADER_MAGIC_COOKIE)
#define STUN_HEADER_TRANSACTION_ID_LEN   (UINT16) 12
#define STUN_ATTRIBUTE_HEADER_TYPE_LEN   (UINT16) 2
#define STUN_ATTRIBUTE_HEADER_DATA_LEN   (UINT16) 2
#define STUN_ATTRIBUTE_HEADER_LEN   (UINT16)(STUN_ATTRIBUTE_HEADER_TYPE_LEN + STUN_ATTRIBUTE_HEADER_DATA_LEN)
#define STUN_ATTRIBUTE_ADDRESS_FAMILY_LEN   (UINT16) 2
#define STUN_ATTRIBUTE_ADDRESS_PORT_LEN   (UINT16) 2
#define STUN_ATTRIBUTE_ADDRESS_HEADER_LEN   (UINT16)(STUN_ATTRIBUTE_ADDRESS_FAMILY_LEN + STUN_ATTRIBUTE_ADDRESS_PORT_LEN)
#define STUN_ATTRIBUTE_FINGERPRINT_LEN   (UINT16) 4
#define STUN_ATTRIBUTE_PRIORITY_LEN   (UINT16) 4
#define STUN_ATTRIBUTE_LIFETIME_LEN   (UINT16) 4
#define STUN_ATTRIBUTE_CHANNEL_NUMBER_LEN   (UINT16) 4
#define STUN_ATTRIBUTE_CHANGE_REQUEST_FLAG_LEN   (UINT16) 4
#define STUN_ATTRIBUTE_ICE_CONTROL_LEN   (UINT16) 8
#define STUN_ATTRIBUTE_REQUESTED_TRANSPORT_PROTOCOL_LEN   (UINT16) 4
#define STUN_ATTRIBUTE_REQUESTED_ADDRESS_FAMILY_LEN   (UINT16) 4
#define STUN_ATTRIBUTE_FLAG_LEN   (UINT16) 0
#define STUN_TRANSACTION_ID_LEN   (UINT16) 12
#define STUN_HMAC_VALUE_LEN   KVS_SHA1_DIGEST_LENGTH
#define STUN_ATTRIBUTE_MAX_COUNT   20
#define STUN_PACKET_ALLOCATION_SIZE   2048
#define STUN_SEND_INDICATION_OVERHEAD_SIZE   36
#define STUN_SEND_INDICATION_APPLICATION_DATA_OFFSET   36
#define STUN_SEND_INDICATION_APPLICATION_DATA_LEN_OFFSET   34
#define STUN_SEND_INDICATION_XOR_PEER_ADDRESS_OFFSET   28
#define STUN_SEND_INDICATION_XOR_PEER_ADDRESS_PORT_OFFSET   26
#define STUN_FINGERPRINT_ATTRIBUTE_XOR_VALUE   (UINT32) 0x5354554e
#define STUN_ERROR_CODE_PACKET_ERROR_CLASS_OFFSET   2
#define STUN_ERROR_CODE_PACKET_ERROR_CODE_OFFSET   3
#define STUN_ERROR_CODE_PACKET_ERROR_PHRASE_OFFSET   4
#define STUN_PACKET_TRANSACTION_ID_OFFSET   8
#define STUN_ATTRIBUTE_CHANGE_REQUEST_FLAG_CHANGE_IP   4
#define STUN_ATTRIBUTE_CHANGE_REQUEST_FLAG_CHANGE_PORT   2
#define GET_STUN_ERROR_CODE(pClass, pCode)
#define PACKAGE_STUN_ATTR_HEADER(pBuf, type, dataLen)
#define STUN_PACKET_IS_TYPE_ERROR(pPacketBuffer)

Typedefs

typedef struct StunHeader * PStunHeader
typedef struct StunAttributeHeader * PStunAttributeHeader
typedef struct StunAttributeAddress * PStunAttributeAddress
typedef struct StunAttributeUsername * PStunAttributeUsername
typedef struct StunAttributeFingerprint * PStunAttributeFingerprint
typedef struct StunAttributePriority * PStunAttributePriority
typedef struct StunAttributeFlag * PStunAttributeFlag
typedef struct StunAttributeMessageIntegrity * PStunAttributeMessageIntegrity
typedef struct StunAttributeLifetime * PStunAttributeLifetime
typedef struct StunAttributeRequestedTransport * PStunAttributeRequestedTransport
typedef struct StunAttributeRealm * PStunAttributeRealm
typedef struct StunAttributeAllocationAddressFamily * PStunAttributeAllocationAddressFamily
typedef struct StunAttributeNonce * PStunAttributeNonce
typedef struct StunAttributeErrorCode * PStunAttributeErrorCode
typedef struct StunAttributeIceControl * PStunAttributeIceControl
typedef struct StunAttributeData * PStunAttributeData
typedef struct StunAttributeChannelNumber * PStunAttributeChannelNumber
typedef struct StunAttributeChangeRequest * PStunAttributeChangeRequest
typedef struct StunPacket * PStunPacket

Enumerations

enum  STUN_PACKET_TYPE {
  STUN_PACKET_TYPE_BINDING_REQUEST = (UINT16) 0x0001 , STUN_PACKET_TYPE_SHARED_SECRET_REQUEST = (UINT16) 0x0002 , STUN_PACKET_TYPE_ALLOCATE = (UINT16) 0x0003 , STUN_PACKET_TYPE_REFRESH = (UINT16) 0x0004 ,
  STUN_PACKET_TYPE_SEND = (UINT16) 0x0006 , STUN_PACKET_TYPE_DATA = (UINT16) 0x0007 , STUN_PACKET_TYPE_CREATE_PERMISSION = (UINT16) 0x0008 , STUN_PACKET_TYPE_CHANNEL_BIND_REQUEST = (UINT16) 0x0009 ,
  STUN_PACKET_TYPE_BINDING_INDICATION = (UINT16) 0x0011 , STUN_PACKET_TYPE_SEND_INDICATION = (UINT16) 0x0016 , STUN_PACKET_TYPE_DATA_INDICATION = (UINT16) 0x0017 , STUN_PACKET_TYPE_BINDING_RESPONSE_SUCCESS = (UINT16) 0x0101 ,
  STUN_PACKET_TYPE_SHARED_SECRET_RESPONSE = (UINT16) 0x0102 , STUN_PACKET_TYPE_ALLOCATE_SUCCESS_RESPONSE = (UINT16) 0x0103 , STUN_PACKET_TYPE_REFRESH_SUCCESS_RESPONSE = (UINT16) 0x0104 , STUN_PACKET_TYPE_CREATE_PERMISSION_SUCCESS_RESPONSE = (UINT16) 0x0108 ,
  STUN_PACKET_TYPE_CHANNEL_BIND_SUCCESS_RESPONSE = (UINT16) 0x0109 , STUN_PACKET_TYPE_BINDING_RESPONSE_ERROR = (UINT16) 0x0111 , STUN_PACKET_TYPE_SHARED_SECRET_ERROR_RESPONSE = (UINT16) 0x0112 , STUN_PACKET_TYPE_ALLOCATE_ERROR_RESPONSE = (UINT16) 0x0113 ,
  STUN_PACKET_TYPE_REFRESH_ERROR_RESPONSE = (UINT16) 0x0114 , STUN_PACKET_TYPE_CREATE_PERMISSION_ERROR_RESPONSE = (UINT16) 0x0118 , STUN_PACKET_TYPE_CHANNEL_BIND_ERROR_RESPONSE = (UINT16) 0x0119
}
enum  STUN_ERROR_CODE { STUN_ERROR_UNAUTHORIZED = (UINT16) 401 , STUN_ERROR_STALE_NONCE = (UINT16) 438 }
enum  STUN_ATTRIBUTE_TYPE {
  STUN_ATTRIBUTE_TYPE_MAPPED_ADDRESS = (UINT16) 0x0001 , STUN_ATTRIBUTE_TYPE_RESPONSE_ADDRESS = (UINT16) 0x0002 , STUN_ATTRIBUTE_TYPE_CHANGE_REQUEST = (UINT16) 0x0003 , STUN_ATTRIBUTE_TYPE_SOURCE_ADDRESS = (UINT16) 0x0004 ,
  STUN_ATTRIBUTE_TYPE_CHANGED_ADDRESS = (UINT16) 0x0005 , STUN_ATTRIBUTE_TYPE_USERNAME = (UINT16) 0x0006 , STUN_ATTRIBUTE_TYPE_PASSWORD = (UINT16) 0x0007 , STUN_ATTRIBUTE_TYPE_MESSAGE_INTEGRITY = (UINT16) 0x0008 ,
  STUN_ATTRIBUTE_TYPE_ERROR_CODE = (UINT16) 0x0009 , STUN_ATTRIBUTE_TYPE_UNKNOWN_ATTRIBUTES = (UINT16) 0x000A , STUN_ATTRIBUTE_TYPE_REFLECTED_FROM = (UINT16) 0x000B , STUN_ATTRIBUTE_TYPE_XOR_MAPPED_ADDRESS = (UINT16) 0x0020 ,
  STUN_ATTRIBUTE_TYPE_PRIORITY = (UINT16) 0x0024 , STUN_ATTRIBUTE_TYPE_USE_CANDIDATE = (UINT16) 0x0025 , STUN_ATTRIBUTE_TYPE_FINGERPRINT = (UINT16) 0x8028 , STUN_ATTRIBUTE_TYPE_ICE_CONTROLLED = (UINT16) 0x8029 ,
  STUN_ATTRIBUTE_TYPE_ICE_CONTROLLING = (UINT16) 0x802A , STUN_ATTRIBUTE_TYPE_CHANNEL_NUMBER = (UINT16) 0x000C , STUN_ATTRIBUTE_TYPE_LIFETIME = (UINT16) 0x000D , STUN_ATTRIBUTE_TYPE_XOR_PEER_ADDRESS = (UINT16) 0x0012 ,
  STUN_ATTRIBUTE_TYPE_DATA = (UINT16) 0x0013 , STUN_ATTRIBUTE_TYPE_REALM = (UINT16) 0x0014 , STUN_ATTRIBUTE_TYPE_NONCE = (UINT16) 0x0015 , STUN_ATTRIBUTE_TYPE_XOR_RELAYED_ADDRESS = (UINT16) 0x0016 ,
  STUN_ATTRIBUTE_TYPE_REQUESTED_ADDRESS_FAMILY = 0x0017 , STUN_ATTRIBUTE_TYPE_EVEN_PORT = (UINT16) 0x0018 , STUN_ATTRIBUTE_TYPE_REQUESTED_TRANSPORT = (UINT16) 0x0019 , STUN_ATTRIBUTE_TYPE_DONT_FRAGMENT = (UINT16) 0x001A ,
  STUN_ATTRIBUTE_TYPE_RESERVATION_TOKEN = (UINT16) 0x0022
}

Functions

STATUS serializeStunPacket (PStunPacket, PBYTE, UINT32, BOOL, BOOL, PBYTE, PUINT32)
STATUS deserializeStunPacket (PBYTE, UINT32, PBYTE, UINT32, PStunPacket *)
STATUS freeStunPacket (PStunPacket *)
STATUS createStunPacket (STUN_PACKET_TYPE, PBYTE, PStunPacket *)
STATUS appendStunAddressAttribute (PStunPacket, STUN_ATTRIBUTE_TYPE, PKvsIpAddress)
STATUS appendStunUsernameAttribute (PStunPacket, PCHAR)
STATUS appendStunFlagAttribute (PStunPacket, STUN_ATTRIBUTE_TYPE)
STATUS appendStunPriorityAttribute (PStunPacket, UINT32)
STATUS appendStunLifetimeAttribute (PStunPacket, UINT32)
STATUS appendStunRequestedTransportAttribute (PStunPacket, UINT8)
STATUS appendStunRealmAttribute (PStunPacket, PCHAR)
STATUS appendStunAllocationAddressFamily (PStunPacket, KVS_IP_FAMILY_TYPE)
STATUS appendStunNonceAttribute (PStunPacket, PBYTE, UINT16)
STATUS updateStunNonceAttribute (PStunPacket, PBYTE, UINT16)
STATUS appendStunErrorCodeAttribute (PStunPacket, PCHAR, UINT16)
STATUS appendStunIceControllAttribute (PStunPacket, STUN_ATTRIBUTE_TYPE, UINT64)
STATUS appendStunDataAttribute (PStunPacket, PBYTE, UINT16)
STATUS appendStunChannelNumberAttribute (PStunPacket, UINT16)
STATUS appendStunChangeRequestAttribute (PStunPacket, UINT32)
STATUS getStunAttribute (PStunPacket, STUN_ATTRIBUTE_TYPE, PStunAttributeHeader *)
STATUS xorIpAddress (PKvsIpAddress, PBYTE)
STATUS stunPackageIpAddr (PStunHeader, STUN_ATTRIBUTE_TYPE, PKvsIpAddress, PBYTE, PUINT32)
UINT16 getPackagedStunAttributeSize (PStunAttributeHeader)
STATUS getFirstAvailableStunAttribute (PStunPacket, PStunAttributeHeader *)

Macro Definition Documentation

◆ GET_STUN_ERROR_CODE

#define GET_STUN_ERROR_CODE ( pClass,
pCode )
Value:
((UINT16) ((*(PUINT8) (pClass)) * 100 + *(PUINT8) (pCode)))

Taking a PBYTE pointing to stun error packet's error code attribute's error class location and another PBYTE pointing to the error code location, return stun error code as UINT16

◆ PACKAGE_STUN_ATTR_HEADER

#define PACKAGE_STUN_ATTR_HEADER ( pBuf,
type,
dataLen )
Value:
putInt16((PINT16) (pBuf), (UINT16) (type)); \
putInt16((PINT16) ((pBuf) + STUN_ATTRIBUTE_HEADER_TYPE_LEN), (UINT16) (dataLen));
#define STUN_ATTRIBUTE_HEADER_TYPE_LEN
Definition Stun.h:35

Packages the attribute header into a specified buffer

◆ STUN_ATTRIBUTE_ADDRESS_FAMILY_LEN

#define STUN_ATTRIBUTE_ADDRESS_FAMILY_LEN   (UINT16) 2

◆ STUN_ATTRIBUTE_ADDRESS_HEADER_LEN

#define STUN_ATTRIBUTE_ADDRESS_HEADER_LEN   (UINT16)(STUN_ATTRIBUTE_ADDRESS_FAMILY_LEN + STUN_ATTRIBUTE_ADDRESS_PORT_LEN)

◆ STUN_ATTRIBUTE_ADDRESS_PORT_LEN

#define STUN_ATTRIBUTE_ADDRESS_PORT_LEN   (UINT16) 2

◆ STUN_ATTRIBUTE_CHANGE_REQUEST_FLAG_CHANGE_IP

#define STUN_ATTRIBUTE_CHANGE_REQUEST_FLAG_CHANGE_IP   4

◆ STUN_ATTRIBUTE_CHANGE_REQUEST_FLAG_CHANGE_PORT

#define STUN_ATTRIBUTE_CHANGE_REQUEST_FLAG_CHANGE_PORT   2

◆ STUN_ATTRIBUTE_CHANGE_REQUEST_FLAG_LEN

#define STUN_ATTRIBUTE_CHANGE_REQUEST_FLAG_LEN   (UINT16) 4

The flag is 32 bit long but only 2 bits are used

◆ STUN_ATTRIBUTE_CHANNEL_NUMBER_LEN

#define STUN_ATTRIBUTE_CHANNEL_NUMBER_LEN   (UINT16) 4

◆ STUN_ATTRIBUTE_FINGERPRINT_LEN

#define STUN_ATTRIBUTE_FINGERPRINT_LEN   (UINT16) 4

Fingerprint attribute value length = 4 bytes = 32 bits

◆ STUN_ATTRIBUTE_FLAG_LEN

#define STUN_ATTRIBUTE_FLAG_LEN   (UINT16) 0

Candidate attribute has no size

◆ STUN_ATTRIBUTE_HEADER_DATA_LEN

#define STUN_ATTRIBUTE_HEADER_DATA_LEN   (UINT16) 2

◆ STUN_ATTRIBUTE_HEADER_LEN

#define STUN_ATTRIBUTE_HEADER_LEN   (UINT16)(STUN_ATTRIBUTE_HEADER_TYPE_LEN + STUN_ATTRIBUTE_HEADER_DATA_LEN)

◆ STUN_ATTRIBUTE_HEADER_TYPE_LEN

#define STUN_ATTRIBUTE_HEADER_TYPE_LEN   (UINT16) 2

Stun attribute header structure

  • 2 UINT16 type len
  • 2 UINT16 attribute data len
  • attribute specific data

◆ STUN_ATTRIBUTE_ICE_CONTROL_LEN

#define STUN_ATTRIBUTE_ICE_CONTROL_LEN   (UINT16) 8

Ice-controll and Ice-controlling attribute value length = 8 bytes = 64 bits for a UINT64 tie breaker

◆ STUN_ATTRIBUTE_LIFETIME_LEN

#define STUN_ATTRIBUTE_LIFETIME_LEN   (UINT16) 4

Lifetime attribute value length = 4 bytes = 32 bits representing number of seconds until expiration

◆ STUN_ATTRIBUTE_MAX_COUNT

#define STUN_ATTRIBUTE_MAX_COUNT   20

Max number of attributes allowed

◆ STUN_ATTRIBUTE_PRIORITY_LEN

#define STUN_ATTRIBUTE_PRIORITY_LEN   (UINT16) 4

Priority attribute value length = 4 bytes = 32 bits

◆ STUN_ATTRIBUTE_REQUESTED_ADDRESS_FAMILY_LEN

#define STUN_ATTRIBUTE_REQUESTED_ADDRESS_FAMILY_LEN   (UINT16) 4

Requested address family attribute value length = 4 bytes = 32 bits

◆ STUN_ATTRIBUTE_REQUESTED_TRANSPORT_PROTOCOL_LEN

#define STUN_ATTRIBUTE_REQUESTED_TRANSPORT_PROTOCOL_LEN   (UINT16) 4

Requested transport protocol attribute value length = 4 bytes = 32 bits

◆ STUN_ERROR_CODE_PACKET_ERROR_CLASS_OFFSET

#define STUN_ERROR_CODE_PACKET_ERROR_CLASS_OFFSET   2

◆ STUN_ERROR_CODE_PACKET_ERROR_CODE_OFFSET

#define STUN_ERROR_CODE_PACKET_ERROR_CODE_OFFSET   3

◆ STUN_ERROR_CODE_PACKET_ERROR_PHRASE_OFFSET

#define STUN_ERROR_CODE_PACKET_ERROR_PHRASE_OFFSET   4

◆ STUN_FINGERPRINT_ATTRIBUTE_XOR_VALUE

#define STUN_FINGERPRINT_ATTRIBUTE_XOR_VALUE   (UINT32) 0x5354554e

Need to XOR the calculate fingerprint value with this per https://tools.ietf.org/html/rfc5389#section-15.5

◆ STUN_HEADER_DATA_LEN

#define STUN_HEADER_DATA_LEN   (UINT16) 2

◆ STUN_HEADER_LEN

#define STUN_HEADER_LEN   (UINT16) 20

Stun header structure

  • 2 UINT16 type len
  • 2 UINT16 packet data len
  • 4 UINT16 magic cookie
  • 12 UINT16 transaction id
  • data

◆ STUN_HEADER_MAGIC_COOKIE

#define STUN_HEADER_MAGIC_COOKIE   (UINT32) 0x2112A442

◆ STUN_HEADER_MAGIC_COOKIE_LE

#define STUN_HEADER_MAGIC_COOKIE_LE   (UINT32) 0x42A41221

◆ STUN_HEADER_MAGIC_COOKIE_LEN

#define STUN_HEADER_MAGIC_COOKIE_LEN   SIZEOF(STUN_HEADER_MAGIC_COOKIE)

◆ STUN_HEADER_TRANSACTION_ID_LEN

#define STUN_HEADER_TRANSACTION_ID_LEN   (UINT16) 12

◆ STUN_HEADER_TYPE_LEN

#define STUN_HEADER_TYPE_LEN   (UINT16) 2

◆ STUN_HMAC_VALUE_LEN

#define STUN_HMAC_VALUE_LEN   KVS_SHA1_DIGEST_LENGTH

STUN HMAC attribute value length

◆ STUN_PACKET_ALLOCATION_SIZE

#define STUN_PACKET_ALLOCATION_SIZE   2048

Default allocation size for a STUN packet

◆ STUN_PACKET_IS_TYPE_ERROR

#define STUN_PACKET_IS_TYPE_ERROR ( pPacketBuffer)
Value:
((getInt16(*(PINT16) pPacketBuffer) == STUN_PACKET_TYPE_BINDING_RESPONSE_ERROR) || \
(getInt16(*(PINT16) pPacketBuffer) == STUN_PACKET_TYPE_SHARED_SECRET_ERROR_RESPONSE) || \
(getInt16(*(PINT16) pPacketBuffer) == STUN_PACKET_TYPE_ALLOCATE_ERROR_RESPONSE) || \
(getInt16(*(PINT16) pPacketBuffer) == STUN_PACKET_TYPE_REFRESH_ERROR_RESPONSE) || \
(getInt16(*(PINT16) pPacketBuffer) == STUN_PACKET_TYPE_CREATE_PERMISSION_ERROR_RESPONSE) || \
(getInt16(*(PINT16) pPacketBuffer) == STUN_PACKET_TYPE_CHANNEL_BIND_ERROR_RESPONSE))
@ STUN_PACKET_TYPE_ALLOCATE_ERROR_RESPONSE
Definition Stun.h:164
@ STUN_PACKET_TYPE_BINDING_RESPONSE_ERROR
Definition Stun.h:162
@ STUN_PACKET_TYPE_CREATE_PERMISSION_ERROR_RESPONSE
Definition Stun.h:166
@ STUN_PACKET_TYPE_SHARED_SECRET_ERROR_RESPONSE
Definition Stun.h:163
@ STUN_PACKET_TYPE_CHANNEL_BIND_ERROR_RESPONSE
Definition Stun.h:167
@ STUN_PACKET_TYPE_REFRESH_ERROR_RESPONSE
Definition Stun.h:165

◆ STUN_PACKET_TRANSACTION_ID_OFFSET

#define STUN_PACKET_TRANSACTION_ID_OFFSET   8

◆ STUN_SEND_INDICATION_APPLICATION_DATA_LEN_OFFSET

#define STUN_SEND_INDICATION_APPLICATION_DATA_LEN_OFFSET   34

◆ STUN_SEND_INDICATION_APPLICATION_DATA_OFFSET

#define STUN_SEND_INDICATION_APPLICATION_DATA_OFFSET   36

◆ STUN_SEND_INDICATION_OVERHEAD_SIZE

#define STUN_SEND_INDICATION_OVERHEAD_SIZE   36

◆ STUN_SEND_INDICATION_XOR_PEER_ADDRESS_OFFSET

#define STUN_SEND_INDICATION_XOR_PEER_ADDRESS_OFFSET   28

◆ STUN_SEND_INDICATION_XOR_PEER_ADDRESS_PORT_OFFSET

#define STUN_SEND_INDICATION_XOR_PEER_ADDRESS_PORT_OFFSET   26

◆ STUN_TRANSACTION_ID_LEN

#define STUN_TRANSACTION_ID_LEN   (UINT16) 12

STUN packet transaction id = 96 bits

Typedef Documentation

◆ PStunAttributeAddress

◆ PStunAttributeAllocationAddressFamily

◆ PStunAttributeChangeRequest

◆ PStunAttributeChannelNumber

◆ PStunAttributeData

◆ PStunAttributeErrorCode

◆ PStunAttributeFingerprint

◆ PStunAttributeFlag

◆ PStunAttributeHeader

◆ PStunAttributeIceControl

◆ PStunAttributeLifetime

◆ PStunAttributeMessageIntegrity

◆ PStunAttributeNonce

◆ PStunAttributePriority

◆ PStunAttributeRealm

◆ PStunAttributeRequestedTransport

◆ PStunAttributeUsername

◆ PStunHeader

typedef struct StunHeader * PStunHeader

◆ PStunPacket

typedef struct StunPacket * PStunPacket

Enumeration Type Documentation

◆ STUN_ATTRIBUTE_TYPE

STUN attribute types

Enumerator
STUN_ATTRIBUTE_TYPE_MAPPED_ADDRESS 
STUN_ATTRIBUTE_TYPE_RESPONSE_ADDRESS 
STUN_ATTRIBUTE_TYPE_CHANGE_REQUEST 
STUN_ATTRIBUTE_TYPE_SOURCE_ADDRESS 
STUN_ATTRIBUTE_TYPE_CHANGED_ADDRESS 
STUN_ATTRIBUTE_TYPE_USERNAME 
STUN_ATTRIBUTE_TYPE_PASSWORD 
STUN_ATTRIBUTE_TYPE_MESSAGE_INTEGRITY 
STUN_ATTRIBUTE_TYPE_ERROR_CODE 
STUN_ATTRIBUTE_TYPE_UNKNOWN_ATTRIBUTES 
STUN_ATTRIBUTE_TYPE_REFLECTED_FROM 
STUN_ATTRIBUTE_TYPE_XOR_MAPPED_ADDRESS 
STUN_ATTRIBUTE_TYPE_PRIORITY 
STUN_ATTRIBUTE_TYPE_USE_CANDIDATE 
STUN_ATTRIBUTE_TYPE_FINGERPRINT 
STUN_ATTRIBUTE_TYPE_ICE_CONTROLLED 
STUN_ATTRIBUTE_TYPE_ICE_CONTROLLING 
STUN_ATTRIBUTE_TYPE_CHANNEL_NUMBER 
STUN_ATTRIBUTE_TYPE_LIFETIME 
STUN_ATTRIBUTE_TYPE_XOR_PEER_ADDRESS 
STUN_ATTRIBUTE_TYPE_DATA 
STUN_ATTRIBUTE_TYPE_REALM 
STUN_ATTRIBUTE_TYPE_NONCE 
STUN_ATTRIBUTE_TYPE_XOR_RELAYED_ADDRESS 
STUN_ATTRIBUTE_TYPE_REQUESTED_ADDRESS_FAMILY 
STUN_ATTRIBUTE_TYPE_EVEN_PORT 
STUN_ATTRIBUTE_TYPE_REQUESTED_TRANSPORT 
STUN_ATTRIBUTE_TYPE_DONT_FRAGMENT 
STUN_ATTRIBUTE_TYPE_RESERVATION_TOKEN 

◆ STUN_ERROR_CODE

STUN error codes

Enumerator
STUN_ERROR_UNAUTHORIZED 
STUN_ERROR_STALE_NONCE 

◆ STUN_PACKET_TYPE

STUN packet types

Enumerator
STUN_PACKET_TYPE_BINDING_REQUEST 
STUN_PACKET_TYPE_SHARED_SECRET_REQUEST 
STUN_PACKET_TYPE_ALLOCATE 
STUN_PACKET_TYPE_REFRESH 
STUN_PACKET_TYPE_SEND 
STUN_PACKET_TYPE_DATA 
STUN_PACKET_TYPE_CREATE_PERMISSION 
STUN_PACKET_TYPE_CHANNEL_BIND_REQUEST 
STUN_PACKET_TYPE_BINDING_INDICATION 
STUN_PACKET_TYPE_SEND_INDICATION 
STUN_PACKET_TYPE_DATA_INDICATION 
STUN_PACKET_TYPE_BINDING_RESPONSE_SUCCESS 
STUN_PACKET_TYPE_SHARED_SECRET_RESPONSE 
STUN_PACKET_TYPE_ALLOCATE_SUCCESS_RESPONSE 
STUN_PACKET_TYPE_REFRESH_SUCCESS_RESPONSE 
STUN_PACKET_TYPE_CREATE_PERMISSION_SUCCESS_RESPONSE 
STUN_PACKET_TYPE_CHANNEL_BIND_SUCCESS_RESPONSE 
STUN_PACKET_TYPE_BINDING_RESPONSE_ERROR 
STUN_PACKET_TYPE_SHARED_SECRET_ERROR_RESPONSE 
STUN_PACKET_TYPE_ALLOCATE_ERROR_RESPONSE 
STUN_PACKET_TYPE_REFRESH_ERROR_RESPONSE 
STUN_PACKET_TYPE_CREATE_PERMISSION_ERROR_RESPONSE 
STUN_PACKET_TYPE_CHANNEL_BIND_ERROR_RESPONSE 

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:

◆ appendStunAllocationAddressFamily()

STATUS appendStunAllocationAddressFamily ( PStunPacket pStunPacket,
KVS_IP_FAMILY_TYPE ipFamily )
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: