com.aelitis.azureus.core.networkmanager.admin.impl
Class NetworkAdminImpl
java.lang.Object
com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin
com.aelitis.azureus.core.networkmanager.admin.impl.NetworkAdminImpl
- All Implemented Interfaces:
- AEDiagnosticsEvidenceGenerator
public class NetworkAdminImpl
- extends NetworkAdmin
- implements AEDiagnosticsEvidenceGenerator
Method Summary |
void |
addAndFirePropertyChangeListener(NetworkAdminPropertyChangeListener listener)
|
void |
addPropertyChangeListener(NetworkAdminPropertyChangeListener listener)
|
protected void |
addToASHistory(NetworkAdminASN asn)
|
protected NetworkAdminASNImpl |
ASNFromMap(Map m)
|
protected Map |
ASNToMap(NetworkAdminASNImpl x)
|
protected void |
bind(ServerSocketChannel ssc,
InetAddress address,
int port)
|
protected boolean[] |
bytesToBits(byte[] bytes)
|
protected boolean |
canBind(InetAddress bind_ip)
|
protected boolean |
canConnectWithBind(InetAddress bind_address,
int timeout)
|
boolean |
canPing()
|
boolean |
canTraceRoute()
|
protected void |
checkDefaultBindAddress(boolean first_time)
|
protected boolean |
checkNetworkInterfaces(boolean first_time,
boolean force)
|
String |
classifyRoute(InetAddress address)
|
NetworkAdminProtocol |
createInboundProtocol(AzureusCore azureus_core,
int type,
int port)
|
NetworkAdminSocksProxy |
createSocksProxy(String host,
int port,
String username,
String password)
|
protected void |
firePropertyChange(String property)
|
void |
generate(IndentWriter writer)
|
void |
generateDiagnostics(IndentWriter iw)
|
protected void |
generateDiagnostics(IndentWriter iw,
NetworkAdminProtocol[] protocols)
|
InetAddress[] |
getAllBindAddresses(boolean include_wildcard)
|
InetAddress[] |
getBindableAddresses()
Returns the list of current addresses that can successfully be bound
to with an ephemeral port |
int |
getBindablePort(int prefer_port)
|
Object[] |
getBindingStatus()
|
String |
getBindStatus()
|
NetworkAdminASN |
getCurrentASN()
|
InetAddress |
getDefaultPublicAddress()
|
InetAddress |
getDefaultPublicAddress(boolean peek)
|
InetAddress |
getDefaultPublicAddressV6()
|
InetAddress |
getDefaultPublicAddressV6(boolean peek)
|
protected NetworkAdminASN |
getFromASHistory(InetAddress address)
|
NetworkAdminHTTPProxy |
getHTTPProxy()
|
NetworkAdminProtocol[] |
getInboundProtocols(AzureusCore azureus_core)
|
Object[] |
getInterfaceForAddress(InetAddress address)
|
NetworkAdminNetworkInterface[] |
getInterfaces()
|
InetAddress |
getMultiHomedOutgoingRoundRobinBindAddress(InetAddress target)
|
InetAddress[] |
getMultiHomedServiceBindAddresses(boolean nio)
|
NetworkAdminNATDevice[] |
getNATDevices(AzureusCore azureus_core)
|
String |
getNetworkInterfacesAsString()
|
NetworkAdminProtocol[] |
getOutboundProtocols(AzureusCore azureus_core)
|
NetworkAdminNode[] |
getRoute(InetAddress interface_address,
InetAddress target,
int max_millis,
NetworkAdminRouteListener listener)
|
void |
getRoutes(InetAddress target,
int max_millis,
NetworkAdminRoutesListener listener)
|
InetAddress |
getSingleHomedServiceBindAddress(int proto)
|
NetworkAdminSocksProxy[] |
getSocksProxies()
|
protected InetAddress |
guessAddress(List addresses)
|
InetAddress |
guessRoutableBindAddress()
|
boolean |
hasDHTIPV6()
|
boolean |
hasIPV4Potential()
|
boolean |
hasIPV6Potential(boolean nio)
|
boolean |
hasMissingForcedBind()
|
boolean |
isIPV6Enabled()
|
boolean |
isSocksActive()
|
void |
logNATStatus(IndentWriter iw)
|
NetworkAdminASN |
lookupASN(InetAddress address)
ad-hoc query |
void |
lookupASN(InetAddress address,
NetworkAdminASNListener listener)
|
NetworkAdminASN |
lookupCurrentASN(InetAddress address)
Only call if the supplied address is believed to be the current public address |
static void |
main(String[] args)
|
protected InetAddress |
mapAddressToBindIP(InetAddress address)
|
boolean |
mustBind()
|
NetworkAdminNode |
pingTarget(InetAddress interface_address,
InetAddress target,
int max_millis,
NetworkAdminRouteListener listener)
|
void |
pingTargets(InetAddress target,
int max_millis,
NetworkAdminRoutesListener listener)
|
void |
removePropertyChangeListener(NetworkAdminPropertyChangeListener listener)
|
InetAddress[] |
resolveBindAddresses(String bind_to)
Given an interface name etc this will return the corresponding ip addresses |
void |
runInitialChecks(AzureusCore azureus_core)
|
protected void |
setIPv6Enabled(boolean enabled)
|
InetAddress |
testProtocol(NetworkAdminProtocol protocol)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BS_INACTIVE
public static final int BS_INACTIVE
- See Also:
- Constant Field Values
BS_OK
public static final int BS_OK
- See Also:
- Constant Field Values
BS_WARNING
public static final int BS_WARNING
- See Also:
- Constant Field Values
BS_ERROR
public static final int BS_ERROR
- See Also:
- Constant Field Values
NetworkAdminImpl
public NetworkAdminImpl()
setIPv6Enabled
protected void setIPv6Enabled(boolean enabled)
isIPV6Enabled
public boolean isIPV6Enabled()
- Specified by:
isIPV6Enabled
in class NetworkAdmin
checkNetworkInterfaces
protected boolean checkNetworkInterfaces(boolean first_time,
boolean force)
getMultiHomedOutgoingRoundRobinBindAddress
public InetAddress getMultiHomedOutgoingRoundRobinBindAddress(InetAddress target)
- Specified by:
getMultiHomedOutgoingRoundRobinBindAddress
in class NetworkAdmin
getMultiHomedServiceBindAddresses
public InetAddress[] getMultiHomedServiceBindAddresses(boolean nio)
- Specified by:
getMultiHomedServiceBindAddresses
in class NetworkAdmin
getSingleHomedServiceBindAddress
public InetAddress getSingleHomedServiceBindAddress(int proto)
- Specified by:
getSingleHomedServiceBindAddress
in class NetworkAdmin
getAllBindAddresses
public InetAddress[] getAllBindAddresses(boolean include_wildcard)
- Specified by:
getAllBindAddresses
in class NetworkAdmin
resolveBindAddresses
public InetAddress[] resolveBindAddresses(String bind_to)
- Description copied from class:
NetworkAdmin
- Given an interface name etc this will return the corresponding ip addresses
- Specified by:
resolveBindAddresses
in class NetworkAdmin
- Returns:
checkDefaultBindAddress
protected void checkDefaultBindAddress(boolean first_time)
getNetworkInterfacesAsString
public String getNetworkInterfacesAsString()
- Specified by:
getNetworkInterfacesAsString
in class NetworkAdmin
hasIPV4Potential
public boolean hasIPV4Potential()
- Specified by:
hasIPV4Potential
in class NetworkAdmin
hasIPV6Potential
public boolean hasIPV6Potential(boolean nio)
- Specified by:
hasIPV6Potential
in class NetworkAdmin
getBindableAddresses
public InetAddress[] getBindableAddresses()
- Description copied from class:
NetworkAdmin
- Returns the list of current addresses that can successfully be bound
to with an ephemeral port
- Specified by:
getBindableAddresses
in class NetworkAdmin
- Returns:
canBind
protected boolean canBind(InetAddress bind_ip)
getBindablePort
public int getBindablePort(int prefer_port)
throws IOException
- Specified by:
getBindablePort
in class NetworkAdmin
- Throws:
IOException
bind
protected void bind(ServerSocketChannel ssc,
InetAddress address,
int port)
throws IOException
- Throws:
IOException
guessRoutableBindAddress
public InetAddress guessRoutableBindAddress()
- Specified by:
guessRoutableBindAddress
in class NetworkAdmin
canConnectWithBind
protected boolean canConnectWithBind(InetAddress bind_address,
int timeout)
mapAddressToBindIP
protected InetAddress mapAddressToBindIP(InetAddress address)
bytesToBits
protected boolean[] bytesToBits(byte[] bytes)
guessAddress
protected InetAddress guessAddress(List addresses)
getDefaultPublicAddress
public InetAddress getDefaultPublicAddress()
- Specified by:
getDefaultPublicAddress
in class NetworkAdmin
getDefaultPublicAddress
public InetAddress getDefaultPublicAddress(boolean peek)
- Specified by:
getDefaultPublicAddress
in class NetworkAdmin
getDefaultPublicAddressV6
public InetAddress getDefaultPublicAddressV6()
- Specified by:
getDefaultPublicAddressV6
in class NetworkAdmin
getDefaultPublicAddressV6
public InetAddress getDefaultPublicAddressV6(boolean peek)
- Specified by:
getDefaultPublicAddressV6
in class NetworkAdmin
hasDHTIPV6
public boolean hasDHTIPV6()
- Specified by:
hasDHTIPV6
in class NetworkAdmin
firePropertyChange
protected void firePropertyChange(String property)
getInterfaces
public NetworkAdminNetworkInterface[] getInterfaces()
- Specified by:
getInterfaces
in class NetworkAdmin
getOutboundProtocols
public NetworkAdminProtocol[] getOutboundProtocols(AzureusCore azureus_core)
- Specified by:
getOutboundProtocols
in class NetworkAdmin
createInboundProtocol
public NetworkAdminProtocol createInboundProtocol(AzureusCore azureus_core,
int type,
int port)
- Specified by:
createInboundProtocol
in class NetworkAdmin
getInboundProtocols
public NetworkAdminProtocol[] getInboundProtocols(AzureusCore azureus_core)
- Specified by:
getInboundProtocols
in class NetworkAdmin
testProtocol
public InetAddress testProtocol(NetworkAdminProtocol protocol)
throws NetworkAdminException
- Specified by:
testProtocol
in class NetworkAdmin
- Throws:
NetworkAdminException
isSocksActive
public boolean isSocksActive()
- Specified by:
isSocksActive
in class NetworkAdmin
createSocksProxy
public NetworkAdminSocksProxy createSocksProxy(String host,
int port,
String username,
String password)
- Specified by:
createSocksProxy
in class NetworkAdmin
getSocksProxies
public NetworkAdminSocksProxy[] getSocksProxies()
- Specified by:
getSocksProxies
in class NetworkAdmin
getHTTPProxy
public NetworkAdminHTTPProxy getHTTPProxy()
- Specified by:
getHTTPProxy
in class NetworkAdmin
getNATDevices
public NetworkAdminNATDevice[] getNATDevices(AzureusCore azureus_core)
- Specified by:
getNATDevices
in class NetworkAdmin
getCurrentASN
public NetworkAdminASN getCurrentASN()
- Specified by:
getCurrentASN
in class NetworkAdmin
ASNToMap
protected Map ASNToMap(NetworkAdminASNImpl x)
ASNFromMap
protected NetworkAdminASNImpl ASNFromMap(Map m)
lookupCurrentASN
public NetworkAdminASN lookupCurrentASN(InetAddress address)
throws NetworkAdminException
- Description copied from class:
NetworkAdmin
- Only call if the supplied address is believed to be the current public address
- Specified by:
lookupCurrentASN
in class NetworkAdmin
- Returns:
-
- Throws:
NetworkAdminException
lookupASN
public NetworkAdminASN lookupASN(InetAddress address)
throws NetworkAdminException
- Description copied from class:
NetworkAdmin
- ad-hoc query
- Specified by:
lookupASN
in class NetworkAdmin
- Returns:
-
- Throws:
NetworkAdminException
lookupASN
public void lookupASN(InetAddress address,
NetworkAdminASNListener listener)
- Specified by:
lookupASN
in class NetworkAdmin
addToASHistory
protected void addToASHistory(NetworkAdminASN asn)
getFromASHistory
protected NetworkAdminASN getFromASHistory(InetAddress address)
runInitialChecks
public void runInitialChecks(AzureusCore azureus_core)
- Specified by:
runInitialChecks
in class NetworkAdmin
canTraceRoute
public boolean canTraceRoute()
- Specified by:
canTraceRoute
in class NetworkAdmin
getRoute
public NetworkAdminNode[] getRoute(InetAddress interface_address,
InetAddress target,
int max_millis,
NetworkAdminRouteListener listener)
throws NetworkAdminException
- Throws:
NetworkAdminException
canPing
public boolean canPing()
- Specified by:
canPing
in class NetworkAdmin
pingTarget
public NetworkAdminNode pingTarget(InetAddress interface_address,
InetAddress target,
int max_millis,
NetworkAdminRouteListener listener)
throws NetworkAdminException
- Throws:
NetworkAdminException
getRoutes
public void getRoutes(InetAddress target,
int max_millis,
NetworkAdminRoutesListener listener)
throws NetworkAdminException
- Specified by:
getRoutes
in class NetworkAdmin
- Throws:
NetworkAdminException
pingTargets
public void pingTargets(InetAddress target,
int max_millis,
NetworkAdminRoutesListener listener)
throws NetworkAdminException
- Specified by:
pingTargets
in class NetworkAdmin
- Throws:
NetworkAdminException
mustBind
public boolean mustBind()
- Specified by:
mustBind
in class NetworkAdmin
hasMissingForcedBind
public boolean hasMissingForcedBind()
- Specified by:
hasMissingForcedBind
in class NetworkAdmin
getBindStatus
public String getBindStatus()
- Specified by:
getBindStatus
in class NetworkAdmin
getBindingStatus
public Object[] getBindingStatus()
classifyRoute
public String classifyRoute(InetAddress address)
- Specified by:
classifyRoute
in class NetworkAdmin
getInterfaceForAddress
public Object[] getInterfaceForAddress(InetAddress address)
addPropertyChangeListener
public void addPropertyChangeListener(NetworkAdminPropertyChangeListener listener)
- Specified by:
addPropertyChangeListener
in class NetworkAdmin
addAndFirePropertyChangeListener
public void addAndFirePropertyChangeListener(NetworkAdminPropertyChangeListener listener)
- Specified by:
addAndFirePropertyChangeListener
in class NetworkAdmin
removePropertyChangeListener
public void removePropertyChangeListener(NetworkAdminPropertyChangeListener listener)
- Specified by:
removePropertyChangeListener
in class NetworkAdmin
generate
public void generate(IndentWriter writer)
- Specified by:
generate
in interface AEDiagnosticsEvidenceGenerator
generateDiagnostics
public void generateDiagnostics(IndentWriter iw)
- Specified by:
generateDiagnostics
in class NetworkAdmin
generateDiagnostics
protected void generateDiagnostics(IndentWriter iw,
NetworkAdminProtocol[] protocols)
logNATStatus
public void logNATStatus(IndentWriter iw)
- Specified by:
logNATStatus
in class NetworkAdmin
main
public static void main(String[] args)