Hi, patch that adds NTATAG_TLS_ALIAS to support RFC 5923 (only client
side) available
on
https://gitorious.org/~alexsanderpetry/sofia-sip/alexsanderpetry-sofia-sip


--- a/libsofia-sip-ua/nta/nta.c
+++ b/libsofia-sip-ua/nta/nta.c
@@ -244,6 +244,8 @@ struct nta_agent_s
   unsigned sa_tcp_rport:1;     /**< Use rport with tcp, too */
   unsigned sa_tls_rport:1;     /**< Use rport with tls, too */

+  unsigned sa_tls_alias:1;     /**< Use alias with tls */
+
   unsigned sa_auto_comp:1;     /**< Automatically create compartments */
   unsigned sa_in_timer:1;      /**< Set when executing timers */
   unsigned sa_use_timer_c:1;   /**< Application has set value for timer C
*/
@@ -837,6 +839,7 @@ su_log_t nta_log[] = { SU_LOG_INIT("nta", "NTA_DEBUG",
SU_DEBUG) };
  * NTATAG_STATELESS(),
  * NTATAG_TAG_3261(), NTATAG_TCP_RPORT(), NTATAG_TIMEOUT_408(),
  * NTATAG_TLS_RPORT(),
+ * NTATAG_TLS_ALIAS(),
  * NTATAG_TIMER_C(), NTATAG_MAX_PROCEEDING(),
  * NTATAG_UA(), NTATAG_UDP_MTU(), NTATAG_USER_VIA(),
  * NTATAG_USE_NAPTR(), NTATAG_USE_SRV() and NTATAG_USE_TIMESTAMP().
@@ -1424,6 +1427,7 @@ void agent_kill_terminator(nta_agent_t *agent)
  * NTATAG_STATELESS(),
  * NTATAG_TAG_3261(), NTATAG_TCP_RPORT(), NTATAG_TIMEOUT_408(),
  * NTATAG_TLS_RPORT(),
+ * NTATAG_TLS_ALIAS(),
  * NTATAG_TIMER_C(), NTATAG_MAX_PROCEEDING(),
  * NTATAG_UA(), NTATAG_UDP_MTU(), NTATAG_USER_VIA(),
  * NTATAG_USE_NAPTR(), NTATAG_USE_SRV() and NTATAG_USE_TIMESTAMP().
@@ -1490,6 +1494,7 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
   int server_rport    = agent->sa_server_rport;
   int tcp_rport       = agent->sa_tcp_rport;
   int tls_rport       = agent->sa_tls_rport;
+  int tls_alias       = agent->sa_tls_alias;
   unsigned preload         = agent->sa_preload;
   unsigned threadpool      = agent->sa_tport_threadpool;
   char const *sigcomp = agent->sa_sigcomp_options;
@@ -1537,6 +1542,7 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
              NTATAG_STATELESS_REF(stateless),
              NTATAG_TCP_RPORT_REF(tcp_rport),
              NTATAG_TLS_RPORT_REF(tls_rport),
+             NTATAG_TLS_ALIAS_REF(tls_alias),
              NTATAG_TIMEOUT_408_REF(timeout_408),
              NTATAG_UA_REF(ua),
              NTATAG_UDP_MTU_REF(udp_mtu),
@@ -1711,6 +1717,7 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags)
   agent->sa_rport = rport != 0;
   agent->sa_tcp_rport = tcp_rport != 0;
   agent->sa_tls_rport = tls_rport != 0;
+  agent->sa_tls_alias = tls_alias != 0;
   agent->sa_preload = preload;
   agent->sa_tport_threadpool = threadpool;

@@ -2570,6 +2577,9 @@ int outgoing_insert_via(nta_outgoing_t *orq,
        (self->sa_tls_rport && v->v_protocol == sip_transport_tls)))
     msg_header_add_param(msg_home(msg), v->v_common, "rport");

+  if (self->sa_tls_alias && v->v_protocol == sip_transport_tls)
+    msg_header_add_param(msg_home(msg), v->v_common, "alias");
+
   if (!orq->orq_tpn->tpn_comp)
     msg_header_remove_param(v->v_common, "comp");

diff --git a/libsofia-sip-ua/nta/nta_tag.c b/libsofia-sip-ua/nta/nta_tag.c
index 1c09016..62f0e64 100644
--- a/libsofia-sip-ua/nta/nta_tag.c
+++ b/libsofia-sip-ua/nta/nta_tag.c
@@ -1399,6 +1399,32 @@ tag_typedef_t ntatag_tcp_rport =
BOOLTAG_TYPEDEF(tcp_rport);
  */
 tag_typedef_t ntatag_tls_rport = BOOLTAG_TYPEDEF(tls_rport);

+/**@def NTATAG_TLS_ALIAS(x)
+ *
+ * Use alias with TLS.
+ *
+ * @par Used with
+ *    nua_create(), nua_set_params(),
+ *    nta_agent_create(), nta_agent_set_params()
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - include alias parameter in the TLS via line on client side
+ *    - false - do not include alias parameter in the TLS via line
+ *      on client side
+ *
+ * @sa @RFC5923, @Via
+ *
+ * @NEW_1_12_12
+ */
+tag_typedef_t ntatag_tls_alias = BOOLTAG_TYPEDEF(tls_alias);
+
 /**@def NTATAG_PRELOAD(x)
  *
  * Preload by N bytes.
diff --git a/libsofia-sip-ua/nta/sofia-sip/nta_tag.h
b/libsofia-sip-ua/nta/sofia-sip/nta_tag.h
index 09f586c..a4cab2b 100644
--- a/libsofia-sip-ua/nta/sofia-sip/nta_tag.h
+++ b/libsofia-sip-ua/nta/sofia-sip/nta_tag.h
@@ -375,6 +375,12 @@ NTA_DLL extern tag_typedef_t ntatag_tls_rport;
 NTA_DLL extern tag_typedef_t ntatag_tls_rport_ref;
 #define NTATAG_TLS_RPORT_REF(x) ntatag_tls_rport_ref, tag_bool_vr(&(x))

+NTA_DLL extern tag_typedef_t ntatag_tls_alias;
+#define NTATAG_TLS_ALIAS(x) ntatag_tls_alias, tag_bool_v((x))
+
+NTA_DLL extern tag_typedef_t ntatag_tls_alias_ref;
+#define NTATAG_TLS_ALIAS_REF(x) ntatag_tls_alias_ref, tag_bool_vr(&(x))
+
 NTA_DLL extern tag_typedef_t ntatag_preload;
 #define NTATAG_PRELOAD(x) ntatag_preload, tag_uint_v((x))



Regards.
-- 
Alexsander Petry
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to