From b1fb764cbf310b33cf706bcc7fc825fbc3505c95 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Thu, 19 Apr 2012 15:17:51 -0400
Subject: [PATCH] * #9871: SipTransport: hide more implementation

---
 daemon/src/sip/siptransport.cpp | 13 +++----------
 daemon/src/sip/siptransport.h   | 30 +++++++++++++++---------------
 2 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/daemon/src/sip/siptransport.cpp b/daemon/src/sip/siptransport.cpp
index 64b12780f7..f2b8b6b2d2 100644
--- a/daemon/src/sip/siptransport.cpp
+++ b/daemon/src/sip/siptransport.cpp
@@ -43,22 +43,17 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
-#include <unistd.h>
 #include <arpa/inet.h>
 #include <net/if.h>
+#include <stdexcept>
 
 #include "logger.h"
 #include "siptransport.h"
 #include "manager.h"
 
-#include "sip/sdp.h"
-#include "sipcall.h"
 #include "sipaccount.h"
-#include "eventthread.h"
-#include "sdes_negotiator.h"
 
 #include "dbus/dbusmanager.h"
-#include "dbus/callmanager.h"
 #include "dbus/configurationmanager.h"
 
 static const char * const DEFAULT_INTERFACE = "default";
@@ -366,16 +361,14 @@ void SipTransport::createSipTransport(SIPAccount &account)
 
 void SipTransport::createDefaultSipUdpTransport()
 {
-    pj_uint16_t port = 0;
-    int counter = 0;
-
     DEBUG("SipTransport: Create default sip udp transport");
 
     SIPAccount *account = Manager::instance().getIP2IPAccount();
 
     pjsip_transport *transport = NULL;
+    pj_uint16_t port = 0;
     static const int DEFAULT_TRANSPORT_ATTEMPTS = 5;
-    for (; transport == NULL and counter < DEFAULT_TRANSPORT_ATTEMPTS; ++counter) {
+    for (int counter = 0; transport == NULL and counter < DEFAULT_TRANSPORT_ATTEMPTS; ++counter) {
         // if default udp transport fails to init on 5060, try other ports
         // with 2 step size increment (i.e. 5062, 5064, ...)
         port = account->getLocalPort() + (counter * 2);
diff --git a/daemon/src/sip/siptransport.h b/daemon/src/sip/siptransport.h
index ace2d3478b..79b874b705 100644
--- a/daemon/src/sip/siptransport.h
+++ b/daemon/src/sip/siptransport.h
@@ -92,14 +92,6 @@ class SipTransport {
             pool_ = pool;
         }
 
-        /**
-         * Create a new stun resolver. Store it inside the array. Resolve public address for this
-         * server name.
-         * @param serverName The name of the stun server
-         * @param port number
-         */
-        pj_status_t createStunResolver(pj_str_t serverName, pj_uint16_t port);
-
         pj_status_t destroyStunResolver(const std::string &serverName);
 
         /**
@@ -111,13 +103,6 @@ class SipTransport {
 
         void createDefaultSipUdpTransport();
 
-        /**
-        * Create SIP UDP transport from account's setting
-        * @param account The account for which a transport must be created.
-        */
-        pjsip_transport *createUdpTransport(const std::string &interface,
-                                            unsigned int port);
-
         /**
          * Initialize the transport selector
          * @param transport		A transport associated with an account
@@ -165,6 +150,21 @@ class SipTransport {
         pjsip_tpfactory *
         createTlsListener(SIPAccount &account);
 
+        /**
+         * Create a new stun resolver. Store it inside the array. Resolve public address for this
+         * server name.
+         * @param serverName The name of the stun server
+         * @param port number
+         */
+        pj_status_t createStunResolver(pj_str_t serverName, pj_uint16_t port);
+
+        /**
+        * Create SIP UDP transport from account's setting
+        * @param account The account for which a transport must be created.
+        */
+        pjsip_transport *createUdpTransport(const std::string &interface,
+                                            unsigned int port);
+
         /**
          * UDP Transports are stored in this map in order to retreive them in case
          * several accounts would share the same port number.
-- 
GitLab