xref: /titanic_51/usr/src/uts/common/smbsrv/smb_inet.h (revision a90cf9f29973990687fa61de9f1f6ea22e924e40)
17f667e74Sjose borrego /*
27f667e74Sjose borrego  * CDDL HEADER START
37f667e74Sjose borrego  *
47f667e74Sjose borrego  * The contents of this file are subject to the terms of the
57f667e74Sjose borrego  * Common Development and Distribution License (the "License").
67f667e74Sjose borrego  * You may not use this file except in compliance with the License.
77f667e74Sjose borrego  *
87f667e74Sjose borrego  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97f667e74Sjose borrego  * or http://www.opensolaris.org/os/licensing.
107f667e74Sjose borrego  * See the License for the specific language governing permissions
117f667e74Sjose borrego  * and limitations under the License.
127f667e74Sjose borrego  *
137f667e74Sjose borrego  * When distributing Covered Code, include this CDDL HEADER in each
147f667e74Sjose borrego  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157f667e74Sjose borrego  * If applicable, add the following below this CDDL HEADER, with the
167f667e74Sjose borrego  * fields enclosed by brackets "[]" replaced with your own identifying
177f667e74Sjose borrego  * information: Portions Copyright [yyyy] [name of copyright owner]
187f667e74Sjose borrego  *
197f667e74Sjose borrego  * CDDL HEADER END
207f667e74Sjose borrego  */
217f667e74Sjose borrego /*
227f667e74Sjose borrego  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237f667e74Sjose borrego  * Use is subject to license terms.
24b819cea2SGordon Ross  *
25*a90cf9f2SGordon Ross  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
267f667e74Sjose borrego  */
277f667e74Sjose borrego 
287f667e74Sjose borrego /*
297f667e74Sjose borrego  * This file was originally generated using rpcgen.
307f667e74Sjose borrego  */
317f667e74Sjose borrego 
327f667e74Sjose borrego #ifndef _SMB_INET_H
337f667e74Sjose borrego #define	_SMB_INET_H
347f667e74Sjose borrego 
357f667e74Sjose borrego #ifdef	__cplusplus
367f667e74Sjose borrego extern "C" {
377f667e74Sjose borrego #endif
387f667e74Sjose borrego 
397f667e74Sjose borrego #include <sys/types.h>
407f667e74Sjose borrego #include <sys/socket.h>
417f667e74Sjose borrego #include <netinet/in.h>
427f667e74Sjose borrego 
43*a90cf9f2SGordon Ross /*
44*a90cf9f2SGordon Ross  * SMB (internal) representation of an IP address.
45*a90cf9f2SGordon Ross  * See also: smb_inaddr_xdr()
46*a90cf9f2SGordon Ross  */
477f667e74Sjose borrego typedef struct smb_inaddr {
487f667e74Sjose borrego 	union {
497f667e74Sjose borrego 		in_addr_t au_ipv4;
507f667e74Sjose borrego 		in6_addr_t au_ipv6;
517f667e74Sjose borrego 		in6_addr_t au_ip;
527f667e74Sjose borrego 	} au_addr;
537f667e74Sjose borrego 	int a_family;
547f667e74Sjose borrego } smb_inaddr_t;
557f667e74Sjose borrego 
567f667e74Sjose borrego #define	a_ipv4 au_addr.au_ipv4
577f667e74Sjose borrego #define	a_ipv6 au_addr.au_ipv6
587f667e74Sjose borrego #define	a_ip au_addr.au_ip
597f667e74Sjose borrego 
607f667e74Sjose borrego #define	SMB_IPSTRLEN(family) \
617f667e74Sjose borrego ((family == AF_INET) ? INET_ADDRSTRLEN : INET6_ADDRSTRLEN)
627f667e74Sjose borrego 
63fc724630SAlan Wright boolean_t smb_inet_equal(smb_inaddr_t *, smb_inaddr_t *);
64fc724630SAlan Wright boolean_t smb_inet_same_subnet(smb_inaddr_t *, smb_inaddr_t *, uint32_t);
657f667e74Sjose borrego boolean_t smb_inet_iszero(smb_inaddr_t *);
667f667e74Sjose borrego const char *smb_inet_ntop(smb_inaddr_t *, char *, int);
677f667e74Sjose borrego 
687f667e74Sjose borrego #ifdef	__cplusplus
697f667e74Sjose borrego }
707f667e74Sjose borrego #endif
717f667e74Sjose borrego 
727f667e74Sjose borrego #endif /* _SMB_INET_H */
73