Package com.biglybt.plugin.upnp
Class UPnPPlugin
- java.lang.Object
-
- com.biglybt.plugin.upnp.UPnPPlugin
-
- All Implemented Interfaces:
AEDiagnosticsEvidenceGenerator
,UPnPWANConnectionListener
,UPnPListener
,Plugin
,UPnPMappingListener
public class UPnPPlugin extends java.lang.Object implements Plugin, UPnPListener, UPnPMappingListener, UPnPWANConnectionListener, AEDiagnosticsEvidenceGenerator
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description UPnPPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addMapping(UPnPMapping mapping)
UPnPMapping
addMapping(java.lang.String desc_resource, boolean tcp, int port, boolean enabled)
protected void
addService(UPnPWANConnection wan_service)
protected boolean
checkDeviceStats(UPnPRootDevice root)
protected boolean
checkDeviceStats(java.lang.String USN, java.net.URL location)
protected void
checkState()
protected void
closeDown(boolean end_of_day)
boolean
deviceDiscovered(java.lang.String USN, java.net.URL location)
void
generate(IndentWriter writer)
protected long
getDeviceStats(java.lang.String USN, java.lang.String stat_key)
java.lang.String[]
getExternalIPAddresses()
UPnPMapping
getMapping(boolean tcp, int port)
UPnPMapping[]
getMappings()
protected java.lang.String[]
getSelectedAddresses()
protected java.lang.String[]
getSelectedInterfaces()
UPnPPluginService[]
getServices()
UPnPPluginService[]
getServices(UPnPDevice device)
protected void
ignoreDevice(java.lang.String USN, java.net.URL location)
protected long
incrementDeviceStats(java.lang.String USN, java.lang.String stat_key)
void
initialize(PluginInterface _plugin_interface)
This method is called when the Plugin is loaded by the clientboolean
isEnabled()
static void
load(PluginInterface plugin_interface)
protected void
logAlert(int type, java.lang.String resource, java.lang.String[] params)
protected void
logNoRepeat(java.lang.String usn, java.lang.String msg, java.lang.String suffix)
void
mappingChanged(UPnPMapping mapping)
void
mappingDestroyed(UPnPMapping mapping)
void
mappingResult(UPnPWANConnection connection, boolean ok)
void
mappingsReadResult(UPnPWANConnection connection, boolean ok)
protected int
processDevice(UPnPDevice device)
protected int
processServices(UPnPDevice device, UPnPService[] device_services)
void
refreshMappings()
Provided for use by other plugins.void
refreshMappings(boolean force)
Provided for use by other plugins.protected void
removeService(UPnPWANConnection wan_service, boolean replaced)
void
rootDeviceFound(UPnPRootDevice device)
protected void
setDeviceStats(java.lang.String USN, java.lang.String stat_key, long value)
protected void
setNATPMPEnableState()
protected void
startUp()
protected void
updateIgnoreList()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.biglybt.pif.Plugin
getInitialProperties
-
-
-
-
Field Detail
-
UPNP_PLUGIN_CONFIGSECTION_ID
private static final java.lang.String UPNP_PLUGIN_CONFIGSECTION_ID
- See Also:
- Constant Field Values
-
NATPMP_PLUGIN_CONFIGSECTION_ID
private static final java.lang.String NATPMP_PLUGIN_CONFIGSECTION_ID
- See Also:
- Constant Field Values
-
STATS_DISCOVER
private static final java.lang.String STATS_DISCOVER
- See Also:
- Constant Field Values
-
STATS_FOUND
private static final java.lang.String STATS_FOUND
- See Also:
- Constant Field Values
-
STATS_READ_OK
private static final java.lang.String STATS_READ_OK
- See Also:
- Constant Field Values
-
STATS_READ_BAD
private static final java.lang.String STATS_READ_BAD
- See Also:
- Constant Field Values
-
STATS_MAP_OK
private static final java.lang.String STATS_MAP_OK
- See Also:
- Constant Field Values
-
STATS_MAP_BAD
private static final java.lang.String STATS_MAP_BAD
- See Also:
- Constant Field Values
-
STATS_KEYS
private static final java.lang.String[] STATS_KEYS
-
plugin_interface
private PluginInterface plugin_interface
-
log
private LoggerChannel log
-
mapping_manager
private UPnPMappingManager mapping_manager
-
upnp
private UPnP upnp
-
upnp_log_listener
private UPnPLogListener upnp_log_listener
-
nat_pmp_upnp
private NatPMPUPnP nat_pmp_upnp
-
natpmp_enable_param
private BooleanParameter natpmp_enable_param
-
nat_pmp_router
private StringParameter nat_pmp_router
-
upnp_enable_param
private BooleanParameter upnp_enable_param
-
trace_to_log
private BooleanParameter trace_to_log
-
desc_prefix_param
private StringParameter desc_prefix_param
-
alert_success_param
private BooleanParameter alert_success_param
-
grab_ports_param
private BooleanParameter grab_ports_param
-
alert_other_port_param
private BooleanParameter alert_other_port_param
-
alert_device_probs_param
private BooleanParameter alert_device_probs_param
-
release_mappings_param
private BooleanParameter release_mappings_param
-
selected_interfaces_param
private StringParameter selected_interfaces_param
-
selected_addresses_param
private StringParameter selected_addresses_param
-
ignore_bad_devices
private BooleanParameter ignore_bad_devices
-
ignored_devices_list
private LabelParameter ignored_devices_list
-
mappings
private java.util.List<UPnPMapping> mappings
-
services
private java.util.List<UPnPPluginService> services
-
root_info_map
private java.util.Map<java.net.URL,java.lang.String> root_info_map
-
log_no_repeat_map
private java.util.Map<java.lang.String,java.lang.String> log_no_repeat_map
-
this_mon
protected AEMonitor this_mon
-
-
Method Detail
-
load
public static void load(PluginInterface plugin_interface)
-
initialize
public void initialize(PluginInterface _plugin_interface)
Description copied from interface:Plugin
This method is called when the Plugin is loaded by the client- Specified by:
initialize
in interfacePlugin
- Parameters:
_plugin_interface
- the interface that the plugin must use to communicate with the client
-
updateIgnoreList
protected void updateIgnoreList()
-
ignoreDevice
protected void ignoreDevice(java.lang.String USN, java.net.URL location)
-
startUp
protected void startUp()
-
closeDown
protected void closeDown(boolean end_of_day)
-
deviceDiscovered
public boolean deviceDiscovered(java.lang.String USN, java.net.URL location)
- Specified by:
deviceDiscovered
in interfaceUPnPListener
-
logNoRepeat
protected void logNoRepeat(java.lang.String usn, java.lang.String msg, java.lang.String suffix)
-
rootDeviceFound
public void rootDeviceFound(UPnPRootDevice device)
- Specified by:
rootDeviceFound
in interfaceUPnPListener
-
checkDeviceStats
protected boolean checkDeviceStats(UPnPRootDevice root)
-
checkDeviceStats
protected boolean checkDeviceStats(java.lang.String USN, java.net.URL location)
-
incrementDeviceStats
protected long incrementDeviceStats(java.lang.String USN, java.lang.String stat_key)
-
getDeviceStats
protected long getDeviceStats(java.lang.String USN, java.lang.String stat_key)
-
setDeviceStats
protected void setDeviceStats(java.lang.String USN, java.lang.String stat_key, long value)
-
mappingResult
public void mappingResult(UPnPWANConnection connection, boolean ok)
- Specified by:
mappingResult
in interfaceUPnPWANConnectionListener
-
mappingsReadResult
public void mappingsReadResult(UPnPWANConnection connection, boolean ok)
- Specified by:
mappingsReadResult
in interfaceUPnPWANConnectionListener
-
getSelectedInterfaces
protected java.lang.String[] getSelectedInterfaces()
-
getSelectedAddresses
protected java.lang.String[] getSelectedAddresses()
-
processDevice
protected int processDevice(UPnPDevice device) throws UPnPException
- Throws:
UPnPException
-
processServices
protected int processServices(UPnPDevice device, UPnPService[] device_services) throws UPnPException
- Throws:
UPnPException
-
addService
protected void addService(UPnPWANConnection wan_service) throws UPnPException
- Throws:
UPnPException
-
removeService
protected void removeService(UPnPWANConnection wan_service, boolean replaced)
-
addMapping
protected void addMapping(UPnPMapping mapping)
-
mappingChanged
public void mappingChanged(UPnPMapping mapping)
- Specified by:
mappingChanged
in interfaceUPnPMappingListener
-
mappingDestroyed
public void mappingDestroyed(UPnPMapping mapping)
- Specified by:
mappingDestroyed
in interfaceUPnPMappingListener
-
checkState
protected void checkState()
-
getExternalIPAddresses
public java.lang.String[] getExternalIPAddresses()
-
getServices
public UPnPPluginService[] getServices()
-
getServices
public UPnPPluginService[] getServices(UPnPDevice device)
-
addMapping
public UPnPMapping addMapping(java.lang.String desc_resource, boolean tcp, int port, boolean enabled)
-
getMapping
public UPnPMapping getMapping(boolean tcp, int port)
-
getMappings
public UPnPMapping[] getMappings()
-
isEnabled
public boolean isEnabled()
-
setNATPMPEnableState
protected void setNATPMPEnableState()
-
logAlert
protected void logAlert(int type, java.lang.String resource, java.lang.String[] params)
-
refreshMappings
public void refreshMappings()
Provided for use by other plugins.
-
refreshMappings
public void refreshMappings(boolean force)
Provided for use by other plugins.
-
generate
public void generate(IndentWriter writer)
- Specified by:
generate
in interfaceAEDiagnosticsEvidenceGenerator
-
-