|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.tomp2p.connection.Bindings
public class Bindings
Gathers information about interface bindings. Here a user can set the preferences to which addresses to bind the socket. This class contains two types of information: 1.) the interface/address to listen for incoming connections and 2.) how other peers see us. The default is to listen to all interfaces and our outside address is set to the first interface it finds. If more than one search hint is used, then the combination operation will be "and"
Nested Class Summary | |
---|---|
static class |
Bindings.Protocol
Types of protocols. |
Field Summary | |
---|---|
static int |
DEFAULT_PORT
The default port of TomP2P |
static int |
MAX_PORT
aeu |
static int |
MIN_DYN_PORT
IANA recommends to use ports higher than 49152 |
Constructor Summary | |
---|---|
Bindings()
Creates a Binding class that binds to everything |
|
Bindings(Bindings.Protocol protocol)
Creates a Binding class that binds to a specified protocol |
|
Bindings(Bindings.Protocol protocol,
InetAddress externalAddress,
int externalTCPPort,
int externalUDPPort)
Creates a Binding class that binds to a specified protocol and provides information about manual port forwarding |
|
Bindings(Bindings.Protocol protocol,
String iface)
Creates a Binding class that binds to a specified protocol and interface |
|
Bindings(Bindings.Protocol protocol,
String iface,
InetAddress bind)
Creates a Binding class that binds to a specified protocol and interface and address |
|
Bindings(InetAddress bind)
Creates a Binding class that binds to a specified address |
|
Bindings(InetAddress externalAddress,
int externalTCPPort,
int externalUDPPort)
Creates a Binding class that binds to everything and provides information about manual port forwarding |
|
Bindings(String iface)
Creates a Binding class that binds to a specified interface |
Method Summary | |
---|---|
Bindings |
add(Bindings other)
Adds the results from an other binding. |
Bindings |
addAddress(InetAddress address)
Adds an address that we want to listen to. |
Bindings |
addInterface(String interfaceHint)
Adds an interface that will be searched for. |
void |
clear()
Clears all lists: listenInterfaceHints, listenAddresses, broadcastAddresses. |
boolean |
containsInterface(String name)
Checks if the user provided an interface hint |
List<InetAddress> |
getAddresses()
|
List<InetAddress> |
getBroadcastAddresses()
|
InetAddress |
getExternalAddress()
|
List<InetAddress> |
getFoundAddresses()
Returns a list of InetAddresses to listen to. |
List<String> |
getInterfaces()
|
int |
getOutsideTCPPort()
|
int |
getOutsideUDPPort()
|
Bindings.Protocol |
getProtocol()
|
boolean |
isAllAddresses()
|
boolean |
isAllInterfaces()
|
boolean |
isAllProtocols()
|
boolean |
isExternalAddress()
|
boolean |
isIPv4()
|
boolean |
isIPv6()
|
boolean |
isListenAll()
|
boolean |
isSetExternalPortsManually()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_PORT
public static final int MIN_DYN_PORT
public static final int DEFAULT_PORT
Constructor Detail |
---|
public Bindings()
public Bindings(InetAddress bind)
bind
- The address to bind topublic Bindings(String iface)
iface
- The interface to bind topublic Bindings(Bindings.Protocol protocol)
protocol
- The protocol to bind topublic Bindings(Bindings.Protocol protocol, String iface)
protocol
- The protocol to bind toiface
- The interface to bind topublic Bindings(Bindings.Protocol protocol, String iface, InetAddress bind)
protocol
- The protocol to bind toiface
- The interface to bind tobind
- The address to bind topublic Bindings(InetAddress externalAddress, int externalTCPPort, int externalUDPPort)
externalAddress
- The external address, how other peers will see usexternalTCPPort
- The external port, how other peers will see usexternalUDPPort
- The external port, how other peers will see uspublic Bindings(Bindings.Protocol protocol, InetAddress externalAddress, int externalTCPPort, int externalUDPPort)
protocol
- The protocol to bind toexternalAddress
- The external address, how other peers will see us. Use null if you don't want to use
external addressexternalTCPPort
- The external port, how other peers will see us, if 0 is provided, a random port will be
usedexternalUDPPort
- The external port, how other peers will see us, if 0 is provided, a random port will be
usedMethod Detail |
---|
public List<InetAddress> getFoundAddresses()
public Bindings addAddress(InetAddress address)
address
- The current class
public List<InetAddress> getAddresses()
public List<InetAddress> getBroadcastAddresses()
public Bindings addInterface(String interfaceHint)
interfaceHint
- The interface, e.g. eth0
public List<String> getInterfaces()
public Bindings.Protocol getProtocol()
public void clear()
public boolean isAllAddresses()
public boolean isAllInterfaces()
public boolean isAllProtocols()
public boolean isIPv4()
public boolean isIPv6()
public boolean isListenAll()
public boolean containsInterface(String name)
name
- The name of the interface reported by the system
public boolean isExternalAddress()
public InetAddress getExternalAddress()
public int getOutsideTCPPort()
public int getOutsideUDPPort()
public Bindings add(Bindings other)
other
- The other instance to get the results from
public boolean isSetExternalPortsManually()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |