~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.2.1/pjlib/src/pj/sock_qos_symbian.cpp

  • Committer: Package Import Robot
  • Author(s): Francois Marier, Francois Marier, Mark Purcell
  • Date: 2014-10-18 15:08:50 UTC
  • mfrom: (1.1.12)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20141018150850-2exfk34ckb15pcwi
Tags: 1.4.1-0.1
[ Francois Marier ]
* Non-maintainer upload
* New upstream release (closes: #759576, #741130)
  - debian/rules +PJPROJECT_VERSION := 2.2.1
  - add upstream patch to fix broken TLS support
  - add patch to fix pjproject regression

[ Mark Purcell ]
* Build-Depends:
  - sflphone-daemon + libavformat-dev, libavcodec-dev, libswscale-dev,
  libavdevice-dev, libavutil-dev
  - sflphone-gnome + libclutter-gtk-1.0-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: sock_qos_symbian.cpp 3553 2011-05-05 06:14:19Z nanang $ */
 
2
/* 
 
3
 * Copyright (C) 2009-2011 Teluu Inc. (http://www.teluu.com)
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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 
 
18
 */
 
19
#include <pj/sock_qos.h>
 
20
#include "os_symbian.h"
 
21
 
 
22
PJ_DEF(pj_status_t) pj_sock_set_qos_params(pj_sock_t sock,
 
23
                                           pj_qos_params *param)
 
24
{
 
25
    PJ_ASSERT_RETURN(sock!=0 && sock!=PJ_INVALID_SOCKET, PJ_EINVAL);
 
26
    
 
27
    CPjSocket *pjsock = (CPjSocket*)sock;
 
28
    RSocket & rsock = pjsock->Socket();
 
29
    pj_status_t last_err = PJ_ENOTSUP;
 
30
    
 
31
    /* SO_PRIORITY and WMM are not supported */
 
32
    param->flags &= ~(PJ_QOS_PARAM_HAS_SO_PRIO | PJ_QOS_PARAM_HAS_WMM);
 
33
    
 
34
    if (param->flags & PJ_QOS_PARAM_HAS_DSCP) {
 
35
        TInt err;
 
36
        
 
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);
 
42
        }
 
43
    }
 
44
    
 
45
    return param->flags ? PJ_SUCCESS : last_err;
 
46
}
 
47
 
 
48
PJ_DEF(pj_status_t) pj_sock_set_qos_type(pj_sock_t sock,
 
49
                                         pj_qos_type type)
 
50
{
 
51
    pj_qos_params param;
 
52
    pj_status_t status;
 
53
    
 
54
    status = pj_qos_get_params(type, &param);
 
55
    if (status != PJ_SUCCESS)
 
56
        return status;
 
57
    
 
58
    return pj_sock_set_qos_params(sock, &param);
 
59
}
 
60
 
 
61
 
 
62
PJ_DEF(pj_status_t) pj_sock_get_qos_params(pj_sock_t sock,
 
63
                                           pj_qos_params *p_param)
 
64
{
 
65
    PJ_ASSERT_RETURN(sock!=0 && sock!=PJ_INVALID_SOCKET, PJ_EINVAL);
 
66
    
 
67
    CPjSocket *pjsock = (CPjSocket*)sock;
 
68
    RSocket & rsock = pjsock->Socket();
 
69
    TInt err, dscp;
 
70
    
 
71
    pj_bzero(p_param, sizeof(*p_param));
 
72
 
 
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);
 
77
        return PJ_SUCCESS;
 
78
    } else {
 
79
        return PJ_RETURN_OS_ERROR(err);
 
80
    }
 
81
}
 
82
 
 
83
PJ_DEF(pj_status_t) pj_sock_get_qos_type(pj_sock_t sock,
 
84
                                         pj_qos_type *p_type)
 
85
{
 
86
    pj_qos_params param;
 
87
    pj_status_t status;
 
88
    
 
89
    status = pj_sock_get_qos_params(sock, &param);
 
90
    if (status != PJ_SUCCESS)
 
91
        return status;
 
92
    
 
93
    return pj_qos_get_type(&param, p_type);
 
94
}
 
95