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

模拟服务器

开发平台:

C/C++

  1. //=============================================================================
  2. //  Microsoft (R) Bloodhound (tm). Copyright (C) 1991-1999.
  3. //
  4. //  MODULE: buffer.h
  5. //
  6. //  This source file contains defintions for Bloodhound buffers.
  7. //=============================================================================
  8. #if !defined(_BUFFER_)
  9. #define _BUFFER_
  10. #pragma pack(1)
  11. #define BUFFERSIZE      ((DWORD) 32768U)    //... Size of each buffer (NDIS and ODI NAL's).
  12. #define ONE_MEG         32
  13. #define ONE_HALF_MEG    (ONE_MEG / 2)
  14. #define STAT_FRAME_SIZE 1024
  15. //=============================================================================
  16. //  Frame type.
  17. //=============================================================================
  18. typedef struct _FRAME
  19. {
  20.     DWORD   TimeStamp; //... Relative time in milliseconds.
  21.     WORD    FrameLength; //... MAC frame length.
  22.     WORD    nBytesAvail; //... Actual frame length copied.
  23.     BYTE    MacFrame[0]; //... Frame data.
  24. } FRAME;
  25. typedef FRAME *LPFRAME;
  26. typedef FRAME UNALIGNED *ULPFRAME;
  27. #define FRAME_SIZE  sizeof(FRAME)
  28. //=============================================================================
  29. //  Buffer Table Entry (BTE). This is the private part of the buffer for
  30. //  the NDIS 2.0, NDIS 3.0, and ODI nals.
  31. //=============================================================================
  32. typedef struct _BTE *LPBTE;
  33. typedef struct _BTE
  34. {
  35.     DWORD   ObjectType;  //... 'BTE$'. Filled in byt kernel.
  36.     DWORD   Flags; //... Used by Nal/driver.
  37.     LPBTE   KrnlModeNext; //... Optional, reserved for NAL usage.
  38.     LPBTE   Next; //... Pointer to next BTE.
  39.     LPFRAME UserModeBuffer; //... User mode buffer pointer.
  40.     LPVOID  KrnlModeBuffer; //... Kernel mode buffer pointer.
  41.     DWORD   Length; //... Overall buffer length (in bytes)
  42.     DWORD   ByteCount; //... Number of bytes in buffer.
  43.     DWORD   FrameCount;  //... Number of frames in buffer.
  44.     WORD    DropCount;          //... Number of dropped frames detected.
  45.     WORD    TransfersPended;    //... Number of transferdatas pended by mac
  46. } BTE;
  47. #define BTE_SIZE    sizeof(BTE)
  48. //=============================================================================
  49. //  Buffer type.
  50. //=============================================================================
  51. typedef struct _BUFFER
  52. {
  53.     //=========================================================================
  54.     //  PUBLIC portion of BUFFER type. This section is filled in by NAL.DLL.
  55.     //  The public section is 64 bytes in size.
  56.     //=========================================================================
  57.     DWORD           ObjectType;         //... 'BUF$'.
  58.     DWORD           NetworkID;          //... Network ID.
  59.     DWORD           BufferSize;         //... Buffer size requested.
  60.     DWORD           TotalBytes;         //... Total bytes captured.
  61.     DWORD           TotalFrames;        //... Total frames captured.
  62.     LPVOID          hNetwork;           //... Handle of network.
  63.     SYSTEMTIME      TimeOfCapture;      //... Time of capture.
  64.     LPBTE           StatFrameBTE;          //... Pointer to the stat frame
  65.     DWORD           Reserved[5];        //... Reserved for future use.
  66.     //=========================================================================
  67.     //  PRIVATE portion of BUFFER type. This section is filled by NAL drivers/dlls.
  68.     //  The private section is 32 bytes in size.
  69.     //=========================================================================
  70. //    BYTE     Private[32]; //... 32 bytes of private space for NAL use.
  71. //  start MSINTERNAL
  72.     DWORD     HeadBTEIndex; //... BTE containing frame #1, filled in by NAL.
  73.     DWORD     TailBTEIndex; //... BTE containing frame #N, filled in by NAL.
  74.     DWORD     NumberOfBuffers; //... Total number of BTE's, filled in by kernel.
  75.     DWORD           NumberOfBuffersUsed;//... Total number of BTE's used, filled in by driver.
  76.     DWORD           Pad[4];             //... Pad out to 32 bytes.
  77.     BTE             bte[0];             //... BTE's follow BUFFER structure in memory.
  78. // stop MSINTERNAL
  79. } BUFFER;
  80. typedef BUFFER *HBUFFER;
  81. //=============================================================================
  82. //  FUNCTION: GetBteIndex();
  83. //
  84. //  Modification History
  85. //
  86. //  raypa       07/10/93                Created.
  87. //=============================================================================
  88. #define GetBteIndex(hBuffer, lpBte)       ((DWORD) ((lpBte) - (hBuffer)->bte))
  89. #pragma pack()
  90. #endif