MirOS Manual: net_addrcmp(3)

NET_ADDRCMP(3)             BSD Programmer's Manual              NET_ADDRCMP(3)

NAME

     net_addrcmp - compare socket address structures

SYNOPSIS

     #include <netdb.h>

     int
     net_addrcmp(struct sockaddr *sa1, struct sockaddr *sa2);

DESCRIPTION

     The net_addrcmp() function compares two socket address structures, sa1
     and sa2.

RETURN VALUES

     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.

HISTORY

     A net_addrcmp() function was added in OpenBSD 2.5.

MirOS BSD #10-current            July 3, 1999                                1

Generated on 2017-04-03 16:26:17 by $MirOS: src/scripts/roff2htm,v 1.88 2017/01/29 00:51:06 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–2017 The MirOS Project, Germany.
This product includes material provided by mirabilos.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.