Package jpcap.packet

Class IPPacket

    • Constructor Summary

      Constructors 
      Constructor Description
      IPPacket()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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, java.net.InetAddress src, java.net.InetAddress dst)
      Sets the IPv4 parameters
      void setIPv6Parameter​(int cls, int flowlabel, int nxt_hdr, int hop_limit, java.net.InetAddress src, java.net.InetAddress dst)
      Sets the IPv6 parameters
      java.lang.String toString()
      Returns a string represenation of this packet.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • version

        public byte version
        IP version (v4/v6)
      • priority

        public byte priority
        Priority (class) (v4/v6)
      • d_flag

        public boolean d_flag
        IP flag bit: [D]elay (v4)
      • t_flag

        public boolean t_flag
        IP flag bit: [T]hrough (v4)
      • r_flag

        public boolean r_flag
        IP flag bit: [R]eliability (v4)
      • rsv_tos

        public byte rsv_tos
        Type of Service (TOS) (v4/v6)
      • length

        public short length
        Packet length (v4/v6)
      • rsv_frag

        public boolean rsv_frag
        Fragmentation reservation flag (v4)
      • dont_frag

        public boolean dont_frag
        Don't fragment flag (v4)
      • more_frag

        public boolean more_frag
        More fragment flag (v4)
      • offset

        public short offset
        Fragment offset (v4)
      • hop_limit

        public short hop_limit
        Hop Limit, Time To Live (TTL) (v4/v6)
      • protocol

        public short protocol
        Protocol (v4/v6)
      • IPPROTO_ICMP

        public static final short IPPROTO_ICMP
        Protocol number for ICMP
        See Also:
        Constant Field Values
      • IPPROTO_IGMP

        public static final short IPPROTO_IGMP
        Protocol number for IGMP
        See Also:
        Constant Field Values
      • IPPROTO_IP

        public static final short IPPROTO_IP
        Protocol number for IP in IP
        See Also:
        Constant Field Values
      • IPPROTO_TCP

        public static final short IPPROTO_TCP
        Protocol number for TCP
        See Also:
        Constant Field Values
      • IPPROTO_UDP

        public static final short IPPROTO_UDP
        Protocol number for UDP
        See Also:
        Constant Field Values
      • IPPROTO_IPv6

        public static final short IPPROTO_IPv6
        Protocol number for IPv6
        See Also:
        Constant Field Values
      • IPPROTO_HOPOPT

        public static final short IPPROTO_HOPOPT
        Protocol number for IPv6 hop-by-hop option
        See Also:
        Constant Field Values
      • IPPROTO_IPv6_Route

        public static final short IPPROTO_IPv6_Route
        Protocol number for routing header for IPv6
        See Also:
        Constant Field Values
      • IPPROTO_IPv6_Frag

        public static final short IPPROTO_IPv6_Frag
        Protocol number for fragment header for IPv6
        See Also:
        Constant Field Values
      • IPPROTO_IPv6_ICMP

        public static final short IPPROTO_IPv6_ICMP
        Protocol number for IPv6 ICMP
        See Also:
        Constant Field Values
      • IPPROTO_IPv6_NoNxt

        public static final short IPPROTO_IPv6_NoNxt
        Protocol number for no next header header for IPv6
        See Also:
        Constant Field Values
      • IPPROTO_IPv6_Opts

        public static final short IPPROTO_IPv6_Opts
        Protocol number for destination option for IPv6
        See Also:
        Constant Field Values
      • ident

        public int ident
        IDENTIFICATION (v4)
      • flow_label

        public int flow_label
        Flow label (v6)
      • src_ip

        public java.net.InetAddress src_ip
        Source IP address
      • dst_ip

        public java.net.InetAddress dst_ip
        Destination IP address
      • option

        public byte[] option
        Option in IPv4 header (v4)
      • options

        public java.util.List options
        Option headers in IPv6Option (v6)
    • Constructor Detail

      • IPPacket

        public IPPacket()
    • Method Detail

      • 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,
                                     java.net.InetAddress src,
                                     java.net.InetAddress dst)
        Sets the IPv4 parameters
        Parameters:
        d_flag - IP flag bit: [D]elay
        t_flag - IP flag bit: [T]hrough
        r_flag - IP flag bit: [R]eliability
        rsv_tos - Type of Service (TOS)
        priority - Priority
        rsv_frag - Fragmentation Reservation flag
        dont_frag - Don't fragment flag
        more_frag - More fragment flag
        offset - Offset
        ident - Identifier
        ttl - Time To Live
        protocol - Protocol
        This value is ignored when this packets inherits a higher layer protocol(e.g. TCPPacket)
        src - Source IP address
        dst - Destination IP address
      • setIPv6Parameter

        public void setIPv6Parameter​(int cls,
                                     int flowlabel,
                                     int nxt_hdr,
                                     int hop_limit,
                                     java.net.InetAddress src,
                                     java.net.InetAddress dst)
        Sets the IPv6 parameters
        Parameters:
        cls - class
        flowlabel - flow label
        nxt_hdr - next header
        hop_limit - hop limit
        src - source address
        dst - destination address
      • toString

        public java.lang.String 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)

        Overrides:
        toString in class Packet
        Returns:
        a string represenation of this packet