com.dalsemi.tininet
Class TININet

java.lang.Object
  |
  +--com.dalsemi.tininet.TININet

public class TININet
extends java.lang.Object

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 INTERFACE_DATA_LENGTH
          Length of the getInterfaceInfo return data.
static int INTERFACE_DEFAULT
           
static int INTERFACE_ETHERNET
          Interface types for getInterfaceInfo.type
static int INTERFACE_FLAGS_OFFS
          Offsets for getInterfaceInfo return data.
static int INTERFACE_GATEWAY_OFFS
           
static int INTERFACE_IP4ADDR_OFFS
           
static int INTERFACE_IP4PREFIX_OFFS
           
static int INTERFACE_IP4SUBNET_OFFS
           
static int INTERFACE_IP6ADDR_OFFS
           
static int INTERFACE_IP6PREFIX_OFFS
           
static int INTERFACE_IPV4
          Definitions for getInterfaceInfo.flags
static int INTERFACE_IPV6
           
static int INTERFACE_LOOPBACK
           
static int INTERFACE_NAME_LEN_OFFS
           
static int INTERFACE_NAME_OFFS
           
static int INTERFACE_PID_OFFS
           
static int INTERFACE_PPP
           
static int INTERFACE_TCP_MSS
           
static int INTERFACE_TCP_RETRY
           
static int INTERFACE_TYPE_OFFS
           
static int MAX_NAME_LEN
          Upper bound of mailhostname, hostname and domainname length.
static int MAX_NETWORK_INTERFACES
          Maximum number of supported network interfaces.
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(java.lang.String host)
          Deprecated. This method is flagged deprecated because callers of this method assume IPv4-only networking.
static java.lang.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 java.lang.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 java.lang.String getDomainname()
          Gets the domain name of TINI.
static java.lang.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 java.lang.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 java.lang.String getGatewayIP(java.lang.String interfaceName)
          Gets the IP address of the gateway for the specified interface as a String in dotted decimal notation.
static void getGatewayIP(java.lang.String interfaceName, byte[] address)
          Gets the IP address of the gateway for the specified interface.
static java.lang.String getHostname()
          Gets the hostname of TINI.
static int getInterfaceFlags(java.lang.String interfaceName)
          Gets the interface flags (see INTERFACE_....).
static boolean getInterfaceInfo(int interfaceNum, byte[] data)
          Gets interface information for given interface and stores it in byte array.
static int getInterfaceMSS(java.lang.String interfaceName)
          Gets the maximum TCP segment size (MSS).
static java.lang.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 java.lang.String getIPAddress(java.lang.String interfaceName)
          Gets the IP address of the specified interface as a String.
static void getIPAddress(java.lang.String interfaceName, byte[] address)
          Gets the IP address of the specified interface.
static void getIPv4Prefix(java.lang.String interfaceName, byte[] prefix)
          Gets the IPv4 subnet mask of the specified interface in prefix notation.
static java.lang.String getIPv6Address()
          Gets the IPv6 address of the default interface.
static void getIPv6Address(byte[] address)
          Gets the IPv6 address of the default interface.
static java.lang.String getIPv6Address(java.lang.String interfaceName)
          Gets the IPv6 address of the specified interface.
static void getIPv6Address(java.lang.String interfaceName, byte[] address)
          Gets the IPv6 address of the specified interface.
static void getIPv6Prefix(java.lang.String interfaceName, byte[] prefix)
          Gets the IPv6 prefix length of the specified interface.
static java.lang.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 java.lang.String getPrimaryDNS()
          Gets the primary DNS server address.
static int getProxyPort()
          Gets the proxy server port number.
static java.lang.String getProxyServer()
          Gets the IP address of the proxy server.
static java.lang.String getSecondaryDNS()
          Gets the secondary DNS server address.
static java.lang.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 java.lang.String getSubnetMask(java.lang.String interfaceName)
          Gets the subnet mask of the specified interface as a String.
static void getSubnetMask(java.lang.String interfaceName, byte[] address)
          Gets the subnet mask of the specified interface.
static java.lang.String ipToString(byte[] ip)
          Converts an IP address to a String.
