Package org.yamcs.cfdp.pdu
Class CfdpPacket
- java.lang.Object
-
- org.yamcs.cfdp.pdu.CfdpPacket
-
- Direct Known Subclasses:
AckPacket,EofPacket,FileDataPacket,FinishedPacket,KeepAlivePacket,MetadataPacket,NakPacket,PromptPacket
public abstract class CfdpPacket extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected ByteBufferbufferstatic TupleDefinitionCFDPprotected CfdpHeaderheader
-
Constructor Summary
Constructors Modifier Constructor Description protectedCfdpPacket()protectedCfdpPacket(ByteBuffer buffer, CfdpHeader header)protectedCfdpPacket(CfdpHeader header)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static CfdpPacketfromTuple(Tuple tuple)static CfdpPacketgetCFDPPacket(ByteBuffer bb)Reads a CFDP PDU from the ByteBuffer which has to have the position set to 0.abstract intgetDataFieldLength()CfdpHeadergetHeader()CfdpTransactionIdgetTransactionId()byte[]toByteArray()TupletoTuple(CfdpTransactionId id, long startTime)TupletoTuple(OngoingCfdpTransfer trans)protected abstract voidwriteCFDPPacket(ByteBuffer buffer)voidwriteToBuffer(ByteBuffer buffer)
-
-
-
Field Detail
-
buffer
protected ByteBuffer buffer
-
header
protected CfdpHeader header
-
CFDP
public static final TupleDefinition CFDP
-
-
Constructor Detail
-
CfdpPacket
protected CfdpPacket()
-
CfdpPacket
protected CfdpPacket(CfdpHeader header)
-
CfdpPacket
protected CfdpPacket(ByteBuffer buffer, CfdpHeader header)
-
-
Method Detail
-
getHeader
public CfdpHeader getHeader()
-
getDataFieldLength
public abstract int getDataFieldLength()
-
getCFDPPacket
public static CfdpPacket getCFDPPacket(ByteBuffer bb) throws PduDecodingException
Reads a CFDP PDU from the ByteBuffer which has to have the position set to 0.The buffer can contain more data than one PDU, at the end of the call the position will be set to the end of the PDU.
In case of error (e.g. cannot decode header) a PduDecodingException is thrown and the position is undetermined.
- Throws:
PduDecodingException
-
toByteArray
public byte[] toByteArray()
-
writeToBuffer
public void writeToBuffer(ByteBuffer buffer)
-
toTuple
public Tuple toTuple(OngoingCfdpTransfer trans)
-
toTuple
public Tuple toTuple(CfdpTransactionId id, long startTime)
-
fromTuple
public static CfdpPacket fromTuple(Tuple tuple)
-
getTransactionId
public CfdpTransactionId getTransactionId()
-
writeCFDPPacket
protected abstract void writeCFDPPacket(ByteBuffer buffer)
-
-