NET_ADDRCMP(3) BSD Programmer's Manual NET_ADDRCMP(3)
net_addrcmp - compare socket address structures
#include <netdb.h>
int
net_addrcmp(struct sockaddr *sa1, struct sockaddr *sa2);
The net_addrcmp() function compares two socket address structures, sa1
and sa2.
If sa1 and sa2 are for the same address, net_addrcmp() returns 0.
The sa_len fields are compared first. If they do not match, net_addrcmp()
returns -1 or 1 if sa1->sa_len is less than or greater than sa2->sa_len,
respectively.
Next, the sa_family members are compared. If they do not match,
net_addrcmp() returns -1 or 1 if sa1->sa_family is less than or greater
than sa2->sa_family, respectively.
Lastly, if each socket address structure's sa_len and sa_family fields
match, the protocol-specific data (the sa_data field) is compared. If
there's a match, both sa1 and sa2 must refer to the same address, and 0
is returned; otherwise, a value >0 or <0 is returned.
A net_addrcmp() function was added in OpenBSD 2.5.
MirOS BSD #10-current July 3, 1999 1
Generated on 2012-02-20 02:47:02 by $MirOS: src/scripts/roff2htm,v 1.70 2011/12/03 18:21:12 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2011 The MirOS Project, Germany.
This product includes material
provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.