package net.northking.cctp.upperComputer.driver.harmony.hyppium;

import java.util.concurrent.atomic.AtomicInteger;

public class RequestCodeProvider {

    private static final int START_VALUE = 0x01000000;
    /**
     * 需要从0x01000000开始，小于此数会导致agent.so返回的数据中没有数据包首尾以及长度信息
     */
    private AtomicInteger number = new AtomicInteger(START_VALUE);

    public int next() {
        int value = number.incrementAndGet();
        if (value == Integer.MAX_VALUE) {
            number.set(START_VALUE);
        }
        return value;
    }
}
