edu.rit.m2mp
Class MessageRouter

java.lang.Object
  extended by edu.rit.m2mp.MessageRouter

public class MessageRouter
extends Object

Class MessageRouter provides an object that decides whether to accept each incoming M2MP message.

Note: Class MessageRouter is multiple thread safe.


Constructor Summary
MessageRouter(int debugMessageFilters)
          Construct a new message router.
 
Method Summary
 boolean acceptMessage(Packet thePacket)
          Determine whether to accept an incoming M2MP message.
 void addMessageFilter(byte[] thePrefix)
          Add a message filter to this message router.
 void removeMessageFilter(byte[] thePrefix)
          Remove a message filter from this message router.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageRouter

public MessageRouter(int debugMessageFilters)
Construct a new message router.

Parameters:
debugMessageFilters - Message filter debug level.
Method Detail

addMessageFilter

public void addMessageFilter(byte[] thePrefix)
Add a message filter to this message router.

Parameters:
thePrefix - Message prefix.

removeMessageFilter

public void removeMessageFilter(byte[] thePrefix)
Remove a message filter from this message router.

Parameters:
thePrefix - Message prefix.

acceptMessage

public boolean acceptMessage(Packet thePacket)
Determine whether to accept an incoming M2MP message. thePacket is the first packet of the M2MP message. This method returns true if the incoming M2MP message should be accepted; namely, if there is a registered message filter whose message prefix matches the initial bytes of the M2MP message. As a side effect, thePacket's position is altered.

Parameters:
thePacket - First packet of an M2MP message.
Returns:
True if the incoming M2MP message should be accepted, false otherwise.


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