47 | | |
| 49 | Based on the above, the following API is proposed. |
| 50 | |
| 51 | Declare the following "standard" traffic classes. |
| 52 | |
| 53 | {{{ |
| 54 | typedef enum pj_sock_dscp_class |
| 55 | { |
| 56 | PJ_SOCK_DSCP_BEST_EFFORT, |
| 57 | PJ_SOCK_DSCP_BACKGROUND, |
| 58 | PJ_SOCK_DSCP_VIDEO, |
| 59 | PJ_SOCK_DSCP_AUDIO |
| 60 | } pj_sock_dscp_class; |
| 61 | }}} |
| 62 | |
| 63 | 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: |
| 64 | |
| 65 | || PJLIB Traffic Class || IP DSCP || WMM* || 802.1p || |
| 66 | || BEST_EFFORT || 0x00 || BE || || |
| 67 | || BACKGROUND || 0x08 || BK || || |
| 68 | || VIDEO || 0x28 || VI || || |
| 69 | || AUDIO || 0x38 || VO || || |
| 70 | |
| 71 | *: WMM acronyms: |
| 72 | - BE: Bulk effort priority |
| 73 | - BK: Bulk priority |
| 74 | - VI: Video priority |
| 75 | - VO: Voice priority |
| 76 | |
| 77 | Application applies the traffic class to a socket via this new APIs: |
| 78 | |
| 79 | {{{ |
| 80 | PJ_DECL(pj_status_t) pj_sock_set_dscp_class(pj_sock_t sock, |
| 81 | pj_sock_dscp_class c); |
| 82 | PJ_DECL(pj_status_t) pj_sock_get_dscp_class(pj_sock_t sock, |
| 83 | pj_sock_dscp_class *c); |
| 84 | }}} |
| 85 | |
| 86 | 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 set/get-able, the API will silently ignore it. If '''both''' layers are not set/get-able, the API will return error. |
| 87 | |
| 88 | '''Limitations''' |
| 89 | |
| 90 | Win32 may not be implemented due to the API mess above. |
| 91 | |
| 92 | '''References''' |
| 93 | |
| 94 | [1] Good intro for QoS (especially on Windows): http://technet.microsoft.com/en-gb/magazine/2007.02.cableguy.aspx |
| 95 | [2] WMM on Windows Mobile: http://msdn.microsoft.com/en-us/library/aa916767.aspx |
| 96 | [3] WMM and DSCP on Symbian: http://wiki.forum.nokia.com/index.php/VoIP_developer_guidelines_for_S60 |
| 97 | |