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.

179 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. ALGconn.h
  5. Abstract:
  6. This module contains declarations for the ALG transparent proxy's
  7. connection-management.
  8. Author:
  9. Qiang Wang (qiangw) 10-Apr-2000
  10. Revision History:
  11. --*/
  12. #pragma once
  13. #define ALG_BUFFER_RESERVE 12
  14. //
  15. // Structure: ALG_CONNECTION
  16. //
  17. // This structure encapsulates information about a control-channel accepted
  18. // on one of the interfaces over which the component is enabled.
  19. // Each entry is stored in the connection list of an interface,
  20. // and is uniquely identified by a 32-bit identifier assigned when the entry
  21. // is created.
  22. // As connection-requests are accepted for a connection-entry,
  23. // endpoints are created in the connection's list.
  24. // Access to the list is synchronized using the interface lock
  25. // for the interface on which the connection was created.
  26. //
  27. typedef struct _ALG_CONNECTION {
  28. LIST_ENTRY Link;
  29. ULONG ConnectionId;
  30. PALG_INTERFACE Interfacep;
  31. LIST_ENTRY ActiveEndpointList;
  32. } ALG_CONNECTION, *PALG_CONNECTION;
  33. typedef enum {
  34. AlgClientEndpointType,
  35. AlgHostEndpointType,
  36. AlgMaximumEndpointType
  37. } ALG_ENDPOINT_TYPE, *PALG_ENDPOINT_TYPE;
  38. //
  39. // Structure: ALG_ENDPOINT
  40. //
  41. // This structure encapsulates information about a ALG endpoint,
  42. // which is an active endpoint transferring data between a client and a host.
  43. // Each endpoint is stored in the endpoint list of the connection for which
  44. // it was created, and in the endpoint list of its connection's interface.
  45. //
  46. typedef struct _ALG_ENDPOINT {
  47. LIST_ENTRY ConnectionLink;
  48. LIST_ENTRY InterfaceLink;
  49. ULONG EndpointId;
  50. ULONG ConnectionId;
  51. PALG_INTERFACE Interfacep;
  52. ULONG Flags;
  53. ALG_ENDPOINT_TYPE Type;
  54. SOCKET ClientSocket;
  55. SOCKET HostSocket;
  56. ULONG BoundaryAddress;
  57. ULONG ActualClientAddress;
  58. ULONG ActualHostAddress;
  59. ULONG DestinationAddress;
  60. ULONG SourceAddress;
  61. ULONG NewDestinationAddress;
  62. ULONG NewSourceAddress;
  63. USHORT ActualClientPort;
  64. USHORT ActualHostPort;
  65. USHORT DestinationPort;
  66. USHORT SourcePort;
  67. USHORT NewDestinationPort;
  68. USHORT NewSourcePort;
  69. USHORT ReservedPort;
  70. } ALG_ENDPOINT, *PALG_ENDPOINT;
  71. #define ALG_ENDPOINT_FLAG_INITIAL_ENDPOINT 0x00000001
  72. #define ALG_ENDPOINT_FLAG_CLIENT_CLOSED 0x00000002
  73. #define ALG_ENDPOINT_FLAG_HOST_CLOSED 0x00000004
  74. #define ALG_ENDPOINT_FLAG_DELETE_CONNECTION 0x00000008
  75. //
  76. // ROUTINE DECLARATIONS
  77. //
  78. ULONG
  79. AlgActivateActiveEndpoint(
  80. PALG_INTERFACE Interfacep,
  81. PALG_ENDPOINT Endpointp
  82. );
  83. VOID
  84. AlgCloseActiveEndpoint(
  85. PALG_ENDPOINT Endpointp,
  86. SOCKET ClosedSocket
  87. );
  88. ULONG
  89. AlgCreateActiveEndpoint(
  90. PALG_CONNECTION Connectionp,
  91. ALG_ENDPOINT_TYPE Type,
  92. SOCKET ListeningSocket,
  93. SOCKET AcceptedSocket,
  94. PUCHAR AcceptBuffer,
  95. ULONG RemoteAddress,
  96. USHORT RemotePort,
  97. ULONG BoundaryAddress,
  98. OUT PALG_ENDPOINT* EndpointCreated OPTIONAL
  99. );
  100. ULONG
  101. AlgCreateConnection(
  102. PALG_INTERFACE Interfacep,
  103. SOCKET ListeningSocket,
  104. SOCKET AcceptedSocket,
  105. PUCHAR AcceptBuffer,
  106. OUT PALG_CONNECTION* ConnectionCreated OPTIONAL
  107. );
  108. VOID
  109. AlgDeleteActiveEndpoint(
  110. PALG_ENDPOINT Endpointp
  111. );
  112. VOID
  113. AlgDeleteConnection(
  114. PALG_CONNECTION Connectionp
  115. );
  116. PALG_ENDPOINT
  117. AlgLookupActiveEndpoint(
  118. PALG_CONNECTION Connectionp,
  119. ULONG EndpointId,
  120. PLIST_ENTRY* InsertionPoint OPTIONAL
  121. );
  122. PALG_CONNECTION
  123. AlgLookupConnection(
  124. PALG_INTERFACE Interfacep,
  125. ULONG ConnectionId,
  126. PLIST_ENTRY* InsertionPoint OPTIONAL
  127. );
  128. PALG_ENDPOINT
  129. AlgLookupInterfaceEndpoint(
  130. PALG_INTERFACE Interfacep,
  131. ULONG EndpointId,
  132. PLIST_ENTRY* InsertionPoint OPTIONAL
  133. );
  134. ULONG
  135. AlgReadActiveEndpoint(
  136. PALG_INTERFACE Interfacep,
  137. PALG_ENDPOINT Endpoint,
  138. SOCKET Socket,
  139. ULONG UserFlags OPTIONAL
  140. );
  141. ULONG
  142. AlgWriteActiveEndpoint(
  143. PALG_INTERFACE Interfacep,
  144. PALG_ENDPOINT Endpoint,
  145. SOCKET Socket,
  146. PNH_BUFFER Bufferp,
  147. ULONG Length,
  148. ULONG UserFlags OPTIONAL
  149. );