rename ip_reassemble -> ip_reassembly
This commit is contained in:
71
src/ip_reassembly/ip_reassembly.h
Normal file
71
src/ip_reassembly/ip_reassembly.h
Normal file
@@ -0,0 +1,71 @@
|
||||
#ifndef _IP_REASSEMBLE_H
|
||||
#define _IP_REASSEMBLE_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "packet.h"
|
||||
#include "log.h"
|
||||
|
||||
#define IP_REASSEMBLE_DEBUG(format, ...) LOG_DEBUG("ip_reassembly", format, ##__VA_ARGS__)
|
||||
#define IP_REASSEMBLE_ERROR(format, ...) LOG_ERROR("ip_reassembly", format, ##__VA_ARGS__)
|
||||
|
||||
struct ip_reassembly_config
|
||||
{
|
||||
bool enable;
|
||||
|
||||
uint32_t timeout; // seconds
|
||||
uint32_t bucket_entries;
|
||||
uint32_t bucket_num;
|
||||
};
|
||||
|
||||
struct ip_reassembly_stat
|
||||
{
|
||||
// IPv4 flow stat
|
||||
uint64_t ip4_flow_find;
|
||||
uint64_t ip4_flow_add;
|
||||
uint64_t ip4_flow_del;
|
||||
uint64_t ip4_flow_timeout;
|
||||
|
||||
uint64_t ip4_flow_fail_no_space;
|
||||
uint64_t ip4_flow_fail_overlap;
|
||||
uint64_t ip4_flow_fail_many_frag;
|
||||
uint64_t ip4_flow_fail_invalid_length;
|
||||
uint64_t ip4_flow_bypass_dup_fist_frag;
|
||||
uint64_t ip4_flow_bypass_dup_last_frag;
|
||||
|
||||
// IPv6 flow stat
|
||||
uint64_t ip6_flow_find;
|
||||
uint64_t ip6_flow_add;
|
||||
uint64_t ip6_flow_del;
|
||||
uint64_t ip6_flow_timeout;
|
||||
|
||||
uint64_t ip6_flow_fail_no_space;
|
||||
uint64_t ip6_flow_fail_overlap;
|
||||
uint64_t ip6_flow_fail_many_frag;
|
||||
uint64_t ip6_flow_fail_invalid_length;
|
||||
uint64_t ip6_flow_bypass_dup_fist_frag;
|
||||
uint64_t ip6_flow_bypass_dup_last_frag;
|
||||
};
|
||||
|
||||
struct ip_reassembly *ip_reassembly_create(const struct ip_reassembly_config *config);
|
||||
void ip_reassembly_destory(struct ip_reassembly *mgr);
|
||||
void ip_reassembly_expire(struct ip_reassembly *mgr);
|
||||
void ip_reassembly_print_stat(struct ip_reassembly *mgr);
|
||||
struct ip_reassembly_stat *ip_reassembly_get_stat(struct ip_reassembly *mgr);
|
||||
|
||||
/*
|
||||
* Returns the reassembled packet, or NULL if the packet is not reassembled
|
||||
* The returned packet should be freed by calling the packet_free() function
|
||||
*/
|
||||
struct packet *ip_reassembly_packet(struct ip_reassembly *mgr, const struct packet *pkt);
|
||||
struct packet *ipv4_reassembly_packet(struct ip_reassembly *mgr, const struct packet *pkt);
|
||||
struct packet *ipv6_reassembly_packet(struct ip_reassembly *mgr, const struct packet *pkt);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user