#ifndef _DUPLICATED_PACKET_H_
#define _DUPLICATED_PACKET_H_

#ifdef __cplusplus
extern "C"
{
#endif

// Duplicated Packet Filter for IPv4 Packet

#include "log.h"
#include "packet_priv.h"

#define DUPLICATED_PACKET_FILTER_LOG_ERROR(format, ...) LOG_ERROR("duplicated packet filter", format, ##__VA_ARGS__)

struct duplicated_packet_filter;
struct duplicated_packet_filter *duplicated_packet_filter_new(uint32_t capacity, uint32_t timeout, double error_rate, uint64_t now);
void duplicated_packet_filter_free(struct duplicated_packet_filter *filter);

// return 1: found
// reutrn 0: no found
int duplicated_packet_filter_lookup(struct duplicated_packet_filter *filter, const struct packet *pkt, uint64_t now);
void duplicated_packet_filter_add(struct duplicated_packet_filter *filter, const struct packet *pkt, uint64_t now);

#ifdef __cplusplus
}
#endif

#endif
