DNSRequestChild.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_net_DNSRequestChild_h
  6. #define mozilla_net_DNSRequestChild_h
  7. #include "mozilla/net/PDNSRequestChild.h"
  8. #include "nsICancelable.h"
  9. #include "nsIDNSRecord.h"
  10. #include "nsIDNSListener.h"
  11. #include "nsIEventTarget.h"
  12. namespace mozilla {
  13. namespace net {
  14. class DNSRequestChild final
  15. : public PDNSRequestChild
  16. , public nsICancelable
  17. {
  18. public:
  19. NS_DECL_THREADSAFE_ISUPPORTS
  20. NS_DECL_NSICANCELABLE
  21. DNSRequestChild(const nsCString& aHost, const uint32_t& aFlags,
  22. const nsCString& aNetworkInterface,
  23. nsIDNSListener *aListener, nsIEventTarget *target);
  24. void AddIPDLReference() {
  25. AddRef();
  26. }
  27. void ReleaseIPDLReference();
  28. // Sends IPDL request to parent
  29. void StartRequest();
  30. void CallOnLookupComplete();
  31. protected:
  32. friend class CancelDNSRequestEvent;
  33. friend class ChildDNSService;
  34. virtual ~DNSRequestChild() {}
  35. virtual bool RecvLookupCompleted(const DNSRequestResponse& reply) override;
  36. virtual void ActorDestroy(ActorDestroyReason why) override;
  37. nsCOMPtr<nsIDNSListener> mListener;
  38. nsCOMPtr<nsIEventTarget> mTarget;
  39. nsCOMPtr<nsIDNSRecord> mResultRecord;
  40. nsresult mResultStatus;
  41. nsCString mHost;
  42. uint16_t mFlags;
  43. nsCString mNetworkInterface;
  44. bool mIPCOpen;
  45. };
  46. } // namespace net
  47. } // namespace mozilla
  48. #endif // mozilla_net_DNSRequestChild_h