Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
0f5bafaa
Commit
0f5bafaa
authored
Jul 26, 2012
by
Alexandre Savard
Browse files
#13891: Make TLS support optional
parent
fe4954e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
daemon/src/sip/siptransport.cpp
View file @
0f5bafaa
...
...
@@ -55,7 +55,9 @@
#include
"sipaccount.h"
#include
"pjsip/sip_types.h"
#if HAVE_TLS
#include
"pjsip/sip_transport_tls.h"
#endif
#include
"dbus/dbusmanager.h"
#include
"dbus/configurationmanager.h"
...
...
@@ -248,7 +250,7 @@ pj_status_t SipTransport::destroyStunResolver(const std::string &serverName)
return
PJ_SUCCESS
;
}
#if HAVE_TLS
pjsip_tpfactory
*
SipTransport
::
createTlsListener
(
SIPAccount
&
account
)
{
pj_sockaddr_in
local_addr
;
...
...
@@ -278,7 +280,6 @@ pjsip_tpfactory* SipTransport::createTlsListener(SIPAccount &account)
return
listener
;
}
pjsip_transport
*
SipTransport
::
createTlsTransport
(
SIPAccount
&
account
)
{
...
...
@@ -317,6 +318,7 @@ SipTransport::createTlsTransport(SIPAccount &account)
RETURN_IF_FAIL
(
transport
!=
NULL
,
NULL
,
"Could not create new TLS transport"
);
return
transport
;
}
#endif
namespace
{
std
::
string
transportMapKey
(
const
std
::
string
&
interface
,
int
port
)
...
...
@@ -331,9 +333,13 @@ void SipTransport::createSipTransport(SIPAccount &account)
{
shutdownSipTransport
(
account
);
#if HAVE_TLS
if
(
account
.
isTlsEnabled
())
{
account
.
transport_
=
createTlsTransport
(
account
);
}
else
if
(
account
.
isStunEnabled
())
{
#else
if
(
account
.
isStunEnabled
())
{
#endif
account
.
transport_
=
createStunTransport
(
account
);
if
(
account
.
transport_
==
NULL
)
{
WARN
(
"falling back to UDP transport"
);
...
...
@@ -352,9 +358,11 @@ void SipTransport::createSipTransport(SIPAccount &account)
}
if
(
!
account
.
transport_
)
{
#if HAVE_TLS
if
(
account
.
isTlsEnabled
())
throw
std
::
runtime_error
(
"Could not create TLS connection"
);
else
#endif
throw
std
::
runtime_error
(
"Could not create new UDP transport"
);
}
}
...
...
daemon/src/sip/siptransport.h
View file @
0f5bafaa
...
...
@@ -43,6 +43,8 @@
#include
<pjnath/stun_config.h>
#include
"noncopyable.h"
#include
"config.h"
class
SIPAccount
;
class
SipTransport
{
...
...
@@ -136,6 +138,8 @@ class SipTransport {
pjsip_transport
*
createStunTransport
(
SIPAccount
&
account
);
#if HAVE_TLS
/**
* Create a connection oriented TLS transport and register to the specified remote address.
* First, initialize the TLS listener sole instance. This means that, for the momment, only one TLS transport
...
...
@@ -154,6 +158,7 @@ class SipTransport {
*/
pjsip_tpfactory
*
createTlsListener
(
SIPAccount
&
account
);
#endif
/**
* Create a new stun resolver. Store it inside the array. Resolve public address for this
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment