SourceForge Jpcap

net.sourceforge.jpcap.net
Interface IP.TCP

All Known Subinterfaces:
IPv4.TCP
All Known Implementing Classes:
IPv4.TCP.Packet, TCPPacket
Enclosing interface:
IP

public static interface IP.TCP

TCP (Transmission Control Protocol) API interface. This is read-only. You can't use Jpcap to send TCP packets, because

  1. the TCP at the other end will ignore them unless you get the TCP sequence numbers correct
  2. the local TCP will reject the replies with an RST unless the sequence numbers, port, etc all correspond to a real TCP application at this end: in which case you don't need Jpcap anyway.
... and even if you could, what exactly is the point, when you have a nice TCP API already?

Since:
2.0.0
Version:
$Revision: 1.1 $
Author:
Esmond Pitt

Method Summary
 long getAcknowledgmentNumber()
          Fetch the byte acknowledgment number, i.e.
 int getDestinationPort()
          Fetches the destination port number.
 int getPayloadDataLength()
          Fetches the length of the payload data.
 long getSequenceNumber()
          Fetch the byte sequence number.
 int getSourcePort()
          Fetch the source port number.
 int getTCPChecksum()
          Fetch the TCP checksum.
 byte[] getTCPData()
          Fetch the TCP data as a byte array.
 byte[] getTCPHeader()
          Fetch the TCP header as a byte array.
 int getTCPHeaderLength()
          Fetch the TCP header length in bytes.
 int getUrgentPointer()
          Fetch the urgent pointer.
 int getWindowSize()
          Fetch the window size.
 boolean isAck()
          Return the ACK flag, indicating that the ack number is valid.
 boolean isFin()
          Return the FIN flag, indicating that the sender has finished sending.
 boolean isPsh()
          Return the PSH flag, indicating that the receiver should pass the data to the application as soon as possible.
 boolean isRst()
          Return the RST flag, indicating that the connection has been reset by the sender.
 boolean isSyn()
          Return the SYN flag, set to synchronize the sequence numbers between the sender and receiver as part of the connect handshake.
 boolean isUrg()
          Return the URG flag, indicating that the urgent pointer is valid.
 boolean isValidTCPChecksum()
          Return true if the TCP checksum is valid
 

Method Detail

getSourcePort

int getSourcePort()
Fetch the source port number.

Returns:
the souce port number.

getDestinationPort

int getDestinationPort()
Fetches the destination port number.

Returns:
the destination port number.

getSequenceNumber

long getSequenceNumber()
Fetch the byte sequence number.

Returns:
the byte sequence number.

getAcknowledgmentNumber

long getAcknowledgmentNumber()
Fetch the byte acknowledgment number, i.e. the next byte that the sender expects to receive.

Returns:
the byte acknowledgement number.

getTCPHeaderLength

int getTCPHeaderLength()
Fetch the TCP header length in bytes.


getPayloadDataLength

int getPayloadDataLength()
Fetches the length of the payload data.

Returns:
the length of the payload data.

getWindowSize

int getWindowSize()
Fetch the window size.

Returns:
the window size.

getTCPChecksum

int getTCPChecksum()
Fetch the TCP checksum.

Returns:
the TCP checksum.

getUrgentPointer

int getUrgentPointer()
Fetch the urgent pointer.

Returns:
the TCP urgent pointer

isUrg

boolean isUrg()
Return the URG flag, indicating that the urgent pointer is valid.

Returns:
the URG flag.

isAck

boolean isAck()
Return the ACK flag, indicating that the ack number is valid.

Returns:
the ACK flag.

isPsh

boolean isPsh()
Return the PSH flag, indicating that the receiver should pass the data to the application as soon as possible.

Returns:
the PSH flag.

isRst

boolean isRst()
Return the RST flag, indicating that the connection has been reset by the sender.

Returns:
the RST flag.

isSyn

boolean isSyn()
Return the SYN flag, set to synchronize the sequence numbers between the sender and receiver as part of the connect handshake.

Returns:
the SYN flag.

isFin

boolean isFin()
Return the FIN flag, indicating that the sender has finished sending.

Returns:
the FIN flag.

getTCPHeader

byte[] getTCPHeader()
Fetch the TCP header as a byte array. Altering this has no effect on the packet.


getTCPData

byte[] getTCPData()
Fetch the TCP data as a byte array. Altering this has no effect on the packet.


isValidTCPChecksum

boolean isValidTCPChecksum()
Return true if the TCP checksum is valid

Returns:
true or false.

Copyright © Patrick Charles & Jonas Lehmann, 2001; Esmond Pitt, 2008.