1/*
2 * Copyright (C) 2004, 2007, 2012  Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001  Internet Software Consortium.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
16 */
17
18/* $Id$ */
19
20#ifndef LWRES_PLATFORM_H
21#define LWRES_PLATFORM_H 1
22
23/*****
24 ***** Platform-dependent defines.
25 *****/
26
27/***
28 *** Network.
29 ***/
30
31/*
32 * Define if this system needs the <netinet/in6.h> header file for IPv6.
33 */
34/*@LWRES_PLATFORM_NEEDNETINETIN6H@ */
35
36/*
37 * Define if this system needs the <netinet6/in6.h> header file for IPv6.
38 */
39/*@LWRES_PLATFORM_NEEDNETINET6IN6H@ */
40
41/*
42 * If sockaddrs on this system have an sa_len field, LWRES_PLATFORM_HAVESALEN
43 * will be defined.
44 */
45/*@LWRES_PLATFORM_HAVESALEN@ */
46
47/*
48 * If this system has the IPv6 structure definitions, LWRES_PLATFORM_HAVEIPV6
49 * will be defined.
50 */
51/*@LWRES_PLATFORM_HAVEIPV6@ */
52
53/*
54 * If this system is missing in6addr_any, LWRES_PLATFORM_NEEDIN6ADDRANY will
55 * be defined.
56 */
57#define LWRES_PLATFORM_NEEDIN6ADDRANY
58
59/*
60 * If this system has in_addr6, rather than in6_addr,
61 * LWRES_PLATFORM_HAVEINADDR6 will be defined.
62 */
63/*@LWRES_PLATFORM_HAVEINADDR6@ */
64
65/*
66 * Defined if unistd.h does not cause fd_set to be delared.
67 */
68/*@LWRES_PLATFORM_NEEDSYSSELECTH@ */
69
70/*
71 * Define some Macros
72 */
73#ifdef LIBLWRES_EXPORTS
74#define LIBLWRES_EXTERNAL_DATA __declspec(dllexport)
75#else
76#define LIBLWRES_EXTERNAL_DATA __declspec(dllimport)
77#endif
78
79/*
80 * Define the MAKE_NONBLOCKING Macro here since it can get used in
81 * a number of places.
82 */
83#define MAKE_NONBLOCKING(sd, retval) \
84do { \
85	int _on = 1; \
86	retval = ioctlsocket((SOCKET) sd, FIONBIO, &_on); \
87} while (0)
88
89/*
90 * Need to define close here since lwres closes sockets and not files
91 */
92#undef  close
93#define close closesocket
94
95/*
96 * Internal to liblwres.
97 */
98void InitSockets(void);
99
100void DestroySockets(void);
101
102#endif /* LWRES_PLATFORM_H */
103