Leaked source code of windows server 2003
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.

190 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. view.h
  5. Abstract:
  6. Manifests, macros, types prototypes for view.c
  7. Author:
  8. Richard L Firth (rfirth) 17-Oct-1994
  9. Revision History:
  10. 17-Oct-1994 rfirth
  11. Created
  12. --*/
  13. #if defined(__cplusplus)
  14. extern "C" {
  15. #endif
  16. //
  17. // have to forward-define LPSESSION_INFO
  18. //
  19. typedef struct _SESSION_INFO * LPSESSION_INFO;
  20. //
  21. // VIEW_TYPE - which type of view are we talking about, FIND or FILE?
  22. //
  23. typedef enum {
  24. ViewTypeFile = 0xff010101, // arbitrary values always good for a few laughs
  25. ViewTypeFind
  26. } VIEW_TYPE;
  27. //
  28. // VIEW_INFO - describes a data view, either the results of a FindFirst or a
  29. // GetFile
  30. //
  31. typedef struct {
  32. //
  33. // List - the list of VIEW_INFO structures owned by the parent SESSION_INFO
  34. //
  35. LIST_ENTRY List;
  36. //
  37. // ViewType - lets us know which of the Session view lists this is on
  38. //
  39. VIEW_TYPE ViewType;
  40. //
  41. // Handle - the handle returned by GopherFindFirst/GopherGetFile
  42. //
  43. HINTERNET Handle;
  44. //
  45. // Request - the request string which generated Buffer
  46. //
  47. LPSTR Request;
  48. //
  49. // RequestLength - number of bytes in Request (excluding terminating \0)
  50. //
  51. DWORD RequestLength;
  52. //
  53. // Set to 1 when this 'object' is created. Any time it is used thereafter
  54. // this field must be incremented and decremented when no longer being
  55. // used. Closing the handle that corresponds to this view will dereference
  56. // it a final time and cause the view to be deleted
  57. //
  58. LONG ReferenceCount;
  59. //
  60. // Flags - various control flags, see below
  61. //
  62. DWORD Flags;
  63. //
  64. // ViewOffset - offset in buffer described by BufferInfo->Buffer which will
  65. // be used to generate the results of the next request on this view
  66. //
  67. DWORD ViewOffset;
  68. //
  69. // Buffer - pointer to BUFFER_INFO containing data returned from gopher
  70. // server
  71. //
  72. LPBUFFER_INFO BufferInfo;
  73. //
  74. // SessionInfo - back-pointer to the owning SESSION_INFO. Used when we
  75. // create or destroy this view - the owning session must be referenced
  76. // or dereferenced accordingly
  77. //
  78. LPSESSION_INFO SessionInfo;
  79. } VIEW_INFO, *LPVIEW_INFO;
  80. //
  81. // VIEW_INFO flags
  82. //
  83. #define VI_GOPHER_PLUS 0x00000001 // the data buffer contains gopher+ data
  84. #define VI_CLEANUP 0x00000002 // set by CleanupSessions()
  85. //
  86. // external data
  87. //
  88. DEBUG_DATA_EXTERN(LONG, NumberOfViews);
  89. //
  90. // prototypes
  91. //
  92. LPVIEW_INFO
  93. CreateView(
  94. IN LPSESSION_INFO SessionInfo,
  95. IN VIEW_TYPE ViewType,
  96. IN LPSTR Request,
  97. OUT LPDWORD Error,
  98. OUT LPBOOL Cloned
  99. );
  100. LPVIEW_INFO
  101. FindViewByHandle(
  102. IN HINTERNET Handle,
  103. IN VIEW_TYPE ViewType
  104. );
  105. VOID
  106. ReferenceView(
  107. IN LPVIEW_INFO ViewInfo
  108. );
  109. LPVIEW_INFO
  110. DereferenceView(
  111. IN LPVIEW_INFO ViewInfo
  112. );
  113. DWORD
  114. DereferenceViewByHandle(
  115. IN HINTERNET Handle,
  116. IN VIEW_TYPE ViewType
  117. );
  118. //
  119. // macros
  120. //
  121. #if INET_DEBUG
  122. #define VIEW_CREATED() ++NumberOfViews
  123. #define VIEW_DESTROYED() --NumberOfViews
  124. #define ASSERT_NO_VIEWS() \
  125. if (NumberOfViews != 0) { \
  126. INET_ASSERT(FALSE); \
  127. }
  128. #else
  129. #define VIEW_CREATED() /* NOTHING */
  130. #define VIEW_DESTROYED() /* NOTHING */
  131. #define ASSERT_NO_VIEWS() /* NOTHING */
  132. #endif // INET_DEBUG
  133. #if defined(__cplusplus)
  134. }
  135. #endif