org.jnetpcap.protocol.tcpip
Class Tcp
java.lang.Object
org.jnetpcap.nio.JMemory
org.jnetpcap.nio.JBuffer
org.jnetpcap.packet.JHeader
org.jnetpcap.protocol.tcpip.Tcp
- All Implemented Interfaces:
- JByteBuffer, JPayloadAccessor
@Header
public class Tcp
- extends JHeader
Tcp/Ip header definition
- Author:
- Mark Bednarczyk, Sly Technologies, Inc.
|
Nested Class Summary |
static class |
Tcp.Flag
Constants for each TCP flag |
|
Field Summary |
static int |
ID
|
|
Constructor Summary |
Tcp()
|
| Methods inherited from class org.jnetpcap.packet.JHeader |
addAnalysis, decode, getAnalysis, getAnalysisIterable, getAnnotatedHeader, getDescription, getFields, getId, getLength, getName, getNicname, getOffset, getPacket, getParent, getPayload, getState, getSubHeaders, getType, hasAnalysis, hasAnalysis, hasAnalysis, hasDescription, hasSubHeaders, peer, peer, peerPayloadTo, setPacket, setSubHeaders, sizeof, toString, transferPayloadTo, transferPayloadTo, transferPayloadTo, validateHeader |
| Methods inherited from class org.jnetpcap.nio.JBuffer |
findUTF8String, getByte, getByteArray, getByteArray, getDouble, getFloat, getInt, getLong, getShort, getUByte, getUInt, getUShort, getUTF8Char, getUTF8String, getUTF8String, getUTF8String, getUTF8String, isReadonly, order, order, peer, peer, peer, peer, setByte, setByteArray, setByteBuffer, setDouble, setFloat, setInt, setLong, setShort, setUByte, setUInt, setUShort, transferFrom, transferFrom, transferFrom, transferTo, transferTo, transferTo |
| Methods inherited from class org.jnetpcap.nio.JMemory |
check, cleanup, finalize, isInitialized, isJMemoryBasedOwner, isOwner, peer, setSize, size, toDebugString, toHexdump, toHexdump, totalActiveAllocated, totalAllocateCalls, totalAllocated, totalAllocatedSegments0To255Bytes, totalAllocatedSegments256OrAbove, totalDeAllocateCalls, totalDeAllocated, transferFrom, transferFrom, transferFromDirect, transferOwnership, transferTo, transferTo, transferTo, transferTo, transferTo |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, notify, notifyAll, wait, wait, wait |
ID
public static final int ID
- See Also:
- Constant Field Values
Tcp
public Tcp()
headerLength
@HeaderLength
public static int headerLength(JBuffer buffer,
int offset)
ack
@Field(offset=64,
length=16,
format="%x")
public long ack()
ack
public void ack(long ack)
- Parameters:
ack -
checksum
@Field(offset=128,
length=16,
format="%x")
public int checksum()
checksum
public void checksum(int crc)
- Parameters:
crc -
decodeHeader
protected void decodeHeader()
- Description copied from class:
JHeader
- Allows a header to decode its complex fields
- Overrides:
decodeHeader in class JHeader
destination
@Field(offset=16,
length=16)
@FlowKey(index=2,
reversable=true)
public int destination()
destination
public void destination(int dst)
flags
@Field(offset=104,
length=8,
format="%x")
public int flags()
flags
public void flags(int flags)
flags_ACK
@Field(parent="flags",
offset=4,
length=1,
format="%b",
display="ack",
description="acknowledgment")
public boolean flags_ACK()
- Returns:
flags_ACK
public void flags_ACK(boolean flag)
- Parameters:
flag -
flags_CWR
@Field(parent="flags",
offset=7,
length=1,
format="%b",
display="cwr",
description="reduced (cwr)")
public boolean flags_CWR()
flags_CWR
public void flags_CWR(boolean flag)
flags_ECE
@Field(parent="flags",
offset=6,
length=1,
format="%b",
display="ece",
description="ECN echo flag")
public boolean flags_ECE()
flags_ECE
public void flags_ECE(boolean flag)
flags_FIN
@Field(parent="flags",
offset=0,
length=1,
format="%b",
display="fin",
description="closing down connection")
public boolean flags_FIN()
flags_FIN
public void flags_FIN(boolean flag)
flags_PSH
@Field(parent="flags",
offset=3,
length=1,
format="%b",
display="ack",
description="push current segment of data")
public boolean flags_PSH()
flags_PSH
public void flags_PSH(boolean flag)
flags_RST
@Field(parent="flags",
offset=2,
length=1,
format="%b",
display="ack",
description="reset connection")
public boolean flags_RST()
flags_RST
public void flags_RST(boolean flag)
flags_SYN
@Field(parent="flags",
offset=1,
length=1,
format="%b",
display="ack",
description="synchronize connection, startup")
public boolean flags_SYN()
flags_SYN
public void flags_SYN(boolean flag)
flags_URG
@Field(parent="flags",
offset=5,
length=1,
format="%b",
display="ack",
description="urgent, out-of-band data")
public boolean flags_URG()
flags_URG
public void flags_URG(boolean flag)
- Parameters:
b -
flagsCompactString
public java.lang.String flagsCompactString()
flagsEnum
public java.util.Set<Tcp.Flag> flagsEnum()
- Returns:
getPayloadLength
public int getPayloadLength()
- Calculates the length of the TCP payload.
- Returns:
- length of tcp segment data in bytes
hashCode
public int hashCode()
- Returns a bi-directional hashcode for this header. The hashcode is made up
of IP source, IP destination, Tcp source and destination port numbers. It
is created in a such a way that packet's source and destination fields are
interchangable and will generate the same hashcode.
- Overrides:
hashCode in class java.lang.Object
- Returns:
- bi-directional hashcode for this TCP/IP header combination
- See Also:
uniHashCode()
hlen
@Field(offset=96,
length=4)
public int hlen()
hlen
public void hlen(int length)
- Parameters:
length - in 4 byte words
reserved
@Field(offset=100,
length=4)
public int reserved()
seq
@Field(offset=32,
length=16,
format="%x")
public long seq()
seq
public void seq(long seq)
- Parameters:
seq -
source
@Field(offset=0,
length=16)
@FlowKey(index=2,
reversable=true)
public int source()
source
public void source(int src)
uniHashCode
public int uniHashCode()
- Uni-directional hashcode. A hashcode that is computed based on IP
destination and TCP destination port. This make the hashcode uni-direction
in the direction from source to destination.
- Returns:
- a hashcode that is uni-directional
urgent
@Field(offset=144,
length=16)
public int urgent()
urgent
public void urgent(int urg)
- Parameters:
urg -
window
@Field(offset=112,
length=16)
public int window()
window
public void window(int win)
windowScaled
public int windowScaled()