mirror of https://github.com/OISF/suricata
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
C
57 lines
1.5 KiB
C
#ifndef __STREAM_TCP_PRIVATE_H__
|
|
#define __STREAM_TCP_PRIVATE_H__
|
|
|
|
typedef struct _TcpSegment {
|
|
u_int8_t *payload;
|
|
u_int16_t payload_len; /* actual size of the payload */
|
|
u_int32_t seq;
|
|
u_int16_t pool_size; /* size of the memory */
|
|
struct _TcpSegment *next;
|
|
struct _TcpSegment *prev;
|
|
} TcpSegment;
|
|
|
|
typedef struct _TcpStream {
|
|
u_int32_t isn; /* initial sequence number */
|
|
u_int32_t next_seq; /* next expected sequence number */
|
|
u_int32_t last_ack; /* last ack'd sequence number */
|
|
u_int32_t next_win; /* next max seq within window */
|
|
u_int8_t wscale;
|
|
u_int16_t window;
|
|
|
|
/* reassembly */
|
|
u_int32_t ra_base_seq; /* reassembled seq. We've reassembled up to this point. */
|
|
TcpSegment *seg_list;
|
|
} TcpStream;
|
|
|
|
/* from /usr/include/netinet/tcp.h */
|
|
enum
|
|
{
|
|
TCP_ESTABLISHED = 1,
|
|
TCP_SYN_SENT,
|
|
TCP_SYN_RECV,
|
|
TCP_FIN_WAIT1,
|
|
TCP_FIN_WAIT2,
|
|
TCP_TIME_WAIT,
|
|
TCP_CLOSE,
|
|
TCP_CLOSE_WAIT,
|
|
TCP_LAST_ACK,
|
|
TCP_LISTEN,
|
|
TCP_CLOSING /* now a valid state */
|
|
};
|
|
|
|
/* Macro's for comparing Sequence numbers
|
|
* Page 810 from TCP/IP Illustrated, Volume 2. */
|
|
#define SEQ_EQ(a,b) ((int)((a) - (b)) == 0)
|
|
#define SEQ_LT(a,b) ((int)((a) - (b)) < 0)
|
|
#define SEQ_LEQ(a,b) ((int)((a) - (b)) <= 0)
|
|
#define SEQ_GT(a,b) ((int)((a) - (b)) > 0)
|
|
#define SEQ_GEQ(a,b) ((int)((a) - (b)) >= 0)
|
|
|
|
typedef struct _TcpSession {
|
|
u_int8_t state;
|
|
TcpStream server;
|
|
TcpStream client;
|
|
} TcpSession;
|
|
|
|
#endif /* __STREAM_TCP_PRIVATE_H__ */
|