ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

adns_win32.h
Go to the documentation of this file.
00001 /*
00002  *
00003  *  This file is
00004  *    Copyright (C) 2000, 2002 Jarle (jgaa) Aase <jgaa@jgaa.com>
00005  *
00006  *  It is part of adns, which is
00007  *    Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
00008  *    Copyright (C) 1999 Tony Finch <dot@dotat.at>
00009  *
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2, or (at your option)
00013  *  any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *
00021  *  For the benefit of certain LGPL'd `omnibus' software which provides
00022  *  a uniform interface to various things including adns, I make the
00023  *  following additional licence.  I do this because the GPL would
00024  *  otherwise force either the omnibus software to be GPL'd or for the
00025  *  adns-using part to be distributed separately.
00026  *
00027  *  So, you may also redistribute and/or modify adns.h (but only the
00028  *  public header file adns.h and not any other part of adns) under the
00029  *  terms of the GNU Library General Public License as published by the
00030  *  Free Software Foundation; either version 2 of the License, or (at
00031  *  your option) any later version.
00032  *
00033  *  Note that adns itself is GPL'd.  Authors of adns-using applications
00034  *  with GPL-incompatible licences, and people who distribute adns with
00035  *  applications where the whole distribution is not GPL'd, are still
00036  *  likely to be in violation of the GPL.  Anyone who wants to do this
00037  *  should contact Ian Jackson.  Please note that to avoid encouraging
00038  *  people to infringe the GPL as it applies the body of adns, Ian thinks
00039  *  that if you take advantage of the special exception to redistribute
00040  *  just adns.h under the LGPL, you should retain this paragraph in its
00041  *  place in the appropriate copyright statements.
00042  *
00043  *
00044  *  You should have received a copy of the GNU General Public License,
00045  *  or the GNU Library General Public License, as appropriate, along
00046  *  with this program; if not, write to the Free Software Foundation,
00047  *  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00048  *
00049  */
00050 
00051 #ifndef ADNS_WIN32_H_INCLUDED
00052 #define ADNS_WIN32_H_INCLUDED
00053 
00054 #ifdef __cplusplus
00055 extern "C"
00056 {
00057 #endif /* __cplusplus */
00058 
00059 #if defined(ADNS_DLL)
00060 # ifdef ADNS_DLL_EXPORTS
00061 #   define ADNS_API __declspec(dllexport)
00062 # else
00063 #   define ADNS_API __declspec(dllimport)
00064 # endif /* ADNS_EXPORTS */
00065 #else
00066 # define ADNS_API
00067 #endif /* ADNS_DLL */
00068 
00069 #if defined (_MSC_VER)
00070 #pragma warning(disable:4003)
00071 #endif /* _MSC_VER */
00072 
00073 /* ---------------- START OF C HEADER -------------- */
00074 
00075 #include <stdlib.h>
00076 #include <stdio.h>
00077 #include <winsock2.h>
00078 #include <windows.h>
00079 #include <sys/types.h>
00080 #include <time.h>
00081 #include <errno.h>
00082 #include <assert.h>
00083 #include <limits.h>
00084 #include <malloc.h>
00085 #include <signal.h>
00086 
00087 #define HAVE_WINSOCK 1
00088 //#define PRINTFFORMAT(si,tc)
00089 #define inline __inline
00090 
00091 #define ADNS_SOCKET SOCKET
00092 #define adns_socket_close(sck) closesocket(sck)
00093 #define adns_socket_read(sck, data, len) recv(sck, (char *)data, len, 0)
00094 #define adns_socket_write(sck, data, len) send(sck, (char *)data, len, 0)
00095 
00096 /* Win32 does not set errno on Winsock errors(!)
00097  * We have to map the winsock errors to errno manually
00098  * in order to support the original UNIX error hadnlig
00099  */
00100 #define ADNS_CAPTURE_ERRNO {errno = WSAGetLastError(); WSASetLastError(errno);}
00101 #define ADNS_CLEAR_ERRNO {WSASetLastError(errno = 0);}
00102 
00103 #define ENOBUFS WSAENOBUFS
00104 #define EWOULDBLOCK WSAEWOULDBLOCK
00105 #define EINPROGRESS WSAEINPROGRESS
00106 #define EMSGSIZE WSAEMSGSIZE
00107 #define ENOPROTOOPT WSAENOPROTOOPT
00108 #define ECONNRESET WSAECONNRESET
00109 
00110 //#define NONRETURNING
00111 //#define NONRETURNPRINTFFORMAT(si,tc)
00112 
00113  /*
00114   * UNIX system API for Win32
00115   * The following is a quick and dirty implementation of
00116   * some UNIX API calls in Win32.
00117   * They are used in the dll, but if your project have
00118   * it's own implementation of these system calls, simply
00119   * undefine ADNS_MAP_UNIXAPI.
00120   */
00121 
00122 struct iovec
00123 {
00124     char  *iov_base;
00125     int  iov_len;
00126 };
00127 
00128 struct timezone; /* XXX arty */
00129 
00130 /*
00131  * Undef ADNS_MAP_UNIXAPI in the calling code to use natve calls
00132  */
00133 ADNS_API int adns_gettimeofday(struct timeval *tv, struct timezone *tz);
00134 ADNS_API int adns_writev (int FileDescriptor, const struct iovec * iov, int iovCount);
00135 ADNS_API int adns_inet_aton(const char *cp, struct in_addr *inp);
00136 ADNS_API int adns_getpid();
00137 
00138 #ifdef ADNS_DLL
00139  ADNS_API void *adns_malloc(const size_t bytes);
00140  ADNS_API void *adns_realloc(void *ptr, const size_t bytes);
00141  ADNS_API void adns_free(void *ptr);
00142 #endif
00143 
00144 #define gettimeofday(tv, tz) adns_gettimeofday(tv, tz)
00145 #define writev(FileDescriptor, iov, iovCount) adns_writev(FileDescriptor, iov, iovCount)
00146 #define inet_aton(ap, inp) adns_inet_aton(ap, inp)
00147 #define getpid() adns_getpid()
00148 
00149 #ifdef ADNS_DLL
00150 # define malloc(bytes) adns_malloc(bytes)
00151 # define realloc(ptr, bytes) adns_realloc(ptr, bytes)
00152 # define free(ptr) adns_free(ptr)
00153 #endif
00154 
00155 /* ---------------- END OF C HEADER -------------- */
00156 #ifdef __cplusplus
00157 }
00158 #endif /* __cplusplus */
00159 
00160 #endif /* ADNS_WIN32_H_INCLUDED */
00161 

Generated on Sat May 26 2012 04:32:16 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.