## net.i2p.router.transport
Class UPnP

    java.lang.Object
      org.cybergarage.upnp.ControlPoint
          net.i2p.router.transport.UPnP

All Implemented Interfaces:
  HTTPRequestListener, DeviceChangeListener, EventListener

     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.

Author:
  Florent Daignière <nextgens@freenetproject.org> some code has been borrowed from Limewire : @see com.limegroup.gnutella.UPnPManager
See Also:
  "http://www.upnp.org/", "http://en.wikipedia.org/wiki/Universal_Plug_and_Play"

Constructor Summary
`UPnP(I2PAppContext context)`

Method Summary
`void` `deviceAdded(Device dev)`
`void` `deviceRemoved(Device dev)`
`void` `eventNotifyReceived(String uuid, long seq, String varName, String value)` event callback - unused for now - how many devices support events?
`DetectedIP[]` `getAddress()`
`int` `getDownstreamMaxBitRate()`
`String` `getNATAddress()`
`int` `getUpstreamMaxBitRate()`
`boolean` `isNATPresent()`
`static void` `main(String[] args)`
`void` `onChangePublicPorts(Set<ForwardPort> ports, ForwardPortCallback cb)` non-blocking
`String` `renderStatusHTML()` warning - slow
`boolean` `runPlugin()`
`void` `terminate()`
`boolean` `tryAddMapping(String protocol, int port, String description, ForwardPort fp)`
`void` `unregisterPortMappings()`

Methods inherited from class org.cybergarage.upnp.ControlPoint

`addDeviceChangeListener, addEventListener, addNotifyListener, addSearchResponseListener, finalize, getDevice, getDeviceDisposer, getDeviceList, getEventSubURI, getExpiredDeviceMonitoringInterval, getHTTPPort, getRenewSubscriber, getSearchMx, getSSDPPort, getSubscriberService, hasDevice, httpRequestRecieved, isNMPRMode, isSubscribed, lock, notifyReceived, performAddDeviceListener, performEventListener, performNotifyListener, performRemoveDeviceListener, performSearchResponseListener, print, removeDeviceChangeListener, removeEventListener, removeExpiredDevices, removeNotifyListener, removeSearchResponseListener, renewSubscriberService, renewSubscriberService, renewSubscriberService, search, search, search, searchResponseReceived, setDeviceDisposer, setEventSubURI, setExpiredDeviceMonitoringInterval, setHTTPPort, setNMPRMode, setRenewSubscriber, setSearchMx, setSSDPPort, start, start, start, stop, subscribe, subscribe, subscribe, subscribe, unlock, unsubscribe, unsubscribe, unsubscribe`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### UPnP

    public UPnP(I2PAppContext context)

Method Detail

### runPlugin

    public boolean runPlugin()

### terminate

    public void terminate()

### getAddress

    public DetectedIP[] getAddress()

### deviceAdded

    public void deviceAdded(Device dev)

  Specified by:
    `deviceAdded` in interface `DeviceChangeListener`

### tryAddMapping

    public boolean tryAddMapping(String protocol,
                                 int port,
                                 String description,
                                 ForwardPort fp)

### unregisterPortMappings

    public void unregisterPortMappings()

### deviceRemoved

    public void deviceRemoved(Device dev)

  Specified by:
    `deviceRemoved` in interface `DeviceChangeListener`

### eventNotifyReceived

    public void eventNotifyReceived(String uuid,
                                    long seq,
                                    String varName,
                                    String value)

  event callback - unused for now - how many devices support events?

  Specified by:
    `eventNotifyReceived` in interface `EventListener`

### isNATPresent

    public boolean isNATPresent()

  Returns:
    whether we are behind an UPnP-enabled NAT/router

### getNATAddress

    public String getNATAddress()

  Returns:
    the external address the NAT thinks we have. Blocking. null if we can't find it.

### getUpstreamMaxBitRate

    public int getUpstreamMaxBitRate()

  Returns:
    the reported upstream bit rate in bits per second. -1 if it's not available. Blocking.

### getDownstreamMaxBitRate

    public int getDownstreamMaxBitRate()

  Returns:
    the reported downstream bit rate in bits per second. -1 if it's not available. Blocking.

### renderStatusHTML

    public String renderStatusHTML()

  warning - slow

### onChangePublicPorts

    public void onChangePublicPorts(Set<ForwardPort> ports,
                                    ForwardPortCallback cb)

  non-blocking

  Parameters:
    `ports` - non-null

### main

    public static void main(String[] args)
                     throws Exception

  Throws:
    `Exception`