|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--java.net.ANEPOption
This class allow to create an ANEP options, this class is used to send options as well as to receive them.
When receiving option, you need to specified the length of data you expect to receive, if there is less data the length will be changed, if there is more the data will be truncated.
Due to constraint inside the anep option, the length of the payload could be greater that the number of bytes effecively put in it due to 32 bits alignment, so you can seem to receive MORE DATA that what you have send.
For information here is the structure of an ANEP option as it is send in the ANEP Packet (the length is expressed in 32bit words):
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |FLG| Option Type | Option Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | . | ~ Option Payload (Option Value) ~ | . | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Field Summary | |
static int |
FLAG_DISCARD
Flag to say if an unknown option should result in ignoring the option or discarding the whole packet. |
static int |
FLAG_PRIVATE
Flag to mark an option has private to the packet type. |
static int |
MAX_LENGTH
Maximal payload size for the option. |
static int |
MAX_TYPE
Maximal value that an ANEP option type can have. |
static int |
USE_DEFAULT_FLAGS
This is the default flags used when not specified |
| Fields inherited from interface java.net.ANEPOptionType |
CHECKSUM, DSTID, NNAUTH, SRCID |
| Constructor Summary | |
ANEPOption(int type,
byte[] payload,
int offset,
int length)
Create an ANEP option which could be used when sending/receiving ANEP Packet. |
|
ANEPOption(int type,
int flags,
byte[] payload,
int offset,
int length)
Create an ANEP option which could be used when sending/receiving ANEP Packet. |
|
| Method Summary | |
byte[] |
getData()
Get the payload of this option. |
int |
getFlags()
Get the flags of this option. |
int |
getLength()
Get the length of the payload. |
int |
getOffset()
Returns the offset of the data to be sent or the offset of the data received. |
int |
getType()
Get the type of this option. |
boolean |
isReceived()
Returns a boolean to indicate if this option has been received whithin the ANEP packet. |
void |
setData(byte[] payload,
int offset,
int length)
Set the data buffer for this option. |
void |
setFlags(int flags)
Set the flag for this option. |
void |
setLength(int length)
Set the length of the payload to send. |
void |
setType(int type)
Set the type of the option. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int FLAG_PRIVATE
public static final int FLAG_DISCARD
public static final int USE_DEFAULT_FLAGS
public static final int MAX_TYPE
public static final int MAX_LENGTH
| Constructor Detail |
public ANEPOption(int type,
int flags,
byte[] payload,
int offset,
int length)
offset combined
with the length should not exced the size of the
payload buffer (payload.length).type - type of the optionflags - option flagspayload - option payloadoffset - offset for the payloadlength - length for the payloadFLAG_PRIVATE,
FLAG_DISCARD,
ANEPOptionType
public ANEPOption(int type,
byte[] payload,
int offset,
int length)
offset combined
with the length should not exced the size of the
payload buffer (payload.length).type - type of the optionpayload - option payloadoffset - offset for the payloadlength - length for the payloadFLAG_PRIVATE,
FLAG_DISCARD,
ANEPOptionType| Method Detail |
public void setType(int type)
type - type of the optionANEPOptionTypepublic void setFlags(int flags)
FLAG_DISCARD and FLAG_PRIVATE).flags - flags of the optionFLAG_PRIVATE,
FLAG_DISCARD
public void setData(byte[] payload,
int offset,
int length)
payload, length and offset
of the option.
The offset combined
with the length should not exced the size of the
payload buffer (payload.length).
If the payload is null, the
offset and length are automatically
set to 0.
payload - option payloadoffset - offset for the payloadlength - lenght for the payloadANEPPacket,
getData(),
getOffset(),
getLength()public int getType()
setType, has it could have changed after having
received an ANEP packet.public int getFlags()
setFlags, has it could have changed after having
received an ANEP packet.public byte[] getData()
setData, has it could have changed after having
received an ANEP packet.public int getLength()
setData, has it could have changed after having
received an ANEP packet.public void setLength(int length)
length - length of the payload to send.java.lang.IllegalArgumentException - if the length is out of range
or if there was no payload buffer previously associated.public int getOffset()
public boolean isReceived()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||