Package jpcap.packet
Class IPPacket
java.lang.Object
jpcap.packet.Packet
jpcap.packet.IPPacket
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ICMPPacket,TCPPacket,UDPPacket
This class represents an IP packet.
Both IPv4 and IPv6 are supported.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanIP flag bit: [D]elay (v4)booleanDon't fragment flag (v4)Destination IP addressintFlow label (v6)shortHop Limit, Time To Live (TTL) (v4/v6)intIDENTIFICATION (v4)static final shortProtocol number for IPv6 hop-by-hop optionstatic final shortProtocol number for ICMPstatic final shortProtocol number for IGMPstatic final shortProtocol number for IP in IPstatic final shortProtocol number for IPv6static final shortProtocol number for fragment header for IPv6static final shortProtocol number for IPv6 ICMPstatic final shortProtocol number for no next header header for IPv6static final shortProtocol number for destination option for IPv6static final shortProtocol number for routing header for IPv6static final shortProtocol number for TCPstatic final shortProtocol number for UDPshortPacket length (v4/v6)booleanMore fragment flag (v4)shortFragment offset (v4)byte[]Option in IPv4 header (v4)Option headers in IPv6Option (v6)bytePriority (class) (v4/v6)shortProtocol (v4/v6)booleanIP flag bit: [R]eliability (v4)booleanFragmentation reservation flag (v4)byteType of Service (TOS) (v4/v6)Source IP addressbooleanIP flag bit: [T]hrough (v4)byteIP version (v4/v6) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetIPv4Parameter(int priority, boolean d_flag, boolean t_flag, boolean r_flag, int rsv_tos, boolean rsv_frag, boolean dont_frag, boolean more_frag, int offset, int ident, int ttl, int protocol, InetAddress src, InetAddress dst) Sets the IPv4 parametersvoidsetIPv6Parameter(int cls, int flowlabel, int nxt_hdr, int hop_limit, InetAddress src, InetAddress dst) Sets the IPv6 parameterstoString()Returns a string represenation of this packet.
-
Field Details
-
version
public byte versionIP version (v4/v6) -
priority
public byte priorityPriority (class) (v4/v6) -
d_flag
public boolean d_flagIP flag bit: [D]elay (v4) -
t_flag
public boolean t_flagIP flag bit: [T]hrough (v4) -
r_flag
public boolean r_flagIP flag bit: [R]eliability (v4) -
rsv_tos
public byte rsv_tosType of Service (TOS) (v4/v6) -
length
public short lengthPacket length (v4/v6) -
rsv_frag
public boolean rsv_fragFragmentation reservation flag (v4) -
dont_frag
public boolean dont_fragDon't fragment flag (v4) -
more_frag
public boolean more_fragMore fragment flag (v4) -
offset
public short offsetFragment offset (v4) -
hop_limit
public short hop_limitHop Limit, Time To Live (TTL) (v4/v6) -
protocol
public short protocolProtocol (v4/v6) -
IPPROTO_ICMP
public static final short IPPROTO_ICMPProtocol number for ICMP- See Also:
-
IPPROTO_IGMP
public static final short IPPROTO_IGMPProtocol number for IGMP- See Also:
-
IPPROTO_IP
public static final short IPPROTO_IPProtocol number for IP in IP- See Also:
-
IPPROTO_TCP
public static final short IPPROTO_TCPProtocol number for TCP- See Also:
-
IPPROTO_UDP
public static final short IPPROTO_UDPProtocol number for UDP- See Also:
-
IPPROTO_IPv6
public static final short IPPROTO_IPv6Protocol number for IPv6- See Also:
-
IPPROTO_HOPOPT
public static final short IPPROTO_HOPOPTProtocol number for IPv6 hop-by-hop option- See Also:
-
IPPROTO_IPv6_Route
public static final short IPPROTO_IPv6_RouteProtocol number for routing header for IPv6- See Also:
-
IPPROTO_IPv6_Frag
public static final short IPPROTO_IPv6_FragProtocol number for fragment header for IPv6- See Also:
-
IPPROTO_IPv6_ICMP
public static final short IPPROTO_IPv6_ICMPProtocol number for IPv6 ICMP- See Also:
-
IPPROTO_IPv6_NoNxt
public static final short IPPROTO_IPv6_NoNxtProtocol number for no next header header for IPv6- See Also:
-
IPPROTO_IPv6_Opts
public static final short IPPROTO_IPv6_OptsProtocol number for destination option for IPv6- See Also:
-
ident
public int identIDENTIFICATION (v4) -
flow_label
public int flow_labelFlow label (v6) -
src_ip
Source IP address -
dst_ip
Destination IP address -
option
public byte[] optionOption in IPv4 header (v4) -
options
Option headers in IPv6Option (v6)
-
-
Constructor Details
-
IPPacket
public IPPacket()
-
-
Method Details
-
setIPv4Parameter
public void setIPv4Parameter(int priority, boolean d_flag, boolean t_flag, boolean r_flag, int rsv_tos, boolean rsv_frag, boolean dont_frag, boolean more_frag, int offset, int ident, int ttl, int protocol, InetAddress src, InetAddress dst) Sets the IPv4 parameters- Parameters:
d_flag- IP flag bit: [D]elayt_flag- IP flag bit: [T]hroughr_flag- IP flag bit: [R]eliabilityrsv_tos- Type of Service (TOS)priority- Priorityrsv_frag- Fragmentation Reservation flagdont_frag- Don't fragment flagmore_frag- More fragment flagoffset- Offsetident- Identifierttl- Time To Liveprotocol- Protocol
This value is ignored when this packets inherits a higher layer protocol(e.g. TCPPacket)src- Source IP addressdst- Destination IP address
-
setIPv6Parameter
public void setIPv6Parameter(int cls, int flowlabel, int nxt_hdr, int hop_limit, InetAddress src, InetAddress dst) Sets the IPv6 parameters- Parameters:
cls- classflowlabel- flow labelnxt_hdr- next headerhop_limit- hop limitsrc- source addressdst- destination address
-
toString
Returns a string represenation of this packet.Format(IPv4): src_ip->dst_ip protocol(protocol) priority(priority) [D][T][R] hop(hop_limit) [RF/][DF/][MF] offset(offset) ident(ident)
Format(IPv6): src_ip->dst_ip protocol(protocol) priority(priority) flowlabel(flow_label) hop(hop_limit)
-