net.kano.joscar.snac
Class ServerSnacProcessor

java.lang.Object
  extended byAbstractSnacProcessor
      extended byServerSnacProcessor

public class ServerSnacProcessor
extends AbstractSnacProcessor

A server-side SNAC processor. This class automatically assigns SNAC request ID's between 0x80000000 and 0xffffffff, the required range for server request ID's. No request-response system is supported (as in ClientSnacProcessor) because this functionality is not used by the server. Additionally, no SNAC queue is implemented, as its intended use, rate limiting, only affects the client side.


Field Summary
static long REQID_MAX
          The maximum request ID value.
static long REQID_MIN
          The minimum request ID value.
 
Fields inherited from class AbstractSnacProcessor
ERRTYPE_SNAC_PACKET_LISTENER, ERRTYPE_SNAC_PACKET_PREPROCESSOR
 
Constructor Summary
ServerSnacProcessor(FlapProcessor flapProcessor)
          Creates a new server-side SNAC processor attached to the given FLAP processor.
 
Method Summary
 void sendResponse(long reqid, SnacCommand cmd)
          Sends the given SNAC command as a response to the client request with the given request ID.
 void sendSnac(SnacCommand cmd)
          Sends the given SNAC command over this SNAC connection.
 
Methods inherited from class AbstractSnacProcessor
addPacketListener, addPreprocessor, addVetoablePacketListener, continueHandling, detach, getCmdFactoryMgr, getFlapProcessor, isAttached, migrate, removePacketListener, removePreprocessor, removeVetoablePacketListener, sendSnac
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQID_MIN

public static final long REQID_MIN
The minimum request ID value.

See Also:
Constant Field Values

REQID_MAX

public static final long REQID_MAX
The maximum request ID value.

See Also:
Constant Field Values
Constructor Detail

ServerSnacProcessor

public ServerSnacProcessor(FlapProcessor flapProcessor)
Creates a new server-side SNAC processor attached to the given FLAP processor.

Parameters:
flapProcessor - a FLAP processor
Method Detail

sendSnac

public final void sendSnac(SnacCommand cmd)
Sends the given SNAC command over this SNAC connection.

Parameters:
cmd - the SNAC command to send

sendResponse

public final void sendResponse(long reqid,
                               SnacCommand cmd)
Sends the given SNAC command as a response to the client request with the given request ID. Note that the given request ID must not be in the server request ID range (REQID_MIN through REQID_MAX).

Parameters:
reqid - the request ID of the client request to which the given command is a response
cmd - the SNAC command to send