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.

159 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name :
  4. xportcon.hxx
  5. Abstract:
  6. This module declares the class XPORT_CONNECTIONS. This class
  7. encapsulates communication information objects, one for each
  8. of the transports on which a connection is established by a service.
  9. Author:
  10. Murali R. Krishnan ( MuraliK ) 08-March-1995
  11. Environment:
  12. Win32 -- User Mode
  13. Project:
  14. Internet Services Common Module
  15. Revision History:
  16. --*/
  17. # ifndef _XPORTCON_HXX_
  18. # define _XPORTCON_HXX_
  19. /************************************************************
  20. * Include Headers
  21. ************************************************************/
  22. # include <winsock.h>
  23. # include <nspapi.h>
  24. # include <atq.h>
  25. //
  26. // Type of callback function to be called when a new connection is established.
  27. // This function should be defined before including conninfo.hxx
  28. //
  29. typedef
  30. VOID
  31. ( * PFN_CONNECT_CALLBACK) ( IN SOCKET sNew,
  32. IN LPSOCKADDR_IN psockAddr);
  33. // # include "conninfo.hxx" <------- defines TS_CONNECTION_INFO
  34. //
  35. // Use a Forward declaration
  36. //
  37. class TS_CONNECTION_INFO_BASE;
  38. /************************************************************
  39. * Type Definitions
  40. ************************************************************/
  41. /*++
  42. class TS_XPORT_CONNECTIONS
  43. This class encapsulates the connection information objects.
  44. One connection information object is created per transport supported.
  45. Each connection information object keeps maintains a socket
  46. for the transport it is bound. It also has a dedicated thread for
  47. accepting new connections and dispatching the same to the client
  48. call back function.
  49. Each service typically needs to provide a single call back function.
  50. ( sockets provide a layer of transparency beyond the point of connection)
  51. Data:
  52. m_nXports count of transports supported.
  53. m_ppConnectionInfo pointer to an array of pointers to
  54. TS_CONNECTION_INFO objects, one each
  55. for each of the transport.
  56. --*/
  57. class TS_XPORT_CONNECTIONS {
  58. public:
  59. dllexp TS_XPORT_CONNECTIONS( VOID)
  60. : m_ppConnectionInfo( NULL),
  61. m_nXports ( 0)
  62. {}
  63. dllexp ~TS_XPORT_CONNECTIONS( VOID)
  64. { Cleanup(); }
  65. dllexp DWORD
  66. QueryNumTransports( VOID) const { return ( m_nXports); }
  67. dllexp const TS_CONNECTION_INFO_BASE *
  68. QueryXportConnection( DWORD i) const
  69. {
  70. return ( m_ppConnectionInfo != NULL && ( i < m_nXports) ?
  71. m_ppConnectionInfo[ i] : NULL);
  72. } // QueryXportConnection()
  73. dllexp const TS_CONNECTION_INFO_BASE *
  74. operator [] ( DWORD i) const { return ( QueryXportConnection( i)); }
  75. dllexp BOOL
  76. EstablishListenConnections(
  77. IN CONST TCHAR * pszServiceName,
  78. IN PCSADDR_INFO pcsAddrInfo,
  79. IN DWORD nAddresses,
  80. OUT LPDWORD lpdwNumEstablished,
  81. IN DWORD nListenBacklog,
  82. IN BOOL fUseAcceptEx );
  83. dllexp BOOL
  84. GetListenSockets(
  85. IN OUT SOCKET * pSockets,
  86. IN OUT LPDWORD pnSocketsMax) const;
  87. dllexp BOOL
  88. StartListenPumps( IN PFN_CONNECT_CALLBACK pfnConnectCallback,
  89. IN ATQ_COMPLETION pfnConnectCallbackEx,
  90. IN ATQ_COMPLETION pfnIOCompletion,
  91. IN DWORD cbAcceptExReceiveBuffer,
  92. IN const CHAR * pszRegParamKey,
  93. OUT LPDWORD lpdwNumStarted) const;
  94. dllexp BOOL
  95. StopListenPumps( VOID) const;
  96. dllexp BOOL Cleanup( VOID);
  97. # if DBG
  98. VOID Print( VOID) const;
  99. # endif // DBG
  100. private:
  101. // array of ptrs to TsConnectionInfo
  102. TS_CONNECTION_INFO_BASE ** m_ppConnectionInfo;
  103. DWORD m_nXports; // number of different transports supported.
  104. }; // class TS_XPORT_CONNECTIONS
  105. typedef TS_XPORT_CONNECTIONS * PTS_XPORT_CONNECTIONS;
  106. # endif // _XPORTCON_HXX_
  107. /************************ End of File ***********************/
  108. 
  109.