#ifndef NETWORK_NIC_LOAD_BALANCE_H
#define NETWORK_NIC_LOAD_BALANCE_H

#include <cstdint>
#include "network/packet.h"
#include "core/rng.h"

namespace dofs {

// Base class for NIC load balancing policy.
// Only exposes update() and get_entropy().
class LoadBalance {
public:
        explicit LoadBalance(Rng *const rng) noexcept : _rng(rng) {}
        virtual ~LoadBalance() = default;

        virtual void update(const Packet& pkt) noexcept = 0;

        // Produce a 16-bit entropy value for the next packet.
        virtual uint16_t get_entropy(const Packet& context) noexcept = 0;

protected:
        Rng *const _rng;
};

// Random per-packet spraying (testing/baseline).
class LBRandomPacketSpraying final : public LoadBalance {
public:
        explicit LBRandomPacketSpraying(Rng *const rng) noexcept : LoadBalance(rng) {}
        virtual void update(const Packet& pkt) noexcept override;
        virtual uint16_t get_entropy(const Packet& context) noexcept override;
};

} // namespace dofs

#endif // NETWORK_NIC_LOAD_BALANCE_H
