[asterisk-commits] blanchet: branch group/v6 r85135 - /team/group/v6/trunk/main/netsock.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 9 10:53:30 CDT 2007


Author: blanchet
Date: Tue Oct  9 10:53:29 2007
New Revision: 85135

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85135
Log:
new routine to compare IP address families of two sockaddr.

Modified:
    team/group/v6/trunk/main/netsock.c

Modified: team/group/v6/trunk/main/netsock.c
URL: http://svn.digium.com/view/asterisk/team/group/v6/trunk/main/netsock.c?view=diff&rev=85135&r1=85134&r2=85135
==============================================================================
--- team/group/v6/trunk/main/netsock.c (original)
+++ team/group/v6/trunk/main/netsock.c Tue Oct  9 10:53:29 2007
@@ -1246,6 +1246,20 @@
 }
 
 
+/*! \brief Compares the IP version of two sockaddr
+ *  \return 0 if ip versions are identical (i.e. both ipv4 or both ipv6), <0 or >0 otherwise
+ */
+int ast_vinetsock_sa_ipv_cmp(const struct sockaddr *sa1,
+                    socklen_t sa1len,
+                    const struct sockaddr *sa2,
+                    socklen_t sa2len)
+	{
+        if (NULL == sa1 || NULL == sa2) {
+                return 1;
+		}
+	return !(sa1->sa_family == sa2->sa_family);
+}
+
 /*! \briefCompares the source address and port of two sockaddr_storage
  *  or only the address
  *  \param ignore_port If true, ignore the ports in the comparison




More information about the asterisk-commits mailing list