com.planet_ink.coffee_mud.core.intermud.i3.packets
Interface ImudServices

All Known Implementing Classes:
IMudInterface

public interface ImudServices

This interface prescribes methods that need to be implemented by a class in the mudlib. These methods do mudlib specific handling of intermud packets as well as provide the Imaginary Intermud 3 System with mudlib specific information.


Method Summary
 boolean addChannel(ChannelsLibrary.CMChannel chan)
          Add a new channel
 boolean delChannel(java.lang.String remoteChannelName)
          Remove a channel
 java.util.Enumeration<java.lang.String> getChannels()
           
 long getLastPacketReceivedTime()
           
 java.lang.String getLocalChannel(java.lang.String cmd)
          Given a I3 channel name, this method should provide the local name for that channel.
 java.lang.String getMudName()
           
 int getMudPort()
           
 java.lang.String getMudState()
           
 java.lang.String getMudVersion()
           
 java.lang.String getRemoteChannel(java.lang.String cmd)
          Given a local channel name, returns the remote channel name.
 java.lang.String getRemoteMask(java.lang.String cmd)
          Returns the mask of a remote channel
 void receive(Packet packet)
          Handles an incoming I3 packet asynchronously.
 void resetLastPacketReceivedTime()
          reset the last packet received time
 

Method Detail

receive

void receive(Packet packet)
Handles an incoming I3 packet asynchronously. An implementation should make sure that asynchronously processing the incoming packet will not have any impact, otherwise you could end up with bizarre behaviour like an intermud chat line appearing in the middle of a room description. If your mudlib is not prepared to handle multiple threads, just stack up incoming packets and pull them off the stack during your main thread of execution.

Parameters:
packet - the incoming packet

getChannels

java.util.Enumeration<java.lang.String> getChannels()
Returns:
an enumeration of channels this mud subscribes to

getLocalChannel

java.lang.String getLocalChannel(java.lang.String cmd)
Given a I3 channel name, this method should provide the local name for that channel. Example: if( cmd.equals("imud_code") ) return "intercre";

Parameters:
cmd - the remote name of the desired channel
Returns:
the local channel name for a remote channel
See Also:
getRemoteChannel(java.lang.String)

getMudVersion

java.lang.String getMudVersion()
Returns:
the software name and version

getMudName

java.lang.String getMudName()
Returns:
the name of this mud

getRemoteMask

java.lang.String getRemoteMask(java.lang.String cmd)
Returns the mask of a remote channel

Parameters:
cmd - the remote channel
Returns:
the mask;

addChannel

boolean addChannel(ChannelsLibrary.CMChannel chan)
Add a new channel

Parameters:
chan - the channel to add
Returns:
true if no conflicts

delChannel

boolean delChannel(java.lang.String remoteChannelName)
Remove a channel

Parameters:
remoteChannelName - the i3 channel to remove
Returns:
true if remove worked

getMudState

java.lang.String getMudState()
Returns:
the status of this mud

getMudPort

int getMudPort()
Returns:
the player port for this mud

getLastPacketReceivedTime

long getLastPacketReceivedTime()
Returns:
the last packet received time

resetLastPacketReceivedTime

void resetLastPacketReceivedTime()
reset the last packet received time


getRemoteChannel

java.lang.String getRemoteChannel(java.lang.String cmd)
Given a local channel name, returns the remote channel name. Example: if( cmd.equals("intercre") ) return "imud_code";

Parameters:
cmd - the local name of the desired channel
Returns:
the remote name of the specified local channel