1 /*	$MirOS: src/include/arpa/inet.h,v 1.3 2013/10/31 20:06:11 tg Exp $ */
2 /*	$OpenBSD: inet.h,v 1.10 2004/01/22 21:48:02 espie Exp $	*/
3 
4 /*
5  * Copyright © 2013
6  *	Thorsten “mirabilos” Glaser <tg@mirbsd.org>
7  * Copyright (c) 1983, 1993
8  *    The Regents of the University of California.  All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  * -
34  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
35  *
36  * Permission to use, copy, modify, and distribute this software for any
37  * purpose with or without fee is hereby granted, provided that the above
38  * copyright notice and this permission notice appear in all copies, and that
39  * the name of Digital Equipment Corporation not be used in advertising or
40  * publicity pertaining to distribution of the document or software without
41  * specific, written prior permission.
42  *
43  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
44  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
45  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
46  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
47  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
48  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
49  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
50  * SOFTWARE.
51  */
52 
53 /*
54  *	@(#)inet.h	8.1 (Berkeley) 6/2/93
55  *	$From: inet.h,v 8.6 1996/08/08 06:54:29 vixie Exp $
56  */
57 
58 #ifndef _INET_H_
59 #define	_INET_H_
60 
61 /* External definitions for functions in inet(3) */
62 
63 #include <sys/param.h>
64 #if (!defined(BSD)) || (BSD < 199306)
65 # include <sys/bitypes.h>
66 #else
67 # include <sys/types.h>
68 #endif
69 #include <sys/cdefs.h>
70 
71 __BEGIN_DECLS
72 in_addr_t	 inet_addr(const char *);
73 int		 inet_aton(const char *, struct in_addr *);
74 in_addr_t	 inet_lnaof(struct in_addr);
75 struct in_addr	 inet_makeaddr(in_addr_t , in_addr_t);
76 char *		 inet_neta(in_addr_t, char *, size_t)
77 			__attribute__((__bounded__(__string__, 2, 3)));
78 in_addr_t	 inet_netof(struct in_addr);
79 in_addr_t	 inet_network(const char *);
80 char		*inet_net_ntop(int, const void *, int, char *, size_t)
81 			__attribute__((__bounded__(__string__, 4, 5)));
82 int		 inet_net_pton(int, const char *, void *, size_t)
83 			__attribute__((__bounded__(__string__, 3, 4)));
84 char		*inet_ntoa(struct in_addr);
85 int		 inet_pton(int, const char *, void *);
86 const char	*inet_ntop(int, const void *, char *, size_t)
87 			__attribute__((__bounded__(__string__, 3, 4)));
88 unsigned int	 inet_nsap_addr(const char *, unsigned char *, int);
89 char		*inet_nsap_ntoa(int, const unsigned char *, char *);
90 __END_DECLS
91 
92 #endif /* !_INET_H_ */
93