1
/* $Id: sock_qos_wm.c 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2009-2011 Teluu Inc. (http://www.teluu.com)
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#include <pj/sock_qos.h>
20
#include <pj/assert.h>
26
/* QoS implementation for Windows Mobile 6, must be enabled explicitly
27
* (this is controlled by pjlib's config.h)
29
#if defined(PJ_QOS_IMPLEMENTATION) && PJ_QOS_IMPLEMENTATION==PJ_QOS_WM
31
#define THIS_FILE "sock_qos_wm.c"
33
/* Mapping between our traffic type and WM's DSCP traffic types */
34
static const int dscp_map[] =
43
PJ_DEF(pj_status_t) pj_sock_set_qos_params(pj_sock_t sock,
49
PJ_LOG(4,(THIS_FILE, "pj_sock_set_qos_params() is not implemented "
50
"for this platform"));
54
PJ_DEF(pj_status_t) pj_sock_set_qos_type(pj_sock_t sock,
59
PJ_ASSERT_RETURN(type < PJ_ARRAY_SIZE(dscp_map), PJ_EINVAL);
61
value = dscp_map[type];
62
return pj_sock_setsockopt(sock, IPPROTO_IP, IP_DSCP_TRAFFIC_TYPE,
63
&value, sizeof(value));
67
PJ_DEF(pj_status_t) pj_sock_get_qos_params(pj_sock_t sock,
68
pj_qos_params *p_param)
71
PJ_UNUSED_ARG(p_param);
73
PJ_LOG(4,(THIS_FILE, "pj_sock_get_qos_params() is not implemented "
74
"for this platform"));
78
PJ_DEF(pj_status_t) pj_sock_get_qos_type(pj_sock_t sock,
85
optlen = sizeof(value);
87
status = pj_sock_getsockopt(sock, IPPROTO_IP, IP_DSCP_TRAFFIC_TYPE,
89
if (status != PJ_SUCCESS)
92
*p_type = PJ_QOS_TYPE_BEST_EFFORT;
93
for (i=0; i<PJ_ARRAY_SIZE(dscp_map); ++i) {
94
if (value == dscp_map[i]) {
95
*p_type = (pj_qos_type)i;
103
#endif /* PJ_QOS_IMPLEMENTATION */