J-Sim v1.2.1-p7 API

drcl.inet
Class Protocol

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.comp.Component
          extended bydrcl.net.Module
              extended bydrcl.inet.Protocol
All Implemented Interfaces:
java.lang.Cloneable, InetConstants, ObjectDuplicable, java.io.Serializable
Direct Known Subclasses:
Hello, Routing, sIGMP, TCP, TCP_full, TCPSink, UDP

public class Protocol
extends Module
implements InetConstants

The base class for transport, routing and other signaling protocols. A protocol may receive services and events from CoreServiceLayer.

It provides a complete set of methods (create<xxx>Port()) for a subclass to create service and event ports for the purpose, and a complete set of event handler/callback methods (<xxx>Handler(...)) that a subclass may override to handle interested events. Refer to CoreServiceLayer for details regarding what services and events are available.

A subclass must create the corresponding service port and then take advantage of the corresponding service contract class in order to use a service. For example, to use the Route Configuration services, a subclass must create a port by calling createRTServicePort() and then invoke the services with the port and the contract class.

To receive and handle a type of events, a subclass must create the corresponding event port and then override the corresponding handler method. For example, to receive the packet arrival event, the protocol subclass may call createPktArrivalEventPort() in the initialized codes, and then override pktArrivalHandler(EventContract.Message, Port).

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class drcl.comp.Component
Component.Locks
 
Field Summary
 
Fields inherited from class drcl.net.Module
address, downPort, PortGroup_DOWN, PortGroup_UP, timerPort, upPort
 
Fields inherited from class drcl.comp.Component
FLAG_COMPONENT_NOTIFICATION, FLAG_DEBUG_ENABLED, FLAG_DIRECT_OUTPUT_ENABLED, FLAG_ENABLED, FLAG_ERROR_ENABLED, FLAG_EVENT_ENABLED, FLAG_EXPOSED, FLAG_GARBAGE_DISPLAY_ENABLED, FLAG_GARBAGE_ENABLED, FLAG_HAS_EXPOSED_CHILD, FLAG_PORT_NOTIFICATION, FLAG_STARTED, FLAG_STOPPED, FLAG_TRACE_ENABLED, FLAG_UNDEFINED_START, id, infoPort, locks, name, parent, PortGroup_DEFAULT_GROUP, PortGroup_EVENT, PortGroup_SERVICE, Root, Trace_DATA, Trace_SEND
 
Fields inherited from interface drcl.inet.InetConstants
BYTE_MODE, DEFAULT_BANDWIDTH, DEFAULT_BUFFER_SIZE, DEFAULT_MTU, EVENT_ID_CHANGED_PORT_ID, EVENT_IDENTITY_ADDED, EVENT_IDENTITY_REMOVED, EVENT_IF_NEIGHBOR_DOWN, EVENT_IF_NEIGHBOR_UP, EVENT_IF_PORT_ID, EVENT_LINK_BROKEN, EVENT_LINK_BROKEN_PORT_ID, EVENT_MCAST_HOST_PORT_ID, EVENT_PKT_ARRIVAL, EVENT_PKT_ARRIVAL_PORT_ID, EVENT_RT_ENTRY_ADDED, EVENT_RT_ENTRY_MODIFIED, EVENT_RT_ENTRY_REMOVED, EVENT_RT_MCAST_CHANGED_PORT_ID, EVENT_RT_UCAST_CHANGED_PORT_ID, EVENT_VIF_NEIGHBOR_DOWN, EVENT_VIF_NEIGHBOR_UP, EVENT_VIF_PORT_ID, HOST_ENTRY_EXT, ID_CSL, MCAST_QUERY_PORT_ID, PACKET_MODE, PID_AODV, PID_DV, PID_DVMRP, PID_HELLO, PID_IGMP, PID_OSPF, PID_RSVP, PID_TCP, PID_UDP, SERVICE_CONFIGSW_PORT_ID, SERVICE_ID_PORT_ID, SERVICE_IF_PORT_ID, SERVICE_MCAST_PORT_ID, SERVICE_RT_PORT_ID, UCAST_QUERY_PORT_ID
 
