Stun Server  Compliant with the latest RFCs including 5389, 5769, and 5780
discover the local host's own external IP address
stuntypes.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  StunAttribute
 
struct  StunMappedAddressAttribute_IPV4
 
struct  StunMappedAddressAttribute_IPV6
 
struct  StunChangeRequestAttribute
 
struct  StunTransactionId
 

Macros

#define STUN_IS_REQUEST(msg_type)   (((msg_type) & 0x0110) == 0x0000)
 
#define STUN_IS_INDICATION(msg_type)   (((msg_type) & 0x0110) == 0x0010)
 
#define STUN_IS_SUCCESS_RESP(msg_type)   (((msg_type) & 0x0110) == 0x0100)
 
#define STUN_IS_ERR_RESP(msg_type)   (((msg_type) & 0x0110) == 0x0110)
 

Enumerations

enum  StunMessageClass {
  StunMsgClassRequest =0x00, StunMsgClassIndication =0x01, StunMsgClassSuccessResponse =0x02, StunMsgClassFailureResponse =0x03,
  StunMsgClassInvalidMessageClass = 0xff
}
 
enum  StunMessageType { StunMsgTypeBinding = 0x0001, StunMsgTypeInvalid = 0xffff }
 

Functions

bool operator== (const StunTransactionId &id1, const StunTransactionId &id2)
 

Variables

const uint16_t DEFAULT_STUN_PORT = 3478
 
const uint16_t DEFAULT_STUN_TLS_PORT = 5349
 
const uint16_t STUN_ATTRIBUTE_MAPPEDADDRESS = 0x0001
 
const uint16_t STUN_ATTRIBUTE_RESPONSEADDRESS = 0x0002
 
const uint16_t STUN_ATTRIBUTE_CHANGEREQUEST = 0x0003
 
const uint16_t STUN_ATTRIBUTE_SOURCEADDRESS = 0x0004
 
const uint16_t STUN_ATTRIBUTE_CHANGEDADDRESS = 0x0005
 
const uint16_t STUN_ATTRIBUTE_USERNAME = 0x0006
 
const uint16_t STUN_ATTRIBUTE_LEGACY_PASSWORD = 0x0007
 
const uint16_t STUN_ATTRIBUTE_MESSAGEINTEGRITY = 0x0008
 
const uint16_t STUN_ATTRIBUTE_ERRORCODE = 0x0009
 
const uint16_t STUN_ATTRIBUTE_UNKNOWNATTRIBUTES = 0x000A
 
const uint16_t STUN_ATTRIBUTE_REFLECTEDFROM = 0x000B
 
const uint16_t STUN_ATTRIBUTE_REALM = 0x0014
 
const uint16_t STUN_ATTRIBUTE_NONCE = 0x0015
 
const uint16_t STUN_ATTRIBUTE_XORMAPPEDADDRESS = 0x0020
 
const uint16_t STUN_ATTRIBUTE_PADDING = 0x0026
 
const uint16_t STUN_ATTRIBUTE_RESPONSE_PORT = 0x0027
 
const uint16_t STUN_ATTRIBUTE_XORMAPPEDADDRESS_OPTIONAL = 0x8020
 
const uint16_t STUN_ATTRIBUTE_SOFTWARE = 0x8022
 
const uint16_t STUN_ATTRIBUTE_ALTERNATESERVER = 0x8023
 
const uint16_t STUN_ATTRIBUTE_FINGERPRINT = 0x8028
 
const uint16_t STUN_ATTRIBUTE_RESPONSE_ORIGIN = 0x802b
 
const uint16_t STUN_ATTRIBUTE_OTHER_ADDRESS = 0x802c
 
const uint16_t STUN_TRANSACTION_ID_LENGTH = 16
 
const uint8_t STUN_ATTRIBUTE_FIELD_IPV4 = 1
 
const uint8_t STUN_ATTRIBUTE_FIELD_IPV6 = 2
 
const uint16_t STUN_IPV4_LENGTH = 4
 
const uint16_t STUN_IPV6_LENGTH = 16
 
const uint16_t STUN_ERROR_TRYALTERNATE = 300
 
const uint16_t STUN_ERROR_BADREQUEST = 400
 
const uint16_t STUN_ERROR_UNAUTHORIZED = 401
 
const uint16_t STUN_ERROR_UNKNOWNATTRIB = 420
 
const uint16_t STUN_ERROR_STALENONCE = 438
 
const uint16_t STUN_ERROR_SERVERERROR = 500
 
const uint16_t STUN_ATTRIBUTE_MAPPEDADDRESS_SIZE_IPV4 = 8
 
const uint16_t STUN_ATTRIBUTE_MAPPEDADDRESS_SIZE_IPV6 = 20
 
const uint16_t STUN_ATTRIBUTE_RESPONSE_PORT_SIZE = 2
 
const uint16_t STUN_ATTRIBUTE_CHANGEREQUEST_SIZE = 4
 
const uint32_t STUN_COOKIE = 0x2112A442
 
const uint8_t STUN_COOKIE_B1 = 0x21
 
const uint8_t STUN_COOKIE_B2 = 0x12
 
const uint8_t STUN_COOKIE_B3 = 0xA4
 
const uint8_t STUN_COOKIE_B4 = 0x42
 
const uint32_t STUN_FINGERPRINT_XOR = 0x5354554e
 
const uint16_t STUN_XOR_PORT_COOKIE = 0x2112
 
const uint32_t STUN_HEADER_SIZE = 20
 
const uint32_t MAX_STUN_MESSAGE_SIZE = 800
 
const uint32_t MAX_STUN_ATTRIBUTE_SIZE = 780
 

Macro Definition Documentation

#define STUN_IS_ERR_RESP (   msg_type)    (((msg_type) & 0x0110) == 0x0110)

