xref: /netbsd-src/external/bsd/libevent/dist/ipv6-internal.h (revision 805a1ce9000bc0ec0951bf35f7e52b85cafb37e2)
1 /*	$NetBSD: ipv6-internal.h,v 1.1.1.2 2017/01/31 21:14:52 christos Exp $	*/
2 /*
3  * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  *    derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 /* Internal use only: Fake IPv6 structures and values on platforms that
29  * do not have them */
30 
31 #ifndef IPV6_INTERNAL_H_INCLUDED_
32 #define IPV6_INTERNAL_H_INCLUDED_
33 
34 #include "event2/event-config.h"
35 #include "evconfig-private.h"
36 
37 #include <sys/types.h>
38 #ifdef EVENT__HAVE_SYS_SOCKET_H
39 #include <sys/socket.h>
40 #endif
41 #include "event2/util.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /** @file ipv6-internal.h
48  *
49  * Replacement types and functions for platforms that don't support ipv6
50  * properly.
51  */
52 
53 #ifndef EVENT__HAVE_STRUCT_IN6_ADDR
54 struct in6_addr {
55 	ev_uint8_t s6_addr[16];
56 };
57 #endif
58 
59 #ifndef EVENT__HAVE_SA_FAMILY_T
60 typedef int sa_family_t;
61 #endif
62 
63 #ifndef EVENT__HAVE_STRUCT_SOCKADDR_IN6
64 struct sockaddr_in6 {
65 	/* This will fail if we find a struct sockaddr that doesn't have
66 	 * sa_family as the first element. */
67 	sa_family_t sin6_family;
68 	ev_uint16_t sin6_port;
69 	struct in6_addr sin6_addr;
70 };
71 #endif
72 
73 #ifndef AF_INET6
74 #define AF_INET6 3333
75 #endif
76 #ifndef PF_INET6
77 #define PF_INET6 AF_INET6
78 #endif
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif
85