summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraaron <aaron@openbsd.org>1999-07-03 18:41:51 +0000
committeraaron <aaron@openbsd.org>1999-07-03 18:41:51 +0000
commit20479cadd94d480d5b29f328c796718bff6de7d9 (patch)
treecaed13f63da7b6725cd7e7747290b172a81311a1
parentuse getnameinfo() (diff)
downloadwireguard-openbsd-20479cadd94d480d5b29f328c796718bff6de7d9.tar.xz
wireguard-openbsd-20479cadd94d480d5b29f328c796718bff6de7d9.zip
man page for net_addrcmp(3)
-rw-r--r--lib/libc/net/net_addrcmp.364
1 files changed, 64 insertions, 0 deletions
diff --git a/lib/libc/net/net_addrcmp.3 b/lib/libc/net/net_addrcmp.3
new file mode 100644
index 00000000000..c29624dc878
--- /dev/null
+++ b/lib/libc/net/net_addrcmp.3
@@ -0,0 +1,64 @@
+.Dd July 3, 1999
+.Dt NET_ADDRCMP 3
+.Os
+.Sh NAME
+.Nm net_addrcmp
+.Nd compare socket address structures
+.Sh SYNOPSIS
+.Fd #include <netdb.h>
+.Ft int
+.Fn net_addrcmp "struct sockaddr *sa1" "struct sockaddr *sa2"
+.Sh DESCRIPTION
+The
+.Fn net_addrcmp
+function compares two socket address structures,
+.Fa sa1
+and
+.Fa sa2 .
+.Sh RETURN VALUES
+If
+.Fa sa1
+and
+.Fa sa2
+are for the same address,
+.Fn net_addrcmp
+returns 0.
+.Pp
+The
+.Fa sa_len
+fields are compared first. If they do not match,
+.Fn net_addrcmp
+returns \-1 or 1 if
+.Li sa1->sa_len
+is less than or greater than
+.Li sa2->sa_len ,
+respectively.
+.Pp
+Next, the
+.Fa sa_family
+members are compared. If they do not match,
+.Fn net_addrcmp
+returns \-1 or 1 if
+.Li sa1->sa_family
+is less than or greater than
+.Li sa2->sa_family ,
+respectively.
+.Pp
+Lastly, if each socket address structure's
+.Fa sa_len
+and
+.Fa sa_family
+fields match,
+the protocol-specific data (the
+.Fa sa_data
+field) is compared. If there's a match, both
+.Fa sa1
+and
+.Fa sa2
+must refer to the same address, and 0 is returned; otherwise, a value >0
+or <0 is returned.
+.Sh HISTORY
+A
+.Fn net_addrcmp
+function was added in
+.Ox 2.5 .