1
/* $Id: sock_qos_symbian.cpp 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 "os_symbian.h"
22
PJ_DEF(pj_status_t) pj_sock_set_qos_params(pj_sock_t sock,
25
PJ_ASSERT_RETURN(sock!=0 && sock!=PJ_INVALID_SOCKET, PJ_EINVAL);
27
CPjSocket *pjsock = (CPjSocket*)sock;
28
RSocket & rsock = pjsock->Socket();
29
pj_status_t last_err = PJ_ENOTSUP;
31
/* SO_PRIORITY and WMM are not supported */
32
param->flags &= ~(PJ_QOS_PARAM_HAS_SO_PRIO | PJ_QOS_PARAM_HAS_WMM);
34
if (param->flags & PJ_QOS_PARAM_HAS_DSCP) {
37
err = rsock.SetOpt(KSoIpTOS, KProtocolInetIp,
38
(param->dscp_val << 2));
39
if (err != KErrNone) {
40
last_err = PJ_RETURN_OS_ERROR(err);
41
param->flags &= ~(PJ_QOS_PARAM_HAS_DSCP);
45
return param->flags ? PJ_SUCCESS : last_err;
48
PJ_DEF(pj_status_t) pj_sock_set_qos_type(pj_sock_t sock,
54
status = pj_qos_get_params(type, ¶m);
55
if (status != PJ_SUCCESS)
58
return pj_sock_set_qos_params(sock, ¶m);
62
PJ_DEF(pj_status_t) pj_sock_get_qos_params(pj_sock_t sock,
63
pj_qos_params *p_param)
65
PJ_ASSERT_RETURN(sock!=0 && sock!=PJ_INVALID_SOCKET, PJ_EINVAL);
67
CPjSocket *pjsock = (CPjSocket*)sock;
68
RSocket & rsock = pjsock->Socket();
71
pj_bzero(p_param, sizeof(*p_param));
73
err = rsock.GetOpt(KSoIpTOS, KProtocolInetIp, dscp);
74
if (err == KErrNone) {
75
p_param->flags |= PJ_QOS_PARAM_HAS_DSCP;
76
p_param->dscp_val = (dscp >> 2);
79
return PJ_RETURN_OS_ERROR(err);
83
PJ_DEF(pj_status_t) pj_sock_get_qos_type(pj_sock_t sock,
89
status = pj_sock_get_qos_params(sock, ¶m);
90
if (status != PJ_SUCCESS)
93
return pj_qos_get_type(¶m, p_type);