net.clackrouter.packets
Class VNSTCPPacket

java.lang.Object
  extended by net.clackrouter.protocol.data.VNSData
      extended by net.clackrouter.packets.VNSPacket
          extended by net.clackrouter.packets.VNSTCPPacket

public class VNSTCPPacket
extends VNSPacket

Represents a Transmission Control Protocol (TCP) Packet.

Options are not supported right now, because they are a pain in the butt. Perhaps I will support them in the future.


Field Summary
 long ack_num
           
 int control_flags
           
 int data_offset
           
static int DEFAULT_HEADER_LEN
           
 int dst_port
           
 int m_header_len_bytes
           
 int recv_window
           
 long seq_num
           
 int src_port
           
static int TH_ACK
           
static int TH_FIN
           
static int TH_PSH
           
static int TH_RST
           
static int TH_SYN
           
static int TH_URG
           
 
Fields inherited from class net.clackrouter.packets.VNSPacket
m_inputInterfaceName, m_length, m_level2Type, m_local_packet, m_nextHopIPAddr, m_nextHopMacAddr, m_outputInterfaceName, m_packetByteBuffer, mParentHeader
 
Constructor Summary
VNSTCPPacket(java.nio.ByteBuffer packetBuffer)
           
VNSTCPPacket(int src_port, int dst_port, long seq_num, long ack_num, int flags, int recv_window, byte[] data)
           
 
Method Summary
 boolean ackFlagSet()
           
 boolean finFlagSet()
           
 long getAckNum()
           
 java.nio.ByteBuffer getBodyBuffer()
           
static java.lang.String getByteString(byte[] arr)
           
 int getDataSize()
           
 int getDestinationPort()
           
 java.net.InetAddress getDestIPAddress()
           
 int getRecvWindowSize()
           
 int getSeqCount()
           
 long getSeqNum()
           
 java.net.InetAddress getSourceIPAddress()
           
 int getSourcePort()
           
 void pack()
           
 void setDestIPAddress(java.net.InetAddress addr)
           
 void setSourceIPAddress(java.net.InetAddress addr)
           
 boolean synFlagSet()
           
 java.lang.String toString()
          Represents the packet in a readable format, by field.
 void trimDataEnd(int numBytes)
           
 void trimDataFront(int numBytes)
           
 
Methods inherited from class net.clackrouter.packets.VNSPacket
addToPath, get16bit, get32bit, getByteBuffer, getInputInterfaceName, getLength, getLevel2Type, getNextHopIPAddress, getNextHopMacAddress, getOutputInterfaceName, getParentHeader, getStringBuffer, isPacket, needsSourceAddress, setByteBuffer, setInputInterfaceName, setLevel2Type, setNeedsSourceAddress, setNextHopIPAddress, setNextHopMacAddress, setOutputInterfaceName, setParentHeader
 
Methods inherited from class net.clackrouter.protocol.data.VNSData
isBanner, isClose, isHWInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_HEADER_LEN

public static final int DEFAULT_HEADER_LEN
See Also:
Constant Field Values

TH_FIN

public static final int TH_FIN
See Also:
Constant Field Values

TH_SYN

public static final int TH_SYN
See Also:
Constant Field Values

TH_RST

public static final int TH_RST
See Also:
Constant Field Values

TH_PSH

public static final int TH_PSH
See Also:
Constant Field Values

TH_ACK

public static final int TH_ACK
See Also:
Constant Field Values

TH_URG

public static final int TH_URG
See Also:
Constant Field Values

seq_num

public long seq_num

ack_num

public long ack_num

src_port

public int src_port

dst_port

public int dst_port

recv_window

public int recv_window

control_flags

public int control_flags

data_offset

public int data_offset

m_header_len_bytes

public int m_header_len_bytes
Constructor Detail

VNSTCPPacket

public VNSTCPPacket(java.nio.ByteBuffer packetBuffer)

VNSTCPPacket

public VNSTCPPacket(int src_port,
                    int dst_port,
                    long seq_num,
                    long ack_num,
                    int flags,
                    int recv_window,
                    byte[] data)
Method Detail

pack

public void pack()

trimDataFront

public void trimDataFront(int numBytes)

trimDataEnd

public void trimDataEnd(int numBytes)

getSourcePort

public int getSourcePort()

getDestinationPort

public int getDestinationPort()

getSeqNum

public long getSeqNum()

getAckNum

public long getAckNum()

getRecvWindowSize

public int getRecvWindowSize()

synFlagSet

public boolean synFlagSet()

ackFlagSet

public boolean ackFlagSet()

finFlagSet

public boolean finFlagSet()

getBodyBuffer

public java.nio.ByteBuffer getBodyBuffer()

getDataSize

public int getDataSize()

getSeqCount

public int getSeqCount()

toString

public java.lang.String toString()
Description copied from class: VNSPacket
Represents the packet in a readable format, by field.

Overrides:
toString in class VNSPacket
Returns:
Packet in readable format

getByteString

public static java.lang.String getByteString(byte[] arr)

setDestIPAddress

public void setDestIPAddress(java.net.InetAddress addr)

getDestIPAddress

public java.net.InetAddress getDestIPAddress()

setSourceIPAddress

public void setSourceIPAddress(java.net.InetAddress addr)

getSourceIPAddress

public java.net.InetAddress getSourceIPAddress()