Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

348 lines
13 KiB

  1. //****************************************************************************
  2. //
  3. // Microsoft NT Remote Access Service
  4. //
  5. // Copyright 1992-93
  6. //
  7. //
  8. // Revision History
  9. //
  10. //
  11. // 6/8/92 Gurdeep Singh Pall Created
  12. //
  13. //
  14. // Description: This file contains all defines used in rasman
  15. //
  16. //****************************************************************************
  17. #pragma once
  18. #ifndef _DEFS_
  19. #define _DEFS_
  20. #define MAX_ENTRYPOINTS 20
  21. #define MAX_DEVICES 20
  22. #define QUEUE_ELEMENT_SIZE 256
  23. #define MAX_BUFFER_SIZE 2000
  24. #define DISCONNECT_TIMEOUT 10 // Should be in registry?
  25. #define PACKET_SIZE 1500
  26. #define MAX_RECVBUFFER_SIZE PACKET_SIZE + 14
  27. #define MAX_SENDRCVBUFFER_SIZE PACKET_SIZE
  28. #define MAX_REQBUFFERS 1
  29. #define MAX_DELTAQUEUE_ELEMENTS 100
  30. #define MAX_DELTA 5000
  31. #define MAX_PORTS_PER_WORKER 32
  32. #define MAX_OBJECT_NAME 32
  33. #define MAX_ADAPTER_NAME 128 // ???????
  34. #define SENDRCVBUFFERS_PER_PORT 2
  35. #define MAX_PENDING_RECEIVES 2
  36. #define INVALID_INDEX 0xFFFF
  37. #define REQBUFFERSIZE_PER_PORT 1000
  38. #define REQBUFFERSIZE_FIXED 2000
  39. #define RASHUB_NAME "\\\\.\\NDISWAN"
  40. #define RASMAN_EXE_NAME "svchost.exe"
  41. #define SCREG_EXE_NAME "screg.exe"
  42. #define REQUEST_PRIORITY_THRESHOLD 16
  43. #define STANDARD_QUALITY_OF_SERVICE 3 // ????
  44. #define STANDARD_NUMBER_OF_VCS 20 // ????
  45. #define INVALID_ENDPOINT 0xFFFF
  46. #define RASMAN_REGISTRY_PATH "System\\CurrentControlSet\\Services\\Rasman\\Parameters"
  47. #define RASMAN_PARAMETER "Medias"
  48. #define MAX_ROUTE_SIZE 128
  49. #define WORKER_THREAD_STACK_SIZE 10000
  50. #define IOCP_THREAD_STACK_SIZE 10000
  51. #define TIMER_THREAD_STACK_SIZE 10000
  52. #define REGISTRY_NETBIOS_KEY_NAME "System\\CurrentControlSet\\Services\\NetBios\\Linkage"
  53. #define REGISTRY_REMOTEACCESS_KEY_NAME "System\\CurrentControlSet\\Services\\RemoteAccess\\Linkage\\Disabled"
  54. #define REGISTRY_ROUTE "Route"
  55. #define REGISTRY_LANANUM "LanaNum"
  56. #define REGISTRY_LANAMAP "LanaMap"
  57. #define REGISTRY_ENUMEXPORT "EnumExport"
  58. #define REGISTRY_SERVICES_KEY_NAME "System\\CurrentControlSet\\Services\\"
  59. #define REGISTRY_PARAMETERS_KEY "\\Parameters"
  60. #define REGISTRY_AUTOIPADDRESS "AutoIPAddress"
  61. #define REGISTRY_SERVERADAPTER "ServerAdapter"
  62. #define REGISTRY_NETCARDS "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards"
  63. #define REGISTRY_PRODUCTNAME "ProductName"
  64. #define REGISTRY_NDISWAN "NdisWan"
  65. // Only reason this is there because we are mapping 3 devices to one name:
  66. //
  67. #define DEVICE_MODEMPADSWITCH "RASMXS"
  68. #define DEVICE_MODEM "MODEM"
  69. #define DEVICE_PAD "PAD"
  70. #define DEVICE_SWITCH "SWITCH"
  71. #define DEVICE_NULL "NULL"
  72. // Media DLL entrypoints:
  73. //
  74. #define PORTENUM_STR "PortEnum"
  75. #define PORTENUM_ID 0
  76. #define PORTOPEN_STR "PortOpen"
  77. #define PORTOPEN_ID 1
  78. #define PORTCLOSE_STR "PortClose"
  79. #define PORTCLOSE_ID 2
  80. #define PORTGETINFO_STR "PortGetInfo"
  81. #define PORTGETINFO_ID 3
  82. #define PORTSETINFO_STR "PortSetInfo"
  83. #define PORTSETINFO_ID 4
  84. #define PORTDISCONNECT_STR "PortDisconnect"
  85. #define PORTDISCONNECT_ID 5
  86. #define PORTCONNECT_STR "PortConnect"
  87. #define PORTCONNECT_ID 6
  88. #define PORTGETPORTSTATE_STR "PortGetPortState"
  89. #define PORTGETPORTSTATE_ID 7
  90. #define PORTCOMPRESSSETINFO_STR "PortCompressionSetInfo" // Unsupported
  91. #define PORTCOMPRESSSETINFO_ID 8
  92. #define PORTCHANGECALLBACK_STR "PortChangeCallback"
  93. #define PORTCHANGECALLBACK_ID 9
  94. #define PORTGETSTATISTICS_STR "PortGetStatistics"
  95. #define PORTGETSTATISTICS_ID 10
  96. #define PORTCLEARSTATISTICS_STR "PortClearStatistics"
  97. #define PORTCLEARSTATISTICS_ID 11
  98. #define PORTSEND_STR "PortSend"
  99. #define PORTSEND_ID 12
  100. #define PORTTESTSIGNALSTATE_STR "PortTestSignalState"
  101. #define PORTTESTSIGNALSTATE_ID 13
  102. #define PORTRECEIVE_STR "PortReceive"
  103. #define PORTRECEIVE_ID 14
  104. #define PORTINIT_STR "PortInit"
  105. #define PORTINIT_ID 15
  106. #define PORTCOMPLETERECEIVE_STR "PortReceiveComplete"
  107. #define PORTCOMPLETERECEIVE_ID 16
  108. #define PORTSETFRAMING_STR "PortSetFraming"
  109. #define PORTSETFRAMING_ID 17
  110. #define PORTGETIOHANDLE_STR "PortGetIOHandle"
  111. #define PORTGETIOHANDLE_ID 18
  112. #define PORTSETIOCOMPLETIONPORT_STR "PortSetIoCompletionPort"
  113. #define PORTSETIOCOMPLETIONPORT_ID 19
  114. #define MAX_MEDIADLLENTRYPOINTS 20
  115. #define MSECS_OutOfProcessReceiveTimeOut 15000
  116. // Macros:
  117. //
  118. #define PORTENUM(mediaptr,buffer,ps,pe) \
  119. ((PortEnum_t)(mediaptr->MCB_AddrLookUp[PORTENUM_ID]))(buffer,ps,pe)
  120. #define PORTCONNECT(mediaptr,iohandle,wait,handle) \
  121. ((PortConnect_t)(mediaptr->MCB_AddrLookUp[PORTCONNECT_ID]))(iohandle, \
  122. wait, \
  123. handle)
  124. #define PORTGETINFO(mediaptr,iohandle,name,buffer,psize) \
  125. ((PortGetInfo_t)(mediaptr->MCB_AddrLookUp[PORTGETINFO_ID]))(iohandle, \
  126. name, \
  127. buffer, \
  128. psize)
  129. #define PORTSETINFO(mediaptr,iohandle,portinfo) \
  130. ((PortSetInfo_t)(mediaptr->MCB_AddrLookUp[PORTSETINFO_ID]))(iohandle,\
  131. portinfo)
  132. #define PORTOPEN(mediaptr,portname,phandle,handle,key) \
  133. ((PortOpen_t)(mediaptr->MCB_AddrLookUp[PORTOPEN_ID]))(portname, \
  134. phandle, \
  135. handle, \
  136. key)
  137. #define PORTDISCONNECT(mediaptr,iohandle) \
  138. ((PortDisconnect_t)(mediaptr->MCB_AddrLookUp[PORTDISCONNECT_ID])) \
  139. (iohandle)
  140. #define PORTGETSTATISTICS(mediaptr,iohandle,pstat) \
  141. ((PortGetStatistics_t)(mediaptr->MCB_AddrLookUp[PORTGETSTATISTICS_ID]))\
  142. (iohandle,pstat)
  143. #define PORTCLEARSTATISTICS(mediaptr,iohandle) \
  144. ((PortClearStatistics_t) \
  145. (mediaptr->MCB_AddrLookUp[PORTCLEARSTATISTICS_ID]))(iohandle)
  146. #define PORTCLOSE(mediaptr,iohandle) \
  147. ((PortClose_t)(mediaptr->MCB_AddrLookUp[PORTCLOSE_ID]))(iohandle)
  148. #define PORTSEND(mediaptr,iohandle,buffer,size) \
  149. ((PortSend_t)(mediaptr->MCB_AddrLookUp[PORTSEND_ID])) (iohandle,\
  150. buffer, \
  151. size)
  152. #define PORTRECEIVE(mediaptr,iohandle,buffer,size,timeout) \
  153. ((PortReceive_t)(mediaptr->MCB_AddrLookUp[PORTRECEIVE_ID])) ( \
  154. iohandle,\
  155. buffer, \
  156. size, \
  157. timeout)
  158. #define PORTCLOSE(mediaptr,iohandle) \
  159. ((PortClose_t)(mediaptr->MCB_AddrLookUp[PORTCLOSE_ID]))(iohandle)
  160. #define PORTCOMPRESSIONGETINFO(mediaptr,pc) \
  161. ((PortCompressionGetInfo)(mediaptr->MCB_AddrLookUp[PORTCOMPRESSGETINFO_ID]))(pc)
  162. #define PORTTESTSIGNALSTATE(mediaptr,iohandle,devstate) \
  163. ((PortTestSignalState_t) \
  164. (mediaptr->MCB_AddrLookUp[PORTTESTSIGNALSTATE_ID]))(iohandle,devstate)
  165. #define PORTINIT(mediaptr,iohandle) \
  166. ((PortInit_t)(mediaptr->MCB_AddrLookUp[PORTINIT_ID]))(iohandle)
  167. #define PORTCOMPLETERECEIVE(mediaptr,iohandle,bytesread) \
  168. ((PortReceiveComplete_t)(mediaptr->MCB_AddrLookUp[PORTCOMPLETERECEIVE_ID]))(iohandle,bytesread)
  169. #define PORTSETFRAMING(mediaptr,iohandle,one,two,three,four) \
  170. ((PortSetFraming_t)(mediaptr->MCB_AddrLookUp[PORTSETFRAMING_ID]))(iohandle,one,two,three,four)
  171. #define PORTGETIOHANDLE(mediaptr,porthandle,iohandle) \
  172. ((PortGetIOHandle_t)(mediaptr->MCB_AddrLookUp[PORTGETIOHANDLE_ID]))(porthandle,iohandle)
  173. #define PORTSETIOCOMPLETIONPORT(mediaptr, hIoCompletionPort) \
  174. ((PortSetIoCompletionPort_t)(mediaptr->MCB_AddrLookUp[PORTSETIOCOMPLETIONPORT_ID])) (hIoCompletionPort)
  175. // Device DLL entrypoints:
  176. //
  177. #define DEVICEENUM_STR "DeviceEnum"
  178. #define DEVICEENUM_ID 0
  179. #define DEVICECONNECT_STR "DeviceConnect"
  180. #define DEVICECONNECT_ID 1
  181. #define DEVICELISTEN_STR "DeviceListen"
  182. #define DEVICELISTEN_ID 2
  183. #define DEVICEGETINFO_STR "DeviceGetInfo"
  184. #define DEVICEGETINFO_ID 3
  185. #define DEVICESETINFO_STR "DeviceSetInfo"
  186. #define DEVICESETINFO_ID 4
  187. #define DEVICEDONE_STR "DeviceDone"
  188. #define DEVICEDONE_ID 5
  189. #define DEVICEWORK_STR "DeviceWork"
  190. #define DEVICEWORK_ID 6
  191. #define DEVICESETDEVCONFIG_STR "DeviceSetDevConfig"
  192. #define DEVICESETDEVCONFIG_ID 7
  193. #define DEVICEGETDEVCONFIG_STR "DeviceGetDevConfig"
  194. #define DEVICEGETDEVCONFIG_ID 8
  195. #define MAX_DEVICEDLLENTRYPOINTS 9
  196. // Macros:
  197. //
  198. #define DEVICEENUM(deviceptr,type,pentries,buffer,psize) \
  199. ((DeviceEnum_t)(deviceptr->DCB_AddrLookUp[DEVICEENUM_ID]))(type, \
  200. pentries, \
  201. buffer, \
  202. psize)
  203. #define DEVICEGETINFO(deviceptr,iohandle,type,name,buffer,psize) \
  204. ((DeviceGetInfo_t)(deviceptr->DCB_AddrLookUp[DEVICEGETINFO_ID]))( \
  205. iohandle, \
  206. type, \
  207. name, \
  208. buffer, \
  209. psize)
  210. #define DEVICESETINFO(deviceptr,iohandle,type,name,pinfo) \
  211. ((DeviceSetInfo_t)(deviceptr->DCB_AddrLookUp[DEVICESETINFO_ID]))( \
  212. iohandle, \
  213. type, \
  214. name, \
  215. pinfo)
  216. #define DEVICECONNECT(deviceptr,iohandle,type,name) \
  217. ((DeviceConnect_t)(deviceptr->DCB_AddrLookUp[DEVICECONNECT_ID]))( \
  218. iohandle, \
  219. type, \
  220. name)
  221. #define DEVICELISTEN(deviceptr,iohandle,type,name) \
  222. ((DeviceListen_t)(deviceptr->DCB_AddrLookUp[DEVICELISTEN_ID]))( \
  223. iohandle, \
  224. type, \
  225. name)
  226. #define DEVICEDONE(deviceptr,iohandle) \
  227. ((DeviceDone_t)(deviceptr->DCB_AddrLookUp[DEVICEDONE_ID]))(iohandle)
  228. #define DEVICEWORK(deviceptr,iohandle) \
  229. ((DeviceWork_t)(deviceptr->DCB_AddrLookUp[DEVICEWORK_ID]))(iohandle)
  230. #define DEVICESETDEVCONFIG(deviceptr,iohandle,config,size) \
  231. ((DeviceSetDevConfig_t)(deviceptr->DCB_AddrLookUp[DEVICESETDEVCONFIG_ID]))(iohandle, config, size)
  232. #define DEVICEGETDEVCONFIG(deviceptr,iohandle,config,size) \
  233. ((DeviceGetDevConfig_t)(deviceptr->DCB_AddrLookUp[DEVICEGETDEVCONFIG_ID]))(iohandle, config, size)
  234. #define PutRecvPacketOnFreeList(_pPacket) \
  235. { \
  236. _pPacket->Next = NULL; \
  237. if (ReceiveBuffers->Free == NULL) { \
  238. ReceiveBuffers->Free = _pPacket; \
  239. } else { \
  240. ReceiveBuffers->LastFree->Next = _pPacket; \
  241. } \
  242. ReceiveBuffers->LastFree = _pPacket; \
  243. ReceiveBuffers->FreeBufferCount++; \
  244. }
  245. #define PutRecvPacketOnPcb(_ppcb, _pPacket) \
  246. { \
  247. _pPacket->Next = NULL; \
  248. if (_ppcb->PCB_RecvPackets == NULL) { \
  249. _ppcb->PCB_RecvPackets = _pPacket; \
  250. } else { \
  251. _ppcb->PCB_LastRecvPacket->Next = _pPacket; \
  252. } \
  253. _ppcb->PCB_LastRecvPacket = _pPacket; \
  254. }
  255. #define GetRecvPacketFromPcb(_ppcb, _ppPacket) \
  256. { \
  257. if (_ppcb->PCB_RecvPackets != NULL) { \
  258. *_ppPacket = _ppcb->PCB_RecvPackets; \
  259. _ppcb->PCB_RecvPackets = (*_ppPacket)->Next; \
  260. if (_ppcb->PCB_RecvPackets == NULL) { \
  261. _ppcb->PCB_LastRecvPacket = NULL; \
  262. } \
  263. } else \
  264. *_ppPacket = NULL; \
  265. }
  266. #endif