1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
26 HREF="net-common-tcpip-manpages-link-addr.html"><LINK
29 HREF="net-common-tcpip-manpages-ns.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="net-common-tcpip-manpages-link-addr.html"
65 >Chapter 38. TCP/IP Library Reference</TD
71 HREF="net-common-tcpip-manpages-ns.html"
85 NAME="NET-COMMON-TCPIP-MANPAGES-NET-ADDRCMP">net_addrcmp</H1
94 >NET_ADDRCMP(3) System Library Functions Manual NET_ADDRCMP(3)
97 net_addrcmp - compare socket address structures
100 #include <netdb.h>
103 net_addrcmp(struct sockaddr *sa1, struct sockaddr *sa2);
106 The net_addrcmp() function compares two socket address structures, sa1
110 If sa1 and sa2 are for the same address, net_addrcmp() returns 0.
112 The sa_len fields are compared first. If they do not match,
113 net_addrcmp() returns -1 or 1 if sa1->sa_len is less than or greater than
114 sa2->sa_len, respectively.
116 Next, the sa_family members are compared. If they do not match,
117 net_addrcmp() returns -1 or 1 if sa1->sa_family is less than or greater
118 than sa2->sa_family, respectively.
120 Lastly, if each socket address structure's sa_len and sa_family fields
121 match, the protocol-specific data (the sa_data field) is compared. If
122 there's a match, both sa1 and sa2 must refer to the same address, and 0
123 is returned; otherwise, a value >0 or <0 is returned.
126 A net_addrcmp() function was added in OpenBSD 2.5.
139 SUMMARY="Footer navigation table"
150 HREF="net-common-tcpip-manpages-link-addr.html"
168 HREF="net-common-tcpip-manpages-ns.html"
184 HREF="tcpip-library-reference.html"