rename ip_reassemble -> ip_reassembly

This commit is contained in:
luwenpeng
2024-03-08 13:55:17 +08:00
parent d7370e0e19
commit 9d562ffee6
15 changed files with 297 additions and 297 deletions

View 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