/
common.go
29 lines (26 loc) · 1002 Bytes
/
common.go
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
// Copyright 2015 David du Colombier. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package pcap implements access to pcap files.
//
// References:
// http://www.tcpdump.org/
// https://wiki.wireshark.org/Development/LibpcapFileFormat
package pcap
// A Header represents the global header in a pcap file.
type Header struct {
Magic uint32 // Magic number.
VersionMajor uint16 // Major version number.
VersionMinor uint16 // Minor version number.
ThisZone int32 // GMT to local correction.
SigFigs uint32 // Accuracy of timestamps.
SnapLen uint32 // Max length of captured packets.
LinkType uint32 // Data link type.
}
// A RecordHeader represents a record header in a pcap file.
type RecordHeader struct {
TsSec uint32 // Timestamp seconds.
TsUsec uint32 // Timestamp microseconds.
CapLen uint32 // Length of packet saved in file.
Len uint32 // Actual length of packet.
}