xref: /illumos-gate/usr/src/head/arpa/inet.h (revision 9525b14b)
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
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*9525b14bSRao Shoaib  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley 4.3 BSD
317c478bd9Sstevel@tonic-gate  * under license from the Regents of the University of California.
327c478bd9Sstevel@tonic-gate  */
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef _ARPA_INET_H
357c478bd9Sstevel@tonic-gate #define	_ARPA_INET_H
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
407c478bd9Sstevel@tonic-gate #include <sys/socket.h>
417c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #include <netinet/in.h>
447c478bd9Sstevel@tonic-gate #if defined(_XPG4_2) && !defined(__EXTENSIONS__)
457c478bd9Sstevel@tonic-gate #include <sys/byteorder.h>
467c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
497c478bd9Sstevel@tonic-gate extern "C" {
507c478bd9Sstevel@tonic-gate #endif
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /*
537c478bd9Sstevel@tonic-gate  * External definitions for
547c478bd9Sstevel@tonic-gate  * functions in inet(3N)
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate #ifdef __STDC__
577c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
587c478bd9Sstevel@tonic-gate extern int inet_net_pton(int, const char *, void *, size_t);
597c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
627c478bd9Sstevel@tonic-gate extern int inet_pton(int, const char *_RESTRICT_KYWD, void *_RESTRICT_KYWD);
637c478bd9Sstevel@tonic-gate extern const char *inet_ntop(int, const void *_RESTRICT_KYWD,
647c478bd9Sstevel@tonic-gate 			char *_RESTRICT_KYWD, socklen_t);
657c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate extern in_addr_t inet_addr(const char *);
682a9459bdSsangeeta /*
692a9459bdSsangeeta  * With the introduction of CIDR the
702a9459bdSsangeeta  * following 4 routines are now considered to be Obsolete
712a9459bdSsangeeta  */
727c478bd9Sstevel@tonic-gate extern in_addr_t inet_lnaof(struct in_addr);
737c478bd9Sstevel@tonic-gate extern struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
747c478bd9Sstevel@tonic-gate extern in_addr_t inet_netof(struct in_addr);
757c478bd9Sstevel@tonic-gate extern in_addr_t inet_network(const char *);
762a9459bdSsangeeta 
77*9525b14bSRao Shoaib 
78*9525b14bSRao Shoaib extern char *inet_neta(ulong_t, char *, size_t);
79*9525b14bSRao Shoaib extern char *inet_net_ntop(int, const void *, int, char *, size_t);
80*9525b14bSRao Shoaib 
81*9525b14bSRao Shoaib extern char *inet_cidr_ntop(int, const void *, int, char *, size_t);
82*9525b14bSRao Shoaib extern int inet_cidr_pton(int, const char *, void *, int *);
837c478bd9Sstevel@tonic-gate extern char *inet_ntoa(struct in_addr);
847c478bd9Sstevel@tonic-gate extern int inet_aton(const char *, struct in_addr *);
85*9525b14bSRao Shoaib 
86*9525b14bSRao Shoaib extern uint_t inet_nsap_addr(const char *, uchar_t *, int);
87*9525b14bSRao Shoaib extern char *inet_nsap_ntoa(int, const uchar_t *, char *);
88*9525b14bSRao Shoaib 
897c478bd9Sstevel@tonic-gate #else
907c478bd9Sstevel@tonic-gate unsigned long inet_addr();
917c478bd9Sstevel@tonic-gate char	*inet_ntoa();
922a9459bdSsangeeta /*
932a9459bdSsangeeta  * With the introduction of CIDR the
942a9459bdSsangeeta  * following 4 routines are now considered to be Obsolete
952a9459bdSsangeeta  */
967c478bd9Sstevel@tonic-gate struct	in_addr inet_makeaddr();
977c478bd9Sstevel@tonic-gate unsigned long inet_network();
987c478bd9Sstevel@tonic-gate extern unsigned long inet_lnaof();
997c478bd9Sstevel@tonic-gate extern unsigned long inet_netof();
1002a9459bdSsangeeta 
1017c478bd9Sstevel@tonic-gate extern int inet_pton();
1027c478bd9Sstevel@tonic-gate extern const char *inet_ntop();
1037c478bd9Sstevel@tonic-gate extern int inet_aton();
104*9525b14bSRao Shoaib 
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1087c478bd9Sstevel@tonic-gate }
1097c478bd9Sstevel@tonic-gate #endif
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate #endif	/* _ARPA_INET_H */
112