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

tcpip.h
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:   See COPYING in the top level directory
00003  * PROJECT:     ReactOS TCP/IP protocol driver
00004  * FILE:        include/tcpip.h
00005  * PURPOSE:     TCP/IP protocol driver definitions
00006  * NOTES:       Spin lock acquire order:
00007  *                - Net table list lock
00008  *                - Interface lock
00009  *                - Interface list lock
00010  *                - Prefix list lock
00011  *                - Neighbor cache lock
00012  *                - Route cache lock
00013  */
00014 
00015 #pragma once
00016 
00017 #ifdef _MSC_VER
00018 #include <basetsd.h>
00019 #include <ntddk.h>
00020 #include <windef.h>
00021 #include <ndis.h>
00022 #include <tdikrnl.h>
00023 #include <tdiinfo.h>
00024 #else
00025 #include <ntddk.h>
00026 #include <ndis.h>
00027 #include <tdikrnl.h>
00028 #include <tdiinfo.h>
00029 #endif
00030 
00031 #include <debug.h>
00032 
00033 #define TAG_STRING  ' RTS' /* string */
00034 
00035 /* Define _NTTEST_ to make test version. Device names are prefixed with
00036    'NT' to allow the driver to run side by side with MS TCP/IP driver */
00037 //#define _NTTEST_
00038 
00039 /* FIXME: The following should be moved to ntddk.h or tdi headers */
00040 #ifndef _MSC_VER
00041 
00042 #ifndef IO_NETWORK_INCREMENT
00043 #define IO_NETWORK_INCREMENT 2
00044 #endif
00045 
00046 #endif
00047 
00048 #ifdef _MSC_VER
00049 /* EXPORTED is already defined ddk/defines.h */
00050 #define EXPORTED __declspec(dllexport)
00051 
00052 #endif
00053 
00054 #include <titypes.h>
00055 #include <ticonsts.h>
00056 
00057 /* Macros */
00058 
00059 #define MIN(value1, value2) \
00060     ((value1 < value2)? value1 : value2)
00061 
00062 #define MAX(value1, value2) \
00063     ((value1 > value2)? value1 : value2)
00064 
00065 #define NDIS_BUFFER_TAG FOURCC('n','b','u','f')
00066 #define NDIS_PACKET_TAG FOURCC('n','p','k','t')
00067 
00068 #ifdef i386
00069 
00070 /* DWORD network to host byte order conversion for i386 */
00071 #define DN2H(dw) \
00072     ((((dw) & 0xFF000000L) >> 24) | \
00073      (((dw) & 0x00FF0000L) >> 8) | \
00074      (((dw) & 0x0000FF00L) << 8) | \
00075      (((dw) & 0x000000FFL) << 24))
00076 
00077 /* DWORD host to network byte order conversion for i386 */
00078 #define DH2N(dw) \
00079     ((((dw) & 0xFF000000L) >> 24) | \
00080      (((dw) & 0x00FF0000L) >> 8) | \
00081      (((dw) & 0x0000FF00L) << 8) | \
00082      (((dw) & 0x000000FFL) << 24))
00083 
00084 /* WORD network to host order conversion for i386 */
00085 #define WN2H(w) \
00086     ((((w) & 0xFF00) >> 8) | \
00087      (((w) & 0x00FF) << 8))
00088 
00089 /* WORD host to network byte order conversion for i386 */
00090 #define WH2N(w) \
00091     ((((w) & 0xFF00) >> 8) | \
00092      (((w) & 0x00FF) << 8))
00093 
00094 #else /* i386 */
00095 
00096 /* DWORD network to host byte order conversion for other architectures */
00097 #define DN2H(dw) \
00098     (dw)
00099 
00100 /* DWORD host to network byte order conversion for other architectures */
00101 #define DH2N(dw) \
00102     (dw)
00103 
00104 /* WORD network to host order conversion for other architectures */
00105 #define WN2H(w) \
00106     (w)
00107 
00108 /* WORD host to network byte order conversion for other architectures */
00109 #define WH2N(w) \
00110     (w)
00111 
00112 #endif /* i386 */
00113 
00114 /* AF_INET and other things Arty likes to use ;) */
00115 #define AF_INET 2
00116 #define SOCK_STREAM 1
00117 
00118 /* Should use TDI structure, but Arty wants to keep BSD style */
00119 typedef unsigned char u_char;
00120 typedef unsigned short u_short;
00121 typedef unsigned int u_int;
00122 typedef unsigned long u_long;
00123 struct in_addr
00124 {
00125     union
00126     {
00127         struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
00128         struct { u_short s_w1,s_w2; } S_un_w;
00129         u_long S_addr;
00130     } S_un;
00131 #define s_addr  S_un.S_addr
00132 #define s_host  S_un.S_un_b.s_b2
00133 #define s_net   S_un.S_un_b.s_b1
00134 #define s_imp   S_un.S_un_w.s_w2
00135 #define s_impno S_un.S_un_b.s_b4
00136 #define s_lh    S_un.S_un_b.s_b3
00137 };
00138 
00139 #define __LWIP_INET_H__
00140 #include "lwip/sockets.h"
00141 
00142 /* Sufficient information to manage the entity list */
00143 typedef struct {
00144     UINT tei_entity;
00145     UINT tei_instance;
00146     PVOID context;
00147     UINT flags;
00148 } TDIEntityInfo;
00149 
00150 #ifndef htons
00151 #define htons(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
00152 #endif
00153 
00154 /* Global variable */
00155 extern PDEVICE_OBJECT TCPDeviceObject;
00156 extern PDEVICE_OBJECT UDPDeviceObject;
00157 extern PDEVICE_OBJECT IPDeviceObject;
00158 extern PDEVICE_OBJECT RawIPDeviceObject;
00159 extern LIST_ENTRY InterfaceListHead;
00160 extern KSPIN_LOCK InterfaceListLock;
00161 extern LIST_ENTRY AddressFileListHead;
00162 extern KSPIN_LOCK AddressFileListLock;
00163 extern NDIS_HANDLE GlobalPacketPool;
00164 extern NDIS_HANDLE GlobalBufferPool;
00165 extern KSPIN_LOCK EntityListLock;
00166 extern TDIEntityInfo *EntityList;
00167 extern ULONG EntityCount;
00168 extern ULONG EntityMax;
00169 
00170 extern NTSTATUS TiGetProtocolNumber( PUNICODE_STRING FileName,
00171                      PULONG Protocol );
00172 
00173 /* EOF */

Generated on Sun May 27 2012 04:28:07 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.