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

ws2_32.h
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:   See COPYING in the top level directory
00003  * PROJECT:     ReactOS WinSock 2 DLL
00004  * FILE:        include/ws2_32.h
00005  * PURPOSE:     WinSock 2 DLL header
00006  */
00007 #ifndef __WS2_32_H
00008 #define __WS2_32_H
00009 
00010 #include <ctype.h>
00011 #include <stdlib.h>
00012 #include <stdio.h>
00013 
00014 #define WIN32_NO_STATUS
00015 #include <winsock2.h>
00016 #include <ws2spi.h>
00017 #include <ws2tcpip.h>
00018 #include <windows.h>
00019 #define NTOS_MODE_USER
00020 #include <ndk/rtlfuncs.h>
00021 
00022 #include <wsahelp.h>
00023 
00024 #undef assert
00025 #include <debug.h>
00026 #include <windns.h> // DNS_A_DATA
00027 
00028 #include <w32api.h>
00029 
00030 #include "catalog.h"
00031 #include "handle.h"
00032 #include "upcall.h"
00033 
00034 #define EXPORT WINAPI
00035 
00036 extern HINSTANCE g_hInstDll;
00037 extern HANDLE GlobalHeap;
00038 extern BOOL WsaInitialized; /* TRUE if WSAStartup() has been successfully called */
00039 extern WSPUPCALLTABLE UpcallTable;
00040 
00041 #define WS2_INTERNAL_MAX_ALIAS 16
00042 
00043 typedef struct _WINSOCK_GETSERVBYNAME_CACHE
00044 {
00045     UINT Size;
00046     SERVENT ServerEntry;
00047     PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS];
00048     CHAR Data[1];
00049 } WINSOCK_GETSERVBYNAME_CACHE, *PWINSOCK_GETSERVBYNAME_CACHE;
00050 
00051 typedef struct _WINSOCK_GETSERVBYPORT_CACHE
00052 {
00053     UINT Size;
00054     SERVENT ServerEntry;
00055     PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS];
00056     CHAR Data[1];
00057 } WINSOCK_GETSERVBYPORT_CACHE, *PWINSOCK_GETSERVBYPORT_CACHE;
00058 
00059 typedef struct _WINSOCK_THREAD_BLOCK
00060 {
00061     INT LastErrorValue;     /* Error value from last function that failed */
00062     CHAR Intoa[16];         /* Buffer for inet_ntoa() */
00063     PWINSOCK_GETSERVBYNAME_CACHE
00064     Getservbyname;          /* Buffer used by getservbyname */
00065     PWINSOCK_GETSERVBYPORT_CACHE
00066     Getservbyport;          /* Buffer used by getservbyname */
00067     struct hostent* Hostent;
00068 } WINSOCK_THREAD_BLOCK, *PWINSOCK_THREAD_BLOCK;
00069 
00070 
00071 /* Macros */
00072 
00073 #define WSAINITIALIZED (WsaInitialized)
00074 
00075 #define WSASETINITIALIZED (WsaInitialized = TRUE)
00076 
00077 /* ws2_32 internal Functions */
00078 void check_hostent(struct hostent **he);
00079 void populate_hostent(struct hostent *he, char* name, DNS_A_DATA addr);
00080 void free_hostent(struct hostent *he);
00081 void free_servent(struct servent* s);
00082 
00083 #ifdef LE
00084 
00085 /* DWORD network to host byte order conversion for little endian machines */
00086 #define DN2H(dw) \
00087   ((((dw) & 0xFF000000L) >> 24) | \
00088    (((dw) & 0x00FF0000L) >> 8) | \
00089      (((dw) & 0x0000FF00L) << 8) | \
00090      (((dw) & 0x000000FFL) << 24))
00091 
00092 /* DWORD host to network byte order conversion for little endian machines */
00093 #define DH2N(dw) \
00094     ((((dw) & 0xFF000000L) >> 24) | \
00095      (((dw) & 0x00FF0000L) >> 8) | \
00096      (((dw) & 0x0000FF00L) << 8) | \
00097      (((dw) & 0x000000FFL) << 24))
00098 
00099 /* WORD network to host order conversion for little endian machines */
00100 #define WN2H(w) \
00101     ((((w) & 0xFF00) >> 8) | \
00102      (((w) & 0x00FF) << 8))
00103 
00104 /* WORD host to network byte order conversion for little endian machines */
00105 #define WH2N(w) \
00106     ((((w) & 0xFF00) >> 8) | \
00107      (((w) & 0x00FF) << 8))
00108 
00109 #else /* LE */
00110 
00111 /* DWORD network to host byte order conversion for big endian machines */
00112 #define DN2H(dw) \
00113     (dw)
00114 
00115 /* DWORD host to network byte order conversion big endian machines */
00116 #define DH2N(dw) \
00117     (dw)
00118 
00119 /* WORD network to host order conversion for big endian machines */
00120 #define WN2H(w) \
00121     (w)
00122 
00123 /* WORD host to network byte order conversion for big endian machines */
00124 #define WH2N(w) \
00125     (w)
00126 
00127 #endif /* LE */
00128 
00129 #endif /* __WS2_32_H */
00130 
00131 /* EOF */

Generated on Mon May 28 2012 04:26:39 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.