Ignore:
Timestamp:
Mar 9, 2008 12:55:00 PM (16 years ago)
Author:
bennylp
Message:

More work for ticket #485: updated pjnath with TURN-07 and added authentication in the server

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/include/pjnath/stun_msg.h

    r1850 r1852  
    298298    PJ_STUN_ATTR_RELAY_ADDR         = 0x0016,/**< RELAY-ADDRESS attribute.  */ 
    299299    PJ_STUN_ATTR_REQ_ADDR_TYPE      = 0x0017,/**< REQUESTED-ADDRESS-TYPE    */ 
    300     PJ_STUN_ATTR_REQ_PORT_PROPS     = 0x0018,/**< REQUESTED-PORT-PROPS      */ 
     300    PJ_STUN_ATTR_REQ_PROPS          = 0x0018,/**< REQUESTED-PROPS           */ 
    301301    PJ_STUN_ATTR_REQ_TRANSPORT      = 0x0019,/**< REQUESTED-TRANSPORT       */ 
    302302    PJ_STUN_ATTR_XOR_MAPPED_ADDR    = 0x0020,/**< XOR-MAPPED-ADDRESS        */ 
    303303    PJ_STUN_ATTR_TIMER_VAL          = 0x0021,/**< TIMER-VAL attribute.      */ 
    304     PJ_STUN_ATTR_REQ_IP             = 0x0022,/**< REQUESTED-IP attribute    */ 
     304    PJ_STUN_ATTR_RESERVATION_TOKEN  = 0x0022,/**< TURN RESERVATION-TOKEN    */ 
    305305    PJ_STUN_ATTR_XOR_REFLECTED_FROM = 0x0023,/**< XOR-REFLECTED-FROM        */ 
    306306    PJ_STUN_ATTR_PRIORITY           = 0x0024,/**< PRIORITY                  */ 
     
    359359    PJ_STUN_SC_INSUFFICIENT_CAPACITY    = 507,  /**< Insufficient Capacity  
    360360                                                     (TURN) */ 
     361    PJ_STUN_SC_INSUFFICIENT_PORT_CAPACITY=508,  /**< Insufficient Port Capacity  
     362                                                     (TURN) */ 
    361363    PJ_STUN_SC_GLOBAL_FAILURE           = 600   /**< Global Failure         */ 
    362364} pj_stun_status; 
     
    946948 
    947949/** 
    948  * This describes the TURN REQUESTED-PORT-PROPS attribute, encoded as 
     950 * This describes the TURN REQUESTED-PROPS attribute, encoded as 
    949951 * STUN 32bit integer attribute. Few macros are provided to manipulate 
    950952 * the values in this attribute: #PJ_STUN_GET_RPP_BITS(),  
    951953 * #PJ_STUN_SET_RPP_BITS(), #PJ_STUN_GET_RPP_PORT(), and 
    952954 * #PJ_STUN_SET_RPP_PORT(). 
    953  * 
     955 *  
    954956 * This attribute allows the client to request certain properties for 
    955  * the port that is allocated by the server.  The attribute can be used 
    956  * with any transport protocol that has the notion of a 16 bit port 
    957  * space (including TCP and UDP).  The attribute is 32 bits long.  Its 
    958  * format is: 
     957 * the relayed transport address that is allocated by the server.  The 
     958 * attribute is 32 bits long.  Its format is: 
    959959 
    960960 \verbatim 
     
    963963      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 
    964964     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
    965      |       Reserved = 0        | A |    Specific Port Number       | 
     965     |   Prop-type   |                  Reserved = 0                 | 
    966966     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
    967967 
    968968 \endverbatim 
    969969 
    970  * The two bits labeled A in the diagram above are for requested port 
    971  * alignment and have the following meaning: 
    972  * 
    973  *  - 00  no specific port alignment 
    974  *  - 01  odd port number 
    975  *  - 10  even port number 
    976  *  - 11  even port number; reserve next higher port 
    977  */ 
    978 typedef struct pj_stun_uint_attr pj_stun_req_port_props_attr; 
    979  
    980 /** 
    981  * Get the 2 bits requested port alignment value from a 32bit integral 
    982  * value of TURN REQUESTED-PORT-PROPS attribute. 
    983  */ 
    984 #define PJ_STUN_GET_RPP_BITS(u32)   ((u32 >> 16) & 0x03) 
    985  
    986 /** 
    987  * Convert 2 bits requested port alignment value to a 32bit integral 
    988  * value of TURN REQUESTED-PORT-PROPS attribute. 
    989  */ 
    990 #define PJ_STUN_SET_RPP_BITS(A)     (A << 16) 
    991  
    992 /** 
    993  * Get the port number in TURN REQUESTED-PORT-PROPS attribute. The port 
    994  * number is returned in host byte order. 
    995  */ 
    996 #define PJ_STUN_GET_RPP_PORT(u32)   pj_ntohs((pj_uint16_t)(u32 & 0x0000FFFFL)) 
    997  
    998 /** 
    999  * Convert port number in host byte order to 32bit value to be encoded in  
    1000  * TURN REQUESTED-PORT-PROPS attribute. 
    1001  */ 
    1002 #define PJ_STUN_SET_RPP_PORT(port) ((pj_uint32_t)pj_htons((pj_uint16_t)(port))) 
     970 * The field labeled "Prop-type" is an 8-bit field specifying the 
     971 * desired property.  The rest of the attribute is RFFU (Reserved For 
     972 * Future Use) and MUST be set to 0 on transmission and ignored on 
     973 * reception.  The values of the "Prop-type" field are: 
     974 *  
     975 *    0x00  (Reserved) 
     976 *    0x01  Even port number 
     977 *    0x02  Pair of ports  
     978 */ 
     979typedef struct pj_stun_uint_attr pj_stun_req_props_attr; 
     980 
     981/** 
     982 * Get the 8bit Prop-type value from a 32bit integral value of TURN  
     983 * TURN REQUESTED-PROPS attribute. 
     984 */ 
     985#define PJ_STUN_GET_PROP_TYPE(u32)      (u32 >> 24) 
     986 
     987/** 
     988 * Convert 8bit Prop-type value to a 32bit integral value of TURN  
     989 * REQUESTED-PROPS attribute. 
     990 */ 
     991#define PJ_STUN_SET_PROP_TYPE(PropType) (PropType << 24) 
    1003992 
    1004993 
     
    10471036 
    10481037/** 
    1049  * This describes the TURN REQUESTED-IP attribute. 
    1050  * The REQUESTED-IP attribute is used by the client to request that a 
    1051  * specific IP address be allocated by the TURN server.  This attribute 
    1052  * is needed since it is anticipated that TURN servers will be multi- 
    1053  * homed so as to be able to allocate more than 64k transport addresses. 
    1054  * As a consequence, a client needing a second transport address on the 
    1055  * same interface as a previous one can use this attribute to request a 
    1056  * remote address from the same TURN server interface as the TURN 
    1057  * client's previous remote address. 
     1038 * This describes the TURN RESERVATION-TOKEN attribute. 
     1039 * The RESERVATION-TOKEN attribute contains a token that uniquely 
     1040 * identifies a relayed transport address being held in reserve by the 
     1041 * server.  The server includes this attribute in a success response to 
     1042 * tell the client about the token, and the client includes this 
     1043 * attribute in a subsequent Allocate request to request the server use 
     1044 * that relayed transport address for the allocation. 
    10581045 *  
    1059  * The format of this attribute is identical to XOR-MAPPED-ADDRESS. 
    1060  * However, the port component of the attribute MUST be ignored by the 
    1061  * server.  If a client wishes to request a specific IP address and 
    1062  * port, it uses both the REQUESTED-IP and REQUESTED-PORT-PROPS 
    1063  * attributes.  
    1064  */ 
    1065 typedef struct pj_stun_sockaddr_attr pj_stun_req_ip_attr; 
     1046 * The attribute value is a 64-bit-long field containing the token 
     1047 * value.  
     1048 */ 
     1049typedef struct pj_stun_uint64_attr pj_stun_res_token_attr; 
    10661050 
    10671051/** 
Note: See TracChangeset for help on using the changeset viewer.