urv.olsr.message
Class OLSRPacket

java.lang.Object
  extended by urv.olsr.message.OLSRPacket
All Implemented Interfaces:
java.io.Serializable, org.jgroups.util.Streamable

public class OLSRPacket
extends java.lang.Object
implements org.jgroups.util.Streamable, java.io.Serializable

OLSR communicates using a unified packet format for all data related to the protocol. The purpose of this is to facilitate extensibility of the protocol without breaking backwards compatibility. This also provides an easy way of piggybacking different "types" of information into a single transmission, and thus for a given implementation to optimize towards utilizing the maximal frame-size, provided by the network. These packets are embedded in UDP datagrams for transmission over the network. The present document is presented with IPv4 addresses. Considerations regarding IPv6 are given in section 17. Each packet encapsulates one or more messages. The messages share a common header format, which enables nodes to correctly accept and (if applicable) retransmit messages of an unknown type. Messages can be flooded onto the entire network, or flooding can be limited to nodes within a diameter (in terms of number of hops) from the originator of the message. Thus transmitting a message to the neighborhood of a node is just a special case of flooding. When flooding any control message, duplicate retransmissions will be eliminated locally (i.e., each node maintains a duplicate set to prevent transmitting the same OLSR control message twice) and minimized in the entire network through the usage of MPRs as described in later sections. Furthermore, a node can examine the header of a message to obtain information on the distance (in terms of number of hops) to the originator of the message. This feature may be useful in situations where, e.g., the time information from a received control messages stored in a node depends on the distance to the originator.

Author:
Gerard Paris Aixala
See Also:
Serialized Form

Field Summary
static int HELLO_MESSAGE
           
static int TC_MESSAGE
           
 
Constructor Summary
OLSRPacket()
           
OLSRPacket(int messageType, OLSRMessage content)
           
OLSRPacket(int messageType, ValidityTime time, OLSRNode originator, int ttl, int hopCount, SequenceNumber messageSequenceNumber, OLSRMessage content)
           
 
Method Summary
 void decreaseTtl()
          Decreses the ttl by one
 OLSRMessage getContent()
           
 int getHopCount()
           
 SequenceNumber getMessageSequenceNumber()
           
 int getMessageType()
           
 OLSRNode getOriginator()
           
 int getTtl()
           
 ValidityTime getVTime()
           
 void increaseHopCount()
          Increases hop count by one
 void readFrom(java.io.DataInputStream in)
           
 void setHopCount(int hopCount)
           
 void setTtl(int ttl)
           
 void writeTo(java.io.DataOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HELLO_MESSAGE

public static final int HELLO_MESSAGE
See Also:
Constant Field Values

TC_MESSAGE

public static final int TC_MESSAGE
See Also:
Constant Field Values
Constructor Detail

OLSRPacket

public OLSRPacket()

OLSRPacket

public OLSRPacket(int messageType,
                  OLSRMessage content)

OLSRPacket

public OLSRPacket(int messageType,
                  ValidityTime time,
                  OLSRNode originator,
                  int ttl,
                  int hopCount,
                  SequenceNumber messageSequenceNumber,
                  OLSRMessage content)
Parameters:
messageType -
time -
originator -
ttl -
hopCount -
messageSequenceNumber -
content -
Method Detail

readFrom

public void readFrom(java.io.DataInputStream in)
              throws java.io.IOException,
                     java.lang.IllegalAccessException,
                     java.lang.InstantiationException
Specified by:
readFrom in interface org.jgroups.util.Streamable
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.InstantiationException

setHopCount

public void setHopCount(int hopCount)
Parameters:
hopCount - the hopCount to set

setTtl

public void setTtl(int ttl)
Parameters:
ttl - the ttl to set

writeTo

public void writeTo(java.io.DataOutputStream out)
             throws java.io.IOException
Specified by:
writeTo in interface org.jgroups.util.Streamable
Throws:
java.io.IOException

decreaseTtl

public void decreaseTtl()
Decreses the ttl by one


getContent

public OLSRMessage getContent()
Returns:
the content

getHopCount

public int getHopCount()
Returns:
the hopCount

getMessageSequenceNumber

public SequenceNumber getMessageSequenceNumber()
Returns:
the messageSequenceNumber

getMessageType

public int getMessageType()
Returns:
the messageType

getOriginator

public OLSRNode getOriginator()
Returns:
the originator

getTtl

public int getTtl()
Returns:
the ttl

getVTime

public ValidityTime getVTime()
Returns:
the vTime

increaseHopCount

public void increaseHopCount()
Increases hop count by one