Closed Bug 1259144 Opened 10 years ago Closed 10 years ago

[FlyWeb] Provide XPCOM service to get device hostname and list network addresses

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: djvj, Assigned: djvj)

References

Details

(Whiteboard: [necko-active])

Attachments

(1 file)

For our in-house DNS service discovery implementation (in JS) to work, the implementation needs to be able to discover the set of network ip addresses exposed on the machine, and to get the hostname of the machine. The network addresses are required to be able to know which addresses to open UDP mDNS listener sockets on, and to compose proper mDNS responses for A requests for the host, when those requests come in on a given interface. The hostname is needed to publish a proper SRV record referring to the ".local" hostname of the device when advertising services.
This patch adds an XPCOM interface nsIFlyWebNetworkInfoService, which exposes two methods: listNetworkAddresses and getHostname. Both methods take a listener argument which is called with the list of network addresses and hostname, respectively. The implementation currently supports Android and OSX backends. The OSX backend simply uses POSIX info. The Android backend uses android java APIs. The OSX backend could be improved by using the NSHost Objective-C class to query for the user-friendly hostname, but the current implementation works. The current OSX implementation will also work for Linux. Windows implementation still needs to be done.
Landed initial patch supporting Android and OSX: http://hg.mozilla.org/projects/larch/rev/226f25d35d1f
Whiteboard: [necko-active]
A bunch of updates. Part 2 - *FIX* Add FlyWebNetworkInfoService.java file. http://hg.mozilla.org/projects/larch/rev/a8e341d8c9eb Part 3 - Refactor FlyWebNetworkInfoService implementation for Cocoa into its own impl files. http://hg.mozilla.org/projects/larch/rev/604e73b0dd0f Part 4 - Rename FlyWebNetworkInfoServiceCocoa.h to FlyWebNetworkInfoServiceImpl.h, since the header files between different C implementations will be shared. http://hg.mozilla.org/projects/larch/rev/6f4a46c8d55e Part 5 - Add Windows support for FlyWebNetworkInfoService XPCOM interface. http://hg.mozilla.org/projects/larch/rev/0ffa97fae548 Part 6 - Move FlyWebNetworkInfoService into necko and rename it NetworkInfoService. http://hg.mozilla.org/projects/larch/rev/6e18d4d560ee
Part 7 - Add Linux support for FlyWebNetworkInfoService. http://hg.mozilla.org/projects/larch/rev/fce91373fb6a
Part 8 - Cleanup. Remove whitespace at end of line. http://hg.mozilla.org/projects/larch/rev/6d5f90a8e32a
This bug was fixed with the last landing. Closing.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Part 9 - Add NetworkInfoServiceLinux.cpp file (Forgot to add earlier). https://hg.mozilla.org/projects/larch/rev/1e2ef0dd02f1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: