|
jSyncManager | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--org.jSyncManager.API.Protocol.PADP
The Packet Assembly/Disassembly Protocol Handler class. This class provides the black-box for handling PADP packets.
| Field Summary | |
|---|---|
static long |
ACK_TIMEOUT
The default packet acknowledgement timeout. |
static long |
IP_TIMEOUT
The default inter-packet timeout. |
static int |
STATE_CONNECTED
The connected state value. |
static int |
STATE_DISCONNECTED
The disconnected state value. |
static int |
STATE_SUSPENDED
The suspended state value. |
| Fields inherited from class java.lang.Thread |
|---|
inheritableThreadLocals, MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY, threadLocals |
| Constructor Summary | |
|---|---|
PADP(SLP slp)
Creates a new instance of the PADP handler. |
|
| Method Summary | |
|---|---|
(package private) static void |
|
void |
connect()
Connects to the underlying protocol stack to start a communication session, if we're not already connected. |
void |
disconnect()
Disconnect from the remote end, putting us into suspended mode. |
void |
enableDebugMode()
Enable packet debug mode. |
protected void |
handleAbort(PADP_Packet pkt)
Handle an abort packet received from the remote end. |
protected void |
handleACK(PADP_Packet pkt)
Handle an ACKnowledgement packet received from the remote end. |
protected void |
handleData(PADP_Packet pkt)
Handle a data packet received from the remote end. |
protected void |
handleNACK(PADP_Packet pkt)
Handle a Negative ACKnowledgement packet received from the remote end. |
protected void |
handleTickle(PADP_Packet pkt)
Handle a tickle packet received from the remote end. |
protected int |
incReadyQueueEnd()
Increment the end pointer for the ready queue. |
protected int |
incReadyQueueStart()
Increment the start pointer for the ready queue. |
protected byte |
incTransID()
Increments the transaction ID. |
boolean |
isConnected()
Checks to see if this protocol is currently connected. |
protected PADP_Packet |
parsePADPacket(GenericPacket data)
Converts an incoming GenericData packet into a PAD_Packet instance. |
protected void |
processPacket(PADP_Packet pkt)
Processes an incoming packet. |
GenericPacket |
readPacket()
Reads a packet from the ready queue. |
void |
run()
Runs the input queue thread. |
protected void |
selfDisconnect()
An internal method for handling disconnects that are caused by inter-packet timeouts or by a retry overrun. |
protected void |
sendAck(PADP_Packet pkt)
Send an ACKnowledgement packet for a received packet. |
protected void |
sendPacket(PADP_Packet pkt)
Sends a packet to the underlying SLP protocol handler. |
protected void |
sendTickle()
Sends a tickle packet. |
void |
setDebugOutputStream(java.io.PrintStream stream)
Sets the print stream that debug packet data should be sent to, if enabled. |
void |
startTickles()
Start the tickle packet sending process. |
void |
stopTickles()
Stop the tickle packet sending process. |
void |
suspendConnection()
Suspend the connection. |
void |
timerExpired(PacketTimer packettimer)
A timer expirey handler. |
void |
transmitPacket(byte[] data,
byte hostSocket,
byte serverSocket)
Transmit a packet to the underlying SLP protocol layer. |
protected void |
transmitPacket(byte[] data,
byte hostSocket,
byte serverSocket,
boolean flag)
Transmit a packet to the underlying SLP protocol layer. |
void |
transmitPacket(GenericPacket pkt)
Transmit a packet to the underlying SLP protocol layer. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static long ACK_TIMEOUT
public static long IP_TIMEOUT
public static final int STATE_DISCONNECTED
public static final int STATE_SUSPENDED
public static final int STATE_CONNECTED
| Constructor Detail |
public PADP(SLP slp)
slp - the underlying SLP packet handler.| Method Detail |
static void()
public void connect()
connect in interface CMPDLPTransferInterfacepublic void disconnect()
disconnect in interface CMPDLPTransferInterfacepublic void enableDebugMode()
protected void handleAbort(PADP_Packet pkt)
pkt - the packet that was received.protected void handleACK(PADP_Packet pkt)
pkt - the packet that was received.protected void handleData(PADP_Packet pkt)
pkt - the packet that was received.protected void handleNACK(PADP_Packet pkt)
pkt - the packet that was received.protected void handleTickle(PADP_Packet pkt)
pkt - the packet that was received.
protected int incReadyQueueEnd()
throws PADP_QueueOverrunException
PADP_QueueOverrunException - if the ready queue is overrun.
protected int incReadyQueueStart()
throws PADP_QueueOverrunException
PADP_QueueOverrunException - if the ready queue is underrun.protected byte incTransID()
public boolean isConnected()
protected PADP_Packet parsePADPacket(GenericPacket data)
data - the incoming GenericPacket.protected void processPacket(PADP_Packet pkt)
pkt - the incoming packet to be processed.
public GenericPacket readPacket()
throws NotConnectedException
readPacket in interface CMPDLPTransferInterfaceNotConnectedException - thrown if we're not connected, or the connection is lost.public void run()
run in class java.lang.Threadprotected void selfDisconnect()
protected void sendAck(PADP_Packet pkt)
pkt - the packet that we wish to acknowledge.
protected void sendPacket(PADP_Packet pkt)
throws NotConnectedException
pkt - the packet object to send.NotConnectedException - thrown if we're not connected,
or if the connection is lost during processing.protected void sendTickle()
public void setDebugOutputStream(java.io.PrintStream stream)
stream - the PrintStream object to use for debug data output.public void startTickles()
public void stopTickles()
public void suspendConnection()
suspendConnection in interface CMPDLPTransferInterfacepublic void timerExpired(PacketTimer packettimer)
timerExpired in interface PacketTimerInterfacepackettimer - the timer object that expired.PacketTimerInterface.timerExpired(org.jSyncManager.API.Protocol.PacketTimer)
public void transmitPacket(GenericPacket pkt)
throws NotConnectedException,
PADP_PacketTooBigException
pkt - the packet of data to be wrapped in a PADP packet (or packets) and transmitted.NotConnectedException - thrown if we're not connected, or the connection is lost.PADP_PacketTooBigException - if the packet being sent exceeds the maximum packet size.
public void transmitPacket(byte[] data,
byte hostSocket,
byte serverSocket)
throws NotConnectedException,
PADP_PacketTooBigException
transmitPacket in interface CMPDLPTransferInterfacedata - the packet of data to be wrapped in a PADP packet (or packets) and transmitted.hostSocket - the host socket the data is being sent from.serverSocket - the server socket to send this data to.NotConnectedException - thrown if we're not connected, or the connection is lost.PADP_PacketTooBigException - if the packet being sent exceeds the maximum packet size.
protected void transmitPacket(byte[] data,
byte hostSocket,
byte serverSocket,
boolean flag)
throws NotConnectedException,
PADP_PacketTooBigException
data - the packet of data to be wrapped in a PADP packet (or packets) and transmitted.hostSocket - the host socket the data is being sent from.serverSocket - the server socket to send this data to.flag - true if this is the first packet, false otherwise.NotConnectedException - thrown if we're not connected, or the connection is lost.PADP_PacketTooBigException - if the packet being sent exceeds the maximum packet size.
|
jSyncManager | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||