- java.lang.Object
-
- org.pcap4j.packet.AbstractPacket.AbstractHeader
-
- org.pcap4j.packet.SctpPacket.SctpHeader
-
- All Implemented Interfaces:
java.io.Serializable,Packet.Header,TransportPacket.TransportHeader
- Enclosing class:
- SctpPacket
public static final class SctpPacket.SctpHeader extends AbstractPacket.AbstractHeader implements TransportPacket.TransportHeader
SCTP header0 16 31 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Src Port | Dst Port | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Verification Tag | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Chunk #1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Chunk #n | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Since:
- pcap4j 1.6.6
- See Also:
- RFC 4960, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private intchecksumprivate static intCHECKSUM_OFFSETprivate static intCHECKSUM_SIZEprivate java.util.List<SctpPacket.SctpChunk>chunksprivate static intCHUNKS_OFFSETprivate static intDST_PORT_OFFSETprivate static intDST_PORT_SIZEprivate SctpPortdstPortprivate static longserialVersionUIDprivate static intSRC_PORT_OFFSETprivate static intSRC_PORT_SIZEprivate SctpPortsrcPortprivate static intVERIFICAION_TAG_SIZEprivate static intVERIFICATION_TAG_OFFSETprivate intverificationTag
-
Constructor Summary
Constructors Modifier Constructor Description privateSctpHeader(byte[] rawData, int offset, int length)privateSctpHeader(SctpPacket.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringbuildString()This method builds the valuetoString()will return.private intcalcChecksum()protected intcalcHashCode()This method builds the valuehashCode()will return using the byte arraygetRawData()returns.protected intcalcLength()This method calculates the valuelength()will return by adding up the lengths of byte arrays in the listgetRawFields()returns.booleanequals(java.lang.Object obj)Indicates whether some other object is "equal to" this one using return values ofgetRawData().intgetChecksum()java.util.List<SctpPacket.SctpChunk>getChunks()SctpPortgetDstPort()protected java.util.List<byte[]>getRawFields()Returns a list of byte arrays which represents this header's fields.SctpPortgetSrcPort()intgetVerificationTag()-
Methods inherited from class org.pcap4j.packet.AbstractPacket.AbstractHeader
buildHexString, buildRawData, getRawData, hashCode, length, toHexString, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.pcap4j.packet.Packet.Header
getRawData, length
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
SRC_PORT_OFFSET
private static final int SRC_PORT_OFFSET
- See Also:
- Constant Field Values
-
SRC_PORT_SIZE
private static final int SRC_PORT_SIZE
- See Also:
- Constant Field Values
-
DST_PORT_OFFSET
private static final int DST_PORT_OFFSET
- See Also:
- Constant Field Values
-
DST_PORT_SIZE
private static final int DST_PORT_SIZE
- See Also:
- Constant Field Values
-
VERIFICATION_TAG_OFFSET
private static final int VERIFICATION_TAG_OFFSET
- See Also:
- Constant Field Values
-
VERIFICAION_TAG_SIZE
private static final int VERIFICAION_TAG_SIZE
- See Also:
- Constant Field Values
-
CHECKSUM_OFFSET
private static final int CHECKSUM_OFFSET
- See Also:
- Constant Field Values
-
CHECKSUM_SIZE
private static final int CHECKSUM_SIZE
- See Also:
- Constant Field Values
-
CHUNKS_OFFSET
private static final int CHUNKS_OFFSET
- See Also:
- Constant Field Values
-
srcPort
private final SctpPort srcPort
-
dstPort
private final SctpPort dstPort
-
verificationTag
private final int verificationTag
-
checksum
private final int checksum
-
chunks
private final java.util.List<SctpPacket.SctpChunk> chunks
-
-
Constructor Detail
-
SctpHeader
private SctpHeader(byte[] rawData, int offset, int length) throws IllegalRawDataException- Throws:
IllegalRawDataException
-
SctpHeader
private SctpHeader(SctpPacket.Builder builder)
-
-
Method Detail
-
calcChecksum
private int calcChecksum()
-
getSrcPort
public SctpPort getSrcPort()
- Specified by:
getSrcPortin interfaceTransportPacket.TransportHeader- Returns:
- Source port
-
getDstPort
public SctpPort getDstPort()
- Specified by:
getDstPortin interfaceTransportPacket.TransportHeader- Returns:
- Destination port
-
getVerificationTag
public int getVerificationTag()
- Returns:
- verification tag
-
getChecksum
public int getChecksum()
- Returns:
- checksum
-
getChunks
public java.util.List<SctpPacket.SctpChunk> getChunks()
- Returns:
- chunks
-
getRawFields
protected java.util.List<byte[]> getRawFields()
Description copied from class:AbstractPacket.AbstractHeaderReturns a list of byte arrays which represents this header's fields. This method is called bycalcLength()andbuildRawData().- Specified by:
getRawFieldsin classAbstractPacket.AbstractHeader- Returns:
- a list of byte arrays which represents this header's fields
-
calcLength
protected int calcLength()
Description copied from class:AbstractPacket.AbstractHeaderThis method calculates the valuelength()will return by adding up the lengths of byte arrays in the listgetRawFields()returns.- Overrides:
calcLengthin classAbstractPacket.AbstractHeader- Returns:
- a calculated length
-
buildString
protected java.lang.String buildString()
Description copied from class:AbstractPacket.AbstractHeaderThis method builds the valuetoString()will return.- Overrides:
buildStringin classAbstractPacket.AbstractHeader- Returns:
- a string representation of this object
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:AbstractPacket.AbstractHeaderIndicates whether some other object is "equal to" this one using return values ofgetRawData(). This method should be overridden so that it does more strict comparisons more efficiently.- Overrides:
equalsin classAbstractPacket.AbstractHeader
-
calcHashCode
protected int calcHashCode()
Description copied from class:AbstractPacket.AbstractHeaderThis method builds the valuehashCode()will return using the byte arraygetRawData()returns. This method may be better to be overridden for performance reason.- Overrides:
calcHashCodein classAbstractPacket.AbstractHeader- Returns:
- a calculated hash code value for the object
-
-