monrovia.protocol.server
Interface ProtocolHandler

All Known Implementing Classes:
ProtocolHandlerImpl

public interface ProtocolHandler


Method Summary
 int addClient(java.lang.String pClientName, java.lang.String pClientPassword, java.lang.String pClientAddress, int pClientPort, ServerTcpSender pTcpSender, ServerUdpSender pUdpSender)
          addClient adds pClientName with pClientAddress and pClientPort as well as this clients udpsender and tcp sender to active clients returning an unique pClientID if pClientPassword is correct, if not returns 0, returns 0 also when client is already logged in
 void command(int pClientID, int pCommandID)
          command: pClientID wishes to execute pCommandID
 void command(int pClientID, int pCommandID, int pArg1)
          command: pClientID wishes to execute pCommandID with argumet pArg1
 void command(int pClientID, int pCommandID, int pArg1, int pArg2)
          command: pClientID wishes to execute pCommandID with argument pArg1 and pArg2
 void command(int pClientID, int pCommandID, java.lang.String pArg1)
          command: pClientID wishes to execute pCommandID with argument pArg1 (string)
 byte[][] getBitmaps(int pClientID)
          getBitmaps returns an array of byte[], each of which is a bitmap
 int getClientID(java.lang.String pClientAddress, int pClientPort)
          getClientID returns the clientID identified by pClientAddress and pClientPort.
 Command[] getCommands(int pClientID)
          getCommands returns an array of strings, each of which is the commands text
 int[][] getMap(int pClientID)
          getMap returns the Map of pClientID
 Stat[] getStats(int pClientID)
          getStats return the Stats of pClientID
 int getTurn(int pClientID)
          getTurn returns the ClientID:s turn
 void removeClient(int pClientID)
          removeClient remove pClientID from active clients
 void setTurn(int pClientID, int pTurn)
          setTurn sets ClientID:s turn
 

Method Detail

getMap

public int[][] getMap(int pClientID)
getMap returns the Map of pClientID
Parameters:
pClientID - the id of the client
Returns:
the map where the client is now

getCommands

public Command[] getCommands(int pClientID)
getCommands returns an array of strings, each of which is the commands text
Parameters:
pClientID - the id of the client
Returns:
the clients commands

getBitmaps

public byte[][] getBitmaps(int pClientID)
getBitmaps returns an array of byte[], each of which is a bitmap
Parameters:
pClientID - the id of the client
Returns:
the bitmaps array

getStats

public Stat[] getStats(int pClientID)
getStats return the Stats of pClientID
Parameters:
pClientID - the id of the client
Returns:
the stats of the client

addClient

public int addClient(java.lang.String pClientName,
                     java.lang.String pClientPassword,
                     java.lang.String pClientAddress,
                     int pClientPort,
                     ServerTcpSender pTcpSender,
                     ServerUdpSender pUdpSender)
addClient adds pClientName with pClientAddress and pClientPort as well as this clients udpsender and tcp sender to active clients returning an unique pClientID if pClientPassword is correct, if not returns 0, returns 0 also when client is already logged in
Parameters:
pClientName - the user name of the client
pClientPassword - the clients password
pClientAddress - the ip address of the client
pClientPort - the port of the client
pTcpSender - the tcpsender for this client
pUdpSender - the udpsender for this client
Returns:
the unique client identifier

removeClient

public void removeClient(int pClientID)
removeClient remove pClientID from active clients
Parameters:
pClientID - the clients id

getClientID

public int getClientID(java.lang.String pClientAddress,
                       int pClientPort)
getClientID returns the clientID identified by pClientAddress and pClientPort. Must return 0 if such a client does not exist.
Parameters:
pClientAddress - the ip address of the client
the - port of the client
Returns:
the clients already allocated unique id

getTurn

public int getTurn(int pClientID)
getTurn returns the ClientID:s turn
Parameters:
pClientID - the id of the client
Returns:
the turn of this client

setTurn

public void setTurn(int pClientID,
                    int pTurn)
setTurn sets ClientID:s turn
Parameters:
pClientID - the clients id
pTurn - the turn to be set

command

public void command(int pClientID,
                    int pCommandID)
command: pClientID wishes to execute pCommandID
Parameters:
pClientID - the clients id
pCommandID - the id of the command

command

public void command(int pClientID,
                    int pCommandID,
                    int pArg1)
command: pClientID wishes to execute pCommandID with argumet pArg1
Parameters:
pClientID - the clients id
pCommandID - the id of the command
pArg1 - the value of the argument

command

public void command(int pClientID,
                    int pCommandID,
                    int pArg1,
                    int pArg2)
command: pClientID wishes to execute pCommandID with argument pArg1 and pArg2
Parameters:
pClientID - the clients id
pCommandID - the id of the command
pArg1 - the value of the first argument
pArg2 - the value of the second argument

command

public void command(int pClientID,
                    int pCommandID,
                    java.lang.String pArg1)
command: pClientID wishes to execute pCommandID with argument pArg1 (string)
Parameters:
pClientID - the clients id
pCommandID - the id of the command
pArg1 - the value of the argument