This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
tcp.h
69 lines (56 loc) · 1.59 KB
/
tcp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
p0f - portable TCP/IP headers
-----------------------------
Well.
Copyright (C) 2003-2006 by Michal Zalewski <lcamtuf@coredump.cx>
*/
#ifndef _HAVE_TCP_H
#define _HAVE_TCP_H
#include "types.h"
#define TCPOPT_EOL 0 /* End of options */
#define TCPOPT_NOP 1 /* Nothing */
#define TCPOPT_MAXSEG 2 /* MSS */
#define TCPOPT_WSCALE 3 /* Window scaling */
#define TCPOPT_SACKOK 4 /* Selective ACK permitted */
#define TCPOPT_TIMESTAMP 8 /* Stamp out timestamping! */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define TH_FIN 0x01
#define TH_SYN 0x02
#define TH_RST 0x04
#define TH_PUSH 0x08
#define TH_ACK 0x10
#define TH_URG 0x20
/* Stupid ECN flags: */
#define TH_ECE 0x40
#define TH_CWR 0x80
struct ip_header {
_u8 ihl, /* IHL */
tos; /* type of service */
_u16 tot_len, /* total length */
id, /* identification */
off; /* fragment offset + DF/MF */
_u8 ttl, /* time to live */
proto; /* protocol */
_u16 cksum; /* checksum */
_u32 saddr, /* source */
daddr; /* destination */
};
struct tcp_header {
_u16 sport, /* source port */
dport; /* destination port */
_u32 seq, /* sequence number */
ack; /* ack number */
#if BYTE_ORDER == LITTLE_ENDIAN
_u8 _x2:4, /* unused */
doff:4; /* data offset */
#else /* BYTE_ORDER == BIG_ENDIAN */
_u8 doff:4, /* data offset */
_x2:4; /* unused */
#endif
_u8 flags; /* flags, d'oh */
_u16 win; /* wss */
_u16 cksum; /* checksum */
_u16 urg; /* urgent pointer */
};
#endif /* ! _HAVE_TCP_H */