|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.util.NetworkUtils
public class NetworkUtils
Utility methods and fields to use when working with network addresses.
| Field Summary | |
|---|---|
static String |
DEFAULT_BACKUP_RESOLVER
The address of the backup resolver we would use by default. |
static String |
IN_ADDR_ANY
A string containing the "any" local address. |
static String |
IN4_ADDR_ANY
A string containing the "any" local address for IPv4. |
static String |
IN6_ADDR_ANY
A string containing the "any" local address for IPv6. |
static int |
MAX_PORT_NUMBER
The maximum int value that could correspond to a port number. |
static int |
MIN_PORT_NUMBER
The minimum int value that could correspond to a port number bindable by the SIP Communicator. |
static boolean |
PDEFAULT_BACKUP_RESOLVER_ENABLED
The default of the property that users may use to disable our backup DNS resolver. |
static boolean |
PDEFAULT_DNS_ALWAYS_ABSOLUTE
Default value of PNAME_DNS_ALWAYS_ABSOLUTE. |
static String |
PNAME_BACKUP_RESOLVER
The name of the property that users may use to override the address of our backup DNS resolver. |
static String |
PNAME_BACKUP_RESOLVER_ENABLED
The name of the property that users may use to disable our backup DNS resolver. |
static String |
PNAME_BACKUP_RESOLVER_FALLBACK_IP
The name of the property that users may use to override the IP address of our backup DNS resolver. |
static String |
PNAME_BACKUP_RESOLVER_PORT
The name of the property that users may use to override the port of our backup DNS resolver. |
static String |
PNAME_DNS_ALWAYS_ABSOLUTE
The name of the boolean property that defines whether all domain names looked up from Jitsi should be treated as absolute. |
| Constructor Summary | |
|---|---|
NetworkUtils()
|
|
| Method Summary | |
|---|---|
static int |
compareDnsNames(String dns1,
String dns2)
Compares two DNS names against each other. |
static InetSocketAddress |
getAAAARecord(String domain,
int port)
Returns array of hosts from the AAAA record of the specified domain. |
static InetSocketAddress[] |
getAandAAAARecords(String domain,
int port)
Returns array of hosts from the A and AAAA records of the specified domain. |
static InetSocketAddress |
getARecord(String domain,
int port)
Returns array of hosts from the A record of the specified domain. |
static short |
getDefaultDnsPort()
Gets the default port used by DNS servers obtained through SimpleResolver.DEFAULT_PORT. |
static InetAddress |
getInetAddress(String hostAddress)
Creates an InetAddress from the specified hostAddress. |
static String[][] |
getNAPTRRecords(String domain)
Makes a NAPTR query and returns the result. |
static int |
getRandomPortNumber()
Returns a random local port number that user applications could bind to. |
static int |
getRandomPortNumber(int min,
int max)
Returns a random local port number, greater than min and lower than max. |
static int |
getRandomPortNumber(int min,
int max,
boolean pair)
Returns a random local port number, greater than min and lower than max. |
static SRVRecord |
getSRVRecord(String service,
String proto,
String domain)
Returns an InetSocketAddress representing the first SRV record available for the specified domain or null if there are not SRV records for domain. |
static SRVRecord[] |
getSRVRecords(String domain)
Returns array of hosts from the SRV record of the specified domain. |
static SRVRecord[] |
getSRVRecords(String service,
String proto,
String domain)
Returns an InetSocketAddress representing the first SRV record available for the specified domain or null if there are not SRV records for domain. |
static boolean |
isIPv4Address(String address)
Verifies whether address could be an IPv4 address string. |
static boolean |
isIPv6Address(String address)
Verifies whether address could be an IPv6 address string. |
static boolean |
isLinkLocalIPv4Address(InetAddress add)
Determines whether the address is an IPv4 link local address. |
static boolean |
isValidIPAddress(String address)
Checks whether address is a valid IP address string. |
static boolean |
isValidPortNumber(int port)
Determines whether port is a valid port number bindable by an application (i.e. |
static boolean |
isWindowsAutoConfiguredIPv4Address(InetAddress add)
Determines whether the address is the result of windows auto configuration. |
static byte[] |
mappedIPv4ToRealIPv4(byte[] addr)
Returns an IPv4 address matching the one mapped in the IPv6 addr. |
static void |
reloadDnsResolverConfig()
Reloads dns server configuration in the resolver. |
static byte[] |
strToIPv4(String ipv4AddrStr)
Creates a byte array containing the specified ipv4AddStr. |
static byte[] |
strToIPv6(String ipv6AddrStr)
Creates a byte array containing the specified ipv6AddStr. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String IN6_ADDR_ANY
public static final String IN4_ADDR_ANY
public static final String IN_ADDR_ANY
public static final int MAX_PORT_NUMBER
public static final int MIN_PORT_NUMBER
public static final String PNAME_BACKUP_RESOLVER
public static final String PNAME_BACKUP_RESOLVER_ENABLED
public static final boolean PDEFAULT_BACKUP_RESOLVER_ENABLED
public static final String PNAME_BACKUP_RESOLVER_PORT
public static final String DEFAULT_BACKUP_RESOLVER
public static final String PNAME_BACKUP_RESOLVER_FALLBACK_IP
public static final String PNAME_DNS_ALWAYS_ABSOLUTE
public static final boolean PDEFAULT_DNS_ALWAYS_ABSOLUTE
PNAME_DNS_ALWAYS_ABSOLUTE.
| Constructor Detail |
|---|
public NetworkUtils()
| Method Detail |
|---|
public static boolean isWindowsAutoConfiguredIPv4Address(InetAddress add)
add - the address to inspect
public static boolean isLinkLocalIPv4Address(InetAddress add)
add - the address to inspect
public static int getRandomPortNumber()
public static int getRandomPortNumber(int min,
int max)
min - the minimum allowed value for the returned port number.max - the maximum allowed value for the returned port number.
public static int getRandomPortNumber(int min,
int max,
boolean pair)
min - the minimum allowed value for the returned port number.max - the maximum allowed value for the returned port number.pair - specifies whether the caller would like the returned port to
be pair.
public static boolean isIPv4Address(String address)
address - the String that we'd like to determine as an IPv4 address.
public static boolean isIPv6Address(String address)
address - the String that we'd like to determine as an IPv6 address.
public static boolean isValidIPAddress(String address)
address - the address that we'd like to check
public static byte[] strToIPv4(String ipv4AddrStr)
ipv4AddrStr - a String containing an IPv4 address.
public static byte[] strToIPv6(String ipv6AddrStr)
ipv6AddrStr - a String containing an IPv6 address.
public static SRVRecord[] getSRVRecords(String domain)
throws ParseException,
DnssecException
domain - the name of the domain we'd like to resolve (_proto._tcp
included).
ParseException - if domain is not a valid domain name.
DnssecException - when a DNSSEC validation failure occurred.
public static SRVRecord getSRVRecord(String service,
String proto,
String domain)
throws ParseException,
DnssecException
domain - the name of the domain we'd like to resolve.service - the service that we are trying to get a record for.proto - the protocol that we'd like service on.
ParseException - if domain is not a valid domain name.
DnssecException - when a DNSSEC validation failure occurred.
public static SRVRecord[] getSRVRecords(String service,
String proto,
String domain)
throws ParseException,
DnssecException
domain - the name of the domain we'd like to resolve.service - the service that we are trying to get a record for.proto - the protocol that we'd like service on.
ParseException - if domain is not a valid domain name.
DnssecException - when a DNSSEC validation failure occurred.
public static String[][] getNAPTRRecords(String domain)
throws ParseException,
DnssecException
domain - the name of the domain we'd like to resolve.
ParseException - if domain is not a valid domain name.
DnssecException - when a DNSSEC validation failure occurred.
public static InetAddress getInetAddress(String hostAddress)
throws UnknownHostException
hostAddress - the String representation of the address
that we would like to create an InetAddress instance for.
UnknownHostException - if any of the InetAddress methods
we are using throw an exception.
public static InetSocketAddress[] getAandAAAARecords(String domain,
int port)
throws ParseException,
DnssecException
domain - the name of the domain we'd like to resolve.port - the port number of the returned InetSocketAddress
ParseException - if domain is not a valid domain name.
DnssecException - when a DNSSEC validation failure occurred.
public static InetSocketAddress getARecord(String domain,
int port)
throws ParseException,
DnssecException
domain - the name of the domain we'd like to resolve.port - the port number of the returned InetSocketAddress
ParseException - if domain is not a valid domain name.
DnssecException - when a DNSSEC validation failure occurred.
public static InetSocketAddress getAAAARecord(String domain,
int port)
throws ParseException,
DnssecException
domain - the name of the domain we'd like to resolve.port - the port number of the returned InetSocketAddress
ParseException - if domain is not a valid domain name.
DnssecExceptionpublic static boolean isValidPortNumber(int port)
port - the port number that we'd like verified.
public static byte[] mappedIPv4ToRealIPv4(byte[] addr)
addr - a String representing an IPv4-Mapped address in textual
format
public static short getDefaultDnsPort()
public static void reloadDnsResolverConfig()
public static int compareDnsNames(String dns1,
String dns2)
throws ParseException
dns1 - The first DNS namedns2 - The DNS name that is compared against dns1
ParseException - if the dns1 or dns2 is not a DNS Name
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||