nsINetworkInfoService.idl 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #include "nsISupports.idl"
  5. /**
  6. * Listener for getting list of addresses.
  7. */
  8. [scriptable, uuid(c4bdaac1-3ab1-4fdb-9a16-17cbed794603)]
  9. interface nsIListNetworkAddressesListener : nsISupports
  10. {
  11. /**
  12. * Callback function that gets called by nsINetworkInfoService.listNetworkAddresses.
  13. * Each address in the array is a string IP address in canonical form,
  14. * e.g. 192.168.1.10, or an IPV6 address in string form.
  15. */
  16. void onListedNetworkAddresses([array, size_is(aAddressArraySize)] in string aAddressArray,
  17. in unsigned long aAddressArraySize);
  18. void onListNetworkAddressesFailed();
  19. };
  20. /**
  21. * Listener for getting hostname.
  22. */
  23. [scriptable, uuid(3ebdcb62-2df4-4042-8864-3fa81abd4693)]
  24. interface nsIGetHostnameListener : nsISupports
  25. {
  26. void onGotHostname(in AUTF8String aHostname);
  27. void onGetHostnameFailed();
  28. };
  29. /**
  30. * Service information
  31. */
  32. [scriptable, uuid(55fc8dae-4a58-4e0f-a49b-901cbabae809)]
  33. interface nsINetworkInfoService : nsISupports
  34. {
  35. /**
  36. * Obtain a list of local machine network addresses. The listener object's
  37. * onListedNetworkAddresses will be called with the obtained addresses.
  38. * On failure, the listener object's onListNetworkAddressesFailed() will be called.
  39. */
  40. void listNetworkAddresses(in nsIListNetworkAddressesListener aListener);
  41. /**
  42. * Obtain the hostname of the local machine. The listener object's
  43. * onGotHostname will be called with the obtained hostname.
  44. * On failure, the listener object's onGetHostnameFailed() will be called.
  45. */
  46. void getHostname(in nsIGetHostnameListener aListener);
  47. };
  48. %{ C++
  49. #define NETWORKINFOSERVICE_CONTRACT_ID \
  50. "@mozilla.org/network-info-service;1"
  51. %}