nsINetworkInfoService.idl (1806B)
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 5 #include "nsISupports.idl" 6 7 /** 8 * Listener for getting list of addresses. 9 */ 10 [scriptable, uuid(c4bdaac1-3ab1-4fdb-9a16-17cbed794603)] 11 interface nsIListNetworkAddressesListener : nsISupports 12 { 13 /** 14 * Callback function that gets called by nsINetworkInfoService.listNetworkAddresses. 15 * Each address in the array is a string IP address in canonical form, 16 * e.g. 192.168.1.10, or an IPV6 address in string form. 17 */ 18 void onListedNetworkAddresses(in Array<ACString> aAddressArray); 19 void onListNetworkAddressesFailed(); 20 }; 21 22 /** 23 * Listener for getting hostname. 24 */ 25 [scriptable, uuid(3ebdcb62-2df4-4042-8864-3fa81abd4693)] 26 interface nsIGetHostnameListener : nsISupports 27 { 28 void onGotHostname(in AUTF8String aHostname); 29 void onGetHostnameFailed(); 30 }; 31 32 /** 33 * Service information 34 */ 35 [scriptable, uuid(55fc8dae-4a58-4e0f-a49b-901cbabae809)] 36 interface nsINetworkInfoService : nsISupports 37 { 38 /** 39 * Obtain a list of local machine network addresses. The listener object's 40 * onListedNetworkAddresses will be called with the obtained addresses. 41 * On failure, the listener object's onListNetworkAddressesFailed() will be called. 42 */ 43 void listNetworkAddresses(in nsIListNetworkAddressesListener aListener); 44 45 /** 46 * Obtain the hostname of the local machine. The listener object's 47 * onGotHostname will be called with the obtained hostname. 48 * On failure, the listener object's onGetHostnameFailed() will be called. 49 */ 50 void getHostname(in nsIGetHostnameListener aListener); 51 }; 52 53 %{ C++ 54 #define NETWORKINFOSERVICE_CONTRACT_ID \ 55 "@mozilla.org/network-info-service;1" 56 %}