|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.m2mp.Channel
public abstract class Channel
Class Channel is the abstract superclass for a channel in the Many-to-Many Protocol (M2MP). The channel is an abstraction of the external network underneath the M2MP Layer. The M2MP Layer uses a channel to send messages to and receive messages from the external network.
Several M2MP channel implementations are provided, including:
UDPMulticastChannel
-- A broadcast channel that sends messages
to and receives messages from all hosts in a multicast group at a given IP
multicast address and port.
UDPUnicastChannel
-- A point-to-point channel that sends
messages to and receives messages from one other host at a given IP unicast
address and port.
NullChannel
-- A channel that does not
send or receive messages; used if the M2MP Layer should not use an external
network.
The M2MP properties file specifies which channel implementation the M2MP
Layer will use. Parameters needed to configure the specified channel
implementation also appear in the M2MP properties file. See class M2MPProperties
for further information.
You can write your own custom M2MP channel implementation to use some other kind of external network. You can even write an M2MP channel implementation that sends messages to and receives messages from another channel. Thus, you can set up a "channel pipeline" by configuring the M2MP Layer to use a channel instance which in turn is configured to use another channel instance, and so on until you reach the final channel instance which hooks up to the external network. Outgoing M2MP messages will traverse the channel pipeline in forward order, and incoming M2MP messages will traverse the channel pipeline in reverse order. This capability can be used, for example, to insert debug logging or other debug controls into the incoming and outgoing M2MP message streams.
Requirements:
M2MPProperties
for further information.
Field Summary | |
---|---|
protected PacketPool |
myPacketPool
This channel's packet pool. |
Constructor Summary | |
---|---|
Channel(PacketPool thePacketPool)
Construct a new channel. |
Method Summary | |
---|---|
abstract Packet |
receivePacket()
Receive an M2MP packet via this channel. |
abstract 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 |
Field Detail |
---|
protected PacketPool myPacketPool
Constructor Detail |
---|
public Channel(PacketPool thePacketPool)
Packet
objects from
the given
PacketPool
.
The channel constructor must get any necessary parameter values from the
M2MP properties file. See class M2MPProperties
for further information.
thePacketPool
- Packet pool.
NullPointerException
- (unchecked exception) Thrown if thePacketPool is null.Method Detail |
---|
public abstract Packet receivePacket() throws IOException
Packet
object's byte buffer with
the contents of the received packet, including the header and data.
Note: The receivePacket() method must "loop back" any packet that was sent via the transmitPacket() method on this channel. However, the looped-back packet returned by receivePacket() must be a copy of, not a reference to, the outgoing packet.
IOException
- Thrown if an I/O error occurred.public abstract void transmitPacket(Packet thePacket) throws IOException
thePacket
- M2MP packet to be sent.
IOException
- Thrown if an I/O error occurred.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |