#pragma once
#include "common.hpp"


class NFQ {
    public:
        typedef struct {
            bool verdict;
            bool changed;
            uint32_t mark;
        } result_t;
        typedef void (*cb_t)(unsigned char*, size_t, result_t&, void*);

    private:
        struct nfq_q_handle* qh;
        cb_t qcb;
        void** qdata;

        NFQ(unsigned, cb_t, void**);

        static struct nfq_handle* h;
        static unsigned h_refcount;
        static int cb(struct nfq_q_handle*, struct nfgenmsg*, struct nfq_data*, void*);

    public:
        ~NFQ();
        static NFQ* getQueue(unsigned proto, unsigned qid, cb_t, void**);
        static bool loop(volatile int&);
};