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.

204 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. session.h
  5. Abstract:
  6. Manifests, macros, types, prototypes for session.c
  7. Author:
  8. Richard L Firth (rfirth) 25-Oct-1994
  9. Revision History:
  10. 25-Oct-1994 rfirth
  11. Created
  12. --*/
  13. #if defined(__cplusplus)
  14. extern "C" {
  15. #endif
  16. //
  17. // types
  18. //
  19. //
  20. // SESSION_INFO - describes a session with a gopher server. We will keep a cache
  21. // of these. Only one 'conversation' can be active at any one time with a gopher
  22. // server. Threads must wait on the mutex handle
  23. //
  24. typedef struct _SESSION_INFO {
  25. //
  26. // List - SESSION_INFOs are maintained on double-linked list
  27. //
  28. LIST_ENTRY List;
  29. //
  30. // ReferenceCount - used to keep this session alive when there are
  31. // concurrent creates/deletes on different threads
  32. //
  33. LONG ReferenceCount;
  34. //
  35. // Handle - identifies this session to the application
  36. //
  37. HANDLE Handle;
  38. //
  39. // Flags - various control flags. See below
  40. //
  41. DWORD Flags;
  42. //
  43. // Host - name of host with which we have a connection
  44. //
  45. LPSTR Host;
  46. //
  47. // Port - port number at which gopher server listens at Host
  48. //
  49. DWORD Port;
  50. //
  51. // FindList - protected, doubly-linked list of VIEW_INFO 'object's generated
  52. // by gopher directory requests
  53. //
  54. SERIALIZED_LIST FindList;
  55. //
  56. // FileList - protected, doubly-linked list of VIEW_INFO 'object's generated
  57. // by gopher document (file) requests
  58. //
  59. SERIALIZED_LIST FileList;
  60. } SESSION_INFO, *LPSESSION_INFO;
  61. //
  62. // SESSION_INFO flags
  63. //
  64. #define SI_GOPHER_PLUS 0x00000001 // gopher server at Host is gopher+
  65. #define SI_CLEANUP 0x00000002 // set by CleanupSession()
  66. #define SI_PERSISTENT 0x80000000 // connection to gopher server kept alive
  67. //
  68. // macros
  69. //
  70. #define UNKNOWN_GOPHER(session) ((session)->Flags & (SI_GOPHER_ZERO | SI_GOPHER_PLUS) == 0)
  71. //
  72. // public data
  73. //
  74. extern SERIALIZED_LIST SessionList;
  75. DEBUG_DATA_EXTERN(LONG, NumberOfSessions);
  76. //
  77. // prototypes
  78. //
  79. VOID
  80. AcquireSessionLock(
  81. VOID
  82. );
  83. VOID
  84. ReleaseSessionLock(
  85. VOID
  86. );
  87. VOID
  88. CleanupSessions(
  89. VOID
  90. );
  91. LPSESSION_INFO
  92. FindOrCreateSession(
  93. IN LPSTR Host,
  94. IN DWORD Port,
  95. OUT LPDWORD Error
  96. );
  97. VOID
  98. ReferenceSession(
  99. IN LPSESSION_INFO SessionInfo
  100. );
  101. LPSESSION_INFO
  102. DereferenceSession(
  103. IN LPSESSION_INFO SessionInfo
  104. );
  105. VOID
  106. AcquireViewLock(
  107. IN LPSESSION_INFO SessionInfo,
  108. IN VIEW_TYPE ViewType
  109. );
  110. VOID
  111. ReleaseViewLock(
  112. IN LPSESSION_INFO SessionInfo,
  113. IN VIEW_TYPE ViewType
  114. );
  115. DWORD
  116. GopherTransaction(
  117. IN LPVIEW_INFO ViewInfo
  118. );
  119. BOOL
  120. IsGopherPlusSession(
  121. IN LPSESSION_INFO SessionInfo
  122. );
  123. DWORD
  124. SearchSessionsForAttribute(
  125. IN LPSTR Locator,
  126. IN LPSTR Attribute,
  127. IN LPBYTE Buffer,
  128. IN OUT LPDWORD BufferLength
  129. );
  130. //
  131. // macros
  132. //
  133. #if INET_DEBUG
  134. #define SESSION_CREATED() ++NumberOfBuffers
  135. #define SESSION_DESTROYED() --NumberOfBuffers
  136. #define ASSERT_NO_SESSIONS() \
  137. if (NumberOfSessions != 0) { \
  138. INET_ASSERT(FALSE); \
  139. }
  140. #else
  141. #define SESSION_CREATED() /* NOTHING */
  142. #define SESSION_DESTROYED() /* NOTHING */
  143. #define ASSERT_NO_SESSIONS() /* NOTHING */
  144. #endif
  145. #if defined(__cplusplus)
  146. }
  147. #endif