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.

201 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. isrpc.hxx
  5. Abstract:
  6. Contains ISRPC class definition - a wrapper for RPC interfaces
  7. ISRPC - Internet Services RPC interface class
  8. Author:
  9. Murali R. Krishnan (MuraliK) 10-Dec-1995
  10. Environment:
  11. User Mode - Win32
  12. Revision History:
  13. --*/
  14. #ifndef _ISRPC_HXX_
  15. #define _ISRPC_HXX_
  16. /************************************************************
  17. * Include Headers
  18. ************************************************************/
  19. extern "C" {
  20. # include <rpc.h>
  21. # include "svcloc.h"
  22. };
  23. /************************************************************
  24. * Symbolic Contstants
  25. ************************************************************/
  26. #define ISRPC_OVER_TCPIP 0x00000001
  27. #define ISRPC_OVER_NP 0x00000002
  28. #define ISRPC_OVER_SPX 0x00000004
  29. #define ISRPC_OVER_LPC 0x00000008
  30. #ifndef CHICAGO
  31. #define ISRPC_USE_ALL \
  32. ( ISRPC_OVER_TCPIP | \
  33. ISRPC_OVER_NP | \
  34. ISRPC_OVER_SPX | \
  35. ISRPC_OVER_LPC \
  36. )
  37. #else
  38. #define ISRPC_OVER_NB 0x00000080
  39. #define ISRPC_USE_ALL \
  40. ( ISRPC_OVER_TCPIP | \
  41. ISRPC_OVER_NP | \
  42. ISRPC_OVER_SPX | \
  43. ISRPC_OVER_LPC | \
  44. ISRPC_OVER_NB \
  45. )
  46. #endif // CHICAGO
  47. #define ISRPC_ADMIN_USE_DEFAULT \
  48. ( ISRPC_OVER_TCPIP | \
  49. ISRPC_OVER_NP | \
  50. ISRPC_OVER_LPC )
  51. #define ISRPC_NAMED_PIPE_PREFIX_W L"\\PIPE\\"
  52. #define ISRPC_NAMED_PIPE_PREFIX_A "\\PIPE\\"
  53. #define ISRPC_LPC_NAME_SUFFIX_A "LPC"
  54. #define ISRPC_LPC_NAME_SUFFIX_W L"LPC"
  55. #define ISRPC_PROTSEQ_MAX_REQS 1
  56. /************************************************************
  57. * Type Definitions
  58. ************************************************************/
  59. /*++
  60. Class Description:
  61. ISRPC is the class definition for RPC interface used by Internet
  62. Services admin.
  63. This class provides methods to enable and disable protocol over rpc,
  64. enable security over rpc, and other rpc related tasks.
  65. Private Member functions:
  66. SetSecurityDescriptor : builds security descriptor to be used in
  67. different RPC calls.
  68. AddSecurity : enables security support provider over raw
  69. non-secure protocol such as tcp/ip.
  70. Public Member functions:
  71. ISRPC : class constructor.
  72. ~ISRPC : class destructor.
  73. AddProtocol : adds another protocol to the binding list.
  74. RemoveProtocol : removes a protocol from the binding list.
  75. StartServer : starts rpc server.
  76. --*/
  77. class ISRPC {
  78. public:
  79. ISRPC(IN LPCTSTR pszServiceName);
  80. ~ISRPC( VOID );
  81. DWORD CleanupData(VOID);
  82. DWORD RegisterInterface( IN RPC_IF_HANDLE hRpcIf);
  83. DWORD UnRegisterInterface( VOID);
  84. //
  85. // We support following combinations
  86. //
  87. // SPX, TCP ==> Dynamic RPC Binding
  88. // LPC ==> static RPC Binding Name: <ServiceName>_LPC
  89. // NamedPipe ==> Static RPC Binding
  90. //
  91. DWORD AddProtocol( IN DWORD Protocol);
  92. DWORD RemoveProtocol( IN DWORD Protocol );
  93. DWORD StartServer( );
  94. DWORD StopServer( );
  95. DWORD EnumBindingStrings( IN OUT LPINET_BINDINGS BindingStrings );
  96. VOID FreeBindingStrings( IN OUT LPINET_BINDINGS BindingStrings );
  97. #ifdef DBG
  98. VOID Print(VOID) const;
  99. #endif // DBG
  100. private:
  101. DWORD m_dwProtocols;
  102. RPC_IF_HANDLE m_hRpcInterface;
  103. LPCTSTR m_pszServiceName;
  104. BOOL m_fInterfaceAdded;
  105. BOOL m_fEpRegistered;
  106. BOOL m_fServerStarted;
  107. RPC_BINDING_VECTOR * m_pBindingVector;
  108. DWORD BindOverLpc(IN BOOL fDynamic);
  109. DWORD BindOverTcp(IN BOOL fDynamic);
  110. DWORD BindOverNamedPipe(IN BOOL fDynamic);
  111. DWORD BindOverSpx(IN BOOL fDynamic);
  112. #ifdef CHICAGO
  113. DWORD BindOverNetBios(IN BOOL fDynamic);
  114. #endif
  115. /*
  116. * Static members to track all the dynamically bound protocols
  117. */
  118. public:
  119. static DWORD Initialize(VOID);
  120. static DWORD Cleanup(VOID);
  121. private:
  122. static DWORD sm_dwProtocols;
  123. static SECURITY_DESCRIPTOR sm_sid;
  124. static PACL sm_pACL;
  125. static BOOL sm_fSecurityEnabled;
  126. static BOOL IsSecurityEnabled(VOID)
  127. { return (sm_fSecurityEnabled); }
  128. static DWORD SetSecurityDescriptor( VOID );
  129. static DWORD AddSecurity( VOID );
  130. static DWORD DynamicBindOverTcp(VOID);
  131. static DWORD DynamicBindOverSpx(VOID);
  132. }; // class ISRPC
  133. typedef ISRPC * PISRPC;
  134. #endif // _ISRPC_HXX_
  135. /****************************** End Of File ******************************/