chiark / gitweb /
Embryonic IPv6 support.
[adns] / src / adns-in6fake.h
1 /*
2  * adns-in6fake.h
3  * - adns declarations for IPv6 compatibility on systems without it
4  */
5 /*
6  *
7  *  This file is
8  *    Copyright (C) 2000 Ian Jackson <ian@davenant.greenend.org.uk>
9  *
10  *  It is part of adns, which is
11  *    Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
12  *    Copyright (C) 1999 Tony Finch <dot@dotat.at>
13  *  
14  *  This program is free software; you can redistribute it and/or modify
15  *  it under the terms of the GNU General Public License as published by
16  *  the Free Software Foundation; either version 2, or (at your option)
17  *  any later version.
18  *  
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  * 
25  *  For the benefit of certain LGPL'd `omnibus' software which provides
26  *  a uniform interface to various things including adns, I make the
27  *  following additional licence.  I do this because the GPL would
28  *  otherwise force either the omnibus software to be GPL'd or for the
29  *  adns-using part to be distributed separately.
30  *  
31  *  So, you may also redistribute and/or modify adns.h (but only the
32  *  public header file adns.h and not any other part of adns) under the
33  *  terms of the GNU Library General Public License as published by the
34  *  Free Software Foundation; either version 2 of the License, or (at
35  *  your option) any later version.
36  *  
37  *  Note that adns itself is GPL'd.  Authors of adns-using applications
38  *  with GPL-incompatible licences, and people who distribute adns with
39  *  applications where the whole distribution is not GPL'd, are still
40  *  likely to be in violation of the GPL.  Anyone who wants to do this
41  *  should contact Ian Jackson.  Please note that to avoid encouraging
42  *  people to infringe the GPL as it applies the body of adns, I think
43  *  that if you take advantage of the special exception to redistribute
44  *  just adns.h under the LGPL, you should retain this paragraph in its
45  *  place in the appropriate copyright statements.
46  *
47  *
48  *  You should have received a copy of the GNU General Public License,
49  *  or the GNU Library General Public License, as appropriate, along
50  *  with this program; if not, write to the Free Software Foundation,
51  *  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
52  *
53  *
54  *  $Id$
55  */
56
57 #ifndef ADNS_IN6FAKE_H_INCLUDED
58 #define ADNS_IN6FAKE_H_INCLUDED
59
60 #define AF_INET6 10 /* copied from the Linux headers -iwj */
61
62 struct in6_addr { unsigned char s6_addr[16]; };
63
64 struct sockaddr_in6 {
65   /* Bezerkely invented a useless sa_len member whose effect is to
66    * pointlessly mess up the layout of this struct.  The hackery below
67    * is to try to make sure that the struct sockaddr_in6 we make up
68    * here probably has the same location and size for sin6_family
69    * as both a struct sockaddr and as any putative future real
70    * struct sockadr_in6.
71    */
72   union {
73     struct sockaddr adns__in6fake_sa;
74     struct {
75       unsigned short adns__in6fake_sin6_family;
76       unsigned short adns__in6fake_sin6_port;
77       unsigned long adns__in6fake_sin6_flowinfo;
78       struct in6_addr adns__in6fake_sin6_addr;
79     } adns__in6fake_sin6;
80   } adns__in6fake_union;
81 };
82
83 #define sin6_family   adns__in6fake_union.adns__in6fake_sa.sa_family
84 #define sin6_port     adns__in6fake_union.adns__in6fake_sin6.adns__in6fake_sin6_port;
85 #define sin6_flowinfo adns__in6fake_union.adns__in6fake_sin6.adns__in6fake_sin6_addr;
86 #define sin6_addr     adns__in6fake_union.adns__in6fake_sin6.adns__in6fake_sin6_addr;
87
88 #endif