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.

52 lines
1.8 KiB

  1. #pragma once
  2. #include "InternetGatewayDevice.h"
  3. #include "dispimpl2.h"
  4. #include "resource.h" // main symbols
  5. #include "upnphost.h"
  6. #include "hnetcfg.h"
  7. class ATL_NO_VTABLE CNATDynamicPortMappingService :
  8. public CComObjectRootEx<CComMultiThreadModel>,
  9. public IDelegatingDispImpl<INATDynamicPortMappingService>,
  10. public IUPnPEventSource
  11. {
  12. public:
  13. DECLARE_REGISTRY_RESOURCEID(IDR_SAMPLE_DEVICE)
  14. DECLARE_PROTECT_FINAL_CONSTRUCT()
  15. BEGIN_COM_MAP(CNATDynamicPortMappingService)
  16. COM_INTERFACE_ENTRY(INATDynamicPortMappingService)
  17. COM_INTERFACE_ENTRY(IDispatch)
  18. COM_INTERFACE_ENTRY(IUPnPEventSource)
  19. END_COM_MAP()
  20. CNATDynamicPortMappingService();
  21. // IUPnPEventSource methods
  22. STDMETHODIMP Advise(IUPnPEventSink* pesSubscriber);
  23. STDMETHODIMP Unadvise(IUPnPEventSink* pesSubscriber);
  24. // INATDynamicPortMappingService
  25. STDMETHODIMP get_DynamicPublicIP(BSTR* pDynamicPublicIP);
  26. STDMETHODIMP get_DynamicPort(ULONG* pulDynamicPort);
  27. STDMETHODIMP get_DynamicProtocol(BSTR* pDynamicProtocol);
  28. STDMETHODIMP get_DynamicPrivateIP(BSTR* pDynamicPrivateIP);
  29. STDMETHODIMP get_DynamicLeaseDuration(ULONG* pulDynamicLeaseDuration);
  30. STDMETHODIMP CreateDynamicPortMapping(BSTR DynamicPublicIP, ULONG ulDynamicPort, BSTR DynamicProtocol, BSTR DynamicPrivateIP, BSTR DynamicLeaseDuration);
  31. STDMETHODIMP DeleteDynamicPortMapping(BSTR DynamicPublicIP, ULONG ulDynamicPort, BSTR DynamicProtocol);
  32. STDMETHODIMP ExtendDynamicPortMapping(BSTR DynamicPublicIP, ULONG ulDynamicPort, BSTR DynamicProtocol, ULONG ulDynamicLeaseDuration);
  33. HRESULT FinalConstruct();
  34. HRESULT FinalRelease();
  35. HRESULT Initialize(IHNetConnection* pHNetConnection);
  36. private:
  37. IUPnPEventSink* m_pEventSink;
  38. IHNetConnection* m_pHNetConnection;
  39. };