Changeset 2967 for pjproject/trunk


Ignore:
Timestamp:
Oct 25, 2009 10:50:17 AM (15 years ago)
Author:
bennylp
Message:

More ticket #950 (QoS):

  • fixed wrong DSCP field operation with sock_qos_bsd.c backend
  • tested on Linux for SIP (UDP/TCP), UDP RTP/RTCP, and ICE
  • renamed 801_1_P names to SO_PRIO
  • changed a bit of doxygen documentation (the title etc)
Location:
pjproject/trunk/pjlib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/sock_qos.h

    r2966 r2967  
    3232 
    3333/** 
    34  * @defgroup socket_qos Socket Quality of Service (QoS) API 
     34 * @defgroup socket_qos Socket Quality of Service (QoS) API: TOS, DSCP, WMM, IEEE 802.1p 
    3535 * @ingroup PJ_SOCK 
    3636 * @{ 
     
    6464    At the Internet layer, you can use Differentiated Services/Diffserv and 
    6565    set the value of the Differentiated Services Code Point (DSCP) in the  
    66     IP header. As defined in RFC 2472, the DSCP value is the high-order 6 bits 
     66    IP header. As defined in RFC 2474, the DSCP value is the high-order 6 bits 
    6767    of the IP version 4 (IPv4) TOS field and the IP version 6 (IPv6) Traffic  
    6868    Class field. 
     
    180180     { 
    181181        PJ_QOS_PARAM_HAS_DSCP = 1, 
    182         PJ_QOS_PARAM_HAS_802_1_P = 2, 
     182        PJ_QOS_PARAM_HAS_SO_PRIO = 2, 
    183183        PJ_QOS_PARAM_HAS_WMM = 4 
    184184     } pj_qos_flag; 
     
    196196        pj_uint8_t      flags;    // Determines which values to  
    197197                                  // set, bitmask of pj_qos_flag 
    198         pj_uint8_t      dscp_val; // DSCP value to set 
     198        pj_uint8_t      dscp_val; // The 6 bits DSCP value to set 
    199199        pj_uint8_t      so_prio;  // SO_PRIORITY value 
    200200        pj_qos_wmm_prio wmm_prio; // WMM priority value 
     
    249249{ 
    250250    PJ_QOS_PARAM_HAS_DSCP = 1,      /**< DSCP field is set.         */ 
    251     PJ_QOS_PARAM_HAS_802_1_P = 2,   /**< IEEE 802.1p  field is set  */ 
     251    PJ_QOS_PARAM_HAS_SO_PRIO = 2,   /**< Socket SO_PRIORITY         */ 
    252252    PJ_QOS_PARAM_HAS_WMM = 4        /**< WMM  field is set.         */ 
    253253} pj_qos_flag; 
     
    273273    pj_uint8_t      flags;    /**< Determines which values to  
    274274                                   set, bitmask of pj_qos_flag      */ 
    275     pj_uint8_t      dscp_val; /**< DSCP value to set                */ 
     275    pj_uint8_t      dscp_val; /**< The 6 bits DSCP value to set     */ 
    276276    pj_uint8_t      so_prio;  /**< SO_PRIORITY value                */ 
    277277    pj_qos_wmm_prio wmm_prio; /**< WMM priority value               */ 
  • pjproject/trunk/pjlib/src/pj/sock_qos_bsd.c

    r2966 r2967  
    4242    /* Set TOS/DSCP */ 
    4343    if (param->flags & PJ_QOS_PARAM_HAS_DSCP) { 
    44         int val = param->dscp_val; 
     44        /* Value is dscp_val << 2 */ 
     45        int val = (param->dscp_val << 2); 
    4546        status = pj_sock_setsockopt(sock, pj_SOL_IP(), pj_IP_TOS(),  
    4647                                    &val, sizeof(val)); 
     
    5253 
    5354    /* Set SO_PRIORITY */ 
    54     if (param->flags & PJ_QOS_PARAM_HAS_802_1_P) { 
     55    if (param->flags & PJ_QOS_PARAM_HAS_SO_PRIO) { 
    5556        int val = param->so_prio; 
    5657        status = pj_sock_setsockopt(sock, pj_SOL_SOCKET(), pj_SO_PRIORITY(), 
    5758                                    &val, sizeof(val)); 
    5859        if (status != PJ_SUCCESS) { 
    59             param->flags &= ~(PJ_QOS_PARAM_HAS_802_1_P); 
     60            param->flags &= ~(PJ_QOS_PARAM_HAS_SO_PRIO); 
    6061            last_err = status; 
    6162        } 
     
    9495    if (status == PJ_SUCCESS) { 
    9596        p_param->flags |= PJ_QOS_PARAM_HAS_DSCP; 
    96         p_param->dscp_val = (pj_uint8_t)val; 
     97        p_param->dscp_val = (pj_uint8_t)(val >> 2); 
    9798    } else { 
    9899        last_err = status; 
     
    104105                                &val, &optlen); 
    105106    if (status == PJ_SUCCESS) { 
    106         p_param->flags |= PJ_QOS_PARAM_HAS_802_1_P; 
     107        p_param->flags |= PJ_QOS_PARAM_HAS_SO_PRIO; 
    107108        p_param->so_prio = (pj_uint8_t)val; 
    108109    } else { 
     
    129130 
    130131#endif  /* PJ_QOS_IMPLEMENTATION */ 
     132 
  • pjproject/trunk/pjlib/src/pj/sock_qos_common.c

    r2966 r2967  
    2424 
    2525#define THIS_FILE   "sock_qos_common.c" 
    26 #define ALL_FLAGS   (PJ_QOS_PARAM_HAS_DSCP | PJ_QOS_PARAM_HAS_802_1_P | \ 
     26#define ALL_FLAGS   (PJ_QOS_PARAM_HAS_DSCP | PJ_QOS_PARAM_HAS_SO_PRIO | \ 
    2727                     PJ_QOS_PARAM_HAS_WMM) 
    2828 
     
    6767    } 
    6868 
    69     if (param->flags & PJ_QOS_PARAM_HAS_802_1_P) { 
     69    if (param->flags & PJ_QOS_PARAM_HAS_SO_PRIO) { 
    7070        for (i=0; i<=PJ_QOS_TYPE_CONTROL; ++i) { 
    7171            if (param->so_prio >= qos_map[i].so_prio) 
  • pjproject/trunk/pjlib/src/pj/sock_qos_symbian.cpp

    r2966 r2967  
    2828     
    2929    /* SO_PRIORITY and WMM are not supported */ 
    30     param->flags &= ~(PJ_QOS_PARAM_HAS_802_1_P | PJ_QOS_PARAM_HAS_WMM); 
     30    param->flags &= ~(PJ_QOS_PARAM_HAS_SO_PRIO | PJ_QOS_PARAM_HAS_WMM); 
    3131     
    3232    if (param->flags & PJ_QOS_PARAM_HAS_DSCP) { 
Note: See TracChangeset for help on using the changeset viewer.