xref: /titanic_52/usr/src/head/arpa/inet.h (revision 9b241b4ed1cf882400b069ff9853cdd310d469bf)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52a9459bdSsangeeta  * Common Development and Distribution License (the "License").
62a9459bdSsangeeta  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
20*9b241b4eSYuri Pankov  *
219525b14bSRao Shoaib  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
227c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
23*9b241b4eSYuri Pankov  *
24*9b241b4eSYuri Pankov  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
287c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley 4.3 BSD
327c478bd9Sstevel@tonic-gate  * under license from the Regents of the University of California.
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifndef _ARPA_INET_H
367c478bd9Sstevel@tonic-gate #define	_ARPA_INET_H
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
417c478bd9Sstevel@tonic-gate #include <sys/socket.h>
427c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #include <netinet/in.h>
457c478bd9Sstevel@tonic-gate #if defined(_XPG4_2) && !defined(__EXTENSIONS__)
467c478bd9Sstevel@tonic-gate #include <sys/byteorder.h>
477c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
507c478bd9Sstevel@tonic-gate extern "C" {
517c478bd9Sstevel@tonic-gate #endif
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * External definitions for
557c478bd9Sstevel@tonic-gate  * functions in inet(3N)
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate #ifdef __STDC__
587c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
597c478bd9Sstevel@tonic-gate extern int inet_net_pton(int, const char *, void *, size_t);
60*9b241b4eSYuri Pankov extern boolean_t inet_matchaddr(const void *, const char *);
617c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
647c478bd9Sstevel@tonic-gate extern int inet_pton(int, const char *_RESTRICT_KYWD, void *_RESTRICT_KYWD);
657c478bd9Sstevel@tonic-gate extern const char *inet_ntop(int, const void *_RESTRICT_KYWD,
667c478bd9Sstevel@tonic-gate 			char *_RESTRICT_KYWD, socklen_t);
677c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate extern in_addr_t inet_addr(const char *);
702a9459bdSsangeeta /*
712a9459bdSsangeeta  * With the introduction of CIDR the
722a9459bdSsangeeta  * following 4 routines are now considered to be Obsolete
732a9459bdSsangeeta  */
747c478bd9Sstevel@tonic-gate extern in_addr_t inet_lnaof(struct in_addr);
757c478bd9Sstevel@tonic-gate extern struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
767c478bd9Sstevel@tonic-gate extern in_addr_t inet_netof(struct in_addr);
777c478bd9Sstevel@tonic-gate extern in_addr_t inet_network(const char *);
782a9459bdSsangeeta 
799525b14bSRao Shoaib 
809525b14bSRao Shoaib extern char *inet_neta(ulong_t, char *, size_t);
819525b14bSRao Shoaib extern char *inet_net_ntop(int, const void *, int, char *, size_t);
829525b14bSRao Shoaib 
839525b14bSRao Shoaib extern char *inet_cidr_ntop(int, const void *, int, char *, size_t);
849525b14bSRao Shoaib extern int inet_cidr_pton(int, const char *, void *, int *);
857c478bd9Sstevel@tonic-gate extern char *inet_ntoa(struct in_addr);
867c478bd9Sstevel@tonic-gate extern int inet_aton(const char *, struct in_addr *);
879525b14bSRao Shoaib 
889525b14bSRao Shoaib extern uint_t inet_nsap_addr(const char *, uchar_t *, int);
899525b14bSRao Shoaib extern char *inet_nsap_ntoa(int, const uchar_t *, char *);
909525b14bSRao Shoaib 
917c478bd9Sstevel@tonic-gate #else
927c478bd9Sstevel@tonic-gate unsigned long inet_addr();
937c478bd9Sstevel@tonic-gate char	*inet_ntoa();
942a9459bdSsangeeta /*
952a9459bdSsangeeta  * With the introduction of CIDR the
962a9459bdSsangeeta  * following 4 routines are now considered to be Obsolete
972a9459bdSsangeeta  */
987c478bd9Sstevel@tonic-gate struct	in_addr inet_makeaddr();
997c478bd9Sstevel@tonic-gate unsigned long inet_network();
1007c478bd9Sstevel@tonic-gate extern unsigned long inet_lnaof();
1017c478bd9Sstevel@tonic-gate extern unsigned long inet_netof();
1022a9459bdSsangeeta 
1037c478bd9Sstevel@tonic-gate extern int inet_pton();
1047c478bd9Sstevel@tonic-gate extern const char *inet_ntop();
1057c478bd9Sstevel@tonic-gate extern int inet_aton();
1069525b14bSRao Shoaib 
1077c478bd9Sstevel@tonic-gate #endif
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1107c478bd9Sstevel@tonic-gate }
1117c478bd9Sstevel@tonic-gate #endif
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #endif	/* _ARPA_INET_H */
114