public class AdsHeader extends Object
parse(java.nio.ByteBuffer) or it can be appended to a byte buffer with
In essence, this header is the combined object from an AMS-TCP header and a pure AMS header.
| Modifier and Type | Field and Description |
|---|---|
static int |
AMSHEADER
Length of the AMS header.
|
private int |
command |
private int |
error |
private int |
flag |
static int |
HEADER
Length of ADS header in bytes.
|
private int |
id |
private long |
payload |
private int |
reserved |
private byte[] |
source |
private int |
sourceport |
private byte[] |
target |
private int |
targetport |
static int |
TCPHEADER
Length of the TCP header.
|
private long |
total |
| Constructor and Description |
|---|
AdsHeader(int r,
long t,
byte[] tadd,
int tp,
byte[] sadd,
int sp,
int c,
int f,
long payl,
int err,
int ii)
Fully qualified ADS header.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
getCommand()
Command ID.
|
int |
getError()
The error code
|
int |
getFlag()
In TCP, only two flags are allowed 0x04 for command request, 0x41 for
command response.
|
int |
getId()
The communication ID.
|
long |
getPayloadLength()
Length of payload in bytes.
|
int |
getReserved()
Must be zero
|
byte[] |
getSource()
A logical IP-style address of the source, consisting of six(!) bytes
in network order.
|
int |
getSourcePort()
Sender port number
|
byte[] |
getTarget()
A logical IP-style address of the target, consisting of six(!) bytes
in network order.
|
int |
getTargetPort()
Target port number
|
long |
getTotal()
Get total length of data packet.
|
int |
hashCode() |
boolean |
isError()
For convenience, we return true here if any error was detected.
|
static AdsHeader |
parse(ByteBuffer in)
From a fully filled byte-buffer, we create a possibly valid AdsHeader
|
ByteBuffer |
push(ByteBuffer into)
Push the header into the provided buffer.
|
private String |
stringAmsNetId(byte[] six) |
String |
toString() |
public static final int AMSHEADER
public static final int TCPHEADER
public static final int HEADER
private final int reserved
private final long total
private final byte[] target
private final int targetport
private final byte[] source
private final int sourceport
private final int command
private final int flag
private final long payload
private final int error
private final int id
AdsHeader(int r,
long t,
byte[] tadd,
int tp,
byte[] sadd,
int sp,
int c,
int f,
long payl,
int err,
int ii)
r - t - tadd - sadd - p - c - f - payl - err - ii - public int getReserved()
public long getTotal()
public byte[] getTarget()
public byte[] getSource()
public int getSourcePort()
public int getTargetPort()
public int getCommand()
public int getFlag()
public long getPayloadLength()
public boolean isError()
getError().public int getError()
public int getId()
public ByteBuffer push(ByteBuffer into)
into - a pre-allocated byte buffer that must be able to hold the entire
package.private String stringAmsNetId(byte[] six)
public static AdsHeader parse(ByteBuffer in)