diff options
| author | Mosder <xmosder12@gmail.com> | 2026-07-10 22:50:12 +0200 |
|---|---|---|
| committer | Mosder <xmosder12@gmail.com> | 2026-07-10 22:50:12 +0200 |
| commit | 0e9be0d902b44894ed747cabb82ea2120f2e4b45 (patch) | |
| tree | 8bbf583d44e135c1f5ccdcbfe113b855be41386a /analyzer/utils/tcp_seq_math.h | |
| parent | 4422f92de05948187eeb0b0067dd947e673f8f1d (diff) | |
feat: added functionallity for TCP stream reassembly
Diffstat (limited to 'analyzer/utils/tcp_seq_math.h')
| -rw-r--r-- | analyzer/utils/tcp_seq_math.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/analyzer/utils/tcp_seq_math.h b/analyzer/utils/tcp_seq_math.h new file mode 100644 index 0000000..c4da5f9 --- /dev/null +++ b/analyzer/utils/tcp_seq_math.h @@ -0,0 +1,28 @@ +// utils/tcp_seq_math.h +// helper functions for math regarding tcp sequence numbers which correctly handle overflow + +#include <stdint.h> + +// check if a is after b +extern int seq_after(uint32_t a, uint32_t b); + +// check if a is before b +extern int seq_before(uint32_t a, uint32_t b); + +// check if a is after or equal to b +extern int seq_after_eq(uint32_t a, uint32_t b); + +// check if a is before or equal to b +extern int seq_before_eq(uint32_t a, uint32_t b); + +// check if value is in [range_start; range_end] +extern int seq_in_range_ii(uint32_t value, uint32_t range_start, uint32_t range_end); + +// check if value is in (range_start; range_end) +extern int seq_in_range_ee(uint32_t value, uint32_t range_start, uint32_t range_end); + +// check if value is in [range_start; range_end) +extern int seq_in_range_ie(uint32_t value, uint32_t range_start, uint32_t range_end); + +// check if value is in (range_start; range_end] +extern int seq_in_range_ei(uint32_t value, uint32_t range_start, uint32_t range_end); |
