forked from oridb/bpflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnet.myr
57 lines (52 loc) · 1.01 KB
/
net.myr
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
pkg net =
type ethhdr = struct
dest : byte[6]
source : byte[6]
proto : uint16
;;
type iphdr = struct
/* ver, ihl here in a byte, 4 bits each */
v_hl : byte
tos : byte
len : uint16
id : uint16
off : uint16
ttl : byte
proto : byte
sum : uint16
src : uint32
dst : uint32
/* options if IHL > 5 */
;;
type udphdr = struct
sport : uint16
dport : uint16
len : uint16
sum : uint16
;;
type tcphdr = struct
sport : uint16
dport : uint16
seq : uint32
ack : uint32
/* offset(4), reserved here */
off : byte
flags : byte
win : uint16
sum : uint16
urp : uint16
;;
/* IP fragmentation options */
const Iprf : uint16 = 0x8000
const Ipdf : uint16 = 0x4000
const Ipmf : uint16 = 0x2000
/* TCP flags */
const Thfin : byte = 0x01
const Thsyn : byte = 0x02
const Thrst : byte = 0x04
const Thpush : byte = 0x08
const Thack : byte = 0x10
const Thurg : byte = 0x20
const Thece : byte = 0x40
const Thcwr : byte = 0x80
;;