WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJNATH Reference

#include <stun_msg.h>

Data Fields

pj_uint16_t type
 
pj_uint16_t length
 
pj_uint32_t magic
 
pj_uint8_t tsx_id [12]
 

Detailed Description

This structure describes STUN message header. A STUN message has the following format:

     0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |0 0|     STUN Message Type     |         Message Length        |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                         Magic Cookie                          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                             Transaction ID
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                                                    |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Field Documentation

◆ length

pj_uint16_t pj_stun_msg_hdr::length

The message length is the size, in bytes, of the message not including the 20 byte STUN header.

◆ magic

pj_uint32_t pj_stun_msg_hdr::magic

The magic cookie is a fixed value, 0x2112A442 (PJ_STUN_MAGIC constant). In the previous version of this specification [15] this field was part of the transaction ID.

◆ tsx_id

pj_uint8_t pj_stun_msg_hdr::tsx_id[12]

The transaction ID is a 96 bit identifier. STUN transactions are identified by their unique 96-bit transaction ID. For request/ response transactions, the transaction ID is chosen by the STUN client and MUST be unique for each new STUN transaction generated by that STUN client. The transaction ID MUST be uniformly and randomly distributed between 0 and 2**96 - 1.

◆ type

pj_uint16_t pj_stun_msg_hdr::type

STUN message type, which the first two bits must be zeroes.


The documentation for this struct was generated from the following file:

 


PJNATH - Open Source NAT traversal helper library supporting STUN, TURN, and ICE
Copyright (C) 2006-2009 Teluu Inc.