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.

132 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. frame.h
  5. Abstract:
  6. Author:
  7. Thomas J. Dimitri (TommyD) 08-May-1992
  8. Environment:
  9. Kernel Mode - Or whatever is the equivalent on OS/2 and DOS.
  10. Revision History:
  11. --*/
  12. // first, some default values
  13. // the ethernet max frame size is 1500+6+6+2 = 1514
  14. /* Note that this only applies to non-PPP framing. See below.
  15. */
  16. #define DEFAULT_MAX_FRAME_SIZE 1514
  17. /* The hard-coded PPP maximum frame sizes for send and receive paths.
  18. **
  19. ** Note: TommyD had these hard-coded. I have simply made this more explicit
  20. ** by removing their attachment to MaxFrameSize which was causing
  21. ** problems for NT31 RAS compression. The doubling is for PPP
  22. ** byte-stuffing, the PPP_PADDING to adjust for possible VJ expansion,
  23. ** and the 100...well, ask TommyD...and the 14 to limit exposure, i.e.
  24. ** wind up with the exact number TommyD was using.
  25. */
  26. #define DEFAULT_PPP_MAX_FRAME_SIZE 1500
  27. #define DEFAULT_EXPANDED_PPP_MAX_FRAME_SIZE ((DEFAULT_PPP_MAX_FRAME_SIZE*2)+PPP_PADDING+100+14)
  28. // ChuckL says 5 is a good default irp stack size
  29. // perhaps we should lower this though since it's typically just 1
  30. // but what if the com port is redirected??
  31. #define DEFAULT_IRP_STACK_SIZE 5
  32. #define SLIP_END_BYTE 192
  33. #define SLIP_ESC_BYTE 219
  34. #define SLIP_ESC_END_BYTE 220
  35. #define SLIP_ESC_ESC_BYTE 221
  36. #define PPP_FLAG_BYTE 0x7e
  37. #define PPP_ESC_BYTE 0x7d
  38. // define the number of framesPerPort
  39. /* The NT35 setting, where sends are IRPed directly from the input buffer
  40. ** passed down from NDISWAN.
  41. */
  42. #define DEFAULT_FRAMES_PER_PORT 1
  43. // define if xon/xoff capability is on by default (off)
  44. #define DEFAULT_XON_XOFF 0
  45. // the mininmum timeout value per connection in ms
  46. #define DEFAULT_TIMEOUT_BASE 500
  47. // the multiplier based on the baud rate tacked on to the base in ms
  48. #define DEFAULT_TIMEOUT_BAUD 28800
  49. // the timeout to use if we drop a frame in ms
  50. #define DEFAULT_TIMEOUT_RESYNC 500
  51. typedef struct ASYNC_FRAME_HEADER ASYNC_FRAME_HEADER, *PASYNC_FRAME_HEADER;
  52. struct ASYNC_FRAME_HEADER {
  53. UCHAR SyncByte; // 0x16
  54. UCHAR FrameType; // 0x01, 0x02 (directed vs. multicast)
  55. // 0x08 compression
  56. UCHAR HighFrameLength;
  57. UCHAR LowFrameLength;
  58. };
  59. typedef struct ASYNC_FRAME_TRAILER ASYNC_FRAME_TRAILER, *PASYNC_FRAME_TRAILER;
  60. struct ASYNC_FRAME_TRAILER {
  61. UCHAR EtxByte; // 0x03
  62. UCHAR LowCRCByte;
  63. UCHAR HighCRCByte;
  64. };
  65. typedef ULONG FRAME_ID;
  66. typedef struct ASYNC_ADAPTER ASYNC_ADAPTER, *PASYNC_ADAPTER;
  67. typedef struct ASYNC_INFO ASYNC_INFO, *PASYNC_INFO;
  68. typedef struct ASYNC_FRAME ASYNC_FRAME, *PASYNC_FRAME;
  69. struct ASYNC_FRAME {
  70. // For PPP/SLIP.
  71. ULONG WaitMask; // Mask bits when IRP completes
  72. #if 0
  73. PIRP Irp; // Irp allocated based on DefaultIrpStackSize.
  74. #if DBG
  75. ULONG Line;
  76. CHAR *File;
  77. #endif
  78. #endif
  79. UINT FrameLength; // Size of Frame allocated.
  80. PUCHAR Frame; // Buffer allocated based on
  81. // DefaultFrameSize
  82. WORK_QUEUE_ITEM WorkItem; // For stack overflow reads
  83. PASYNC_ADAPTER Adapter; // back ptr to adapter
  84. PASYNC_INFO Info; // back ptr to info field
  85. NDIS_HANDLE MacBindingHandle;
  86. NDIS_HANDLE NdisBindingContext;
  87. };
  88. NTSTATUS
  89. AsyncGetFrameFromPool(
  90. IN PASYNC_INFO Info,
  91. OUT PASYNC_FRAME *NewFrame );