public interface PacketHandler extends Comparable<PacketHandler>
| Modifier and Type | Method and Description |
|---|---|
boolean |
canHandle(byte[] packet)
Checks whether the handler can process the incoming packet or not.
|
boolean |
canHandle(byte[] packet,
int dataLength,
int offset) |
int |
getPipelinePriority()
Gets the priority of the handler in the pipeline.
The priority affects the place of the handler in the pipeline. |
byte[] |
handle(byte[] packet,
InetSocketAddress localPeer,
InetSocketAddress remotePeer)
Processes the packet and provides a suitable answer.
|
byte[] |
handle(byte[] packet,
int dataLength,
int offset,
InetSocketAddress localPeer,
InetSocketAddress remotePeer)
Processes the packet and provides a suitable answer.
|
compareToboolean canHandle(byte[] packet)
packet - The packet to be processed.true, if the packet can be handled.
false, otherwise.boolean canHandle(byte[] packet,
int dataLength,
int offset)
byte[] handle(byte[] packet,
InetSocketAddress localPeer,
InetSocketAddress remotePeer)
throws PacketHandlerException
packet - The packet to be processed.localPeer - The local peer who received the packetremotePeer - The remote peer who sent the packetPacketHandlerException - When the handler cannot process the packet.byte[] handle(byte[] packet,
int dataLength,
int offset,
InetSocketAddress localPeer,
InetSocketAddress remotePeer)
throws PacketHandlerException
packet - The packet to be processed.dataLength - The length of the data to be read.offset - The initial position to start reading data from.localPeer - The local peer who received the packetremotePeer - The remote peer who sent the packetPacketHandlerException - When the handler cannot process the packet.int getPipelinePriority()
Copyright © 2017 TeleStax, Inc.. All Rights Reserved.