xref: /minix3/external/bsd/libevent/dist/ipv6-internal.h (revision e985b929927b5932e3b68f4b50587d458900107a)
1 /*	$NetBSD: ipv6-internal.h,v 1.1.1.1 2013/04/11 16:43:28 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 _EVENT_IPV6_INTERNAL_H
32 #define _EVENT_IPV6_INTERNAL_H
33 
34 #include <sys/types.h>
35 #ifdef _EVENT_HAVE_SYS_SOCKET_H
36 #include <sys/socket.h>
37 #endif
38 #include "event2/event-config.h"
39 #include "event2/util.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /** @file ipv6-internal.h
46  *
47  * Replacement types and functions for platforms that don't support ipv6
48  * properly.
49  */
50 
51 #ifndef _EVENT_HAVE_STRUCT_IN6_ADDR
52 struct in6_addr {
53 	ev_uint8_t s6_addr[16];
54 };
55 #endif
56 
57 #ifndef _EVENT_HAVE_SA_FAMILY_T
58 typedef int sa_family_t;
59 #endif
60 
61 #ifndef _EVENT_HAVE_STRUCT_SOCKADDR_IN6
62 struct sockaddr_in6 {
63 	/* This will fail if we find a struct sockaddr that doesn't have
64 	 * sa_family as the first element. */
65 	sa_family_t sin6_family;
66 	ev_uint16_t sin6_port;
67 	struct in6_addr sin6_addr;
68 };
69 #endif
70 
71 #ifndef AF_INET6
72 #define AF_INET6 3333
73 #endif
74 #ifndef PF_INET6
75 #define PF_INET6 AF_INET6
76 #endif
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif
83