xref: /libevent-2.1.12/ipv6-internal.h (revision 3f8c7cd0)
1b85b710cSNick Mathewson /*
2e49e2891SNick Mathewson  * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
3b85b710cSNick Mathewson  *
4b85b710cSNick Mathewson  * Redistribution and use in source and binary forms, with or without
5b85b710cSNick Mathewson  * modification, are permitted provided that the following conditions
6b85b710cSNick Mathewson  * are met:
7b85b710cSNick Mathewson  * 1. Redistributions of source code must retain the above copyright
8b85b710cSNick Mathewson  *    notice, this list of conditions and the following disclaimer.
9b85b710cSNick Mathewson  * 2. Redistributions in binary form must reproduce the above copyright
10b85b710cSNick Mathewson  *    notice, this list of conditions and the following disclaimer in the
11b85b710cSNick Mathewson  *    documentation and/or other materials provided with the distribution.
12b85b710cSNick Mathewson  * 3. The name of the author may not be used to endorse or promote products
13b85b710cSNick Mathewson  *    derived from this software without specific prior written permission.
14b85b710cSNick Mathewson  *
15b85b710cSNick Mathewson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16b85b710cSNick Mathewson  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17b85b710cSNick Mathewson  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18b85b710cSNick Mathewson  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19b85b710cSNick Mathewson  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20b85b710cSNick Mathewson  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21b85b710cSNick Mathewson  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22b85b710cSNick Mathewson  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23b85b710cSNick Mathewson  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24b85b710cSNick Mathewson  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25b85b710cSNick Mathewson  */
26b85b710cSNick Mathewson 
27980bcd68SNick Mathewson /* Internal use only: Fake IPv6 structures and values on platforms that
28980bcd68SNick Mathewson  * do not have them */
29980bcd68SNick Mathewson 
30*3f8c7cd0SNick Mathewson #ifndef IPV6_INTERNAL_H_INCLUDED_
31*3f8c7cd0SNick Mathewson #define IPV6_INTERNAL_H_INCLUDED_
32980bcd68SNick Mathewson 
330915ca0aSKevin Bowling #include "event2/event-config.h"
340915ca0aSKevin Bowling #include "evconfig-private.h"
350915ca0aSKevin Bowling 
36980bcd68SNick Mathewson #include <sys/types.h>
3768120d9bSNick Mathewson #ifdef EVENT__HAVE_SYS_SOCKET_H
3801be8708SNick Mathewson #include <sys/socket.h>
3901be8708SNick Mathewson #endif
40fbe64f21SEvan Jones #include "event2/util.h"
41980bcd68SNick Mathewson 
42980bcd68SNick Mathewson #ifdef __cplusplus
43980bcd68SNick Mathewson extern "C" {
44980bcd68SNick Mathewson #endif
45980bcd68SNick Mathewson 
46838d0a81SNick Mathewson /** @file ipv6-internal.h
47838d0a81SNick Mathewson  *
48e3fd294aSNick Mathewson  * Replacement types and functions for platforms that don't support ipv6
49838d0a81SNick Mathewson  * properly.
50838d0a81SNick Mathewson  */
51838d0a81SNick Mathewson 
5268120d9bSNick Mathewson #ifndef EVENT__HAVE_STRUCT_IN6_ADDR
53980bcd68SNick Mathewson struct in6_addr {
54980bcd68SNick Mathewson 	ev_uint8_t s6_addr[16];
55980bcd68SNick Mathewson };
56980bcd68SNick Mathewson #endif
57980bcd68SNick Mathewson 
5868120d9bSNick Mathewson #ifndef EVENT__HAVE_SA_FAMILY_T
599935d5b0SNick Mathewson typedef int sa_family_t;
60980bcd68SNick Mathewson #endif
61980bcd68SNick Mathewson 
6268120d9bSNick Mathewson #ifndef EVENT__HAVE_STRUCT_SOCKADDR_IN6
63980bcd68SNick Mathewson struct sockaddr_in6 {
64713c254dSNick Mathewson 	/* This will fail if we find a struct sockaddr that doesn't have
65713c254dSNick Mathewson 	 * sa_family as the first element. */
66980bcd68SNick Mathewson 	sa_family_t sin6_family;
67980bcd68SNick Mathewson 	ev_uint16_t sin6_port;
68980bcd68SNick Mathewson 	struct in6_addr sin6_addr;
69980bcd68SNick Mathewson };
70980bcd68SNick Mathewson #endif
71980bcd68SNick Mathewson 
72713c254dSNick Mathewson #ifndef AF_INET6
73713c254dSNick Mathewson #define AF_INET6 3333
74713c254dSNick Mathewson #endif
75713c254dSNick Mathewson #ifndef PF_INET6
76713c254dSNick Mathewson #define PF_INET6 AF_INET6
77713c254dSNick Mathewson #endif
78713c254dSNick Mathewson 
79980bcd68SNick Mathewson #ifdef __cplusplus
80980bcd68SNick Mathewson }
81980bcd68SNick Mathewson #endif
82980bcd68SNick Mathewson 
83980bcd68SNick Mathewson #endif
84