|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttuwien.auto.calimero.knxnetip.util.HPAI
public class HPAI
KNXnet/IP Host Protocol Address Information (HPAI).
The address information is used to describe a communication channel. Its structure
varies according to the used underlying protocol. This class is implemented for IPv4.
For IP networks with NAT, consider use of HPAI(short, InetSocketAddress).
UDP is the default communication mode with mandatory support used in KNXnet/IP.
Objects of this type are immutable.
| Field Summary | |
|---|---|
static short |
IPV4_TCP
Internet protocol version 4 address, TCP communication. |
static short |
IPV4_UDP
Internet protocol version 4 address, UDP communication. |
| Constructor Summary | |
|---|---|
HPAI(byte[] data,
int offset)
Creates a HPAI out of a byte array. |
|
HPAI(java.net.InetAddress addr,
int port)
Creates a HPAI for UDP communication with the given address information. |
|
HPAI(short hostProtocol,
java.net.InetAddress addr,
int port)
Creates a HPAI with the given address information. |
|
HPAI(short hostProtocol,
java.net.InetSocketAddress addr)
Creates a HPAI with the given address information. |
|
| Method Summary | |
|---|---|
java.net.InetAddress |
getAddress()
Returns the IP network address as InetAddress representation. |
short |
getHostProtocol()
Returns the host protocol of this HPAI. |
int |
getPort()
Returns the port number of this HPAI. |
byte[] |
getRawAddress()
Returns the raw IP network address. |
short |
getStructLength()
Returns the structure length of this HPAI in bytes. |
byte[] |
toByteArray()
Returns the byte representation of the whole HPAI structure. |
java.lang.String |
toString()
Returns this HPAI representation in textual format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final short IPV4_TCP
public static final short IPV4_UDP
| Constructor Detail |
|---|
public HPAI(byte[] data,
int offset)
throws KNXFormatException
data - byte array containing the HPAI structureoffset - start offset of HPAI in data
KNXFormatException - if no HPAI found, invalid structure or unknown host
protocol
public HPAI(java.net.InetAddress addr,
int port)
The constructor uses the fact, that UDP is the default communication mode used in
KNXnet/IP.
The following first matching rule is used for the addr argument:
1) addr holds an InetAddress, use that address
2) addr is null, the local host is retrieved by
InetAddress.getLocalHost()
3) if no local host could be found, fall back to safe state and initialize IP
and port to 0 (NAT aware mode)
addr - local IP address, use null for setting local hostport - local port number to set, 0 <= port <= 0xFFFF
public HPAI(short hostProtocol,
java.net.InetAddress addr,
int port)
hostProtocol - host protocol code (UDP or TCP on IP)addr - local IP addressport - local port number to set, 0 <= port <= 0xFFFF
public HPAI(short hostProtocol,
java.net.InetSocketAddress addr)
To indicate the use of network address translation (NAT) to the receiver, leave
addr null.
hostProtocol - host protocol code (UDP or TCP on IP)addr - socket with IP address and port number, if addr =
null address and port are initialized to 0| Method Detail |
|---|
public final java.net.InetAddress getAddress()
InetAddress representation.
public final short getHostProtocol()
public final int getPort()
public final byte[] getRawAddress()
public final short getStructLength()
public final byte[] toByteArray()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||