Constructor Summary
Protocol()
           
Protocol(java.lang.String id_)
           
 
Method Summary
 void broadcast(java.lang.Object body_, int bodySize_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_)
          Broadcast a raw packet body.
 void broadcast(java.lang.Object body_, int bodySize_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_, int excludeIf_)
          Broadcast excluding the specified link.
 void broadcast(java.lang.Object p_, int bodysize_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_, int[] excludeIfs_)
          Broadcast excluding the specified links.
 void broadcast(Packet p_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_)
          Broadcast the packet.
 void broadcast(Packet p_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_, int excludeIf_)
          Broadcast excluding the specified link.
 void broadcast(Packet p_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_, int[] excludeIfs_)
          Broadcast excluding the specified links.
 Port createConfigSwitchPort()
          Creates and returns a port to use with the ConfigSwitch contract in this protocol implementation.
 Port createIDChangedEventPort()
          Creates and returns a port to accept the identity changed events from the core service layer in this protocol implementation.
 Port createIDServicePort()
          Creates and returns a port to use with the IDLookup and/or the {#link IDConfig} contracts in this protocol implementation.
 Port createIFEventPort()
          Creates and returns a port to accept the interface/neighbor events from the core service layer in this protocol implementation.
 Port createIFQueryPort()
          Creates and returns a port to use with the IFQuery contract in this protocol implementation.
 Port createLinkBrokenEventPort()
          Creates and returns a port to accept the link broken events from CSL.
 Port createMcastHostEventPort()
          Creates and returns a port to accept the multicast host join/leave events in this protocol implementation.
 Port createMcastQueryPort()
          Creates and returns a port to accept the multicast queries from the core service layer in this protocol implementation.
 Port createMulticastRTChangedEventPort()
          Creates and returns a port to accept the multicast routing entry changed events from the core service layer in this protocol implementation.
 Port createPktArrivalEventPort()
          Creates and returns a port to accept the packet arrival events from the core service layer in this protocol implementation.
 Port createRTServicePort()
          Creates and returns a port to use with the RTLookup and/or the RTConfig contracts in this protocol implementation.
 Port createUcastQueryPort()
          Creates and returns a port to accept the unicast queries from the core service layer in this protocol implementation.
 Port createUnicastRTChangedEventPort()
          Creates and returns a port to accept the unicast routing entry changed events from the core service layer in this protocol implementation.
 Port createVIFEventPort()
          Creates and returns a port to accept the virtual interface/neighbor events from the core service layer in this protocol implementation.
 void duplicate(java.lang.Object source_)
          Duplicates the content of source_, including ID, name, child components and connections among them, to this component.
 void forward(java.lang.Object p_, int bodysize_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_)
          Route lookup forwarding.
 void forward(java.lang.Object p_, int bodysize_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_, int if_)
          Forward packet via specified link.
 void forward(java.lang.Object p_, int bodysize_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_, int[] ifs_)
          This method presents the most general case where the packet is forwarded on arbitrarily specified interfaces.
 void forward(Packet p_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_)
          Route lookup forwarding.
 void forward(Packet p_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_, int if_)
          Forward packet via specified link.
 void forward(Packet p_, long src_, long dest_, boolean routerAlert_, int TTL_, long ToS_, int[] ifs_)
          This method presents the most general case where the packet is forwarded on arbitrarily specified interfaces.
protected  void idAddedEventHandler(java.lang.Object data_, Port inPort_)
          Called back when an identity added event is received.
protected  void idRemovedEventHandler(java.lang.Object data_, Port inPort_)
          Called back when an identity removed event is received.
 void LinkBrokenEventHandler(InetPacket p, Port inPort_)
          Called back when a link broken event is received.
protected  void mcastHostJoinEventHandler(long src_, long srcmask_, long group_, int ifindex_, Port inPort_)
          Called back when a multicast host join event is received.
protected  void mcastHostLeaveEventHandler(long src_, long srcmask_, long group_, int ifindex_, Port inPort_)
          Called back when a multicast host leave event is received.
protected  void neighborDownEventHandler(int ifindex_, NetAddress neighbor_, Port inPort_)
          Called back when a neighbor down event is received.
protected  void neighborUpEventHandler(int ifindex_, NetAddress neighbor_, Port inPort_)
          Called back when a neighbor up event is received.
protected  void pktArrivalHandler(EventContract.Message event_, Port inPort_)
          Called back when a packet arrival event is received.
protected  void processOther(java.lang.Object data_, Port inPort_)
          The handler invoked when a packet arrived at a port other than the "up", "down" and timer ports.
protected  int[] routeQueryHandler(InetPacket p, int incomingIf_, Port inPort_)
          Called back when a unicast/multicast query event is received.
protected  int[] routeQueryHandler(RTKey request_, Port inPort_)
          Called back when a unicast/multicast query event is received.
protected  void rtAddedEventHandler(java.lang.Object data_, Port inPort_)
          Called back when a routing entry added event is received.
protected  void rtModifiedEventHandler(java.lang.Object data_, Port inPort_)
          Called back when a routing entry modified event is received.
protected  void rtRemovedEventHandler(java.lang.Object data_, Port inPort_)
          Called back when a routing entry removed event is received.
protected  void vNeighborDownEventHandler(int ifindex_, NetAddress neighbor_, Port inPort_)
          Called back when a (virtual) neighbor down event is received.
protected  void vNeighborUpEventHandler(int ifindex_, NetAddress neighbor_, Port inPort_)
          Called back when a (virtual) neighbor up event is received.
 
Methods inherited from class drcl.net.Module
cancelTimeout, dataArriveAtDownPort, dataArriveAtUpPort, deliver, getAddress, process, removeDefaultDownPort, removeDefaultUpPort, removeTimerPort, setAddress, setTimeout, setTimeoutAt, timeout
 
Methods inherited from class drcl.comp.Component
_resume, _start, _stop, addComponent, addComponent, addEventPort, addEventPort, addForkPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addPort, addServerPort, addServerPort, cancelFork, componentAdded, componentRemoved, connect, containsComponent, containsComponent, containsPort, debug, disconnectAll, disconnectAllPeers, disconnectAllPorts, drop, drop, error, error, expose, exposeEventPorts, exposePort, exposePort, exposePort, exposePort, exposePort, findAvailable, findAvailable, findAvailable, finishing, fork, forkAt, getAllComponents, getAllPorts, getAllPorts, getAllWiresInside, getAllWiresInsideOut, getAllWiresOut, getComponent, getComponentFlag, getComponentFlag, getContract, getContractHT, getContractHT, getDebugFlagsInBinary, getDebugLevelNames, getForkManager, getID, getName, getParent, getPort, getPort, getRoot, getRuntime, getTime, iduplicate, info, isAncestorOf, isComponentNotificationEnabled, isContainer, isDebugEnabled, isDebugEnabledAt, isDirectlyRelatedTo, isDirectOutputEnabled, isEnabled, isErrorNoticeEnabled, isEventExportEnabled, isGarbageDisplayEnabled, isGarbageEnabled, isPortNotificationEnabled, isPortRemovable, isStarted, isStopped, isTraceEnabled, lock, notify, notifyAll, operate, portAdded, portRemoved, reboot, removeAll, removeAllComponents, removeAllPorts, removeAllPorts, removeComponent, removeComponent, removePort, removePort, removePort, reset, resume, run, sduplicate, send, sendAt, setComponentFlag, setComponentFlag, setComponentNotificationEnabled, setContract, setDebugEnabled, setDebugEnabled, setDebugEnabledAt, setDebugEnabledAt, setDebugEnabledAt, setDirectOutputEnabled, setDirectOutputEnabled, setEnabled, setErrorNoticeEnabled, setErrorNoticeEnabled, setEventExportEnabled, setEventExportEnabled, setExecutionBoundary, setGarbageDisplayEnabled, setGarbageDisplayEnabled, setGarbageEnabled, setGarbageEnabled, setID, setID, setName, setPort, setPort, setPortNotificationEnabled, setPortRemovable, setRuntime, setTraceEnabled, setTraceEnabled, sleepFor, sleepUntil, stop, toString, unexpose, unlock, useLocalForkManager, useLocalForkManager, wait, yield
 
Methods inherited from class drcl.DrclObj
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Protocol

public Protocol()

Protocol

public Protocol(java.lang.String id_)
Method Detail

createIDServicePort

public Port createIDServicePort()
Creates and returns a port to use with the IDLookup and/or the {#link IDConfig} contracts in this protocol implementation.


createRTServicePort

public Port createRTServicePort()
Creates and returns a port to use with the RTLookup and/or the RTConfig contracts in this protocol implementation.


createIFQueryPort

public Port createIFQueryPort()
Creates and returns a port to use with the IFQuery contract in this protocol implementation.


createConfigSwitchPort

public Port createConfigSwitchPort()
Creates and returns a port to use with the ConfigSwitch contract in this protocol implementation.


createUcastQueryPort

public Port createUcastQueryPort()
Creates and returns a port to accept the unicast queries from the core service layer in this protocol implementation.

See Also:
routeQueryHandler(RTKey, Port), routeQueryHandler(InetPacket, int, Port)

createMcastQueryPort

public Port createMcastQueryPort()
Creates and returns a port to accept the multicast queries from the core service layer in this protocol implementation.

See Also:
routeQueryHandler(RTKey, Port), routeQueryHandler(InetPacket, int, Port)

createPktArrivalEventPort

public Port createPktArrivalEventPort()
Creates and returns a port to accept the packet arrival events from the core service layer in this protocol implementation.

See Also:
pktArrivalHandler(EventContract.Message, Port)

createIDChangedEventPort

public Port createIDChangedEventPort()
Creates and returns a port to accept the identity changed events from the core service layer in this protocol implementation.

See Also:
idAddedEventHandler(Object, Port), idRemovedEventHandler(Object, Port)

createUnicastRTChangedEventPort

public Port createUnicastRTChangedEventPort()
Creates and returns a port to accept the unicast routing entry changed events from the core service layer in this protocol implementation.

See Also:
rtAddedEventHandler(Object, Port), rtRemovedEventHandler(Object, Port), rtModifiedEventHandler(Object, Port)

createMulticastRTChangedEventPort

public Port createMulticastRTChangedEventPort()
Creates and returns a port to accept the multicast routing entry changed events from the core service layer in this protocol implementation.

See Also:
rtAddedEventHandler(Object, Port), rtRemovedEventHandler(Object, Port), rtModifiedEventHandler(Object, Port)

createIFEventPort

public Port createIFEventPort()
Creates and returns a port to accept the interface/neighbor events from the core service layer in this protocol implementation.

See Also:
neighborUpEventHandler(int, NetAddress, Port), neighborDownEventHandler(int, NetAddress, Port)

createVIFEventPort

public Port createVIFEventPort()
Creates and returns a port to accept the virtual interface/neighbor events from the core service layer in this protocol implementation.

See Also:
vNeighborUpEventHandler(int, NetAddress, Port), vNeighborDownEventHandler(int, NetAddress, Port)

createMcastHostEventPort

public Port createMcastHostEventPort()
Creates and returns a port to accept the multicast host join/leave events in this protocol implementation.

See Also:
mcastHostJoinEventHandler(long, long, long, int, Port), mcastHostLeaveEventHandler(long, long, long, int, Port)

routeQueryHandler

protected int[] routeQueryHandler(RTKey request_,
                                  Port inPort_)
Called back when a unicast/multicast query event is received.

See Also:
RTLookup, createUcastQueryPort(), createMcastQueryPort()

routeQueryHandler

protected int[] routeQueryHandler(InetPacket p,
                                  int incomingIf_,
                                  Port inPort_)
Called back when a unicast/multicast query event is received.

See Also:
RTLookup, createUcastQueryPort(), createMcastQueryPort()

LinkBrokenEventHandler

public void LinkBrokenEventHandler(InetPacket p,
                                   Port inPort_)
Called back when a link broken event is received.

See Also:
createLinkBrokenEventPort()

createLinkBrokenEventPort

public Port createLinkBrokenEventPort()
Creates and returns a port to accept the link broken events from CSL.


pktArrivalHandler

protected void pktArrivalHandler(EventContract.Message event_,
                                 Port inPort_)
Called back when a packet arrival event is received.

See Also:
createPktArrivalEventPort()

idAddedEventHandler

protected void idAddedEventHandler(java.lang.Object data_,
                                   Port inPort_)
Called back when an identity added event is received.

See Also:
createIDChangedEventPort()

idRemovedEventHandler

protected void idRemovedEventHandler(java.lang.Object data_,
                                     Port inPort_)
Called back when an identity removed event is received.

See Also:
createIDChangedEventPort()

rtAddedEventHandler

protected void rtAddedEventHandler(java.lang.Object data_,
                                   Port inPort_)
Called back when a routing entry added event is received.

See Also:
createUnicastRTChangedEventPort(), createMulticastRTChangedEventPort()

rtRemovedEventHandler

protected void rtRemovedEventHandler(java.lang.Object data_,
                                     Port inPort_)
Called back when a routing entry removed event is received.

See Also:
createUnicastRTChangedEventPort(), createMulticastRTChangedEventPort()

rtModifiedEventHandler

protected void rtModifiedEventHandler(java.lang.Object data_,
                                      Port inPort_)
Called back when a routing entry modified event is received.

See Also:
createUnicastRTChangedEventPort(), createMulticastRTChangedEventPort()

neighborUpEventHandler

protected void neighborUpEventHandler(int ifindex_,
                                      NetAddress neighbor_,
                                      Port inPort_)
Called back when a neighbor up event is received.

Parameters:
ifindex_ - index of the interface.
See Also:
createIFEventPort()

neighborDownEventHandler

protected void neighborDownEventHandler(int ifindex_,
                                        NetAddress neighbor_,
                                        Port inPort_)
Called back when a neighbor down event is received.

Parameters:
ifindex_ - index of the interface.
See Also:
createIFEventPort()

vNeighborUpEventHandler

protected void vNeighborUpEventHandler(int ifindex_,
                                       NetAddress neighbor_,
                                       Port inPort_)
Called back when a (virtual) neighbor up event is received.

Parameters:
ifindex_ - index of the virtual interface.
See Also:
createVIFEventPort()

vNeighborDownEventHandler

protected void vNeighborDownEventHandler(int ifindex_,
                                         NetAddress neighbor_,
                                         Port inPort_)
Called back when a (virtual) neighbor down event is received.

Parameters:
ifindex_ - index of the interface.
See Also:
createVIFEventPort()

mcastHostJoinEventHandler

protected void mcastHostJoinEventHandler(long src_,
                                         long srcmask_,
                                         long group_,
                                         int ifindex_,
                                         Port inPort_)
Called back when a multicast host join event is received.

Parameters:
group_ - the multicast group the host network joins.
ifindex_ - index of the interface where the host network is connected. Could be -1 if it is a local join (multihomed router).
See Also:
createMcastHostEventPort()

mcastHostLeaveEventHandler

protected void mcastHostLeaveEventHandler(long src_,
                                          long srcmask_,
                                          long group_,
                                          int ifindex_,
                                          Port inPort_)
Called back when a multicast host leave event is received.

Parameters:
group_ - the multicast group the host network leaves.
ifindex_ - index of the interface where the host network is connected. Could be -1 if it is a local leave (multihomed router).
See Also:
createMcastHostEventPort()

processOther

protected void processOther(java.lang.Object data_,
                            Port inPort_)
Description copied from class: Module
The handler invoked when a packet arrived at a port other than the "up", "down" and timer ports.

Overrides:
processOther in class Module

duplicate

public void duplicate(java.lang.Object source_)
Description copied from class: Component
Duplicates the content of source_, including ID, name, child components and connections among them, to this component. Subclasses need to override this method to copy its own variables.

Specified by:
duplicate in interface ObjectDuplicable
Overrides:
duplicate in class Module

broadcast

public void broadcast(Packet p_,
                      long src_,
                      long dest_,
                      boolean routerAlert_,
                      int TTL_,
                      long ToS_)
Broadcast the packet.


broadcast

public void broadcast(java.lang.Object body_,
                      int bodySize_,
                      long src_,
                      long dest_,
                      boolean routerAlert_,
                      int TTL_,
                      long ToS_)
Broadcast a raw packet body.


broadcast

public void broadcast(Packet p_,
                      long src_,
                      long dest_,
                      boolean routerAlert_,
                      int TTL_,
                      long ToS_,
                      int excludeIf_)
Broadcast excluding the specified link. Useful as incoming link is usually excluded.


broadcast

public void broadcast(java.lang.Object body_,
                      int bodySize_,
                      long src_,
                      long dest_,
                      boolean routerAlert_,
                      int TTL_,
                      long ToS_,
                      int excludeIf_)
Broadcast excluding the specified link. Useful as incoming link is usually excluded.


broadcast

public void broadcast(Packet p_,
                      long src_,
                      long dest_,
                      boolean routerAlert_,
                      int TTL_,
                      long ToS_,
                      int[] excludeIfs_)
Broadcast excluding the specified links.


broadcast

public void broadcast(java.lang.Object p_,
                      int bodysize_,
                      long src_,
                      long dest_,
                      boolean routerAlert_,
                      int TTL_,
                      long ToS_,
                      int[] excludeIfs_)
Broadcast excluding the specified links.


forward

public void forward(Packet p_,
                    long src_,
                    long dest_,
                    boolean routerAlert_,
                    int TTL_,
                    long ToS_,
                    int if_)
Forward packet via specified link.


forward

public void forward(java.lang.Object p_,
                    int bodysize_,
                    long src_,
                    long dest_,
                    boolean routerAlert_,
                    int TTL_,
                    long ToS_,
                    int if_)
Forward packet via specified link.


forward

public void forward(Packet p_,
                    long src_,
                    long dest_,
                    boolean routerAlert_,
                    int TTL_,
                    long ToS_,
                    int[] ifs_)
This method presents the most general case where the packet is forwarded on arbitrarily specified interfaces.


forward

public void forward(java.lang.Object p_,
                    int bodysize_,
                    long src_,
                    long dest_,
                    boolean routerAlert_,
                    int TTL_,
                    long ToS_,
                    int[] ifs_)
This method presents the most general case where the packet is forwarded on arbitrarily specified interfaces.


forward

public void forward(Packet p_,
                    long src_,
                    long dest_,
                    boolean routerAlert_,
                    int TTL_,
                    long ToS_)
Route lookup forwarding.


forward

public void forward(java.lang.Object p_,
                    int bodysize_,
                    long src_,
                    long dest_,
                    boolean routerAlert_,
                    int TTL_,
                    long ToS_)
Route lookup forwarding.


J-Sim v1.2.1-p7 API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~