Bug 961313 - Add the transport protocol to candidate labels. r=abr
☠☠ backed out by 02118ca19721 ☠ ☠
authorByron Campen [:bwc] <docfaraday@gmail.com>
Wed, 22 Jan 2014 16:50:52 -0800
changeset 165321 ce887b471785
parent 165320 0783396d0342
child 165322 d6646242ba77
push id38942
push userryanvm@gmail.com
push date2014-01-27 13:26 +0000
treeherdermozilla-inbound@d6646242ba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersabr
bugs961313
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 961313 - Add the transport protocol to candidate labels. r=abr
media/mtransport/third_party/nICEr/src/net/transport_addr.c
media/mtransport/third_party/nICEr/src/net/transport_addr.h
--- a/media/mtransport/third_party/nICEr/src/net/transport_addr.c
+++ b/media/mtransport/third_party/nICEr/src/net/transport_addr.c
@@ -52,27 +52,39 @@ static char *RCSSTRING __UNUSED__="$Id: 
 #include "nr_api.h"
 #include "transport_addr.h"
 
 int nr_transport_addr_fmt_addr_string(nr_transport_addr *addr)
   {
     int _status;
     /* Max length for normalized IPv6 address string represntation is 39 */
     char buffer[40];
+    const char *protocol;
+
+    switch(addr->protocol){
+      case IPPROTO_TCP:
+        protocol = "TCP";
+        break;
+      case IPPROTO_UDP:
+        protocol = "UDP";
+        break;
+      default:
+        ABORT(R_INTERNAL);
+    }
 
     switch(addr->ip_version){
       case NR_IPV4:
         if (!inet_ntop(AF_INET, &addr->u.addr4.sin_addr,buffer,sizeof(buffer)))
           strcpy(buffer, "[error]");
-        snprintf(addr->as_string,sizeof(addr->as_string),"IP4:%s:%d",buffer,ntohs(addr->u.addr4.sin_port));
+        snprintf(addr->as_string,sizeof(addr->as_string),"IP4:%s:%d/%s",buffer,ntohs(addr->u.addr4.sin_port),protocol);
         break;
       case NR_IPV6:
         if (!inet_ntop(AF_INET6, &addr->u.addr6.sin6_addr,buffer,sizeof(buffer)))
           strcpy(buffer, "[error]");
-        snprintf(addr->as_string,sizeof(addr->as_string),"IP6:[%s]:%d",buffer,ntohs(addr->u.addr6.sin6_port));
+        snprintf(addr->as_string,sizeof(addr->as_string),"IP6:[%s]:%d/%s",buffer,ntohs(addr->u.addr6.sin6_port),protocol);
         break;
       default:
         ABORT(R_INTERNAL);
     }
 
     _status=0;
   abort:
     return(_status);
--- a/media/mtransport/third_party/nICEr/src/net/transport_addr.h
+++ b/media/mtransport/third_party/nICEr/src/net/transport_addr.h
@@ -62,18 +62,18 @@ typedef struct nr_transport_addr_ {
   struct sockaddr *addr;
   int addr_len;
   union {
     struct sockaddr_in addr4;
     struct sockaddr_in6 addr6;
   } u;
   char ifname[MAXIFNAME];
   /* A string version.
-     52 = 5 ("IP6:[") + 39 (ipv6 address) + 2 ("]:") + 5 (port) + 1 (null) */
-  char as_string[52];
+     56 = 5 ("IP6:[") + 39 (ipv6 address) + 2 ("]:") + 5 (port) + 4 (/UDP) + 1 (null) */
+  char as_string[56];
 } nr_transport_addr;
 
 int nr_sockaddr_to_transport_addr(struct sockaddr *saddr, int saddr_len, int protocol, int keep, nr_transport_addr *addr);
 
 // addresses, ports in local byte order
 int nr_ip4_port_to_transport_addr(UINT4 ip4, UINT2 port, int protocol, nr_transport_addr *addr);
 int nr_ip4_str_port_to_transport_addr(const char *ip4, UINT2 port, int protocol, nr_transport_addr *addr);