Definition at line 148 of file stuntypes.h.

#define STUN_IS_INDICATION (   msg_type)    (((msg_type) & 0x0110) == 0x0010)

Definition at line 146 of file stuntypes.h.

#define STUN_IS_REQUEST (   msg_type)    (((msg_type) & 0x0110) == 0x0000)

Definition at line 145 of file stuntypes.h.

#define STUN_IS_SUCCESS_RESP (   msg_type)    (((msg_type) & 0x0110) == 0x0100)

Definition at line 147 of file stuntypes.h.

Enumeration Type Documentation

Enumerator
StunMsgClassRequest 
StunMsgClassIndication 
StunMsgClassSuccessResponse 
StunMsgClassFailureResponse 
StunMsgClassInvalidMessageClass 

Definition at line 93 of file stuntypes.h.

Enumerator
StunMsgTypeBinding 
StunMsgTypeInvalid 

Definition at line 102 of file stuntypes.h.

Function Documentation

bool operator== ( const StunTransactionId id1,
const StunTransactionId id2 
)
inline

Definition at line 157 of file stuntypes.h.

Variable Documentation

const uint16_t DEFAULT_STUN_PORT = 3478

Definition at line 29 of file stuntypes.h.

const uint16_t DEFAULT_STUN_TLS_PORT = 5349

Definition at line 30 of file stuntypes.h.

const uint32_t MAX_STUN_ATTRIBUTE_SIZE = 780

Definition at line 179 of file stuntypes.h.

const uint32_t MAX_STUN_MESSAGE_SIZE = 800

Definition at line 178 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_ALTERNATESERVER = 0x8023

Definition at line 65 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_CHANGEDADDRESS = 0x0005

Definition at line 37 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_CHANGEREQUEST = 0x0003

Definition at line 35 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_CHANGEREQUEST_SIZE = 4

Definition at line 141 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_ERRORCODE = 0x0009

Definition at line 45 of file stuntypes.h.

const uint8_t STUN_ATTRIBUTE_FIELD_IPV4 = 1

Definition at line 77 of file stuntypes.h.

const uint8_t STUN_ATTRIBUTE_FIELD_IPV6 = 2

Definition at line 78 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_FINGERPRINT = 0x8028

Definition at line 67 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_LEGACY_PASSWORD = 0x0007

Definition at line 41 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_MAPPEDADDRESS = 0x0001

Definition at line 33 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_MAPPEDADDRESS_SIZE_IPV4 = 8

Definition at line 138 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_MAPPEDADDRESS_SIZE_IPV6 = 20

Definition at line 139 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_MESSAGEINTEGRITY = 0x0008

Definition at line 44 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_NONCE = 0x0015

Definition at line 52 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_OTHER_ADDRESS = 0x802c

Definition at line 70 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_PADDING = 0x0026

Definition at line 55 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_REALM = 0x0014

Definition at line 51 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_REFLECTEDFROM = 0x000B

Definition at line 48 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_RESPONSE_ORIGIN = 0x802b

Definition at line 69 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_RESPONSE_PORT = 0x0027

Definition at line 56 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_RESPONSE_PORT_SIZE = 2

Definition at line 140 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_RESPONSEADDRESS = 0x0002

Definition at line 34 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_SOFTWARE = 0x8022

Definition at line 64 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_SOURCEADDRESS = 0x0004

Definition at line 36 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_UNKNOWNATTRIBUTES = 0x000A

Definition at line 46 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_USERNAME = 0x0006

Definition at line 39 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_XORMAPPEDADDRESS = 0x0020

Definition at line 53 of file stuntypes.h.

const uint16_t STUN_ATTRIBUTE_XORMAPPEDADDRESS_OPTIONAL = 0x8020

Definition at line 62 of file stuntypes.h.

const uint32_t STUN_COOKIE = 0x2112A442

Definition at line 165 of file stuntypes.h.

const uint8_t STUN_COOKIE_B1 = 0x21

Definition at line 166 of file stuntypes.h.

const uint8_t STUN_COOKIE_B2 = 0x12

Definition at line 167 of file stuntypes.h.

const uint8_t STUN_COOKIE_B3 = 0xA4

Definition at line 168 of file stuntypes.h.

const uint8_t STUN_COOKIE_B4 = 0x42

Definition at line 169 of file stuntypes.h.

const uint16_t STUN_ERROR_BADREQUEST = 400

Definition at line 85 of file stuntypes.h.

const uint16_t STUN_ERROR_SERVERERROR = 500

Definition at line 89 of file stuntypes.h.

const uint16_t STUN_ERROR_STALENONCE = 438

Definition at line 88 of file stuntypes.h.

const uint16_t STUN_ERROR_TRYALTERNATE = 300

Definition at line 84 of file stuntypes.h.

const uint16_t STUN_ERROR_UNAUTHORIZED = 401

Definition at line 86 of file stuntypes.h.

const uint16_t STUN_ERROR_UNKNOWNATTRIB = 420

Definition at line 87 of file stuntypes.h.

const uint32_t STUN_FINGERPRINT_XOR = 0x5354554e

Definition at line 172 of file stuntypes.h.

const uint32_t STUN_HEADER_SIZE = 20

Definition at line 176 of file stuntypes.h.

const uint16_t STUN_IPV4_LENGTH = 4

Definition at line 80 of file stuntypes.h.

const uint16_t STUN_IPV6_LENGTH = 16

Definition at line 81 of file stuntypes.h.

const uint16_t STUN_TRANSACTION_ID_LENGTH = 16

Definition at line 75 of file stuntypes.h.

const uint16_t STUN_XOR_PORT_COOKIE = 0x2112

Definition at line 174 of file stuntypes.h.