|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sbbi.upnp.impls.InternetGatewayDevice
This class can be used to access some funtionalities on the InternetGatewayDevice on your network without having to know anything about the required input/output parameters. All device functions are not provided.
Constructor Summary | |
InternetGatewayDevice(UPNPRootDevice igd)
|
Method Summary | |
boolean |
addPortMapping(java.lang.String description,
java.lang.String remoteHost,
int internalPort,
int externalPort,
java.lang.String internalClient,
int leaseDuration,
java.lang.String protocol)
Configures a nat entry on the UPNP device. |
boolean |
deletePortMapping(java.lang.String remoteHost,
int externalPort,
java.lang.String protocol)
Deletes a port mapping on the IDG device |
static InternetGatewayDevice[] |
getDevices(int timeout)
Lookup all the IGD (IP or PPP) devices on the network. |
static InternetGatewayDevice[] |
getDevices(int timeout,
int ttl,
int mx,
java.net.NetworkInterface ni)
Lookup all the IGD (IP urn:schemas-upnp-org:service:WANIPConnection:1, or PPP urn:schemas-upnp-org:service:WANPPPConnection:1) devices for a given network interface. |
java.lang.String |
getExternalIPAddress()
Retreives the external IP address |
ActionResponse |
getGenericPortMappingEntry(int newPortMappingIndex)
Retreives a generic port mapping entry. |
UPNPRootDevice |
getIGDRootDevice()
Retreives the IDG UNPNRootDevice object |
static InternetGatewayDevice[] |
getIPDevices(int timeout)
Deprecated. use generic getDevices(int) or getDevices(int, int, int, NetworkInterface) methods since this one is not
usable with all IGD devices ( will only work with devices implementing the urn:schemas-upnp-org:service:WANIPConnection:1 service ) |
java.lang.Integer |
getNatMappingsCount()
Retreives the current number of mapping in the NAT table |
java.lang.Integer |
getNatTableSize()
Computes the total entries in avaliable in the nat table size, not that this method is not guaranteed to work with all upnp devices since it is not an generic IGD command |
static InternetGatewayDevice[] |
getPPPDevices(int timeout)
Deprecated. use generic getDevices(int) or getDevices(int, int, int, NetworkInterface) methods since this one is not
usable with all IGD devices ( will only work with devices implementing the urn:schemas-upnp-org:service:WANPPPConnection:1 service ) |
ActionResponse |
getSpecificPortMappingEntry(java.lang.String remoteHost,
int externalPort,
java.lang.String protocol)
Retreives information about a specific port mapping |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public InternetGatewayDevice(UPNPRootDevice igd) throws java.lang.UnsupportedOperationException
Method Detail |
public UPNPRootDevice getIGDRootDevice()
public static InternetGatewayDevice[] getDevices(int timeout) throws java.io.IOException
timeout
- the timeout in ms to listen for devices response, -1 for default value
java.io.IOException
- if some IO Exception occurs during discoverypublic static InternetGatewayDevice[] getDevices(int timeout, int ttl, int mx, java.net.NetworkInterface ni) throws java.io.IOException
timeout
- the timeout in ms to listen for devices response, -1 for default valuettl
- the discovery ttl such as Discovery.DEFAULT_TTL
mx
- the discovery mx such as Discovery.DEFAULT_MX
ni
- the network interface where to lookup IGD devices
java.io.IOException
- if some IO Exception occurs during discoverypublic static InternetGatewayDevice[] getIPDevices(int timeout) throws java.io.IOException
getDevices(int)
or getDevices(int, int, int, NetworkInterface)
methods since this one is not
usable with all IGD devices ( will only work with devices implementing the urn:schemas-upnp-org:service:WANIPConnection:1 service )
timeout
- the timeout in ms to listen for devices response, -1 for default value
java.io.IOException
public static InternetGatewayDevice[] getPPPDevices(int timeout) throws java.io.IOException
getDevices(int)
or getDevices(int, int, int, NetworkInterface)
methods since this one is not
usable with all IGD devices ( will only work with devices implementing the urn:schemas-upnp-org:service:WANPPPConnection:1 service )
timeout
- the timeout in ms to listen for devices response, -1 for default value
java.io.IOException
public java.lang.String getExternalIPAddress() throws UPNPResponseException, java.io.IOException
UPNPResponseException
- if the devices returns an error code
java.io.IOException
- if some error occurs during communication with the devicepublic ActionResponse getGenericPortMappingEntry(int newPortMappingIndex) throws java.io.IOException, UPNPResponseException
newPortMappingIndex
- the index to lookup in the nat table of the upnp device
java.io.IOException
- if some error occurs during communication with the device
UPNPResponseException
- if some unexpected error occurs on the UPNP devicepublic ActionResponse getSpecificPortMappingEntry(java.lang.String remoteHost, int externalPort, java.lang.String protocol) throws java.io.IOException, UPNPResponseException
remoteHost
- the remote host ip to check, null if wildcardexternalPort
- the port to checkprotocol
- the protocol for the mapping, either TCP or UDP
java.io.IOException
- if some error occurs during communication with the device
UPNPResponseException
- if some unexpected error occurs on the UPNP devicepublic boolean addPortMapping(java.lang.String description, java.lang.String remoteHost, int internalPort, int externalPort, java.lang.String internalClient, int leaseDuration, java.lang.String protocol) throws java.io.IOException, UPNPResponseException
description
- the mapping description, null for no descriptionremoteHost
- the remote host ip for this entry, null for a wildcard valueinternalPort
- the internal client port where data should be redirectedexternalPort
- the external port to open on the UPNP device an map on the internal client, 0 for a wildcard valueinternalClient
- the internal client ip where data should be redirectedleaseDuration
- the lease duration in seconds 0 for an infinite timeprotocol
- the protocol, either TCP or UDP
java.io.IOException
- if some error occurs during communication with the device
UPNPResponseException
- if the device does not accept some settings :public boolean deletePortMapping(java.lang.String remoteHost, int externalPort, java.lang.String protocol) throws java.io.IOException, UPNPResponseException
remoteHost
- the host ip for which the mapping was done, null value for a wildcard valueexternalPort
- the port to closeprotocol
- the protocol for the mapping, TCP or UDP
java.io.IOException
- if some error occurs during communication with the device
UPNPResponseException
- if the devices returns an error messagepublic java.lang.Integer getNatMappingsCount() throws java.io.IOException, UPNPResponseException
java.io.IOException
- if some error occurs during communication with the device
UPNPResponseException
- if the devices returns an error message with error code other than 404public java.lang.Integer getNatTableSize() throws java.io.IOException, UPNPResponseException
java.io.IOException
- if some error occurs during communication with the device
UPNPResponseException
- if the devices returns an error message with error code other than 713 or 402
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |