add support for QoS

Change-Id: Ic75d07dd85a09af8255e24d5993920d8bf1ed005
diff --git a/include/ice_options.h b/include/ice_options.h
index 33ac76e..f117495 100644
--- a/include/ice_options.h
+++ b/include/ice_options.h
@@ -67,6 +67,19 @@
     std::string realm;    // credentials realm (optional, empty if not used)
 };
 
+/** Maps PJSIP QOS types */
+enum class QosType
+{
+    BEST_EFFORT,    /**< Best effort traffic (default value).
+                         Any QoS function calls with specifying
+                         this value are effectively no-op   */
+    BACKGROUND,     /**< Background traffic.                */
+    VIDEO,          /**< Video traffic.                     */
+    VOICE,          /**< Voice traffic.                     */
+    CONTROL,        /**< Control traffic.                   */
+    SIGNALLING      /**< Signalling traffic.                */
+};
+
 struct IceTransportOptions
 {
     std::shared_ptr<IceTransportFactory> factory {};
@@ -83,6 +96,8 @@
     IpAddr accountLocalAddr {};
     IpAddr accountPublicAddr {};
     std::shared_ptr<upnp::UPnPContext> upnpContext {};
+    /** Per component QoS Type. */
+    std::vector<QosType> qosType {};
 };
 
 }
diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp
index 2817195..52a6383 100644
--- a/src/ice_transport.cpp
+++ b/src/ice_transport.cpp
@@ -423,6 +423,15 @@
         config_.stun.conn_type = PJ_STUN_TP_UDP;
         config_.turn.conn_type = PJ_TURN_TP_UDP;
     }
+    if (options.qosType.size() == 1) {
+        config_.stun.cfg.qos_type = (pj_qos_type)options.qosType[0];
+        config_.turn.cfg.qos_type = (pj_qos_type)options.qosType[0];
+    }
+    if (options.qosType.size() == compCount_) {
+        for (unsigned i = 0; i < compCount_; ++i) {
+            config_.comp[i].qos_type = (pj_qos_type)(options.qosType[i]);
+        }
+    }
 
     pool_.reset(
         pj_pool_create(factory->getPoolFactory(), "IceTransport.pool", 512, 512, NULL));