jSyncManager

org.jSyncManager.API.Protocol
Class PADP_Packet

java.lang.Object
  |
  +--org.jSyncManager.API.Protocol.PADP_Packet
All Implemented Interfaces:
java.io.Serializable

public class PADP_Packet
extends java.lang.Object
implements java.io.Serializable

PADP_Packet class. This class provides the class representation of a PADP packet.

Version:
$Revision: 1.6 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>
Last modified by: $Author: yaztromo $ on $Date: 2003/05/01 05:48:04 $.
See Also:
Serialized Form

Field Summary
static byte ABORT
          Denotes that this packets type is an Abort Packet.
static byte ACK
          Denotes that this packets type is an Acknowledgement Parket.
 byte[] data
          A field to hold the data encapsulated within this packet.
static byte DATA
          Denotes that this packets type is Data Packet.
 byte destinationSocket
          A field to hold the destination socket for this packet.
static byte FIRST_FRAGMENT
          This flag identifies this packet as the first fragment of a series.
 byte flags
          A field to hold the flags for this packet.
static byte LAST_FRAGMENT
          This flag identifies this packet as being the last fragment in a series.
static byte NACK
          Denotes that this packets type is a Negative Acknowledgement Packet.
static byte OUT_OF_MEMORY
          This flag denotes an error condition on the handheld signifying that it is out of memory.
 char packetSize
          A field to hold the size of this packet.
 byte packetType
          A field to hold the packet type for this packet.
 boolean sent
          A field to denote wether or not this packet has been sent.
 byte sourceSocket
          A field to hold the source socket for this packet.
static byte TICKLE
          Denotes that this packets type is a Tickle Packet.
 byte transactionID
          A field to hold the transaction ID for this packet.
 
Constructor Summary
(package private) PADP_Packet()
          Construct a new, empty PAD Packet instance.
(package private) PADP_Packet(byte type, byte flags, byte[] data, byte destSocket, byte srcSocket, byte transID)
          Construct a new PAD Packet instance with the specified information.
 
Method Summary
(package private) static PADP_Packet bytes2Packet(byte[] pkt)
          Converts a packet byte array into an instance of PADP_Packet.
(package private)  byte[] packet2Bytes()
          Converts this packet object into a byte array suitable for transmission.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA

public static final byte DATA
Denotes that this packets type is Data Packet.

ACK

public static final byte ACK
Denotes that this packets type is an Acknowledgement Parket.

NACK

public static final byte NACK
Denotes that this packets type is a Negative Acknowledgement Packet. Note that since PADP 1.0, this packet type is no longer used or supported. NACKs are inherently problematic. This field is included purely for the sake of completeness.

TICKLE

public static final byte TICKLE
Denotes that this packets type is a Tickle Packet. Tickle packets are used to prevent the connection from timing out. They are, in effect, a "keep alive" packet.

ABORT

public static final byte ABORT
Denotes that this packets type is an Abort Packet. Abort packets are used to terminate the PADP connection.

FIRST_FRAGMENT

public static final byte FIRST_FRAGMENT
This flag identifies this packet as the first fragment of a series. PADP breaks large packets into smaller fragments (of at most 1KB in size). This flag is used to denote that the received packet is the first in a series.

LAST_FRAGMENT

public static final byte LAST_FRAGMENT
This flag identifies this packet as being the last fragment in a series. Note that it is required for a packet that can fit within a single fragment to sport both the first and last fragment flags.
See Also:
FIRST_FRAGMENT

OUT_OF_MEMORY

public static final byte OUT_OF_MEMORY
This flag denotes an error condition on the handheld signifying that it is out of memory. It is forseeable that on a handheld where nearly all of the available memory is used that it won't have sufficient RAM to perform packetizing operations. If this is the case, an out of memory error occurs. Note that this flag isn't intended be set for packets going to the handheld.

packetType

public byte packetType
A field to hold the packet type for this packet.

flags

public byte flags
A field to hold the flags for this packet.

packetSize

public char packetSize
A field to hold the size of this packet.

data

public byte[] data
A field to hold the data encapsulated within this packet.

destinationSocket

public byte destinationSocket
A field to hold the destination socket for this packet. Note that this field isn't actually a part of the packet itself. This data is transmitted as a part of the SLP packet. However, it may be needed at various levels of the protocol stack, and is thus included here as a way of propogating it between protocols.

sourceSocket

public byte sourceSocket
A field to hold the source socket for this packet. Note that this field isn't actually a part of the packet itself. This data is transmitted as a part of the SLP packet. However, it may be needed at various levels of the protocol stack, and is thus included here as a way of propogating it between protocols.

transactionID

public byte transactionID
A field to hold the transaction ID for this packet. Note that this field isn't actually a part of the packet itself. This data is transmitted as a part of the SLP packet. However, it may be needed at various levels of the protocol stack, and is thus included here as a way of propogating it between protocols.

sent

public boolean sent
A field to denote wether or not this packet has been sent. This field is set to true if this packet has been transmitted, false otherwise.
Constructor Detail

PADP_Packet

PADP_Packet()
Construct a new, empty PAD Packet instance.

PADP_Packet

PADP_Packet(byte type,
            byte flags,
            byte[] data,
            byte destSocket,
            byte srcSocket,
            byte transID)
Construct a new PAD Packet instance with the specified information.
Parameters:
type - of type for this packet.
flags - the flags associated with this packet.
data - the data to be encapsulated within this packet.
destSocket - the destination socket for this packet.
srcSocket - the source socket for this packet.
transID - the Transaction ID for this packet.
Method Detail

bytes2Packet

static PADP_Packet bytes2Packet(byte[] pkt)
Converts a packet byte array into an instance of PADP_Packet.
Parameters:
pkt - a byte array containing a valid PAD packet.
Returns:
an instance of PADP_Packet repsesenting this packet.

packet2Bytes

byte[] packet2Bytes()
Converts this packet object into a byte array suitable for transmission.
Returns:
a byte array suitable for transmission.

jSyncManager

Copyright (c) 1999 - 2003 Brad BARCLAY and others. All Rights Reserved.