|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.dalsemi.tininet.TININet
TININet
This class is used to set up parameters for TINI
networking.
| Field Summary | |
static byte[] |
anyIPv6Address
The unspecified IPv6 address. |
static int |
COMMITTED
Network configuration is committed to flash memory. |
static int |
ETH_STATUS_LINK
Ethernet controller status flags. |
static int |
ETH_STATUS_RX
Ethernet controller status flags. |
static int |
ETH_STATUS_TX
Ethernet controller status flags. |
static int |
IN4ADDRSZ
Size of an IPv4 address. |
static int |
INADDRSZ
Size of an IP address. |
static int |
MAX_NAME_LEN
Upper bound of mailhostname, hostname and domainname length. |
static int |
PREFER_IPV4
Preferred address family: IPv4 only |
static int |
PREFER_IPV6
Preferred address family: IPv6 only |
static int |
PREFER_UNSPEC
Preferred address family: Unspecified (v6->v4) |
static int |
RESTORE_DISABLED
Network configuration restore is disabled. |
static int |
TCP_TIMEOUT_128
TCP retransmission timeout value |
static int |
TCP_TIMEOUT_16
TCP retransmission timeout value |
static int |
TCP_TIMEOUT_32
TCP retransmission timeout value |
static int |
TCP_TIMEOUT_64
TCP retransmission timeout value |
static int |
TCP_TIMEOUT_8
TCP retransmission timeout value |
static int |
UNCOMMITTED
Network configuration is not committed to flash memory. |
| Method Summary | |
static void |
addInterfaceEntry(byte[] name,
byte[] ipAddr,
byte[] subnet,
byte[] gateway,
byte flags,
byte type,
int transmitter)
Adds an interface to the network interface list with the given parameters. |
static void |
addInterfaceEntry(byte[] name,
byte[] ipAddr,
byte[] subnet,
byte[] gateway,
byte flags,
byte type,
int transmitter,
int mtu,
int tcpTimeout)
Adds an interface to the network interface list with the given parameters. |
static void |
commitNetworkState()
Commits the current network configuration to flash. |
static byte[] |
createIPFromString(String host)
Deprecated. This method is flagged deprecated because callers of this method assume IPv4-only networking. |
static String |
createIPString(byte[] ip)
Deprecated. This method is flagged deprecated because callers of this method assume IPv4-only networking. |
static void |
disableNetworkRestore()
Disables the ability to commit or restore network configuration until the bank 7 application is re-flashed. |
static byte[] |
getARPCacheTable()
Gets the current ARP cache table. |
static byte[] |
getConnectionTable()
Gets the current connection table. |
static String |
getDHCPServerIP()
Gets the IP address of DHCP server. |
static void |
getDHCPServerIP(byte[] address)
Gets the IP address of the DHCP server. |
static int |
getDNSTimeout()
Gets the timeout value for DNS queries. |
static String |
getDomainname()
Gets the domain name of TINI. |
static String |
getEthernetAddress()
Gets the Ethernet MAC address as a String. |
static void |
getEthernetAddress(byte[] mac)
Gets the Ethernet MAC address into the given byte array, with the most significant byte first. |
static int |
getEthernetStatus()
Returns status from the Ethernet controller. |
static String |
getGatewayIP()
Gets the gateway IP address of the default interface as a String. |
static void |
getGatewayIP(byte[] address)
Gets the gateway IP address of the default interface. |
static String |
getGatewayIP(String interfaceName)
Gets the IP address of the gateway for the specified interface as a String in dotted decimal notation. |
static void |
getGatewayIP(String interfaceName,
byte[] address)
Gets the IP address of the gateway for the specified interface. |
static String |
getHostname()
Gets the hostname of TINI. |
static boolean |
getInterfaceInfo(int interfaceNum,
byte[] data)
Gets interface information for given interface and stores it in byte array. |
static String |
getIPAddress()
Gets the IPv4 address of the default interface as a String. |
static void |
getIPAddress(byte[] address)
Gets the IPv4 address of the default interface. |
static String |
getIPAddress(String interfaceName)
Gets the IP address of the specified interface as a String. |
static void |
getIPAddress(String interfaceName,
byte[] address)
Gets the IP address of the specified interface. |
static void |
getIPv4Prefix(String interfaceName,
byte[] prefix)
Gets the IPv4 subnet mask of the specified interface in prefix notation. |
static String |
getIPv6Address()
Gets the IPv6 address of the default interface. |
static void |
getIPv6Address(byte[] address)
Gets the IPv6 address of the default interface. |
static String |
getIPv6Address(String interfaceName)
Gets the IPv6 address of the specified interface. |
static void |
getIPv6Address(String interfaceName,
byte[] address)
Gets the IPv6 address of the specified interface. |
static void |
getIPv6Prefix(String interfaceName,
byte[] prefix)
Gets the IPv6 prefix length of the specified interface. |
static String |
getMailhost()
Gets the IP address or name of the default mailhost. |
static int |
getNetworkCommitState()
Returns the commit state as UNCOMMITED, COMMITTED or RESTORE_DISABLED. |
static int |
getPreferredAddressFamily()
Gets the preferred address family. |
static String |
getPrimaryDNS()
Gets the primary DNS server address. |
static int |
getProxyPort()
Gets the proxy server port number. |
static String |
getProxyServer()
Gets the IP address of the proxy server. |
static String |
getSecondaryDNS()
Gets the secondary DNS server address. |
static String |
getSubnetMask()
Gets the subnet mask of the default interface as a String. |
static void |
getSubnetMask(byte[] address)
Gets the subnet mask of the default interface. |
static String |
getSubnetMask(String interfaceName)
Gets the subnet mask of the specified interface as a String. |
static void |
getSubnetMask(String interfaceName,
byte[] address)
Gets the subnet mask of the specified interface. |
static String |
ipToString(byte[] ip)
Converts an IP address to a String. |
static String |
ipv4ToString(byte[] ip)
Converts an IPv4 address to a String. |
static String |
ipv4ToString(byte[] ip,
int offset)
Converts an IPv4 address to a String. |
static String |
ipv6ToString(byte[] ip)
Converts an IPv6 address to a String. |
static boolean |
isIPv4CompatibleAddress(byte[] ip)
This method checks whether the given IP address contains an IPv4 address. |
static byte[] |
makeIP6Compatible(byte[] ip)
Takes the IP address argument and turns it into a 16 byte IP address. |
static void |
removeInterfaceEntry(byte[] name)
Removes specified interface from the network interface list. |
static boolean |
setDefaultInterface(byte[] name)
Sets the default network interface. |
static boolean |
setDHCPServerIP(byte[] dhcpServer)
Sets the IP address of the DHCP server. |
static boolean |
setDHCPServerIP(String dhcpServer)
Sets the IP address of the DHCP server to the given String. |
static boolean |
setDNSTimeout(int dnsTimeout)
Sets the DNS timeout in milliseconds. |
static boolean |
setDomainname(String domain)
Sets the domain name to the given String. |
static boolean |
setGatewayIP(byte[] gateway)
Sets the gateway address for the default interface. |
static boolean |
setGatewayIP(String gateway)
Sets the gateway IP for the default interface. |
static boolean |
setGatewayIP(String interfaceName,
byte[] gateway)
Sets the gateway IP address for the specified interface. |
static boolean |
setGatewayIP(String interfaceName,
String gateway)
Sets the gateway IP for the specified interface. |
static boolean |
setHostname(String host)
Sets the host name to the given String. |
static boolean |
setIPAddress(byte[] localIP)
Sets the IP address of the default interface. |
static boolean |
setIPAddress(String localIP)
Sets the IP address of the default interface. |
static boolean |
setIPAddress(String interfaceName,
byte[] localIP)
Sets the IP address of the specified interface. |
static boolean |
setIPAddress(String interfaceName,
String localIP)
Sets the IP address of the specified interface. |
static boolean |
setMailhost(String mailhost)
Sets the mail host to the given IP address. |
static boolean |
setOptions(byte[] dhcp,
byte[] ip,
byte[] gateway,
byte[] subnet,
byte[] dns1,
byte[] dns2,
byte[] domain,
byte[] mailhost)
Sets multiple network configuration settings. |
static boolean |
setPreferredAddressFamily(int prefer)
Sets the preferred address family. |
static boolean |
setPrimaryDNS(byte[] primaryDNS)
Sets the primary DNS IP address. |
static boolean |
setPrimaryDNS(String primaryDNS)
Sets the primary DNS IP address to the given String. |
static boolean |
setProxyPort(int proxyPort)
Sets the proxy port. |
static boolean |
setProxyServer(String proxyServer)
Sets the proxy server IP address |
static boolean |
setSecondaryDNS(byte[] secondDNS)
Sets the secondary DNS IP address. |
static boolean |
setSecondaryDNS(String secondDNS)
Sets the secondary DNS IP address to the given String. |
static boolean |
setSubnetMask(byte[] subnetMask)
Sets the subnet mask of the default interface. |
static boolean |
setSubnetMask(String subnetMask)
Sets the subnet mask of the default interface. |
static boolean |
setSubnetMask(String interfaceName,
byte[] subnetMask)
Sets the subnet mask of the specified interface. |
static boolean |
setSubnetMask(String interfaceName,
String subnetMask)
Sets the subnet mask of the specified interface. |
static byte[] |
stringToIP(String host)
Converts a String representation of an IP to a byte array. |
static byte[] |
stringToIPv4(String host)
Converts a String representation of an IPv4 address to a byte array. |
static byte[] |
stringToIPv6(String host)
Converts a String representation of an IPv6 address to a byte array. |
| 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_NAME_LEN
public static final int UNCOMMITTED
public static final int COMMITTED
public static final int RESTORE_DISABLED
public static final int ETH_STATUS_LINK
public static final int ETH_STATUS_TX
public static final int ETH_STATUS_RX
public static final int PREFER_UNSPEC
public static final int PREFER_IPV4
public static final int PREFER_IPV6
public static final int TCP_TIMEOUT_8
public static final int TCP_TIMEOUT_16
public static final int TCP_TIMEOUT_32
public static final int TCP_TIMEOUT_64
public static final int TCP_TIMEOUT_128
public static final int INADDRSZ
public static final int IN4ADDRSZ
public static final byte[] anyIPv6Address
| Method Detail |
public static boolean isIPv4CompatibleAddress(byte[] ip)
ip - the IP address to check.ip is IPv4 compatible.public static String ipToString(byte[] ip)
ip - the IP address to convert.ip.public static String createIPString(byte[] ip)
ip - ip.
public static String ipv4ToString(byte[] ip,
int offset)
ip - the IP address to convert.offset - offset in the ip[] array where
the IP address starts.ip.public static String ipv4ToString(byte[] ip)
ip - the IP address to convert.ip.public static String ipv6ToString(byte[] ip)
ip - the IP address to convert.ip.public static byte[] stringToIP(String host)
host - the IP address as a String.public static byte[] createIPFromString(String host)
host - the IP address in String form.
public static byte[] stringToIPv4(String host)
throws UnknownHostException
host - the String representation of the IP.host is an invalid address.
public static byte[] stringToIPv6(String host)
throws UnknownHostException
host - the String representation of the IP.host is an invalid address.public static String getHostname()
public static String getDomainname()
public static String getPrimaryDNS()
public static String getSecondaryDNS()
public static int getPreferredAddressFamily()
public static String getMailhost()
public static int getDNSTimeout()
public static void getDHCPServerIP(byte[] address)
address - byte array of length four to be filled
with the IP DHCP server address, most
significant byte of address is stored
at index zero.public static String getDHCPServerIP()
public static void getIPAddress(String interfaceName,
byte[] address)
interfaceName - network interface (lo, eth0 or pppn)address - byte array of length four/sixteen to be filled in with the IP
address, most significant byte of address is stored at index
zero.
public static void getIPv6Address(String interfaceName,
byte[] address)
interfaceName - the name of the interface.address - byte array where the address should be stored.public static String getIPAddress(String interfaceName)
interfaceName - network interface (lo, eth or ppp)public static String getIPv6Address(String interfaceName)
interfaceName - the name of the interface.public static String getIPAddress()
public static String getIPv6Address()
public static void getIPAddress(byte[] address)
address - byte array of length four to be filled with the IP address, most significant
byte of address is stored at index zeropublic static void getIPv6Address(byte[] address)
address - the byte array where the address should be
stored.public static void getGatewayIP(byte[] address)
address - byte array to be filled with the IP address, most significant
byte of address is stored at index zero.public static String getGatewayIP()
public static void getGatewayIP(String interfaceName,
byte[] address)
interfaceName - network interface (lo, eth or ppp)address - byte array to be filled with the IP address, most significant
byte of address is stored at index zeropublic static String getGatewayIP(String interfaceName)
interfaceName - the interface.public static void getSubnetMask(byte[] address)
address - byte array of length four to be filled with the subnet mask, most significant
byte of mask is stored at index zeropublic static String getSubnetMask()
public static void getSubnetMask(String interfaceName,
byte[] address)
interfaceName - network interface (lo, eth or ppp)address - byte array of length four to be filled with the subnet mask, most significant
byte of mask is stored at index zero
public static void getIPv4Prefix(String interfaceName,
byte[] prefix)
interfaceName - network interface (lo, eth or ppp).prefix - the prefix length to fill in.
public static void getIPv6Prefix(String interfaceName,
byte[] prefix)
interfaceName - network interface (lo, eth or ppp).prefix - the prefix length.public static String getSubnetMask(String interfaceName)
interfaceName - network interface (lo, eth or ppp).public static void getEthernetAddress(byte[] mac)
mac - the MAC address to be filled in.public static String getEthernetAddress()
public static String getProxyServer()
public static int getProxyPort()
public static boolean setHostname(String host)
host - hostnamepublic static boolean setDomainname(String domain)
domain - domain name to be setpublic static boolean setPrimaryDNS(String primaryDNS)
primaryDNS - primary DNS IP address in dotted decimal notationpublic static boolean setPrimaryDNS(byte[] primaryDNS)
primaryDNS - the IP address as a byte array.public static boolean setSecondaryDNS(String secondDNS)
secondDNS - secondary DNS IP address in dotted decimal notation.public static boolean setSecondaryDNS(byte[] secondDNS)
secondDNS - secondary DNS IP.public static boolean setPreferredAddressFamily(int prefer)
prefer - a PREFER_XXX value.public static boolean setMailhost(String mailhost)
mailhost - IP address or name of the mail hostpublic static boolean setDNSTimeout(int dnsTimeout)
dnsTimeout - timeout value in milliseconds, zero for fallback and retry.public static boolean setDHCPServerIP(String dhcpServer)
dhcpServer - DHCP server IP address in dotted decimal notation.public static boolean setDHCPServerIP(byte[] dhcpServer)
dhcpServer - the IP address of the DHCP server.public static boolean setIPAddress(byte[] localIP)
localIP - IP address, MSB of address is index zeropublic static boolean setIPAddress(String localIP)
localIP - IP address in dotted decimal notation
public static boolean setIPAddress(String interfaceName,
byte[] localIP)
interfaceName - network interface namelocalIP - IP address, MSB of address is index zero
public static boolean setIPAddress(String interfaceName,
String localIP)
interfaceName - network interface namelocalIP - IP address in dotted decimal notationpublic static boolean setGatewayIP(byte[] gateway)
gateway - IP address of the gateway, MSB of address is index zeropublic static boolean setGatewayIP(String gateway)
gateway - IP address of the gateway in dotted decimal notation
public static boolean setGatewayIP(String interfaceName,
byte[] gateway)
interfaceName - network interface namegateway - ip address of the gateway, MSB of address is index zero
public static boolean setGatewayIP(String interfaceName,
String gateway)
interfaceName - network interface namegateway - IP address of the gateway in dotted decimal notationpublic static boolean setSubnetMask(byte[] subnetMask)
subnetMask - subnet mask, MSB of mask is at index zeropublic static boolean setSubnetMask(String subnetMask)
subnetMask - subnet mask in dotted decimal notation
public static boolean setSubnetMask(String interfaceName,
byte[] subnetMask)
interfaceName - network interface namesubnetMask - subnet mask, MSB of mask is at index zero
public static boolean setSubnetMask(String interfaceName,
String subnetMask)
interfaceName - network interface namesubnetMask - subnet mask in dotted decimal notationpublic static boolean setProxyServer(String proxyServer)
proxyServer - IP address of the proxy server, MSB of address is at index zeropublic static byte[] makeIP6Compatible(byte[] ip)
ip - IP address to verify as a 16 byte IP addresspublic static boolean setProxyPort(int proxyPort)
proxyPort - the port number to be used for proxypublic static byte[] getConnectionTable()
public static byte[] getARPCacheTable()
public static void commitNetworkState()
throws CommitException
commitNetworkState method. Once they are committed you
can disable boot time restore using the
disableNetworkRestore. Effectively this is the same as if
the network configuration was never committed. The configuration is
stored in RAM only and can be reconfigured at will.
The network configuration can only be recommitted after erasing
(zapping) bank 7 which will also erase the bank 7 application.
The easiest way to do this is to simply reload the bank 7
application using JavaKit.
This functionality is available in a login session using the
slush commands "ipconfig -C" and "ipconfig -D". getNetworkCommitState(),
disableNetworkRestore(),
TINIOS.getBootState()public static int getNetworkCommitState()
commitNetworkState(),
disableNetworkRestore(),
TINIOS.getBootState()public static void disableNetworkRestore()
commitNetworkState(),
getNetworkCommitState(),
TINIOS.getBootState()public static boolean setDefaultInterface(byte[] name)
name - network interface, lo (loopback), eth (Ethernet) or ppp
public static boolean getInterfaceInfo(int interfaceNum,
byte[] data)
interfaceNum - network interface numberdata - buffer for interface info
public static void addInterfaceEntry(byte[] name,
byte[] ipAddr,
byte[] subnet,
byte[] gateway,
byte flags,
byte type,
int transmitter)
name - network interface lo(loopback), eth(Ethernet) or pppipAddr - IP address of the new interfacesubnet - subnet mask of the new interfacegateway - gateway IP address of the new interfaceflags - network configuration flags mapped as follows:
type - type of network interface Ethernet = 1, ppp = 2, loopback = 3transmitter - 24 bit transmitter routine address represented as a 32-bit int
public static void addInterfaceEntry(byte[] name,
byte[] ipAddr,
byte[] subnet,
byte[] gateway,
byte flags,
byte type,
int transmitter,
int mtu,
int tcpTimeout)
name - network interface lo(loopback), eth(Ethernet) or pppipAddr - IP address of the new interfacesubnet - subnet mask of the new interfacegateway - gateway IP address of the new interfaceflags - network configuration flags mapped as follows:
type - type of network interface Ethernet = 1, ppp = 2, loopback = 3transmitter - 24 bit transmitter routine address represented as a 32-bit intmtu - maximum transmission unittcpTimeout - initial tcp timout period based on an 8Hz tickpublic static void removeInterfaceEntry(byte[] name)
name - network interface name to removepublic static int getEthernetStatus()
public static boolean setOptions(byte[] dhcp,
byte[] ip,
byte[] gateway,
byte[] subnet,
byte[] dns1,
byte[] dns2,
byte[] domain,
byte[] mailhost)
dhcp - IP address of the DHCP server, MSB of address is at index zeroip - IP address of the local machine, MSB of address is at index zerogateway - IP address of gateway address, MSB of address is at index zerosubnet - subnet mask, MSB of address is at index zerodns1 - IP address of the primary DNS server, MSB of address is at index zerodns2 - IP address of the secondary DNS server, MSB of address is at index zerodomain - domain name stored as a byte array, first character of name is at index zeromailhost - IP address of the outgoing mail server, MSB of address is at index zero
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||