SSF.OS.BGP4.Comm
Class Message

java.lang.Object
  |
  +--SSF.OS.ProtocolMessage
        |
        +--SSF.OS.BGP4.Comm.Message
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
KeepAliveMessage, NotificationMessage, OpenMessage, StartStopMessage, TimeoutMessage, TransportMessage, UpdateMessage

public class Message
extends ProtocolMessage
implements java.io.Externalizable

This class holds the header fields of a BGP message. It serves as a parent class for the more specific types of BGP messages which are derived from it (Open, Update, Notification, and KeepAlive messages). It has also also been extended to serve as a timeout notification message and start/stop message.

See Also:
Serialized Form

Field Summary
static int KEEPALIVE
          Indicates that a BGP message is a KeepAlive message.
 java.lang.String nh
          The NHI prefix of the router of the neighbor/peer with whom this message is associated.
static int NOTICEUPDATE
          Indicates that a BGP message is a NoticeUpdate indicator.
static int NOTIFICATION
          Indicates that a BGP message is a Notification message.
static int OCTETS_IN_HEADER
          The number of octets (bytes) in the standard header.
static int OPEN
          Indicates that a BGP message is an Open message.
static int RUN
          Indicates a 'start BGP process' directive to bring BGP into existence in the simulated network.
static int STARTSTOP
          Indicates that a BGP message is a Start or Stop directive.
static int TIMEOUT
          Indicates that a BGP message is a local timer expiration indicator.
static int TRANSPORT
          Indicates that a BGP message is a Transport message.
 int typ
          The type code of the message.
static java.lang.String[] typeNames
          String representations of the different message types.
static int UPDATE
          Indicates that a BGP message is an Update message.
static java.lang.String version
          The developer's version string of this implementation of BGP-4.
 
Constructor Summary
Message()
          Empty constructor.
Message(int mtyp, java.lang.String nhipre)
          Constructs a message with the given sender NHI prefix address and message type.
 
Method Summary
 int body_bytecount()
          Returns the number of octets (bytes) in the message body.
 int bytecount()
          Returns the number of octets (bytes) in the message.
 int header_bytecount()
          Returns the number of octets (bytes) in the message header.
 void readExternal(java.io.ObjectInput in)
          Reads the contents of this object from a serialization stream.
 java.lang.String toString()
          Returns a string briefly summarizing the message.
static java.lang.String type2str(int typ)
          Returns a string representation of the message type name.
 java.lang.String version()
          Returns the developer's version string of this BGP-4 implementation.
 void writeExternal(java.io.ObjectOutput out)
          Writes the contents of this object to a serialization stream.
 
Methods inherited from class SSF.OS.ProtocolMessage
carryPayload, copy, dropHeader, dropPayload, frombytes, fromVersion, payload, previous, size, tobytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OPEN

public static final int OPEN
Indicates that a BGP message is an Open message.

See Also:
Constant Field Values

UPDATE

public static final int UPDATE
Indicates that a BGP message is an Update message.

See Also:
Constant Field Values

NOTIFICATION

public static final int NOTIFICATION
Indicates that a BGP message is a Notification message.

See Also:
Constant Field Values

KEEPALIVE

public static final int KEEPALIVE
Indicates that a BGP message is a KeepAlive message.

See Also:
Constant Field Values

TIMEOUT

public static final int TIMEOUT
Indicates that a BGP message is a local timer expiration indicator.

See Also:
Constant Field Values

TRANSPORT

public static final int TRANSPORT
Indicates that a BGP message is a Transport message.

See Also:
Constant Field Values

STARTSTOP

public static final int STARTSTOP
Indicates that a BGP message is a Start or Stop directive.

See Also:
Constant Field Values

RUN

public static final int RUN
Indicates a 'start BGP process' directive to bring BGP into existence in the simulated network.

See Also:
Constant Field Values

NOTICEUPDATE

public static final int NOTICEUPDATE
Indicates that a BGP message is a NoticeUpdate indicator.

See Also:
Constant Field Values

typeNames

public static final java.lang.String[] typeNames
String representations of the different message types.


OCTETS_IN_HEADER

public static final int OCTETS_IN_HEADER
The number of octets (bytes) in the standard header.

See Also:
Constant Field Values

version

public static java.lang.String version
The developer's version string of this implementation of BGP-4.


typ

public int typ
The type code of the message.


nh

public java.lang.String nh
The NHI prefix of the router of the neighbor/peer with whom this message is associated. For traditional message types (open, update, notification, and keepalive), it is the NHI prefix of the peer who sent the message. For timeout, transport, and start/stop messages, it is the NHI prefix of the neighbor/peer that the action associated with the message is directed towards.

Constructor Detail

Message

public Message()
Empty constructor. Used to deserialize this object.


Message

public Message(int mtyp,
               java.lang.String nhipre)
Constructs a message with the given sender NHI prefix address and message type.

Parameters:
mtyp - The type of the message.
nhipre - The NHI prefix of the router of the neighbor/peer with whom this message is associated.
Method Detail

version

public java.lang.String version()
Returns the developer's version string of this BGP-4 implementation.

Overrides:
version in class ProtocolMessage
Returns:
the developer's version string of this BGP-4 implementation

header_bytecount

public final int header_bytecount()
Returns the number of octets (bytes) in the message header.

Overrides:
header_bytecount in class ProtocolMessage
Returns:
the number of octets (bytes) in the message header

body_bytecount

public int body_bytecount()
Returns the number of octets (bytes) in the message body.

Returns:
the number of octets (bytes) in the message body

bytecount

public int bytecount()
Returns the number of octets (bytes) in the message.

Overrides:
bytecount in class ProtocolMessage
Returns:
the number of octets (bytes) in the message

type2str

public static java.lang.String type2str(int typ)
Returns a string representation of the message type name.

Parameters:
typ - An integer indicating a message type.
Returns:
a string representation of the message type name

toString

public java.lang.String toString()
Returns a string briefly summarizing the message.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the message

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Writes the contents of this object to a serialization stream.

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException - if there's an error writing the data

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the contents of this object from a serialization stream.

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException - if there's an error reading in the data
java.lang.ClassNotFoundException - if a class name is unrecognized