-
Notifications
You must be signed in to change notification settings - Fork 0
/
CapStruct.cs
66 lines (63 loc) · 1.91 KB
/
CapStruct.cs
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
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct pcap_pkthdr {
public int tv_sec; /* seconds */
public int tv_usec; /* and microseconds */
public uint caplen; // /* length of portion present */
public uint len; // /* length this packet (off wire) */
};
[StructLayout(LayoutKind.Sequential)]
public struct ethernet_hdstr {
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[] dst;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[] src;
public short type;
}
[StructLayout(LayoutKind.Sequential)]
public struct ip_hdstr {
public byte version_length;
public byte differentiated_services_field;
public ushort total_length;
public short identification;
public short flags;
public byte time_to_live;
public byte protocol;
public short checksum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[] src;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[] dst;
}
[StructLayout(LayoutKind.Sequential)]
public struct tcp_hdstr {
public byte src_u; public byte src_l;
public byte dst_u; public byte dst_l;
public byte seq0; public byte seq1; public byte seq2; public byte seq3;
public byte ack0; public byte ack1; public byte ack2; public byte ack3;
public byte length;
public byte flags;
public byte window_u; public byte window_l;
public byte checksum_u; public byte checksum__l;
}
[StructLayout(LayoutKind.Sequential)]
public struct udp_hdstr {
public short src;
public short dst;
public short length;
public short checksum;
}
[StructLayout(LayoutKind.Sequential)]
public struct sctp_hdstr {
public short src;
public short dst;
public uint verification_tag;
public uint checksum;
public byte chunk_type;
public byte chunk_flags;
public short chunk_len;
public int tsn;
public short stream_id;
public short stream_seq_number;
public int payload_proto_type;
}