Ok, here is a darcs whatsnew patch for adding the IP TOS to tport. I didn't look into Win32 compatibility or any other validity tests, but it does set the TOS properly.

Colin..


[EMAIL PROTECTED] sofia-sip]$ darcs whatsnew
{
hunk ./libsofia-sip-ua/tport/sofia-sip/tport_tag.h 260
+
+TPORT_DLL extern tag_typedef_t tptag_tos;
+/** Sets the IP TOS for the socket. */
+#define TPTAG_TOS(x) tptag_tos, tag_uint_v((x))
+
+TPORT_DLL extern tag_typedef_t tptag_tos_ref;
+#define TPTAG_TOS_REF(x) tptag_tos_ref, tag_uint_vr(&(x))
hunk ./libsofia-sip-ua/tport/tport.c 300
+/** Set IP TOS for socket */
+void tport_set_tos( su_socket_t socket, int tos )
+{
+       if ( tos >= 0 && $
+               setsockopt(socket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) {
+               SU_DEBUG_3(("setsockopt(IP_TOS): %s\n", $
+                       su_strerror(su_errno())));
+       }
+}
+
hunk ./libsofia-sip-ua/tport/tport.c 460
+  tpp->tpp_tos = -1;                  /* set invalid, valid values are 0-255 */
hunk ./libsofia-sip-ua/tport/tport.c 838
+       /* Set IP TOS if primary is set */
+       tport_set_tos( socket, self->tp_pri->pri_params->tpp_tos );
hunk ./libsofia-sip-ua/tport/tport.c 1104
+              TPTAG_TOS(tpp->tpp_tos),
hunk ./libsofia-sip-ua/tport/tport.c 1152
+             TPTAG_TOS_REF(tpp->tpp_tos),
hunk ./libsofia-sip-ua/tport/tport_internal.h 94
+  int      tpp_tos;         /**< IP TOS */
hunk ./libsofia-sip-ua/tport/tport_internal.h 363
+void tport_set_tos( su_socket_t socket, int tos );
+
hunk ./libsofia-sip-ua/tport/tport_tag.c 80
+tag_typedef_t tptag_tos = UINTTAG_TYPEDEF(tos);
+
hunk ./libsofia-sip-ua/tport/tport_type_sctp.c 153
+
+  /* Set IP TOS if set */
+  tport_set_tos( socket, pri->pri_params->tpp_tos );
hunk ./libsofia-sip-ua/tport/tport_type_tcp.c 113
+
+  /* Set IP TOS if set */
+  tport_set_tos( socket, pri->pri_params->tpp_tos );
hunk ./libsofia-sip-ua/tport/tport_type_udp.c 153
+
+  tport_set_tos( s, pri->pri_params->tpp_tos );
}



Pekka Pessi wrote:
On 12/4/06, Colin Whittaker <[EMAIL PROTECTED]> wrote:
  
 I'm looking at implementing setting the IP TOS for SIP messages.
 My first idea is to add a tport tag, say, TPTAG_TOS( x ).
 And in each of the vtable functions of tport,
 tport_udp_init_primary(), tport_tcp_init_primary(), and
tport_sctp_init_primary(),  and tport_base_connect(),
 add a
 setsockopt( socket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos) )
    

I guess tport_alloc_secondary() instead of tport_base_connect()?

  
 Is this sufficient ?
 Are there other places I would need to add this setting ?
    

I'm not sure how the sockets inherit TOS settings. I guess that it is
enough when you cover all the case where you make an UDP socket or TCP
connection. SCTP does not really work with SIP.

  
 Should I add tos to the tport_params_t ?
    

Yep.

  
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to