1 #ifndef NMSG_BASE_IPREASM_H
2 #define NMSG_BASE_IPREASM_H
32 struct reasm_id_ipv4 {
42 struct reasm_id_ipv6 {
49 struct reasm_id_ipv4 ipv4;
50 struct reasm_id_ipv6 ipv6;
53 struct reasm_frag_entry {
61 struct reasm_frag_entry *next;
71 struct reasm_ip_entry {
77 struct timespec timeout;
78 enum entry_state state;
79 enum reasm_proto protocol;
80 struct reasm_frag_entry *frags;
81 struct reasm_ip_entry *prev, *next;
82 struct reasm_ip_entry *time_prev, *time_next;
88 struct reasm_ip *reasm_ip_new(
void);
89 void reasm_ip_free(
struct reasm_ip *reasm);
102 bool reasm_ip_next(
struct reasm_ip *reasm,
const uint8_t *packet,
unsigned len,
103 const struct timespec *timestamp,
struct reasm_ip_entry **out_entry);
117 struct reasm_frag_entry *reasm_parse_packet(
const uint8_t *packet,
unsigned len,
118 const struct timespec *ts,
119 enum reasm_proto *protocol,
union reasm_id *
id,
120 unsigned *hash,
bool *last_frag);
125 bool reasm_ip_set_timeout(
struct reasm_ip *reasm,
const struct timespec *timeout);
130 unsigned reasm_ip_waiting(
const struct reasm_ip *reasm);
131 unsigned reasm_ip_max_waiting(
const struct reasm_ip *reasm);
132 unsigned reasm_ip_timed_out(
const struct reasm_ip *reasm);
133 unsigned reasm_ip_dropped_frags(
const struct reasm_ip *reasm);
138 bool reasm_is_complete(
struct reasm_ip_entry *entry);
147 void reasm_assemble(
struct reasm_ip_entry *entry,
148 uint8_t *out_packet,
size_t *output_len);
154 bool reasm_add_fragment(
struct reasm_ip_entry *entry,
155 struct reasm_frag_entry *frag,
158 void reasm_free_entry(
struct reasm_ip_entry *entry);