// 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/Util.java
// public static byte[] zeroPadArray(byte[] source, int size) {
//     byte[] data = new byte[size];
//     for (int i = 0; i < data.length; i++) {
//         if (i < source.length)
//             data[i] = source[i];
//         else
//             data[i] = 0;
//     }
//     return data;
// }


import java.nio.ByteBuffer;
import static com.github.ffalcinelli.jdivert.Util.unsigned;
import static com.github.ffalcinelli.jdivert.Util.zeroPadArray;
import static com.github.ffalcinelli.jdivert.headers.Tcp.Flag.NS;
        raw.putShort(start + 14, (short) windowSize);
    }

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

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

    public int getUrgentPointer() {
        return unsigned(raw.getShort(start + 18));
    }

    public void setUrgentPointer(int urgPtr) {
        raw.putShort(start + 18, (short) urgPtr);
    }

    public byte[] getOptions() {
        if (getHeaderLength() > 20)
            return getBytesAtOffset(start + 20, getHeaderLength() - 20);
        return null;
    }

    public void setOptions(byte[] options) {
        int delta = getHeaderLength() - 20;
        if (delta <= 0) {
            throw new IllegalStateException("Packet is too short for options.");
        }
// 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/Util.java
// public static byte[] zeroPadArray(byte[] source, int size) {
//     byte[] data = new byte[size];
//     for (int i = 0; i < data.length; i++) {
//         if (i < source.length)
//             data[i] = source[i];
//         else
//             data[i] = 0;
//     }
//     return data;
// }


// Path: src/main/java/com/github/ffalcinelli/jdivert/headers/Tcp.java
import java.nio.ByteBuffer;
import static com.github.ffalcinelli.jdivert.Util.unsigned;
import static com.github.ffalcinelli.jdivert.Util.zeroPadArray;
import static com.github.ffalcinelli.jdivert.headers.Tcp.Flag.NS;

        raw.putShort(start + 14, (short) windowSize);
    }

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

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

    public int getUrgentPointer() {
        return unsigned(raw.getShort(start + 18));
    }

    public void setUrgentPointer(int urgPtr) {
        raw.putShort(start + 18, (short) urgPtr);
    }

    public byte[] getOptions() {
        if (getHeaderLength() > 20)
            return getBytesAtOffset(start + 20, getHeaderLength() - 20);
        return null;
    }

    public void setOptions(byte[] options) {
        int delta = getHeaderLength() - 20;
        if (delta <= 0) {
            throw new IllegalStateException("Packet is too short for options.");
        }
        setBytesAtOffset(start + 20, delta, zeroPadArray(options, delta));