// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static String printHexBinary(ByteBuffer data) {
//     return printHexBinary(getBytesAtOffset(data, 0, data.capacity()));
// }
// 
// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static int unsigned(short value) {
//     return value & 0x0000ffff;
// }


import java.nio.ByteBuffer;
import static com.github.ffalcinelli.jdivert.Util.printHexBinary;
import static com.github.ffalcinelli.jdivert.Util.unsigned;
    }

    public int getChecksum() {
        return unsigned(raw.getShort(start + 6));
    }

    public void setChecksum(int cksum) {
        raw.putShort(start + 6, (short) cksum);
    }

    @Override
    public int getHeaderLength() {
        return 8;
    }

    public byte[] getData() {
        return getBytesAtOffset(start + getHeaderLength(), getLength() - getHeaderLength());
    }

    public void setData(byte[] data) {
        setBytesAtOffset(start + getHeaderLength(), data.length, data);
    }

    @Override
    public String toString() {
        return String.format("UDP {srcPort=%d, dstPort=%d, len=%d, cksum=%s, data=%s}"
                , getSrcPort()
                , getDstPort()
                , getLength()
                , Integer.toHexString(getChecksum())
// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static String printHexBinary(ByteBuffer data) {
//     return printHexBinary(getBytesAtOffset(data, 0, data.capacity()));
// }
// 
// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static int unsigned(short value) {
//     return value & 0x0000ffff;
// }


// Path: src/main/java/com/github/ffalcinelli/jdivert/headers/Udp.java
import java.nio.ByteBuffer;
import static com.github.ffalcinelli.jdivert.Util.printHexBinary;
import static com.github.ffalcinelli.jdivert.Util.unsigned;

    }

    public int getChecksum() {
        return unsigned(raw.getShort(start + 6));
    }

    public void setChecksum(int cksum) {
        raw.putShort(start + 6, (short) cksum);
    }

    @Override
    public int getHeaderLength() {
        return 8;
    }

    public byte[] getData() {
        return getBytesAtOffset(start + getHeaderLength(), getLength() - getHeaderLength());
    }

    public void setData(byte[] data) {
        setBytesAtOffset(start + getHeaderLength(), data.length, data);
    }

    @Override
    public String toString() {
        return String.format("UDP {srcPort=%d, dstPort=%d, len=%d, cksum=%s, data=%s}"
                , getSrcPort()
                , getDstPort()
                , getLength()
                , Integer.toHexString(getChecksum())
                , printHexBinary(getData())