public class UscHeader extends Object
Modifier and Type | Class and Description |
---|---|
static class |
UscHeader.OperationType
Types of USC packets.
|
Modifier and Type | Field and Description |
---|---|
static int |
HEADER_LENGTH
Length of the header by bytes.
|
static int |
PAYLOAD_LENGTH_OFFSET
Offset to the payload length field in bytes.
|
static int |
PAYLOAD_LENGTH_SIZE
The length of the payload length field in bytes.
|
static int |
USC_VERSION
USC protocol version number.
|
Constructor and Description |
---|
UscHeader(int uscVersion,
UscHeader.OperationType operationType,
int applicationPort,
int sessionId,
int payloadLength)
Initializes the USC header.
|
Modifier and Type | Method and Description |
---|---|
static UscHeader |
fromByteBuffer(ByteBuffer buf)
Constructs an USC header from a byte stream
|
int |
getApplicationPort()
Returns the port number of the service on the device
|
static int |
getBitsAsInteger(byte value,
int offset,
int size)
Returns a range of bits in a byte value as an integer
|
static UscHeader |
getFromBytes(byte[] bytes)
Constructs an USC header from a byte stream
|
UscHeader.OperationType |
getOperationType()
Returns the USC packet type
|
int |
getPayloadLength()
Returns the the payload length in bytes
|
int |
getSessionId()
Returns the session ID
|
int |
getUscVersion()
Returns the USC version
|
static boolean |
isBitSet(byte value,
int offset)
Checks whether a bit is set in a byte value
|
int |
length()
Returns the length of the USC header in bytes
|
static byte |
setBit(byte value,
int offset,
boolean target)
Set or unset a specific bit in a byte value
|
static byte |
setBitsAsInteger(byte value,
int offset,
int size,
int target)
Set or unset a range of bits in a byte value
|
ByteBuffer |
toByteBuffer()
Constructs a byte stream representation of this USC header
|
public static final int HEADER_LENGTH
public static final int PAYLOAD_LENGTH_OFFSET
public static final int PAYLOAD_LENGTH_SIZE
public static final int USC_VERSION
public UscHeader(int uscVersion, UscHeader.OperationType operationType, int applicationPort, int sessionId, int payloadLength)
uscVersion
- USC version numberoperationType
- USC packet typeapplicationPort
- the port number of the service on the devicesessionId
- the session IDpayloadLength
- the length of the payload in bytespublic static byte setBit(byte value, int offset, boolean target)
value
- offset
- target
- public static byte setBitsAsInteger(byte value, int offset, int size, int target)
value
- offset
- size
- target
- public static boolean isBitSet(byte value, int offset)
value
- offset
- public static int getBitsAsInteger(byte value, int offset, int size)
value
- offset
- size
- public static UscHeader fromByteBuffer(ByteBuffer buf)
buf
- public static UscHeader getFromBytes(byte[] bytes)
bytes
- bufferpublic int getUscVersion()
public UscHeader.OperationType getOperationType()
public int getApplicationPort()
public int getSessionId()
public int getPayloadLength()
public int length()
public ByteBuffer toByteBuffer()
Copyright © 2019 OpenDaylight. All rights reserved.