Opened 14 years ago

Last modified 14 years ago

#950 closed enhancement

Support for QoS settings (TOS, DSCP, WMM, 802.1p) for sockets — at Version 4

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-1.5
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp)


QoS settings are available for both Layer 2 and Layer 3 of TCP/IP protocols:

Layer 2: IEEE 802.1p for Ethernet

IEEE 802.1p tagging will mark frames sent by a host for prioritized delivery using a 3-bit Priority field in the virtual local area network (VLAN) header of the Ethernet frame. The VLAN header is placed inside the Ethernet header, between the Source Address field and either the Length field (for an IEEE 802.3 frame) or the EtherType field (for an Ethernet II frame).

Layer 2: WMM

At the Network Interface layer for IEEE 802.11 wireless, the Wi-Fi Alliance certification for Wi-Fi Multimedia (WMM) defines four access categories for prioritizing network traffic. These access categories are (in order of highest to lowest priority) voice, video, best-effort, and background. Host support for WMM prioritization requires that both wireless network adapters and their drivers support WMM. Wireless access points (APs) must have WMM enabled.

Layer 3: DSCP

At the Internet layer, you can use Differentiated Services/Diffserv? and set the value of the Differentiated Services Code Point (DSCP) in the IP header. As defined in RFC 2472, the DSCP value is the high-order 6 bits of the IP version 4 (IPv4) TOS field and the IP version 6 (IPv6) Traffic Class field.

Layer 3: Other

Other mechanisms exist (such as RSVP, IntServ) but this will not be implemented.



Ethernet 802.1p tagging is available via SO_PRIORITY option. DSCP is available via IP TOS option. Both are settable via setsockopt(). WMM is not known to be available.


(It's a mess!)

DSCP is settable with setsockopt() on Windows 2000 or older, but Windows would silently ignore this call on WinXP or later, unless administrator modifies the registry. On Windows 2000, Windows XP, and Windows Server 2003, GQoS (Generic QoS) API is the standard API, but this API may not be supported in the future. On Vista and Windows 7, the is a new QoS2 API, also known as Quality Windows Audio-Video Experience (qWAVE).

IEEE 802.1p tagging is available via Traffic Control (TC) API, available on Windows XP SP2, but this needs administrator access. For Vista and later, it's in qWAVE.

WMM is available for mobile platforms on Windows Mobile 6 platform and Windows Embedded CE 6, via setsockopt(IP_DSCP_TRAFFIC_TYPE). qWAVE supports this as well.

Symbian S60 3rd Ed

Both DSCP and WMM is supported via RSocket::SetOpt() with will set both Layer 2 and Layer 3 QoS settings accordingly.


The objective of this ticket is to add new API to PJLIB socket API to enable manipulation of the QoS parameters above in a uniform and portable manner.


Based on the above, the following API is proposed.

Declare the following "standard" traffic classes.

typedef enum pj_sock_dscp_class
} pj_sock_dscp_class;

The traffic classes above will determine how the Layer 2 and 3 QoS settings will be used. As general guidelines, the mapping between the classes above to the corresponding Layer 2 and 3 settings are as follows:

PJLIB Traffic Class IP DSCP WMM* 802.1p Priority

*: WMM acronyms:

  • BE: Bulk effort priority
  • BK: Bulk priority
  • VI: Video priority
  • VO: Voice priority

Application applies the traffic class to a socket via this new APIs:

PJ_DECL(pj_status_t) pj_sock_set_dscp_class(pj_sock_t sock,
                                            pj_sock_dscp_class c);

The API will set the traffic type according to the DSCP class, for both Layer 2 and Layer 3 QoS setting, where it's available. If any of the layer QoS is not settable, the API will silently ignore it. If both layers are not setable, the API will return error.


Win32 may not be implemented due to the API mess above.

There is no get API for now, since it may be difficult to map the current socket (native) QoS values into PJLIB traffic classes.


  1. Good intro for QoS (especially on Windows):
  2. WMM on Windows Mobile:
  3. WMM and DSCP on Symbian:

Change History (4)

comment:1 Changed 14 years ago by bennylp

  • Description modified (diff)

comment:2 Changed 14 years ago by bennylp

  • Description modified (diff)

comment:3 Changed 14 years ago by bennylp

  • Description modified (diff)

comment:4 Changed 14 years ago by bennylp

  • Description modified (diff)

Removed the get_dscp_class() API.

Note: See TracTickets for help on using tickets.