diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-07-03 18:41:52 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 1999-07-03 18:41:52 +0000 |
commit | cb64696179f2ee0ff8c793d43d0d9da2e7fb69f3 (patch) | |
tree | fb6e198c4c14f6e5363aa62aef51fa865569b809 | |
parent | 009d65a7cb3b2c78febc1fff61f40149c48d061d (diff) |
man page for net_addrcmp(3)
-rw-r--r-- | lib/libc/net/net_addrcmp.3 | 64 |
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 . |