Package net.i2p.router.transport
Class UPnP
java.lang.Object
org.cybergarage.upnp.ControlPoint
net.i2p.router.transport.UPnP
- All Implemented Interfaces:
HTTPRequestListener,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.
- Since:
- 0.7.4
- Author:
- Florent Daignière <nextgens@freenetproject.org> 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classExtended to store the requested IP to be forwarded. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUPnP(I2PAppContext context, int ssdpPort, int httpPort, InetAddress[] binds) -
Method Summary
Modifier and TypeMethodDescriptionvoiddeviceAdded(Device dev) DeviceChangeListenervoiddeviceRemoved(Device dev) DeviceChangeListenervoideventNotifyReceived(String uuid, long seq, String varName, String value) EventListener callback - unused for now - supported in miniupnpd as of 1.1As 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.Get the addresses we want to bind tostatic voidDumps out device info in semi-HTML formatvoidonChangePublicPorts(Set<ForwardPort> ports, ForwardPortCallback cb) Registers a callback when the given ports change.warning - slowbooleanvoidsearch()We override search() to update the SSDPSearchResponseSocketList, SSDPNotifySocketList, and HTTPServerList every time.voidWARNING - Blocking up to 2 secondsvoidMethods inherited from class org.cybergarage.upnp.ControlPoint
addDeviceChangeListener, addEventListener, addNotifyListener, addSearchResponseListener, finalize, getDevice, getDeviceDisposer, getDeviceList, getEventSubURI, getExpiredDeviceMonitoringInterval, getHTTPPort, getHTTPServerList, getRenewSubscriber, getSearchMx, getSSDPNotifySocketList, getSSDPPort, getSSDPSearchResponseSocketList, getSubscriberService, getUserData, hasDevice, httpRequestRecieved, isNMPRMode, isSubscribed, lock, notifyReceived, performAddDeviceListener, performEventListener, performNotifyListener, performRemoveDeviceListener, performSearchResponseListener, print, removeDevice, removeDevice, removeDeviceChangeListener, removeEventListener, removeExpiredDevices, removeNotifyListener, removeSearchResponseListener, renewSubscriberService, renewSubscriberService, renewSubscriberService, search, search, searchResponseReceived, setDeviceDisposer, setEventSubURI, setExpiredDeviceMonitoringInterval, setHTTPPort, setNMPRMode, setRenewSubscriber, setSearchMx, setSSDPPort, setUserData, start, start, start, stop, subscribe, subscribe, subscribe, subscribe, unlock, unsubscribe, unsubscribe, unsubscribe
-
Field Details
-
LEASE_TIME_SECONDS
public static final int LEASE_TIME_SECONDS- See Also:
-
-
Constructor Details
-
UPnP
-
-
Method Details
-
runPlugin
public boolean runPlugin() -
terminate
public void terminate()WARNING - Blocking up to 2 seconds -
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!!!- Returns:
- array of length 1 containing an IPv4 address, or null
-
deviceAdded
DeviceChangeListener- Specified by:
deviceAddedin interfaceDeviceChangeListener
-
unregisterPortMappings
public void unregisterPortMappings() -
deviceRemoved
DeviceChangeListener- Specified by:
deviceRemovedin interfaceDeviceChangeListener
-
eventNotifyReceived
EventListener callback - unused for now - supported in miniupnpd as of 1.1- Specified by:
eventNotifyReceivedin interfaceEventListener
-
getLocalAddresses
Get the addresses we want to bind to- Since:
- 0.9.46, public since 0.9.55 for HTTPServerList
-
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.- Overrides:
searchin classControlPoint- Since:
- 0.9.46
-
renderStatusHTML
warning - slow -
onChangePublicPorts
Registers a callback when the given ports change. non-blocking- Parameters:
ports- non-nullcb- in UPnPManager
-
main
Dumps out device info in semi-HTML format- Throws:
Exception
-