edu.rit.m2mp
Class ControllableChannel

java.lang.Object
  extended by edu.rit.m2mp.Channel
      extended by edu.rit.m2mp.ControllableChannel

public class ControllableChannel
extends Channel

Class ControllableChannel provides a user-controllable channel in the Many-to-Many Protocol (M2MP). The M2MP Layer uses a channel to send messages to and receive messages from the external network. The edu.rit.m2mp.channel.class property in the M2MP properties file specifies the type of channel the M2MP Layer uses to communicate with the external network. If the edu.rit.m2mp.debug.controlpanel property is set to 1, the M2MP Layer interposes a ControllableChannel between itself and the external channel. (See class M2MPProperties for further information about the M2MP properties file.)

The ControllableChannel, if present, displays this UI:

The "Network" setting specifies whether the M2MP Layer is connected to the external network. If the "Connected" button is selected, the ControllableChannel passes all incoming and outgoing packets straight through; the M2MP Layer is connected to the external network. If the "Disconnected" button is selected, the ControllableChannel drops all incoming and outgoing packets; the M2MP Layer is disconnected from the external network. This can be used to simulate a network failure or network partition.


Field Summary
 
Fields inherited from class edu.rit.m2mp.Channel
myPacketPool
 
Constructor Summary
ControllableChannel(PacketPool thePacketPool, Channel theChannel)
          Construct a new controllable channel.
 
Method Summary
 Packet receivePacket()
          Receive an M2MP packet via this channel.
 void transmitPacket(Packet thePacket)
          Send the given M2MP packet via this channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControllableChannel

public ControllableChannel(PacketPool thePacketPool,
                           Channel theChannel)
Construct a new controllable channel. To receive incoming packets, the controllable channel may obtain Packet objects from the given PacketPool. The controllable channels will pass packets through to and from the given channel.

Parameters:
thePacketPool - Packet pool.
theChannel - Underlying channel.
Throws:
NullPointerException - (unchecked exception) Thrown if thePacketPool is null or theChannel is null.
Method Detail

receivePacket

public Packet receivePacket()
                     throws IOException
Receive an M2MP packet via this channel.

Specified by:
receivePacket in class Channel
Returns:
M2MP packet that was received.
Throws:
IOException - Thrown if an I/O error occurred.

transmitPacket

public void transmitPacket(Packet thePacket)
                    throws IOException
Send the given M2MP packet via this channel.

Specified by:
transmitPacket in class Channel
Parameters:
thePacket - M2MP packet to be sent.
Throws:
IOException - Thrown if an I/O error occurred.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.