Source code of Windows XP (NT5)
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.

125 lines
3.6 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. ntos\tdi\isn\fwd\fwddefs.h
  5. Abstract:
  6. IPX Forwarder driver constants and general macro definitions
  7. Author:
  8. Vadim Eydelman
  9. Revision History:
  10. --*/
  11. #ifndef _IPXFWD_FWDDEFS_
  12. #define _IPXFWD_FWDDEFS_
  13. // Forwarder tag used in memory allocations
  14. #define FWD_POOL_TAG 'wFwN'
  15. //*** Offsets into the IPX header
  16. #define IPXH_HDRSIZE 30 // Size of the IPX header
  17. #define IPXH_CHECKSUM 0 // Checksum
  18. #define IPXH_LENGTH 2 // Length
  19. #define IPXH_XPORTCTL 4 // Transport Control
  20. #define IPXH_PKTTYPE 5 // Packet Type
  21. #define IPXH_DESTADDR 6 // Dest. Address (Total)
  22. #define IPXH_DESTNET 6 // Dest. Network Address
  23. #define IPXH_DESTNODE 10 // Dest. Node Address
  24. #define IPXH_DESTSOCK 16 // Dest. Socket Number
  25. #define IPXH_SRCADDR 18 // Source Address (Total)
  26. #define IPXH_SRCNET 18 // Source Network Address
  27. #define IPXH_SRCNODE 22 // Source Node Address
  28. #define IPXH_SRCSOCK 28 // Source Socket Number
  29. //*** Packet Types we care about
  30. #define IPX_NETBIOS_TYPE 20 // Netbios propagated packet
  31. //*** Socket Numbers we care about
  32. #define IPX_NETBIOS_SOCKET ((USHORT)0x0455)
  33. #define IPX_SAP_SOCKET ((USHORT)0x0452)
  34. #define IPX_SMB_NAME_SOCKET ((USHORT)0x0551)
  35. //*** maximum nr of hops for a normal packet ***
  36. #define IPX_MAX_HOPS 16
  37. //*** offsets into the netbios name frames ***
  38. #define NB_NAME_TYPE_FLAG 62
  39. #define NB_DATA_STREAM_TYPE2 63
  40. #define NB_NAME 64
  41. #define NB_TOTAL_DATA_LENGTH 80
  42. // *** offsets into smb name claim/query frames
  43. #define SMB_OPERATION 62
  44. #define SMB_NAME_TYPE 63
  45. #define SMB_MESSAGE_IF 64
  46. #define SMB_NAME 66
  47. // Some commonly used macros
  48. #define IPX_NODE_CPY(dst,src) memcpy(dst,src,6)
  49. #define IPX_NODE_CMP(node1,node2) memcmp(node1,node2,6)
  50. #define IPX_NET_CPY(dst,src) memcpy(dst,src,4)
  51. #define IPX_NET_CMP(net1,net2) memcmp(net1,net2,4)
  52. #define NB_NAME_CPY(dst,src) strncpy((char *)dst,(char *)src,16)
  53. #define NB_NAME_CMP(name1,name2) strncmp((char *)name1,(char *)name2,16)
  54. // Make sure the structure is copied with DWORD granularity
  55. #define IF_STATS_CPY(dst,src) \
  56. (dst)->OperationalState = (src)->OperationalState; \
  57. (dst)->MaxPacketSize = (src)->MaxPacketSize; \
  58. (dst)->InHdrErrors = (src)->InHdrErrors; \
  59. (dst)->InFiltered = (src)->InFiltered; \
  60. (dst)->InNoRoutes = (src)->InNoRoutes; \
  61. (dst)->InDiscards = (src)->InDiscards; \
  62. (dst)->InDelivers = (src)->InDelivers; \
  63. (dst)->OutFiltered = (src)->OutFiltered; \
  64. (dst)->OutDiscards = (src)->OutDiscards; \
  65. (dst)->OutDelivers = (src)->OutDelivers; \
  66. (dst)->NetbiosReceived = (src)->NetbiosReceived; \
  67. (dst)->NetbiosSent = (src)->NetbiosSent;
  68. // Extensions to list macros
  69. #define InitializeListEntry(entry) InitializeListHead(entry)
  70. #define IsListEntry(entry) IsListEmpty(entry)
  71. #define IsSingleEntry(head) ((head)->Flink==(head)->Blink)
  72. // Conversions from/to on-the-wire format
  73. #define GETUSHORT(src) ( \
  74. (USHORT)( \
  75. (((UCHAR *)src)[0]<<8) \
  76. + (((UCHAR *)src)[1]) \
  77. ) \
  78. )
  79. #define GETULONG(src) ( \
  80. (ULONG)( \
  81. (((UCHAR *)src)[0]<<24) \
  82. + (((UCHAR *)src)[1]<<16) \
  83. + (((UCHAR *)src)[2]<<8) \
  84. + (((UCHAR *)src)[3]) \
  85. ) \
  86. )
  87. #define PUTUSHORT(src,dst) { \
  88. ((UCHAR *)dst)[0] = ((UCHAR)(src>>8)); \
  89. ((UCHAR *)dst)[1] = ((UCHAR)src); \
  90. }
  91. #define PUTULONG(src,dst) { \
  92. ((UCHAR *)dst)[0] = ((UCHAR)(src>>24)); \
  93. ((UCHAR *)dst)[1] = ((UCHAR)(src>>16)); \
  94. ((UCHAR *)dst)[2] = ((UCHAR)(src>>8)); \
  95. ((UCHAR *)dst)[3] = ((UCHAR)src); \
  96. }
  97. #endif