static java.lang.String ipv4ToString(byte[] ip)
          Converts an IPv4 address to a String.
static java.lang.String ipv4ToString(byte[] ip, int offset)
          Converts an IPv4 address to a String.
static java.lang.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(java.lang.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(java.lang.String domain)
          Sets the domain name to the given String.
static boolean setEthernetAddress(byte[] mac)
          Sets the Ethernet MAC address into the given byte array, with the most significant byte first.
static boolean setGatewayIP(byte[] gateway)
          Sets the gateway address for the default interface.
static boolean setGatewayIP(java.lang.String gateway)
          Sets the gateway IP for the default interface.
static boolean setGatewayIP(java.lang.String interfaceName, byte[] gateway)
          Sets the gateway IP address for the specified interface.
static boolean setGatewayIP(java.lang.String interfaceName, java.lang.String gateway)
          Sets the gateway IP for the specified interface.
static boolean setHostname(java.lang.String host)
          Sets the host name to the given String.
static boolean setInterfaceFlags(java.lang.String interfaceName, int clearFlags, int setFlags)
          Sets and clears the specified interface flags.
static boolean setInterfaceMSS(java.lang.String interfaceName, int MSS)
          Sets the maximum TCP segment size (MSS).
static boolean setIPAddress(byte[] localIP)
          Sets the IP address of the default interface.
static boolean setIPAddress(java.lang.String localIP)
          Sets the IP address of the default interface.
static boolean setIPAddress(java.lang.String interfaceName, byte[] localIP)
          Sets the IP address of the specified interface.
static boolean setIPAddress(java.lang.String interfaceName, java.lang.String localIP)
          Sets the IP address of the specified interface.
static boolean setMailhost(java.lang.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(java.lang.String primaryDNS)
          Sets the primary DNS IP address to the given String.
static boolean setProxyPort(int proxyPort)
          Sets the proxy port.
static boolean setProxyServer(java.lang.String proxyServer)
          Sets the proxy server IP address
static boolean setSecondaryDNS(byte[] secondDNS)
          Sets the secondary DNS IP address.
static boolean setSecondaryDNS(java.lang.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(java.lang.String subnetMask)
          Sets the subnet mask of the default interface.
static boolean setSubnetMask(java.lang.String interfaceName, byte[] subnetMask)
          Sets the subnet mask of the specified interface.
static boolean setSubnetMask(java.lang.String interfaceName, java.lang.String subnetMask)
          Sets the subnet mask of the specified interface.
static byte[] stringToIP(java.lang.String host)
          Converts a String representation of an IP to a byte array.
static byte[] stringToIPv4(java.lang.String host)
          Converts a String representation of an IPv4 address to a byte array.
static byte[] stringToIPv6(java.lang.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

MAX_NAME_LEN

public static final int MAX_NAME_LEN
Upper bound of mailhostname, hostname and domainname length.

UNCOMMITTED

public static final int UNCOMMITTED
Network configuration is not committed to flash memory.

COMMITTED

public static final int COMMITTED
Network configuration is committed to flash memory.

RESTORE_DISABLED

public static final int RESTORE_DISABLED
Network configuration restore is disabled.

ETH_STATUS_LINK

public static final int ETH_STATUS_LINK
Ethernet controller status flags.

ETH_STATUS_TX

public static final int ETH_STATUS_TX
Ethernet controller status flags.

ETH_STATUS_RX

public static final int ETH_STATUS_RX
Ethernet controller status flags.

PREFER_UNSPEC

public static final int PREFER_UNSPEC
Preferred address family: Unspecified (v6->v4)

PREFER_IPV4

public static final int PREFER_IPV4
Preferred address family: IPv4 only

PREFER_IPV6

public static final int PREFER_IPV6
Preferred address family: IPv6 only

TCP_TIMEOUT_8

public static final int TCP_TIMEOUT_8
TCP retransmission timeout value

TCP_TIMEOUT_16

public static final int TCP_TIMEOUT_16
TCP retransmission timeout value

TCP_TIMEOUT_32

public static final int TCP_TIMEOUT_32
TCP retransmission timeout value

TCP_TIMEOUT_64

public static final int TCP_TIMEOUT_64
TCP retransmission timeout value

TCP_TIMEOUT_128

public static final int TCP_TIMEOUT_128
TCP retransmission timeout value

MAX_NETWORK_INTERFACES

public static final int MAX_NETWORK_INTERFACES
Maximum number of supported network interfaces.

INTERFACE_DATA_LENGTH

public static final int INTERFACE_DATA_LENGTH
Length of the getInterfaceInfo return data.

INTERFACE_FLAGS_OFFS

public static final int INTERFACE_FLAGS_OFFS
Offsets for getInterfaceInfo return data.

INTERFACE_TYPE_OFFS

public static final int INTERFACE_TYPE_OFFS

INTERFACE_IP4ADDR_OFFS

public static final int INTERFACE_IP4ADDR_OFFS

INTERFACE_IP4SUBNET_OFFS

public static final int INTERFACE_IP4SUBNET_OFFS

INTERFACE_IP4PREFIX_OFFS

public static final int INTERFACE_IP4PREFIX_OFFS

INTERFACE_GATEWAY_OFFS

public static final int INTERFACE_GATEWAY_OFFS

INTERFACE_IP6ADDR_OFFS

public static final int INTERFACE_IP6ADDR_OFFS

INTERFACE_IP6PREFIX_OFFS

public static final int INTERFACE_IP6PREFIX_OFFS

INTERFACE_NAME_LEN_OFFS

public static final int INTERFACE_NAME_LEN_OFFS

INTERFACE_NAME_OFFS

public static final int INTERFACE_NAME_OFFS

INTERFACE_PID_OFFS

public static final int INTERFACE_PID_OFFS

INTERFACE_TCP_MSS

public static final int INTERFACE_TCP_MSS

INTERFACE_TCP_RETRY

public static final int INTERFACE_TCP_RETRY

INTERFACE_IPV4

public static final int INTERFACE_IPV4
Definitions for getInterfaceInfo.flags

INTERFACE_DEFAULT

public static final int INTERFACE_DEFAULT

INTERFACE_IPV6

public static final int INTERFACE_IPV6

INTERFACE_ETHERNET

public static final int INTERFACE_ETHERNET
Interface types for getInterfaceInfo.type

INTERFACE_PPP

public static final int INTERFACE_PPP

INTERFACE_LOOPBACK

public static final int INTERFACE_LOOPBACK

INADDRSZ

public static final int INADDRSZ
Size of an IP address.

IN4ADDRSZ

public static final int IN4ADDRSZ
Size of an IPv4 address.

anyIPv6Address

public static final byte[] anyIPv6Address
The unspecified IPv6 address.
Method Detail

isIPv4CompatibleAddress

public static boolean isIPv4CompatibleAddress(byte[] ip)
This method checks whether the given IP address contains an IPv4 address.
Parameters:
ip - the IP address to check.
Returns:
true if ip is IPv4 compatible.

ipToString

public static java.lang.String ipToString(byte[] ip)
Converts an IP address to a String.
Parameters:
ip - the IP address to convert.
Returns:
the String representation of the ip.

createIPString

public static java.lang.String createIPString(byte[] ip)
Deprecated. This method is flagged deprecated because callers of this method assume IPv4-only networking.

Converts a byte[] representation of an IP to a String representation.
Parameters:
ip -  
Returns:
a String representation of ip.

ipv4ToString

public static java.lang.String ipv4ToString(byte[] ip,
                                            int offset)
Converts an IPv4 address to a String.
Parameters:
ip - the IP address to convert.
offset - offset in the ip[] array where the IP address starts.
Returns:
the String representation of ip.

ipv4ToString

public static java.lang.String ipv4ToString(byte[] ip)
Converts an IPv4 address to a String.
Parameters:
ip - the IP address to convert.
Returns:
the String representation of ip.

ipv6ToString

public static java.lang.String ipv6ToString(byte[] ip)
Converts an IPv6 address to a String.
Parameters:
ip - the IP address to convert.
Returns:
the String representation of ip.

stringToIP

public static byte[] stringToIP(java.lang.String host)
Converts a String representation of an IP to a byte array.
Parameters:
host - the IP address as a String.
Returns:
the IP address as byte[].

createIPFromString

public static byte[] createIPFromString(java.lang.String host)
Deprecated. This method is flagged deprecated because callers of this method assume IPv4-only networking.

Converts a String representation of an IP to a byte[] representation.
Parameters:
host - the IP address in String form.
Returns:
the IP address as a byte[].

stringToIPv4

public static byte[] stringToIPv4(java.lang.String host)
                           throws java.net.UnknownHostException
Converts a String representation of an IPv4 address to a byte array.
Parameters:
host - the String representation of the IP.
Returns:
the byte[] representation of the IP address.
Throws:
java.net.UnknownHostException - if host is an invalid address.

stringToIPv6

public static byte[] stringToIPv6(java.lang.String host)
                           throws java.net.UnknownHostException
Converts a String representation of an IPv6 address to a byte array.
Parameters:
host - the String representation of the IP.
Returns:
the byte[] representation of the IP address.
Throws:
java.net.UnknownHostException - if host is an invalid address.

getHostname

public static java.lang.String getHostname()
Gets the hostname of TINI.
Returns:
TINI hostname

getDomainname

public static java.lang.String getDomainname()
Gets the domain name of TINI.
Returns:
TINI domain name

getPrimaryDNS

public static java.lang.String getPrimaryDNS()
Gets the primary DNS server address.
Returns:
primary DNS server address, if the address has not been set an empty string is returned

getSecondaryDNS

public static java.lang.String getSecondaryDNS()
Gets the secondary DNS server address.
Returns:
secondary DNS server address, if the address has not been set an empty string is returned

getPreferredAddressFamily

public static int getPreferredAddressFamily()
Gets the preferred address family.
Returns:
preferred Address Family value.

getMailhost

public static java.lang.String getMailhost()
Gets the IP address or name of the default mailhost.
Returns:
IP address or name of the default mailhost, if the address has not been set an empty string is returned.

getDNSTimeout

public static int getDNSTimeout()
Gets the timeout value for DNS queries.
Returns:
timeout in milliseconds

getDHCPServerIP

public static void getDHCPServerIP(byte[] address)
Gets the IP address of the DHCP server.
Parameters:
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.

getDHCPServerIP

public static java.lang.String getDHCPServerIP()
Gets the IP address of DHCP server.
Returns:
IP address of the dhcp server in dotted decimal notation, if the address has not been set an empty string is returned

getIPAddress

public static void getIPAddress(java.lang.String interfaceName,
                                byte[] address)
Gets the IP address of the specified interface. Currently loopback (lo), Ethernet (eth0) and ppp are supported.
Parameters:
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.

getIPv6Address

public static void getIPv6Address(java.lang.String interfaceName,
                                  byte[] address)
Gets the IPv6 address of the specified interface.
Parameters:
interfaceName - the name of the interface.
address - byte array where the address should be stored.

getIPAddress

public static java.lang.String getIPAddress(java.lang.String interfaceName)
Gets the IP address of the specified interface as a String. Currently loopback (lo), Ethernet (eth) and ppp are supported
Parameters:
interfaceName - network interface (lo, eth or ppp)
Returns:
the IP address of the named interface, if the address has not been set an empty string is returned

getIPv6Address

public static java.lang.String getIPv6Address(java.lang.String interfaceName)
Gets the IPv6 address of the specified interface.
Parameters:
interfaceName - the name of the interface.
Returns:
the IP address of the specified interface.

getIPAddress

public static java.lang.String getIPAddress()
Gets the IPv4 address of the default interface as a String.
Returns:
the IP address in dotted decimal notation, if the address has not been set an empty string is returned

getIPv6Address

public static java.lang.String getIPv6Address()
Gets the IPv6 address of the default interface.
Returns:
the IP address as a String.

getIPAddress

public static void getIPAddress(byte[] address)
Gets the IPv4 address of the default interface.
Parameters:
address - byte array of length four to be filled with the IP address, most significant byte of address is stored at index zero

getIPv6Address

public static void getIPv6Address(byte[] address)
Gets the IPv6 address of the default interface.
Parameters:
address - the byte array where the address should be stored.

getGatewayIP

public static void getGatewayIP(byte[] address)
Gets the gateway IP address of the default interface.
Parameters:
address - byte array to be filled with the IP address, most significant byte of address is stored at index zero.

getGatewayIP

public static java.lang.String getGatewayIP()
Gets the gateway IP address of the default interface as a String.
Returns:
ip address of the gateway in dotted decimal notation, if the address has not been set an empty string is returned.

getGatewayIP

public static void getGatewayIP(java.lang.String interfaceName,
                                byte[] address)
Gets the IP address of the gateway for the specified interface.
Parameters:
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 zero

getGatewayIP

public static java.lang.String getGatewayIP(java.lang.String interfaceName)
Gets the IP address of the gateway for the specified interface as a String in dotted decimal notation.
Parameters:
interfaceName - the interface.
Returns:
IP address of the gateway in dotted decimal notation, if the address has not been set an empty string is returned

getSubnetMask

public static void getSubnetMask(byte[] address)
Gets the subnet mask of the default interface.
Parameters:
address - byte array of length four to be filled with the subnet mask, most significant byte of mask is stored at index zero

getSubnetMask

public static java.lang.String getSubnetMask()
Gets the subnet mask of the default interface as a String.
Returns:
the subnet mask in dotted decimal notation, if the address has not been set an empty string is returned

getSubnetMask

public static void getSubnetMask(java.lang.String interfaceName,
                                 byte[] address)
Gets the subnet mask of the specified interface.
Parameters:
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

getIPv4Prefix

public static void getIPv4Prefix(java.lang.String interfaceName,
                                 byte[] prefix)
Gets the IPv4 subnet mask of the specified interface in prefix notation.
Parameters:
interfaceName - network interface (lo, eth or ppp).
prefix - the prefix length to fill in.

getIPv6Prefix

public static void getIPv6Prefix(java.lang.String interfaceName,
                                 byte[] prefix)
Gets the IPv6 prefix length of the specified interface.
Parameters:
interfaceName - network interface (lo, eth or ppp).
prefix - the prefix length.

getSubnetMask

public static java.lang.String getSubnetMask(java.lang.String interfaceName)
Gets the subnet mask of the specified interface as a String.
Parameters:
interfaceName - network interface (lo, eth or ppp).
Returns:
the subnet mask in dotted decimal notation, if the address has not been set an empty string is returned

getEthernetAddress

public static void getEthernetAddress(byte[] mac)
Gets the Ethernet MAC address into the given byte array, with the most significant byte first.
Parameters:
mac - the MAC address to be filled in.

setEthernetAddress

public static boolean setEthernetAddress(byte[] mac)
Sets the Ethernet MAC address into the given byte array, with the most significant byte first.
Parameters:
mac - the MAC address.
Returns:
success

getEthernetAddress

public static java.lang.String getEthernetAddress()
Gets the Ethernet MAC address as a String.
Returns:
the Ethernet MAC address as a String.

getProxyServer

public static java.lang.String getProxyServer()
Gets the IP address of the proxy server.
Returns:
the IP address of the proxy server in dotted decimal notation, if the address has not been set an empty string is returned

getProxyPort

public static int getProxyPort()
Gets the proxy server port number.
Returns:
the proxy port number

setHostname

public static boolean setHostname(java.lang.String host)
Sets the host name to the given String.
Parameters:
host - hostname
Returns:
true if successful

setDomainname

public static boolean setDomainname(java.lang.String domain)
Sets the domain name to the given String.
Parameters:
domain - domain name to be set
Returns:
true if successful

setPrimaryDNS

public static boolean setPrimaryDNS(java.lang.String primaryDNS)
Sets the primary DNS IP address to the given String.
Parameters:
primaryDNS - primary DNS IP address in dotted decimal notation
Returns:
true if successful.

setPrimaryDNS

public static boolean setPrimaryDNS(byte[] primaryDNS)
Sets the primary DNS IP address.
Parameters:
primaryDNS - the IP address as a byte array.
Returns:
true if successful.

setSecondaryDNS

public static boolean setSecondaryDNS(java.lang.String secondDNS)
Sets the secondary DNS IP address to the given String.
Parameters:
secondDNS - secondary DNS IP address in dotted decimal notation.
Returns:
true if successful.

setSecondaryDNS

public static boolean setSecondaryDNS(byte[] secondDNS)
Sets the secondary DNS IP address.
Parameters:
secondDNS - secondary DNS IP.
Returns:
true if successful.

setPreferredAddressFamily

public static boolean setPreferredAddressFamily(int prefer)
Sets the preferred address family.
Parameters:
prefer - a PREFER_XXX value.
Returns:
true if successful.

setMailhost

public static boolean setMailhost(java.lang.String mailhost)
Sets the mail host to the given IP address.
Parameters:
mailhost - IP address or name of the mail host
Returns:
true on success.

setDNSTimeout

public static boolean setDNSTimeout(int dnsTimeout)
Sets the DNS timeout in milliseconds. If the timeout value is set to zero, a fallback and retry procedure will take effect. The DNS client will retry starting at 2 seconds and doubling until reaching 16 seconds. The DNS resolver will try four times in this period to resolve the name. * 2s * 4s * 8s * 16s
Parameters:
dnsTimeout - timeout value in milliseconds, zero for fallback and retry.
Returns:
true on success.

setDHCPServerIP

public static boolean setDHCPServerIP(java.lang.String dhcpServer)
Sets the IP address of the DHCP server to the given String.
Parameters:
dhcpServer - DHCP server IP address in dotted decimal notation.
Returns:
true on success.

setDHCPServerIP

public static boolean setDHCPServerIP(byte[] dhcpServer)
Sets the IP address of the DHCP server.
Parameters:
dhcpServer - the IP address of the DHCP server.
Returns:
true on success.

setIPAddress

public static boolean setIPAddress(byte[] localIP)
Sets the IP address of the default interface.
Parameters:
localIP - IP address, MSB of address is index zero
Returns:
true on success.

setIPAddress

public static boolean setIPAddress(java.lang.String localIP)
Sets the IP address of the default interface.
Parameters:
localIP - IP address in dotted decimal notation
Returns:
true on success.

setIPAddress

public static boolean setIPAddress(java.lang.String interfaceName,
                                   byte[] localIP)
Sets the IP address of the specified interface.
Parameters:
interfaceName - network interface name
localIP - IP address, MSB of address is index zero
Returns:
true on success

setIPAddress

public static boolean setIPAddress(java.lang.String interfaceName,
                                   java.lang.String localIP)
Sets the IP address of the specified interface.
Parameters:
interfaceName - network interface name
localIP - IP address in dotted decimal notation
Returns:
true on success

setGatewayIP

public static boolean setGatewayIP(byte[] gateway)
Sets the gateway address for the default interface.
Parameters:
gateway - IP address of the gateway, MSB of address is index zero
Returns:
true on success

setGatewayIP

public static boolean setGatewayIP(java.lang.String gateway)
Sets the gateway IP for the default interface.
Parameters:
gateway - IP address of the gateway in dotted decimal notation
Returns:
true on success

setGatewayIP

public static boolean setGatewayIP(java.lang.String interfaceName,
                                   byte[] gateway)
Sets the gateway IP address for the specified interface.
Parameters:
interfaceName - network interface name
gateway - ip address of the gateway, MSB of address is index zero
Returns:
true on success

setGatewayIP

public static boolean setGatewayIP(java.lang.String interfaceName,
                                   java.lang.String gateway)
Sets the gateway IP for the specified interface.
Parameters:
interfaceName - network interface name
gateway - IP address of the gateway in dotted decimal notation
Returns:
true on success

setSubnetMask

public static boolean setSubnetMask(byte[] subnetMask)
Sets the subnet mask of the default interface.
Parameters:
subnetMask - subnet mask, MSB of mask is at index zero
Returns:
true on success

setSubnetMask

public static boolean setSubnetMask(java.lang.String subnetMask)
Sets the subnet mask of the default interface.
Parameters:
subnetMask - subnet mask in dotted decimal notation
Returns:
true on success

setSubnetMask

public static boolean setSubnetMask(java.lang.String interfaceName,
                                    byte[] subnetMask)
Sets the subnet mask of the specified interface.
Parameters:
interfaceName - network interface name
subnetMask - subnet mask, MSB of mask is at index zero
Returns:
true on success

setSubnetMask

public static boolean setSubnetMask(java.lang.String interfaceName,
                                    java.lang.String subnetMask)
Sets the subnet mask of the specified interface.
Parameters:
interfaceName - network interface name
subnetMask - subnet mask in dotted decimal notation
Returns:
true on success

setProxyServer

public static boolean setProxyServer(java.lang.String proxyServer)
Sets the proxy server IP address
Parameters:
proxyServer - IP address of the proxy server, MSB of address is at index zero
Returns:
true on success

makeIP6Compatible

public static byte[] makeIP6Compatible(byte[] ip)
Takes the IP address argument and turns it into a 16 byte IP address. Note that if the IP address is already 16 bytes, the original argument is returned, not a new copy.
Parameters:
ip - IP address to verify as a 16 byte IP address
Returns:
16 byte IP address

setProxyPort

public static boolean setProxyPort(int proxyPort)
Sets the proxy port.
Parameters:
proxyPort - the port number to be used for proxy
Returns:
true on success

getConnectionTable

public static byte[] getConnectionTable()
Gets the current connection table.
Returns:
byte array containing the connection table

getARPCacheTable

public static byte[] getARPCacheTable()
Gets the current ARP cache table.
Returns:
byte array containing the ARP cache table

commitNetworkState

public static void commitNetworkState()
                               throws CommitException
Commits the current network configuration to flash.
Note: Committing the network settings to flash allows applications to use TINIOS.blastHeapOnReboot(BLAST_ALL) to clear the heap to a virgin state on reboot without having to reconfigure the network through a serial connection. If the settings are committed, TINIOS will compare the settings stored in flash to those stored in heap at boot time. If they are different, the settings in flash will be copied over those in the heap. This allows TINIOS to always boot up with a known network configuration. Due to the nature of flash (write once and erase) the network settings can only be committed one time using the 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".
Throws:
CommitException - if state has already been committed.
See Also:
getNetworkCommitState(), disableNetworkRestore(), TINIOS.getBootState()

getNetworkCommitState

public static int getNetworkCommitState()
Returns the commit state as UNCOMMITED, COMMITTED or RESTORE_DISABLED.
Returns:
the current commit state
See Also:
commitNetworkState(), disableNetworkRestore(), TINIOS.getBootState()

disableNetworkRestore

public static void disableNetworkRestore()
Disables the ability to commit or restore network configuration until the bank 7 application is re-flashed.
See Also:
commitNetworkState(), getNetworkCommitState(), TINIOS.getBootState()

setDefaultInterface

public static boolean setDefaultInterface(byte[] name)
Sets the default network interface.
Parameters:
name - network interface, lo (loopback), eth (Ethernet) or ppp
Returns:
true if interface was successfully set as the default

getInterfaceInfo

public static boolean getInterfaceInfo(int interfaceNum,
                                       byte[] data)
Gets interface information for given interface and stores it in byte array. Returns true if information was found using supplied interface number.
Parameters:
interfaceNum - network interface number
data - buffer for interface info
Returns:
true if interface info was found. Data gets filled in with the Information. Well-known masks for the "flags" are INTERFACE_IPV4, INTERFACE_IPV6 and INTERFACE_DEFAULT.

addInterfaceEntry

public 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.
Parameters:
name - network interface lo(loopback), eth(Ethernet) or ppp
ipAddr - IP address of the new interface
subnet - subnet mask of the new interface
gateway - gateway IP address of the new interface
flags - network configuration flags mapped as follows:
      flags.0 = used - should always be set
      flags.1 = active - should be set if the interface is to be active
      flags.2 = default - set if this should be the default network interface
      flags.3 = UNUSED - must be cleared
      flags.4 = routable - set if interface is to carry routable packets
      flags.5 = multicasting enabled - set if interface supports multicast
      flags.6 = UNUSED - must be cleared
type - type of network interface Ethernet = 1, ppp = 2, loopback = 3
transmitter - 24 bit transmitter routine address represented as a 32-bit int

addInterfaceEntry

public 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.
Parameters:
name - network interface lo(loopback), eth(Ethernet) or ppp
ipAddr - IP address of the new interface
subnet - subnet mask of the new interface
gateway - gateway IP address of the new interface
flags - network configuration flags mapped as follows:
      flags.0 = used - should always be set
      flags.1 = active - should be set if the interface is to be active
      flags.2 = default - set if this should be the default network interface
      flags.3 = UNUSED - must be cleared
      flags.4 = routable - set if interface is to carry routable packets
      flags.5 = multicasting enabled - set if interface supports multicast
      flags.6 = UNUSED - must be cleared
type - type of network interface Ethernet = 1, ppp = 2, loopback = 3
transmitter - 24 bit transmitter routine address represented as a 32-bit int
mtu - maximum transmission unit
tcpTimeout - initial tcp timout period based on an 8Hz tick

removeInterfaceEntry

public static void removeInterfaceEntry(byte[] name)
Removes specified interface from the network interface list.
Parameters:
name - network interface name to remove

getEthernetStatus

public static int getEthernetStatus()
Returns status from the Ethernet controller. The status includes Link Transmit Receive
Returns:
The bitwise-or of any of the ETH_STATUS_XXX integer constants

setOptions

public static boolean setOptions(byte[] dhcp,
                                 byte[] ip,
                                 byte[] gateway,
                                 byte[] subnet,
                                 byte[] dns1,
                                 byte[] dns2,
                                 byte[] domain,
                                 byte[] mailhost)
Sets multiple network configuration settings.
Parameters:
dhcp - IP address of the DHCP server, MSB of address is at index zero
ip - IP address of the local machine, MSB of address is at index zero
gateway - IP address of gateway address, MSB of address is at index zero
subnet - subnet mask, MSB of address is at index zero
dns1 - IP address of the primary DNS server, MSB of address is at index zero
dns2 - IP address of the secondary DNS server, MSB of address is at index zero
domain - domain name stored as a byte array, first character of name is at index zero
mailhost - IP address of the outgoing mail server, MSB of address is at index zero
Returns:
true on success

setInterfaceMSS

public static boolean setInterfaceMSS(java.lang.String interfaceName,
                                      int MSS)
Sets the maximum TCP segment size (MSS). This is useful on PPPoE/ATM configurations where the maximum transfer unit (MTU) is smaller than 1460. Since TINI doesn't support fragmentation, this function allows tuning TCP so that no packets bigger than the MTU are generated.
Parameters:
interfaceName - the name of the interface; null for default interface.
MSS - MSS value (default and maximum: 1460).
Returns:
success.

getInterfaceMSS

public static int getInterfaceMSS(java.lang.String interfaceName)
Gets the maximum TCP segment size (MSS).
Parameters:
interfaceName - the name of the interface; null for default interface.
Returns:
MSS value for the selected interface, -1 on error.

setInterfaceFlags

public static boolean setInterfaceFlags(java.lang.String interfaceName,
                                        int clearFlags,
                                        int setFlags)
Sets and clears the specified interface flags. Valid bitmasks are INTERFACE_IPV4, INTERFACE_IPV6.
Parameters:
interfaceName - the name of the interface; null for default interface.
clearFlags - flags to clear
setFlags - flags to set
Returns:
success.

getInterfaceFlags

public static int getInterfaceFlags(java.lang.String interfaceName)
Gets the interface flags (see INTERFACE_....).
Parameters:
interfaceName - the name of the interface; null for default interface.
Returns:
flags for the selected interface, -1 on error.


Also see:
o TINI 1.11 API, Optional Modules
o TINI Home Page
o 1-Wire API

Last update Fri Jan 24 12:06:43 CST 2003
Используются технологии uCoz