/[cvs]/eggdrop1.8/src/compat/in6.h
ViewVC logotype

Contents of /eggdrop1.8/src/compat/in6.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Wed Oct 6 19:07:47 2010 UTC (8 years, 10 months ago) by pseudo
Branch: MAIN
CVS Tags: HEAD
Branch point for: gettext
Changes since 1.1: +2 -1 lines
File MIME type: text/x-csrc
Fixed some problems with IPv6 autodetection and system headers.

1 /*
2 * in6.h -- various IPv6 related definitions and macros
3 *
4 * $Id: in6.h,v 1.1 2010/08/05 18:12:05 pseudo Exp $
5 */
6 /*
7 * Copyright (C) 2010 Eggheads Development Team
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24 #ifdef IPV6
25
26 #include <sys/types.h>
27 #include <sys/socket.h>
28 #include <netinet/in.h>
29
30
31 #ifndef PF_INET6
32 # define PF_INET6 PF_MAX
33 #endif
34
35 #ifndef AF_INET6
36 # define AF_INET6 PF_INET6
37 #endif
38
39 #ifndef HAVE_STRUCT_IN6_ADDR
40 struct in6_addr {
41 union {
42 u_8bit_t __u6_addr8[16];
43 u_16bit_t __u6_addr16[8];
44 u_32bit_t __u6_addr32[4];
45 } __u6_addr;
46 #define s6_addr __u6_addr.__u6_addr8
47 };
48 #endif
49
50 #ifndef HAVE_STRUCT_SOCKADDR_IN6
51 struct sockaddr_in6 {
52 u_16bit_t sin6_family;
53 u_16bit_t sin6_port;
54 u_32bit_t sin6_flowinfo;
55 struct in6_addr sin6_addr;
56 u_32bit_t sin6_scope_id;
57 };
58 #endif
59
60 #ifndef INET6_ADDRSTRLEN
61 # define INET6_ADDRSTRLEN 46
62 #endif
63
64 #ifndef IN6ADDR_ANY_INIT
65 # define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
66 #endif
67
68 #ifndef IN6ADDR_LOOPBACK_INIT
69 # define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
70 #endif
71
72 #ifndef HAVE_IN6ADDR_ANY
73 extern const struct in6_addr in6addr_any;
74 #endif
75
76 #ifndef HAVE_IN6ADDR_LOOPBACK
77 extern const struct in6_addr in6addr_loopback;
78 #endif
79
80 #ifndef IN6_IS_ADDR_UNSPECIFIED
81 # define IN6_IS_ADDR_UNSPECIFIED(a) \
82 (((const u_32bit_t *) (a))[0] == 0 \
83 && ((const u_32bit_t *) (a))[1] == 0 \
84 && ((const u_32bit_t *) (a))[2] == 0 \
85 && ((const u_32bit_t *) (a))[3] == 0)
86 #endif
87
88 #ifndef IN6_IS_ADDR_LOOPBACK
89 # define IN6_IS_ADDR_LOOPBACK(a) \
90 (((const u_32bit_t *) (a))[0] == 0 \
91 && ((const u_32bit_t *) (a))[1] == 0 \
92 && ((const u_32bit_t *) (a))[2] == 0 \
93 && ((const u_32bit_t *) (a))[3] == htonl (1))
94 #endif
95
96 #ifndef IN6_IS_ADDR_V4MAPPED
97 # define IN6_IS_ADDR_V4MAPPED(a) \
98 ((((const u_32bit_t *) (a))[0] == 0) \
99 && (((const u_32bit_t *) (a))[1] == 0) \
100 && (((const u_32bit_t *) (a))[2] == htonl (0xffff)))
101 #endif
102
103 #ifndef IN6_ARE_ADDR_EQUAL
104 # define IN6_ARE_ADDR_EQUAL(a,b) \
105 ((((const u_32bit_t *) (a))[0] == ((const u_32bit_t *) (b))[0]) \
106 && (((const u_32bit_t *) (a))[1] == ((const u_32bit_t *) (b))[1]) \
107 && (((const u_32bit_t *) (a))[2] == ((const u_32bit_t *) (b))[2]) \
108 && (((const u_32bit_t *) (a))[3] == ((const u_32bit_t *) (b))[3]))
109 #endif
110
111 #endif /* IPV6 */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23