nmipstructs.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:15k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //=============================================================================
  2. //  Microsoft (R) Network Monitor (tm). 
  3. //  Copyright (C) 1992-1999. All rights reserved.
  4. //
  5. //  MODULE: nmipstructs.h
  6. //
  7. //  IP structures & #defines
  8. //=============================================================================
  9. #ifndef NMIPSTRUCTS_H
  10. #define NMIPSTRUCTS_H
  11. #ifdef __cplusplus
  12. extern "C"
  13. {
  14. #endif
  15. //
  16. // IP Packet Structure
  17. //
  18. #pragma warning(disable:4200)
  19. typedef struct _IP 
  20. {
  21.     union 
  22.     {
  23.         BYTE   Version;
  24.         BYTE   HdrLen;
  25.     };
  26.     BYTE ServiceType;
  27.     WORD TotalLen;
  28.     WORD ID;
  29.     union 
  30.     {
  31.         WORD   Flags;
  32.         WORD   FragOff;
  33.     };
  34.     BYTE TimeToLive;
  35.     BYTE Protocol;
  36.     WORD HdrChksum;
  37.     DWORD   SrcAddr;
  38.     DWORD   DstAddr;
  39.     BYTE Options[0];
  40. } IP;
  41. typedef IP * LPIP;
  42. typedef IP UNALIGNED * ULPIP;
  43. #pragma warning(default:4200)
  44. // Psuedo Header used for CheckSum Calculations
  45. typedef struct _PSUHDR 
  46. {
  47.     DWORD   ph_SrcIP;
  48.     DWORD   ph_DstIP;
  49.     UCHAR   ph_Zero;
  50.     UCHAR   ph_Proto;
  51.     WORD    ph_ProtLen;
  52. } PSUHDR;
  53. typedef PSUHDR UNALIGNED * LPPSUHDR;
  54. //
  55. // IP Bitmasks that are useful
  56. // (and the appropriate bit shifts, as well)
  57. //
  58. #define IP_VERSION_MASK ((BYTE) 0xf0)
  59. #define IP_VERSION_SHIFT (4)
  60. #define IP_HDRLEN_MASK  ((BYTE) 0x0f)
  61. #define IP_HDRLEN_SHIFT (0)
  62. #define IP_PRECEDENCE_MASK ((BYTE) 0xE0)
  63. #define IP_PRECEDENCE_SHIFT   (5)
  64. #define IP_TOS_MASK ((BYTE) 0x1E)
  65. #define IP_TOS_SHIFT   (1)
  66. #define IP_DELAY_MASK   ((BYTE) 0x10)
  67. #define IP_THROUGHPUT_MASK ((BYTE) 0x08)
  68. #define IP_RELIABILITY_MASK   ((BYTE) 0x04)
  69. #define IP_FLAGS_MASK   ((BYTE) 0xE0)
  70. #define IP_FLAGS_SHIFT  (13)
  71. #define IP_DF_MASK   ((BYTE) 0x40)
  72. #define IP_MF_MASK   ((BYTE) 0x20)
  73. #define IP_MF_SHIFT     (5)
  74. #define IP_FRAGOFF_MASK ((WORD) 0x1FFF)
  75. #define IP_FRAGOFF_SHIFT   (3)
  76. #define IP_TCC_MASK  ((DWORD) 0xFFFFFF00)
  77. #define IP_TIME_OPTS_MASK  ((BYTE) 0x0F)
  78. #define IP_MISS_STNS_MASK  ((BYTE) 0xF0)
  79. #define IP_TIME_OPTS_SHIFT (0)
  80. #define IP_MISS_STNS_SHIFT  (4)
  81. #ifndef XCHG
  82. #define XCHG(x)         MAKEWORD( HIBYTE(x), LOBYTE(x) )
  83. #endif
  84. #ifndef DXCHG
  85. #define DXCHG(x)        MAKELONG( XCHG(HIWORD(x)), XCHG(LOWORD(x)) )
  86. #endif
  87. //
  88. // Offset to checksum field in ip header
  89. //
  90. #define IP_CHKSUM_OFF   10
  91. INLINE BYTE IP_Version(ULPIP pIP)
  92. {
  93.     return (pIP->Version & IP_VERSION_MASK) >> IP_VERSION_SHIFT;
  94. }
  95. INLINE DWORD IP_HdrLen(ULPIP pIP)
  96. {
  97.     return ((pIP->HdrLen & IP_HDRLEN_MASK) >> IP_HDRLEN_SHIFT) << 2;
  98. }
  99. INLINE WORD IP_FragOff(ULPIP pIP)
  100. {
  101.     return (XCHG(pIP->FragOff) & IP_FRAGOFF_MASK) << IP_FRAGOFF_SHIFT;
  102. }
  103. INLINE DWORD IP_TotalLen(ULPIP pIP)
  104. {
  105.     return XCHG(pIP->TotalLen);
  106. }
  107. INLINE DWORD IP_MoreFragments(ULPIP pIP)
  108. {
  109.     return (pIP->Flags & IP_MF_MASK) >> IP_MF_SHIFT;
  110. }
  111. //
  112. // Well known ports in the TCP/IP protocol (See RFC 1060)
  113. //
  114. #define PORT_TCPMUX              1  // TCP Port Service Multiplexer
  115. #define PORT_RJE                 5  // Remote Job Entry
  116. #define PORT_ECHO                7  // Echo
  117. #define PORT_DISCARD             9  // Discard
  118. #define PORT_USERS              11  // Active users
  119. #define PORT_DAYTIME            13  // Daytime
  120. #define PORT_NETSTAT            15  // Netstat
  121. #define PORT_QUOTE              17  // Quote of the day
  122. #define PORT_CHARGEN            19  // Character Generator
  123. #define PORT_FTPDATA            20  // File transfer [default data]
  124. #define PORT_FTP                21  // File transfer [Control]
  125. #define PORT_TELNET             23  // Telnet
  126. #define PORT_SMTP               25  // Simple Mail Transfer
  127. #define PORT_NSWFE              27  // NSW User System FE
  128. #define PORT_MSGICP             29  // MSG ICP
  129. #define PORT_MSGAUTH            31  // MSG Authentication
  130. #define PORT_DSP                33  // Display Support
  131. #define PORT_PRTSERVER          35  // any private printer server
  132. #define PORT_TIME               37  // Time
  133. #define PORT_RLP                39  // Resource Location Protocol
  134. #define PORT_GRAPHICS           41  // Graphics
  135. #define PORT_NAMESERVER         42  // Host Name Server
  136. #define PORT_NICNAME            43  // Who is
  137. #define PORT_MPMFLAGS           44  // MPM Flags 
  138. #define PORT_MPM                45  // Message Processing Module [recv]
  139. #define PORT_MPMSND             46  // MPM [default send]
  140. #define PORT_NIFTP              47  // NI FTP
  141. #define PORT_LOGIN              49  // Login Host Protocol
  142. #define PORT_LAMAINT            51  // IMP Logical Address Maintenance
  143. #define PORT_DOMAIN             53  // Domain Name Server
  144. #define PORT_ISIGL              55  // ISI Graphics Language
  145. #define PORT_ANYTERMACC         57  // any private terminal access
  146. #define PORT_ANYFILESYS         59  // any private file service
  147. #define PORT_NIMAIL             61  // NI Mail
  148. #define PORT_VIAFTP             63  // VIA Systems - FTP
  149. #define PORT_TACACSDS           65  // TACACS - Database Service
  150. #define PORT_BOOTPS             67  // Bootstrap Protocol server
  151. #define PORT_BOOTPC             68  // Bootstrap Protocol client
  152. #define PORT_TFTP               69  // Trivial File Transfer
  153. #define PORT_NETRJS1            71  // Remote Job service
  154. #define PORT_NETRJS2            72  // Remote Job service
  155. #define PORT_NETRJS3            73  // Remote Job service
  156. #define PORT_NETRJS4            74  // Remote Job service
  157. #define PORT_ANYDIALOUT         75  // any private dial out service
  158. #define PORT_ANYRJE             77  // any private RJE service
  159. #define PORT_FINGER             79  // Finger
  160. #define PORT_HTTP               80  // HTTP (www)
  161. #define PORT_HOSTS2NS           81  // Hosts2 Name Server
  162. #define PORT_MITMLDEV1          83  // MIT ML Device
  163. #define PORT_MITMLDEV2          85  // MIT ML Device
  164. #define PORT_ANYTERMLINK        87  // any private terminal link
  165. #define PORT_SUMITTG            89  // SU/MIT Telnet Gateway
  166. #define PORT_MITDOV             91  // MIT Dover Spooler
  167. #define PORT_DCP                93  // Device Control Protocol
  168. #define PORT_SUPDUP             95  // SUPDUP
  169. #define PORT_SWIFTRVF           97  // Swift Remote Vitural File Protocol
  170. #define PORT_TACNEWS            98  // TAC News
  171. #define PORT_METAGRAM           99  // Metagram Relay
  172. #define PORT_NEWACCT           100  // [Unauthorized use]
  173. #define PORT_HOSTNAME          101  // NIC Host Name Server
  174. #define PORT_ISOTSAP           102  // ISO-TSAP
  175. #define PORT_X400              103  // X400
  176. #define PORT_X400SND           104  // X400 - SND
  177. #define PORT_CSNETNS           105  // Mailbox Name Nameserver
  178. #define PORT_RTELNET           107  // Remote Telnet Service
  179. #define PORT_POP2              109  // Post Office Protocol - version 2
  180. #define PORT_POP3              110  // Post Office Protocol - version 3
  181. #define PORT_SUNRPC            111  // SUN Remote Procedure Call
  182. #define PORT_AUTH              113  // Authentication
  183. #define PORT_SFTP              115  // Simple File Transfer Protocol
  184. #define PORT_UUCPPATH          117  // UUCP Path Service
  185. #define PORT_NNTP              119  // Network News Transfer Protocol
  186. #define PORT_ERPC              121  // Encore Expedited Remote Proc. Call
  187. #define PORT_NTP               123  // Network Time Protocol
  188. #define PORT_LOCUSMAP          125  // Locus PC-Interface Net Map Sesrver
  189. #define PORT_LOCUSCON          127  // Locus PC-Interface Conn Server
  190. #define PORT_PWDGEN            129  // Password Generator Protocol
  191. #define PORT_CISCOFNA          130  // CISCO FNATIVE
  192. #define PORT_CISCOTNA          131  // CISCO TNATIVE
  193. #define PORT_CISCOSYS          132  // CISCO SYSMAINT
  194. #define PORT_STATSRV           133  // Statistics Service
  195. #define PORT_INGRESNET         134  // Ingres net service
  196. #define PORT_LOCSRV            135  // Location Service
  197. #define PORT_PROFILE           136  // PROFILE Naming System
  198. #define PORT_NETBIOSNS         137  // NETBIOS Name Service
  199. #define PORT_NETBIOSDGM        138  // NETBIOS Datagram Service
  200. #define PORT_NETBIOSSSN        139  // NETBIOS Session Service
  201. #define PORT_EMFISDATA         140  // EMFIS Data Service
  202. #define PORT_EMFISCNTL         141  // EMFIS Control Service
  203. #define PORT_BLIDM             142  // Britton-Lee IDM
  204. #define PORT_IMAP2             143  // Interim Mail Access Protocol v2
  205. #define PORT_NEWS              144  // NewS
  206. #define PORT_UAAC              145  // UAAC protocol
  207. #define PORT_ISOTP0            146  // ISO-IP0
  208. #define PORT_ISOIP             147  // ISO-IP
  209. #define PORT_CRONUS            148  // CRONUS-Support
  210. #define PORT_AED512            149  // AED 512 Emulation Service
  211. #define PORT_SQLNET            150  // SQL-NET
  212. #define PORT_HEMS              151  // HEMS
  213. #define PORT_BFTP              152  // Background File Transfer Protocol
  214. #define PORT_SGMP              153  // SGMP
  215. #define PORT_NETSCPROD         154  // NETSC
  216. #define PORT_NETSCDEV          155  // NETSC
  217. #define PORT_SQLSRV            156  // SQL service
  218. #define PORT_KNETCMP           157  // KNET/VM Command/Message Protocol
  219. #define PORT_PCMAILSRV         158  // PCMail server
  220. #define PORT_NSSROUTING        159  // NSS routing
  221. #define PORT_SGMPTRAPS         160  // SGMP-TRAPS
  222. #define PORT_SNMP              161  // SNMP
  223. #define PORT_SNMPTRAP          162  // SNMPTRAP
  224. #define PORT_CMIPMANAGE        163  // CMIP/TCP Manager
  225. #define PORT_CMIPAGENT         164  // CMIP/TCP Agent
  226. #define PORT_XNSCOURIER        165  // Xerox
  227. #define PORT_SNET              166  // Sirius Systems
  228. #define PORT_NAMP              167  // NAMP
  229. #define PORT_RSVD              168  // RSVC
  230. #define PORT_SEND              169  // SEND
  231. #define PORT_PRINTSRV          170  // Network Postscript
  232. #define PORT_MULTIPLEX         171  // Network Innovations Multiples
  233. #define PORT_CL1               172  // Network Innovations CL/1
  234. #define PORT_XYPLEXMUX         173  // Xyplex
  235. #define PORT_MAILQ             174  // MAILQ
  236. #define PORT_VMNET             175  // VMNET
  237. #define PORT_GENRADMUX         176  // GENRAD-MUX
  238. #define PORT_XDMCP             177  // X Display Manager Control Protocol
  239. #define PORT_NEXTSTEP          178  // NextStep Window Server
  240. #define PORT_BGP               179  // Border Gateway Protocol
  241. #define PORT_RIS               180  // Intergraph
  242. #define PORT_UNIFY             181  // Unify
  243. #define PORT_UNISYSCAM         182  // Unisys-Cam
  244. #define PORT_OCBINDER          183  // OCBinder
  245. #define PORT_OCSERVER          184  // OCServer
  246. #define PORT_REMOTEKIS         185  // Remote-KIS
  247. #define PORT_KIS               186  // KIS protocol
  248. #define PORT_ACI               187  // Application Communication Interface
  249. #define PORT_MUMPS             188  // MUMPS
  250. #define PORT_QFT               189  // Queued File Transport
  251. #define PORT_GACP              190  // Gateway Access Control Protocol
  252. #define PORT_PROSPERO          191  // Prospero
  253. #define PORT_OSUNMS            192  // OSU Network Monitoring System
  254. #define PORT_SRMP              193  // Spider Remote Monitoring Protocol
  255. #define PORT_IRC               194  // Internet Relay Chat Protocol
  256. #define PORT_DN6NLMAUD         195  // DNSIX Network Level Module Audit
  257. #define PORT_DN6SMMRED         196  // DSNIX Session Mgt Module Audit Redirector
  258. #define PORT_DLS               197  // Directory Location Service
  259. #define PORT_DLSMON            198  // Directory Location Service Monitor
  260. #define PORT_ATRMTP            201  // AppleTalk Routing Maintenance
  261. #define PORT_ATNBP             202  // AppleTalk Name Binding
  262. #define PORT_AT3               203  // AppleTalk Unused
  263. #define PORT_ATECHO            204  // AppleTalk Echo
  264. #define PORT_AT5               205  // AppleTalk Unused
  265. #define PORT_ATZIS             206  // AppleTalk Zone Information
  266. #define PORT_AT7               207  // AppleTalk Unused
  267. #define PORT_AT8               208  // AppleTalk Unused
  268. #define PORT_SURMEAS           243  // Survey Measurement
  269. #define PORT_LINK              245  // LINK
  270. #define PORT_DSP3270           246  // Display Systems Protocol
  271. #define PORT_LDAP1             389  // LDAP
  272. #define PORT_ISAKMP            500  // ISAKMP
  273. #define PORT_REXEC             512  // Remote Process Execution
  274. #define PORT_RLOGIN            513  // Remote login a la telnet
  275. #define PORT_RSH               514  // Remote command
  276. #define PORT_LPD               515  // Line printer spooler - LPD
  277. #define PORT_RIP               520  // TCP=? / UDP=RIP
  278. #define PORT_TEMPO             526  // Newdate
  279. #define PORT_COURIER           530  // rpc
  280. #define PORT_NETNEWS           532  // READNEWS
  281. #define PORT_UUCPD             540  // UUCPD
  282. #define PORT_KLOGIN            543  //
  283. #define PORT_KSHELL            544  // krcmd
  284. #define PORT_DSF               555  //
  285. #define PORT_REMOTEEFS         556  // RFS server
  286. #define PORT_CHSHELL           562  // chmod
  287. #define PORT_METER             570  // METER
  288. #define PORT_PCSERVER          600  // SUN IPC Server
  289. #define PORT_NQS               607  // NQS
  290. #define PORT_HMMP_INDICATION   612  //     
  291. #define PORT_HMMP_OPERATION    613  //     
  292. #define PORT_MDQS              666  // MDQS
  293. #define PORT_LPD721            721  // LPD Client (lpd client ports 721 - 731)
  294. #define PORT_LPD722            722  // LPD Client (see RFC 1179)
  295. #define PORT_LPD723            723  // LPD Client
  296. #define PORT_LPD724            724  // LPD Client
  297. #define PORT_LPD725            725  // LPD Client
  298. #define PORT_LPD726            726  // LPD Client
  299. #define PORT_LPD727            727  // LPD Client
  300. #define PORT_LPD728            728  // LPD Client
  301. #define PORT_LPD729            729  // LPD Client
  302. #define PORT_LPD730            730  // LPD Client
  303. #define PORT_LPD731            731  // LPD Client
  304. #define PORT_RFILE             750  // RFILE
  305. #define PORT_PUMP              751  // PUMP
  306. #define PORT_QRH               752  // QRH
  307. #define PORT_RRH               753  // RRH
  308. #define PORT_TELL              754  // TELL
  309. #define PORT_NLOGIN            758  // NLOGIN
  310. #define PORT_CON               759  // CON
  311. #define PORT_NS                760  // NS
  312. #define PORT_RXE               761  // RXE
  313. #define PORT_QUOTAD            762  // QUOTAD
  314. #define PORT_CYCLESERV         763  // CYCLESERV
  315. #define PORT_OMSERV            764  // OMSERV
  316. #define PORT_WEBSTER           765  // WEBSTER
  317. #define PORT_PHONEBOOK         767  // PHONE
  318. #define PORT_VID               769  // VID
  319. #define PORT_RTIP              771  // RTIP
  320. #define PORT_CYCLESERV2        772  // CYCLESERV-2
  321. #define PORT_SUBMIT            773  // submit
  322. #define PORT_RPASSWD           774  // RPASSWD
  323. #define PORT_ENTOMB            775  // ENTOMB
  324. #define PORT_WPAGES            776  // WPAGES
  325. #define PORT_WPGS              780  // wpgs
  326. #define PORT_MDBSDAEMON        800  // MDBS DAEMON
  327. #define PORT_DEVICE            801  // DEVICE
  328. #define PORT_MAITRD            997  // MAITRD
  329. #define PORT_BUSBOY            998  // BUSBOY
  330. #define PORT_GARCON            999  // GARCON
  331. #define PORT_NFS              2049  // NFS
  332. #define PORT_LDAP2            3268  // LDAP
  333. #define PORT_PPTP             5678  // PPTP
  334. #ifdef __cplusplus
  335. }
  336. #endif
  337. #endif // NMIPSTRUCTS_H