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.

138 lines
3.5 KiB

  1. // sessions.h : Declaration of the CSmtpAdminSessions
  2. #include "resource.h" // main symbols
  3. /*
  4. typedef SMTP_CONN_USER_ENTRY _SMTP_CONN_USER_ENTRY;
  5. typedef _SMTP_CONN_USER_ENTRY SMTP_CONN_USER_ENTRY;
  6. typedef _SMTP_CONN_USER_ENTRY * LPSMTP_CONN_USER_ENTRY;
  7. */
  8. #define MAX_USER_NAME_LENGTH 256
  9. #include "smtpapi.h"
  10. /*
  11. typedef struct _SMTP_CONN_USER_ENTRY {
  12. FILETIME SessionStartTime;
  13. DWORD IPAddress; // ipaddress
  14. DWORD PortConnected; // port connected to
  15. CHAR UserName[MAX_USER_NAME_LENGTH+1]; // logged on user
  16. } SMTP_CONN_USER_ENTRY, *LPSMTP_CONN_USER_ENTRY;
  17. */
  18. /////////////////////////////////////////////////////////////////////////////
  19. // smtpadm
  20. class CSmtpAdminSessions :
  21. public ISmtpAdminSessions,
  22. public IPrivateUnknown,
  23. public IPrivateDispatch,
  24. public IADsExtension,
  25. public INonDelegatingUnknown,
  26. public ISupportErrorInfo,
  27. public CComObjectRoot,
  28. public CComCoClass<CSmtpAdminSessions,&CLSID_CSmtpAdminSessions>
  29. {
  30. public:
  31. CSmtpAdminSessions();
  32. virtual ~CSmtpAdminSessions ();
  33. BEGIN_COM_MAP(CSmtpAdminSessions)
  34. COM_INTERFACE_ENTRY(IDispatch)
  35. COM_INTERFACE_ENTRY(IADs)
  36. COM_INTERFACE_ENTRY(ISmtpAdminSessions)
  37. COM_INTERFACE_ENTRY(IADsExtension)
  38. COM_INTERFACE_ENTRY(IPrivateUnknown)
  39. COM_INTERFACE_ENTRY(IPrivateDispatch)
  40. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  41. END_COM_MAP()
  42. //DECLARE_NOT_AGGREGATABLE(CSmtpAdminSessions)
  43. // Remove the comment from the line above if you don't want your object to
  44. // support aggregation. The default is to support it
  45. DECLARE_REGISTRY(CSmtpAdminSessions, _T("Smtpadm.Sessions.1"), _T("Smtpadm.Sessions"), IDS_SMTPADMIN_SESSIONS_DESC, THREADFLAGS_BOTH)
  46. // ISupportsErrorInfo
  47. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  48. //
  49. // This declares methods for the following:
  50. // IADsExtension
  51. // IUnknown
  52. // IDispatch
  53. // IPrivateUnknown
  54. // IPrivateDispatch
  55. //
  56. #define THIS_LIBID LIBID_SMTPADMLib
  57. #define THIS_IID IID_ISmtpAdminSessions
  58. #include "adsimp.inl"
  59. #undef THIS_LIBID
  60. #undef THIS_IID
  61. // ISmtpAdminSessions
  62. public:
  63. //////////////////////////////////////////////////////////////////////
  64. // Properties:
  65. //////////////////////////////////////////////////////////////////////
  66. //
  67. // IADs methods:
  68. //
  69. DECLARE_IADS_METHODS()
  70. // Which service to configure:
  71. STDMETHODIMP get_Server ( BSTR * pstrServer );
  72. STDMETHODIMP put_Server ( BSTR strServer );
  73. STDMETHODIMP get_ServiceInstance ( long * plServiceInstance );
  74. STDMETHODIMP put_ServiceInstance ( long lServiceInstance );
  75. STDMETHODIMP get_Count ( long * plCount );
  76. STDMETHODIMP get_UserName ( BSTR * pstrUsername );
  77. STDMETHODIMP get_Host ( BSTR * pstrHost );
  78. STDMETHODIMP get_UserId ( long * plId );
  79. STDMETHODIMP put_UserId ( long lId );
  80. STDMETHODIMP get_ConnectTime ( long * plConnectTime );
  81. //////////////////////////////////////////////////////////////////////
  82. // Methods:
  83. //////////////////////////////////////////////////////////////////////
  84. STDMETHODIMP Enumerate ( );
  85. STDMETHODIMP GetNth ( long lIndex );
  86. STDMETHODIMP Terminate ( );
  87. STDMETHODIMP TerminateAll ( );
  88. //////////////////////////////////////////////////////////////////////
  89. // Data:
  90. //////////////////////////////////////////////////////////////////////
  91. private:
  92. CIADsImpl m_iadsImpl;
  93. // Property variables:
  94. DWORD m_cCount;
  95. DWORD m_dwId;
  96. CComBSTR m_strUsername;
  97. CComBSTR m_strHost;
  98. DWORD m_dwConnectTime;
  99. //DWORD m_dwPort; // not used yet
  100. // Service variables:
  101. BOOL m_fSetCursor;
  102. LPSMTP_CONN_USER_LIST m_pSessionInfo;
  103. };