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.

181 lines
4.0 KiB

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