*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> net_addrcmp (3)              
Title
Content
Arch
Section
 

NET_ADDRCMP(3)

Contents


NAME    [Toc]    [Back]

     net_addrcmp - compare socket address structures

SYNOPSIS    [Toc]    [Back]

     #include <netdb.h>

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

DESCRIPTION    [Toc]    [Back]

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

RETURN VALUES    [Toc]    [Back]

     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    [Toc]    [Back]

     A net_addrcmp() function was added in OpenBSD 2.5.

OpenBSD      3.6                           July      3,      1999
[ Back ]
 Similar pages
Name OS Title
SSL_SESSION_cmp Tru64 Compare two SSL_SESSION structures
inet_ntop Linux Parse network address structures
getsockname HP-UX get socket address
bind HP-UX bind an address to a socket
rresvport Tru64 Retrieve a socket with a privileged address
rresvport_af Tru64 Retrieve a socket with a privileged address
bind FreeBSD assign a local protocol address to a socket
mac_get FreeBSD get the label of a file, socket, socket peer or process
mac_get_proc FreeBSD get the label of a file, socket, socket peer or process
mac_get_pid FreeBSD get the label of a file, socket, socket peer or process
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service