/** * Sets the TCP flags for the current TCP object instance. * * @param flags The TCP flags. * @return This instance. */ public TCP setHeaderLenFlags(short flags) { getHeaderFieldMap().put(HEADERLENFLAGS, toBytes(flags)); return this; }
/** * Sets the TCP window size for the current TCP object instance. * * @param wsize The TCP window size. * @return This instance. */ public TCP setWindowSize(short wsize) { getHeaderFieldMap().put(WINDOWSIZE, toBytes(wsize)); return this; }
/** * Sets the VLAN identifier(VID) for the current IEEE 802.1Q instance. * * @param vid The VLAN ID. * @return This instance. */ public IEEE8021Q setVid(short vid) { getHeaderFieldMap().put(VID, toBytes(vid)); return this; }
/** * Sets the protocol Type for the current ARP object instance. * * @param ptype The protocol type to set. * @return This instance. */ public ARP setProtocolType(short ptype) { getHeaderFieldMap().put(PTYPE, toBytes(ptype)); return this; }
/** * Sets the ICMP identifier for the current ICMP object instance. * @param id The ICMP identifier to be set. * @return This instance. */ public ICMP setIdentifier(short id) { getHeaderFieldMap().put(IDENTIFIER, toBytes(id)); return this; }
/** * Stores the total length of IPv4 packet in bytes. * * @param len The total length of the IPv4 packet. * @return This instance. */ public IPv4 setTotalLength(short len) { getHeaderFieldMap().put(TOTLENGTH, toBytes(len)); return this; }
/** * Stores the IP fragmentation offset value. * * @param off The fragmentation offset. * @return This instance. */ public IPv4 setFragmentOffset(short off) { getHeaderFieldMap().put(FRAGOFFSET, toBytes(off)); return this; }
/** * Create an {@link InetAddress} instance which represents the IPv4 address * specified by the given integer value. * * @param addr An integer value which represents the IPv4 address. * @return An {@link InetAddress} instance. */ public static InetAddress getInetAddress(int addr) { return getInetAddress(NumberUtils.toBytes(addr)); }
/** * {@inheritDoc} */ @Override public byte[] getBytes() { byte[] bytes = byteAddress; if (bytes == null) { bytes = NumberUtils.toBytes(address); byteAddress = bytes; } return bytes.clone(); }
/** * Sets the TCP checksum for the current TCP object instance. * * @param cksum The TCP checksum. * @return This instance. */ public TCP setChecksum(short cksum) { getHeaderFieldMap().put(CHECKSUM, toBytes(cksum)); return this; }
/** * Sets the ICMP sequence number for the current ICMP object instance. * * @param seq The ICMP sequence number to be set. * @return This instance. */ public ICMP setSequenceNumber(short seq) { getHeaderFieldMap().put(SEQNUMBER, toBytes(seq)); return this; }
/** * Set the UDP header length value for the current UDP object instance. * * @param len The number of bytes in the UDP datagram. * @return This instance. */ public UDP setLength(short len) { getHeaderFieldMap().put(LENGTH, toBytes(len)); return this; }
/** * Sets the ICMP checksum for the current ICMP object instance. * * @param cksum The checksum value to be set. * @return This instance. */ public ICMP setChecksum(short cksum) { getHeaderFieldMap().put(CHECKSUM, toBytes(cksum)); return this; }
/** * Sets the hardware Type for the current ARP object instance. * * @param hwtype The hardwareType to set. * @return This instance. */ public ARP setHardwareType(short hwtype) { getHeaderFieldMap().put(HWTYPE, toBytes(hwtype)); return this; }
/** * Sets the opCode for the current ARP object instance. * * @param op The operation code. * @return This instance. */ public ARP setOpCode(short op) { getHeaderFieldMap().put(OPCODE, toBytes(op)); return this; }
/** * Set the checksum for the current UDP object instance. * * @param cksum The UDP checksum. * @return This instance. */ public UDP setChecksum(short cksum) { getHeaderFieldMap().put(CHECKSUM, toBytes(cksum)); return this; }
/** * Sets the TCP sequence number for the current TCP object instance. * * @param seq The TCP sequence number. * @return This instance. */ public TCP setSequenceNumber(int seq) { getHeaderFieldMap().put(SEQNUMBER, toBytes(seq)); return this; }
/** * Sets the TCP Ack number for the current TCP object instance. * * @param acq The TCP acknowledgement number. * @return This instance. */ public TCP setAckNumber(int acq) { getHeaderFieldMap().put(ACKNUMBER, toBytes(acq)); return this; }
/** * Sets the TCP Urgent Pointer for the current TCP object instance. * * @param urg The TCP urgent pointer. * @return This instance. */ public TCP setUrgentPointer(short urg) { getHeaderFieldMap().put(URGENTPOINTER, toBytes(urg)); return this; }
/** * Stores the identification number from the header. * * @param id The identification to set. * @return This instance. */ public IPv4 setIdentification(short id) { getHeaderFieldMap().put(IDENTIFICATION, toBytes(id)); return this; }