Class UPnP

  • All Implemented Interfaces:
    HTTPRequestListener, DeviceChangeListener, EventListener

    public class UPnP
    extends ControlPoint
    implements DeviceChangeListener, EventListener
    This (and all in org/freenet, org/cybergarage, org/xmlpull) grabbed from freenet SVN, mid-February 2009 by zzz. This file modded somewhat to remove freenet-specific stuff, but most of the glue to I2P is in UPnPManager (which was written from scratch and is not the Limewire one referred to below). ================== This plugin implements UP&P support on a Freenet node.
    Florent Daignière <> some code has been borrowed from Limewire : @see com.limegroup.gnutella.UPnPManager Public only for command line usage. Not a public API, not for external use.
    See Also:
    "", ""
    • Method Detail

      • runPlugin

        public boolean runPlugin()
      • terminate

        public void terminate()
        WARNING - Blocking up to 2 seconds
      • getAddress

        public DetectedIP[] getAddress()
        As we only support a single active IGD, and we don't currently have any way to get any IPv6 addresses, this will return at most one IPv4 address. Blocking!!!
        array of length 1 containing an IPv4 address, or null
      • unregisterPortMappings

        public void unregisterPortMappings()
      • eventNotifyReceived

        public void eventNotifyReceived​(String uuid,
                                        long seq,
                                        String varName,
                                        String value)
        EventListener callback - unused for now - supported in miniupnpd as of 1.1
        Specified by:
        eventNotifyReceived in interface EventListener
      • getLocalAddresses

        static Set<String> getLocalAddresses()
        Get the addresses we want to bind to
      • search

        public void search()
        We override search() to update the SSDPSearchResponseSocketList, SSDPNotifySocketList, and HTTPServerList every time. Otherwise, we are just listening on the interfaces that were present when started.
        search in class ControlPoint
      • renderStatusHTML

        public String renderStatusHTML()
        warning - slow
      • onChangePublicPorts

        public void onChangePublicPorts​(Set<ForwardPort> ports,
                                        ForwardPortCallback cb)
        Registers a callback when the given ports change. non-blocking
        ports - non-null
        cb - in UPnPManager
      • main

        public static void main​(String[] args)
                         throws Exception
        Dumps out device info in semi-HTML format