public abstract class BGP4Message extends Object implements BGP4Element
From RFC 4271, Section 4.1
RFC 4271. From RFC 4271, Section 4.1 4.1. Message Header Format Each message has a fixed-size header. There may or may not be a data portion following the header, depending on the message type. The layout of these fields is shown below:
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ +
| Marker |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Length | Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Marker:
This 16-octet field is included for compatibility; it MUST be
set to all ones.
Length:
This 2-octet unsigned integer indicates the total length of the
message, including the header in octets. Thus, it allows one
to locate the (Marker field of the) next message in the TCP
stream. The value of the Length field MUST always be at least
19 and no greater than 4096, and MAY be further constrained,
depending on the message type. "padding" of extra data after
the message is not allowed. Therefore, the Length field MUST
have the smallest value required, given the rest of the
message.
Type:
This 1-octet unsigned integer indicates the type code of the
message. This document defines the following type codes:
1 - OPEN
2 - UPDATE
3 - NOTIFICATION
4 - KEEPALIVE| Modifier and Type | Field and Description |
|---|---|
static int |
BGPHeaderLength |
static int |
BGPMarkerLength |
protected static org.slf4j.Logger |
log
Logger
|
protected byte[] |
messageBytes
The bytes of the message
|
| Constructor and Description |
|---|
BGP4Message()
Default constructor
|
BGP4Message(byte[] bytes)
Creates a PCEP message from a byte array.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
encodeHeader() |
static int |
getBGPHeaderLength() |
static int |
getBGPMarkerLength() |
byte[] |
getBytes()
Get the message Bytes
|
int |
getLength() |
int |
getMessageType()
Message-Type (8 bits): The following message types are currently
defined:
Value Meaning
1 Open
2 Update
3 Notification
4 Keepalive
|
static int |
getMessageType(byte[] bytes) |
void |
setMessageLength(int messageLength) |
void |
setMessageType(int messageType) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitencodeprotected byte[] messageBytes
protected static final org.slf4j.Logger log
public static int BGPHeaderLength
public static int BGPMarkerLength
public BGP4Message()
public BGP4Message(byte[] bytes)
bytes - PCEPProtocolViolationExceptionpublic void setMessageLength(int messageLength)
public void setMessageType(int messageType)
public byte[] getBytes()
getBytes in interface BGP4Elementpublic int getMessageType()
public static int getMessageType(byte[] bytes)
public int getLength()
getLength in interface BGP4Elementprotected void encodeHeader()
public static int getBGPMarkerLength()
public static int getBGPHeaderLength()
Copyright © 2016. All rights reserved.