SSF.OS.BGP4.Comm
Class UpdateMessage

java.lang.Object
  |
  +--SSF.OS.ProtocolMessage
        |
        +--SSF.OS.BGP4.Comm.Message
              |
              +--SSF.OS.BGP4.Comm.UpdateMessage
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class UpdateMessage
extends Message

A BGP Update message. An update message is used to transfer routing information between two BGP peers. That routing information consists of new and/or outdated routes. New routes are specified by a destination IP prefix and path attributes which describe the route to that destination. Outdated routes, known as infeasible routes, are routes which are no longer valid. They are indicated only by destination, and are used to inform a peer that routes to that destination (as learned from the sending BGP speaker) are no longer valid.

See Also:
Serialized Form

Field Summary
 java.util.ArrayList rtes
          A list of routes being advertised.
 boolean treat_as_notice
          Whether or not this message serves as an update arrival notification.
 java.util.ArrayList wds
          A list of the destinations of withdrawn routes.
 
Fields inherited from class SSF.OS.BGP4.Comm.Message
KEEPALIVE, nh, NOTICEUPDATE, NOTIFICATION, OCTETS_IN_HEADER, OPEN, RUN, STARTSTOP, TIMEOUT, TRANSPORT, typ, typeNames, UPDATE, version
 
Constructor Summary
UpdateMessage()
          Empty constructor.
UpdateMessage(java.lang.String nh)
          Constructs the update message with default values.
UpdateMessage(java.lang.String nh, IPaddress wdnlri)
          Constructs the update message with the given infeasible NLRI.
UpdateMessage(java.lang.String nh, Route rte)
          Constructs the update message with the given feasible route.
 
Method Summary
 void add_route(Route rte)
          Adds a route to the message.
 void add_wd(IPaddress wd)
          Adds the destination of a withdrawn route to this message.
 int body_bytecount()
          Returns the number of octets (bytes) in the message body.
 boolean is_empty()
          Returns true only if there is information in the message.
 int num_ads()
          Returns the number of prefixes being advertised in this message.
 int num_wds()
          Returns the number of prefixes being withdrawn in this message.
 void readExternal(java.io.ObjectInput in)
          Reads the contents of this object from a serialization stream.
 boolean remove_wd(IPaddress ipa)
          Remove withdrawn route information from the message.
 Route rte(int ind)
          Returns one of the message's routes.
 java.lang.String toString()
          Returns a string describing the contents of the update message.
 IPaddress wd(int ind)
          Returns one of the message's withdrawn route addresses.
 void writeExternal(java.io.ObjectOutput out)
          Writes the contents of this object to a serialization stream.
 
Methods inherited from class SSF.OS.BGP4.Comm.Message
bytecount, header_bytecount, type2str, version
 
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

wds

public java.util.ArrayList wds
A list of the destinations of withdrawn routes. Each element is an IP address prefix indicating a route which is no longer being used by the sending BGP speaker.


rtes

public java.util.ArrayList rtes
A list of routes being advertised. Each element includes the NLRI and path attributes for the route.


treat_as_notice

public boolean treat_as_notice
Whether or not this message serves as an update arrival notification.

See Also:
Global.notice_update_arrival
Constructor Detail

UpdateMessage

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


UpdateMessage

public UpdateMessage(java.lang.String nh)
Constructs the update message with default values.

Parameters:
nh - The NHI address prefix of the sender of this message.

UpdateMessage

public UpdateMessage(java.lang.String nh,
                     Route rte)
Constructs the update message with the given feasible route.

Parameters:
nh - The NHI address prefix of the sender of this message.
rte - The route to advertise in this message.

UpdateMessage

public UpdateMessage(java.lang.String nh,
                     IPaddress wdnlri)
Constructs the update message with the given infeasible NLRI.

Parameters:
nh - The NHI address prefix of the sender of this message.
Method Detail

rte

public final Route rte(int ind)
Returns one of the message's routes.

Parameters:
ind - The index of the route to return.
Returns:
one of the message's routes

wd

public final IPaddress wd(int ind)
Returns one of the message's withdrawn route addresses.

Parameters:
ind - The index of the withdrawn route address to return.
Returns:
one of the message's withdrawn route addresses

add_route

public final void add_route(Route rte)
Adds a route to the message.

Parameters:
rte - The route to add to the message.

add_wd

public final void add_wd(IPaddress wd)
Adds the destination of a withdrawn route to this message.

Parameters:
wd - The destination of the withdrawn route to add.

remove_wd

public final boolean remove_wd(IPaddress ipa)
Remove withdrawn route information from the message.

Parameters:
ipa - The IP address prefix to remove.
Returns:
true only if the remove was successful

num_ads

public final int num_ads()
Returns the number of prefixes being advertised in this message.


num_wds

public final int num_wds()
Returns the number of prefixes being withdrawn in this message.


is_empty

public final boolean is_empty()
Returns true only if there is information in the message.

Returns:
true only if there are no withdrawn routes nor any NLRI

body_bytecount

public int body_bytecount()
Returns the number of octets (bytes) in the message body. It is the sum of two octets for the infeasible routes length, plus a variable number of octets for the withdrawn routes, plus two octets for the total path attribute length, plus a variable number of octets for the path attributes, plus a variable number of octets for the NLRI.

Overrides:
body_bytecount in class Message
Returns:
the number of octets (bytes) in the message

toString

public java.lang.String toString()
Returns a string describing the contents of the update message.

Overrides:
toString in class Message
Returns:
a string representation of the update 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
Overrides:
writeExternal in class Message
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
Overrides:
readExternal in class Message
Throws:
java.io.IOException - if there's an error reading in the data
java.lang.ClassNotFoundException - if a class name is unrecognized