xref: /illumos-gate/usr/src/head/arpa/inet.h (revision b4203d75)
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
209b241b4eSYuri Pankov  *
21ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
22ba3594baSGarrett D'Amore  *
239525b14bSRao Shoaib  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
259b241b4eSYuri Pankov  *
269b241b4eSYuri Pankov  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
277c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
30*b4203d75SMarcel Telka /*	  All Rights Reserved	*/
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley 4.3 BSD
347c478bd9Sstevel@tonic-gate  * under license from the Regents of the University of California.
357c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate #ifndef _ARPA_INET_H
387c478bd9Sstevel@tonic-gate #define	_ARPA_INET_H
407c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h>
427c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
437c478bd9Sstevel@tonic-gate #include <sys/socket.h>
447c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
467c478bd9Sstevel@tonic-gate #include <netinet/in.h>
477c478bd9Sstevel@tonic-gate #if defined(_XPG4_2) && !defined(__EXTENSIONS__)
487c478bd9Sstevel@tonic-gate #include <sys/byteorder.h>
497c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */
517c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
527c478bd9Sstevel@tonic-gate extern "C" {
537c478bd9Sstevel@tonic-gate #endif
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * External definitions for
577c478bd9Sstevel@tonic-gate  * functions in inet(3N)
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
607c478bd9Sstevel@tonic-gate extern int inet_net_pton(int, const char *, void *, size_t);
6103b59f78SYuri Pankov extern int inet_matchaddr(const void *, const char *);
627c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
647c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
657c478bd9Sstevel@tonic-gate extern int inet_pton(int, const char *_RESTRICT_KYWD, void *_RESTRICT_KYWD);
667c478bd9Sstevel@tonic-gate extern const char *inet_ntop(int, const void *_RESTRICT_KYWD,
677c478bd9Sstevel@tonic-gate 			char *_RESTRICT_KYWD, socklen_t);
687c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
707c478bd9Sstevel@tonic-gate extern in_addr_t inet_addr(const char *);
712a9459bdSsangeeta /*
722a9459bdSsangeeta  * With the introduction of CIDR the
732a9459bdSsangeeta  * following 4 routines are now considered to be Obsolete
742a9459bdSsangeeta  */
757c478bd9Sstevel@tonic-gate extern in_addr_t inet_lnaof(struct in_addr);
767c478bd9Sstevel@tonic-gate extern struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
777c478bd9Sstevel@tonic-gate extern in_addr_t inet_netof(struct in_addr);
787c478bd9Sstevel@tonic-gate extern in_addr_t inet_network(const char *);
809525b14bSRao Shoaib 
819525b14bSRao Shoaib extern char *inet_neta(ulong_t, char *, size_t);
829525b14bSRao Shoaib extern char *inet_net_ntop(int, const void *, int, char *, size_t);
839525b14bSRao Shoaib 
849525b14bSRao Shoaib extern char *inet_cidr_ntop(int, const void *, int, char *, size_t);
859525b14bSRao Shoaib extern int inet_cidr_pton(int, const char *, void *, int *);
867c478bd9Sstevel@tonic-gate extern char *inet_ntoa(struct in_addr);
877c478bd9Sstevel@tonic-gate extern int inet_aton(const char *, struct in_addr *);
889525b14bSRao Shoaib 
899525b14bSRao Shoaib extern uint_t inet_nsap_addr(const char *, uchar_t *, int);
909525b14bSRao Shoaib extern char *inet_nsap_ntoa(int, const uchar_t *, char *);
919525b14bSRao Shoaib 
927c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
937c478bd9Sstevel@tonic-gate }
947c478bd9Sstevel@tonic-gate #endif
967c478bd9Sstevel@tonic-gate #endif	/* _ARPA_INET_H */