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.

138 lines
4.2 KiB

  1. /****************************************************************************
  2. *
  3. * $Archive: S:/STURGEON/SRC/INCLUDE/VCS/mspbuffs.h_v $
  4. *
  5. * INTEL Corporation Prorietary Information
  6. *
  7. * This listing is supplied under the terms of a license agreement
  8. * with INTEL Corporation and may not be copied nor disclosed except
  9. * in accordance with the terms of that agreement.
  10. *
  11. * Copyright (c) 1993-1994 Intel Corporation.
  12. *
  13. * $Revision: 1.7 $
  14. * $Date: Apr 25 1996 10:46:04 $
  15. * $Author: MLEWIS1 $
  16. *
  17. * Deliverable:
  18. *
  19. * Abstract:
  20. *
  21. * Notes:
  22. *
  23. ***************************************************************************/
  24. #ifndef MSPBUFFS_H
  25. #define MSPBUFFS_H
  26. #ifdef __cplusplus
  27. extern "C" { // Assume C declarations for C++.
  28. #endif // __cplusplus
  29. //////////////////////////////////////////////////////
  30. // Buffer Manager typedef Section
  31. //////////////////////////////////////////////////////
  32. typedef DWORD STATUS, *LPSTATUS;
  33. typedef LPBYTE BUFPTR;
  34. typedef DWORD HBUFQUEUE;
  35. //////////////////////////////////////////////////////
  36. // Buffer Manager Error Code Section
  37. //////////////////////////////////////////////////////
  38. #define MBE_OK 0
  39. #define MBE_EMPTY 1000
  40. #define MBE_NOMEM 1001
  41. #define MBE_PARAM 1002
  42. #define MBE_STATE 1003
  43. #define MBE_EMPTYQ MBE_EMPTY
  44. //////////////////////////////////////////////////////
  45. // Buffer Manager Prototypes Section
  46. //////////////////////////////////////////////////////
  47. // create a buffer of the specified size
  48. BUFPTR MB_CreateBuffer(UINT size, LPSTATUS lpStatus);
  49. // delete the buffer. must not be on a queue
  50. STATUS MB_DeleteBuffer(BUFPTR pBuf);
  51. // get the size a buffer
  52. UINT MB_BufSize(BUFPTR pBuf);
  53. // associate user data with a buffer
  54. STATUS MB_Associate(BUFPTR pBuf, LPVOID pAssc);
  55. // retrieve the user data associated with a buffer
  56. LPVOID MB_GetAssociation(BUFPTR pBuf, LPSTATUS lpStatus);
  57. //////////////////////////////////////////////////////
  58. // Queue Manager Prototypes Section
  59. //////////////////////////////////////////////////////
  60. // create a FIFO queue (empty)
  61. HBUFQUEUE MB_CreateQueue(LPSTATUS lpStatus);
  62. // delete the FIFO queue. must be empty
  63. STATUS MB_DeleteQueue(HBUFQUEUE hQue);
  64. // add a buffer to the tail of the queue
  65. STATUS MB_Enqueue(HBUFQUEUE hQue, BUFPTR pBuf);
  66. // get the next buffer from the head of the queue (NULL if empty)
  67. BUFPTR MB_Dequeue(HBUFQUEUE hQue, LPSTATUS lpStatus);
  68. // remove a specified buffer from anywhere in the queue
  69. STATUS MB_Remove(HBUFQUEUE hQue, BUFPTR pBuf);
  70. // refer to buffer on the head of the queue (not dequeued, NULL if empty)
  71. BUFPTR MB_Front(HBUFQUEUE hQue, LPSTATUS lpStatus);
  72. // refer to buffer at the tail of the queue (not dequeued, NULL if empty)
  73. BUFPTR MB_Back(HBUFQUEUE hQue, LPSTATUS lpStatus);
  74. // refer to next buffer in the queue (NULL if last)
  75. BUFPTR MB_Next(BUFPTR pBuf, LPSTATUS lpStatus);
  76. // refer to previous buffer in the queue (NULL if first)
  77. BUFPTR MB_Prev(BUFPTR pBuf, LPSTATUS lpStatus);
  78. // count of buffers in a queue
  79. UINT MB_QCount(HBUFQUEUE hQue, LPSTATUS lpStatus);
  80. // get a buffer with specified associated data (dequeued, NULL if not found)
  81. BUFPTR MB_RemoveByAssociation(HBUFQUEUE hQue, LPVOID pAssc, LPSTATUS lpStatus);
  82. // get the queue a buffer is on (NULL if not on queue)
  83. HBUFQUEUE MB_OnQueue(BUFPTR pBuf, LPSTATUS lpStatus);
  84. // add a buffer to the head of the queue
  85. STATUS MB_GetAndResetWatermarks(HBUFQUEUE hQue, UINT *lpHiWater, UINT *lpLoWater);
  86. // Get and reset watermarks on the queue
  87. STATUS MB_Requeue(HBUFQUEUE hQue, BUFPTR pBuf);
  88. // get a buffer with specified associated data ( leave queued, NULL if not found)
  89. BUFPTR MB_FindByAssociation(HBUFQUEUE hQue, LPVOID pAssc, LPSTATUS lpStatus);
  90. // Restrict queue access to the calling thread
  91. STATUS MB_QLock(HBUFQUEUE hQue);
  92. // Restore queue access to all threads
  93. STATUS MB_QUnlock(HBUFQUEUE hQue);
  94. //////////////////////////////////////////////////////
  95. // Pool Manager Prototypes Section
  96. //////////////////////////////////////////////////////
  97. // create a pool(queue) with the specified number and size of buffers
  98. HBUFQUEUE MB_CreatePool(UINT bufSize, UINT count, LPSTATUS lpStatus);
  99. // delete a pool(queue) and all buffers queued on it
  100. STATUS MB_DeletePool(HBUFQUEUE hPool);
  101. #ifdef __cplusplus
  102. } // End of extern "C" {
  103. #endif // __cplusplus
  104. #endif // MSPBUFFS_H