aboutsummaryrefslogtreecommitdiff
path: root/analyzer/utils/tcp.h
diff options
context:
space:
mode:
authorMosder <xmosder12@gmail.com>2026-07-14 13:40:17 +0200
committerMosder <xmosder12@gmail.com>2026-07-14 13:40:17 +0200
commitc7277e7654c0d8d0e7a4665373c0762c6e8a038d (patch)
treebd6e5c7cc864e423cb3285c40c5a8217a19fbf52 /analyzer/utils/tcp.h
parent4dbef658e31e0520d77f90df2bb3e66c21ce2ea4 (diff)
fix: fixed not handling of different connections and bug regarding TCP SYN packet
Diffstat (limited to 'analyzer/utils/tcp.h')
-rw-r--r--analyzer/utils/tcp.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/analyzer/utils/tcp.h b/analyzer/utils/tcp.h
index 37ab4bc..9c6a949 100644
--- a/analyzer/utils/tcp.h
+++ b/analyzer/utils/tcp.h
@@ -12,9 +12,10 @@ typedef unsigned char byte_t;
#ifndef TCP_SEGMENT_DEFINED
#define TCP_SEGMENT_DEFINED
typedef struct {
- byte_t *payload;
- size_t len;
- uint32_t seq;
+ byte_t *payload; // payload in the segment
+ size_t len; // length of the payload
+ uint32_t seq; // TCP sequence number of the segment
+ uint16_t port; // destination (client) port of connection the segment was received from
} TCPSegment;
#endif
@@ -23,7 +24,7 @@ typedef struct {
// - packet - captured packet
// - packet_data - metadata about packet
// returns:
-// TCPSegment from packet, payload is NULL and len is -1 if the received packet was incorrect
+// TCPSegment from packet, payload is NULL if the received packet was incorrect
extern TCPSegment get_segment_from_packet(const byte_t *packet, const struct pcap_pkthdr *packet_data);
// struct that stores all the information about stream
@@ -34,6 +35,7 @@ typedef struct {
size_t len; // length of the stream
size_t capacity; // capacity of the data buffer
uint32_t seq; // TCP sequence number of the first byte in the stream
+ uint16_t port; // destination (client) port of current analyzed connection
Heap *pending; // min heap of segments yet to be added to stream (sorted by TCP sequence number)
} TCPStream;
#endif