layers

package
Version: v1.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2016 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package layers provides decoding layers for many common protocols.

The layers package contains decode implementations for a number of different types of packet layers. Users of gopacket will almost always want to also use layers to actually decode packet data into useful pieces. To see the set of protocols that gopacket/layers is currently able to decode, look at the set of LayerTypes defined in the Variables sections. The layers package also defines endpoints for many of the common packet layers that have source/destination addresses associated with them, for example IPv4/6 (IPs) and TCP/UDP (ports). Finally, layers contains a number of useful enumerations (IPProtocol, EthernetType, LinkType, PPPType, etc...). Many of these implement the gopacket.Decoder interface, so they can be passed into gopacket as decoders.

Most common protocol layers are named using acronyms or other industry-common names (IPv4, TCP, PPP). Some of the less common ones have their names expanded (CiscoDiscoveryProtocol). For certain protocols, sub-parts of the protocol are split out into their own layers (SCTP, for example). This is done mostly in cases where portions of the protocol may fulfill the capabilities of interesting layers (SCTPData implements ApplicationLayer, while base SCTP implements TransportLayer), or possibly because splitting a protocol into a few layers makes decoding easier.

This package is meant to be used with its parent, http://github.com/google/gopacket.

Port Types

Instead of using raw uint16 or uint8 values for ports, we use a different port type for every protocol, for example TCPPort and UDPPort. This allows us to override string behavior for each port, which we do by setting up port name maps (TCPPortNames, UDPPortNames, etc...). Well-known ports are annotated with their protocol names, and their String function displays these names:

p := TCPPort(80)
fmt.Printf("Number: %d  String: %v", p, p)
// Prints: "Number: 80  String: 80(http)"

Modifying Decode Behavior

layers links together decoding through its enumerations. For example, after decoding layer type Ethernet, it uses Ethernet.EthernetType as its next decoder. All enumerations that act as decoders, like EthernetType, can be modified by users depending on their preferences. For example, if you have a spiffy new IPv4 decoder that works way better than the one built into layers, you can do this:

var mySpiffyIPv4Decoder gopacket.Decoder = ...
layers.EthernetTypeMetadata[EthernetTypeIPv4].DecodeWith = mySpiffyIPv4Decoder

This will make all future ethernet packets use your new decoder to decode IPv4 packets, instead of the built-in decoder used by gopacket.

Index

Constants

View Source
const (
	ARPRequest = 1
	ARPReply   = 2
)
View Source
const (
	CDPPoEFourWire  byte = 0x01
	CDPPoEPDArch    byte = 0x02
	CDPPoEPDRequest byte = 0x04
	CDPPoEPSE       byte = 0x08
)
View Source
const (
	CDPProtocolTypeNLPID byte = 1
	CDPProtocolType802_2 byte = 2
)

CDP Protocol Types

View Source
const (
	EAPCodeRequest  EAPCode = 1
	EAPCodeResponse EAPCode = 2
	EAPCodeSuccess  EAPCode = 3
	EAPCodeFailure  EAPCode = 4

	// EAPTypeNone means that this EAP layer has no Type or TypeData.
	// Success and Failure EAPs will have this set.
	EAPTypeNone EAPType = 0

	EAPTypeIdentity     EAPType = 1
	EAPTypeNotification EAPType = 2
	EAPTypeNACK         EAPType = 3
	EAPTypeOTP          EAPType = 4
	EAPTypeTokenCard    EAPType = 5
)
View Source
const (
	ICMPv4TypeEchoReply              = 0
	ICMPv4TypeDestinationUnreachable = 3
	ICMPv4TypeSourceQuench           = 4
	ICMPv4TypeRedirect               = 5
	ICMPv4TypeEchoRequest            = 8
	ICMPv4TypeRouterAdvertisement    = 9
	ICMPv4TypeRouterSolicitation     = 10
	ICMPv4TypeTimeExceeded           = 11
	ICMPv4TypeParameterProblem       = 12
	ICMPv4TypeTimestampRequest       = 13
	ICMPv4TypeTimestampReply         = 14
	ICMPv4TypeInfoRequest            = 15
	ICMPv4TypeInfoReply              = 16
	ICMPv4TypeAddressMaskRequest     = 17
	ICMPv4TypeAddressMaskReply       = 18
)
View Source
const (
	// DestinationUnreachable
	ICMPv4CodeNet                 = 0
	ICMPv4CodeHost                = 1
	ICMPv4CodeProtocol            = 2
	ICMPv4CodePort                = 3
	ICMPv4CodeFragmentationNeeded = 4
	ICMPv4CodeSourceRoutingFailed = 5
	ICMPv4CodeNetUnknown          = 6
	ICMPv4CodeHostUnknown         = 7
	ICMPv4CodeSourceIsolated      = 8
	ICMPv4CodeNetAdminProhibited  = 9
	ICMPv4CodeHostAdminProhibited = 10
	ICMPv4CodeNetTOS              = 11
	ICMPv4CodeHostTOS             = 12
	ICMPv4CodeCommAdminProhibited = 13
	ICMPv4CodeHostPrecedence      = 14
	ICMPv4CodePrecedenceCutoff    = 15

	// TimeExceeded
	ICMPv4CodeTTLExceeded                    = 0
	ICMPv4CodeFragmentReassemblyTimeExceeded = 1

	// ParameterProblem
	ICMPv4CodePointerIndicatesError = 0
	ICMPv4CodeMissingOption         = 1
	ICMPv4CodeBadLength             = 2

	// Redirect
	// ICMPv4CodeNet  = same as for DestinationUnreachable
	// ICMPv4CodeHost = same as for DestinationUnreachable
	ICMPv4CodeTOSNet  = 2
	ICMPv4CodeTOSHost = 3
)
View Source
const (
	// The following are from RFC 4443
	ICMPv6TypeDestinationUnreachable = 1
	ICMPv6TypePacketTooBig           = 2
	ICMPv6TypeTimeExceeded           = 3
	ICMPv6TypeParameterProblem       = 4
	ICMPv6TypeEchoRequest            = 128
	ICMPv6TypeEchoReply              = 129
	// The following are from RFC 4861
	ICMPv6TypeRouterSolicitation    = 133
	ICMPv6TypeRouterAdvertisement   = 134
	ICMPv6TypeNeighborSolicitation  = 135
	ICMPv6TypeNeighborAdvertisement = 136
	ICMPv6TypeRedirect              = 137
)
View Source
const (
	// DestinationUnreachable
	ICMPv6CodeNoRouteToDst           = 0
	ICMPv6CodeAdminProhibited        = 1
	ICMPv6CodeBeyondScopeOfSrc       = 2
	ICMPv6CodeAddressUnreachable     = 3
	ICMPv6CodePortUnreachable        = 4
	ICMPv6CodeSrcAddressFailedPolicy = 5
	ICMPv6CodeRejectRouteToDst       = 6

	// TimeExceeded
	ICMPv6CodeHopLimitExceeded               = 0
	ICMPv6CodeFragmentReassemblyTimeExceeded = 1

	// ParameterProblem
	ICMPv6CodeErroneousHeaderField   = 0
	ICMPv6CodeUnrecognizedNextHeader = 1
	ICMPv6CodeUnrecognizedIPv6Option = 2
)
View Source
const (
	LLDPCapsOther       uint16 = 1 << 0
	LLDPCapsRepeater    uint16 = 1 << 1
	LLDPCapsBridge      uint16 = 1 << 2
	LLDPCapsWLANAP      uint16 = 1 << 3
	LLDPCapsRouter      uint16 = 1 << 4
	LLDPCapsPhone       uint16 = 1 << 5
	LLDPCapsDocSis      uint16 = 1 << 6
	LLDPCapsStationOnly uint16 = 1 << 7
	LLDPCapsCVLAN       uint16 = 1 << 8
	LLDPCapsSVLAN       uint16 = 1 << 9
	LLDPCapsTmpr        uint16 = 1 << 10
)

LLDPCapabilities Types

View Source
const (
	LLDP8021SubtypePortVLANID       uint8 = 1
	LLDP8021SubtypeProtocolVLANID   uint8 = 2
	LLDP8021SubtypeVLANName         uint8 = 3
	LLDP8021SubtypeProtocolIdentity uint8 = 4
	LLDP8021SubtypeVDIUsageDigest   uint8 = 5
	LLDP8021SubtypeManagementVID    uint8 = 6
	LLDP8021SubtypeLinkAggregation  uint8 = 7
)

/ IEEE 802.1 TLV Subtypes

View Source
const (
	LLDPProtocolVLANIDCapability byte = 1 << 1
	LLDPProtocolVLANIDStatus     byte = 1 << 2
)

VLAN Port Protocol ID options

View Source
const (
	LLDPAggregationCapability byte = 1 << 0
	LLDPAggregationStatus     byte = 1 << 1
)

LACP options

View Source
const (
	LLDP8023SubtypeMACPHY          uint8 = 1
	LLDP8023SubtypeMDIPower        uint8 = 2
	LLDP8023SubtypeLinkAggregation uint8 = 3
	LLDP8023SubtypeMTU             uint8 = 4
)

IEEE 802.3 TLV Subtypes

View Source
const (
	LLDPMACPHYCapability byte = 1 << 0
	LLDPMACPHYStatus     byte = 1 << 1
)

MACPHY options

View Source
const (
	LLDPMAUTypeUnknown         uint16 = 0
	LLDPMAUTypeAUI             uint16 = 1
	LLDPMAUType10Base5         uint16 = 2
	LLDPMAUTypeFOIRL           uint16 = 3
	LLDPMAUType10Base2         uint16 = 4
	LLDPMAUType10BaseT         uint16 = 5
	LLDPMAUType10BaseFP        uint16 = 6
	LLDPMAUType10BaseFB        uint16 = 7
	LLDPMAUType10BaseFL        uint16 = 8
	LLDPMAUType10BROAD36       uint16 = 9
	LLDPMAUType10BaseT_HD      uint16 = 10
	LLDPMAUType10BaseT_FD      uint16 = 11
	LLDPMAUType10BaseFL_HD     uint16 = 12
	LLDPMAUType10BaseFL_FD     uint16 = 13
	LLDPMAUType100BaseT4       uint16 = 14
	LLDPMAUType100BaseTX_HD    uint16 = 15
	LLDPMAUType100BaseTX_FD    uint16 = 16
	LLDPMAUType100BaseFX_HD    uint16 = 17
	LLDPMAUType100BaseFX_FD    uint16 = 18
	LLDPMAUType100BaseT2_HD    uint16 = 19
	LLDPMAUType100BaseT2_FD    uint16 = 20
	LLDPMAUType1000BaseX_HD    uint16 = 21
	LLDPMAUType1000BaseX_FD    uint16 = 22
	LLDPMAUType1000BaseLX_HD   uint16 = 23
	LLDPMAUType1000BaseLX_FD   uint16 = 24
	LLDPMAUType1000BaseSX_HD   uint16 = 25
	LLDPMAUType1000BaseSX_FD   uint16 = 26
	LLDPMAUType1000BaseCX_HD   uint16 = 27
	LLDPMAUType1000BaseCX_FD   uint16 = 28
	LLDPMAUType1000BaseT_HD    uint16 = 29
	LLDPMAUType1000BaseT_FD    uint16 = 30
	LLDPMAUType10GBaseX        uint16 = 31
	LLDPMAUType10GBaseLX4      uint16 = 32
	LLDPMAUType10GBaseR        uint16 = 33
	LLDPMAUType10GBaseER       uint16 = 34
	LLDPMAUType10GBaseLR       uint16 = 35
	LLDPMAUType10GBaseSR       uint16 = 36
	LLDPMAUType10GBaseW        uint16 = 37
	LLDPMAUType10GBaseEW       uint16 = 38
	LLDPMAUType10GBaseLW       uint16 = 39
	LLDPMAUType10GBaseSW       uint16 = 40
	LLDPMAUType10GBaseCX4      uint16 = 41
	LLDPMAUType2BaseTL         uint16 = 42
	LLDPMAUType10PASS_TS       uint16 = 43
	LLDPMAUType100BaseBX10D    uint16 = 44
	LLDPMAUType100BaseBX10U    uint16 = 45
	LLDPMAUType100BaseLX10     uint16 = 46
	LLDPMAUType1000BaseBX10D   uint16 = 47
	LLDPMAUType1000BaseBX10U   uint16 = 48
	LLDPMAUType1000BaseLX10    uint16 = 49
	LLDPMAUType1000BasePX10D   uint16 = 50
	LLDPMAUType1000BasePX10U   uint16 = 51
	LLDPMAUType1000BasePX20D   uint16 = 52
	LLDPMAUType1000BasePX20U   uint16 = 53
	LLDPMAUType10GBaseT        uint16 = 54
	LLDPMAUType10GBaseLRM      uint16 = 55
	LLDPMAUType1000BaseKX      uint16 = 56
	LLDPMAUType10GBaseKX4      uint16 = 57
	LLDPMAUType10GBaseKR       uint16 = 58
	LLDPMAUType10_1GBasePRX_D1 uint16 = 59
	LLDPMAUType10_1GBasePRX_D2 uint16 = 60
	LLDPMAUType10_1GBasePRX_D3 uint16 = 61
	LLDPMAUType10_1GBasePRX_U1 uint16 = 62
	LLDPMAUType10_1GBasePRX_U2 uint16 = 63
	LLDPMAUType10_1GBasePRX_U3 uint16 = 64
	LLDPMAUType10GBasePR_D1    uint16 = 65
	LLDPMAUType10GBasePR_D2    uint16 = 66
	LLDPMAUType10GBasePR_D3    uint16 = 67
	LLDPMAUType10GBasePR_U1    uint16 = 68
	LLDPMAUType10GBasePR_U3    uint16 = 69
)

From IANA-MAU-MIB (introduced by RFC 4836) - dot3MauType

View Source
const (
	LLDPMAUPMDOther        uint16 = 1 << 15
	LLDPMAUPMD10BaseT      uint16 = 1 << 14
	LLDPMAUPMD10BaseT_FD   uint16 = 1 << 13
	LLDPMAUPMD100BaseT4    uint16 = 1 << 12
	LLDPMAUPMD100BaseTX    uint16 = 1 << 11
	LLDPMAUPMD100BaseTX_FD uint16 = 1 << 10
	LLDPMAUPMD100BaseT2    uint16 = 1 << 9
	LLDPMAUPMD100BaseT2_FD uint16 = 1 << 8
	LLDPMAUPMDFDXPAUSE     uint16 = 1 << 7
	LLDPMAUPMDFDXAPAUSE    uint16 = 1 << 6
	LLDPMAUPMDFDXSPAUSE    uint16 = 1 << 5
	LLDPMAUPMDFDXBPAUSE    uint16 = 1 << 4
	LLDPMAUPMD1000BaseX    uint16 = 1 << 3
	LLDPMAUPMD1000BaseX_FD uint16 = 1 << 2
	LLDPMAUPMD1000BaseT    uint16 = 1 << 1
	LLDPMAUPMD1000BaseT_FD uint16 = 1 << 0
)

From RFC 3636 - ifMauAutoNegCapAdvertisedBits

View Source
const (
	LLDPMAUPMDOtherInv        uint16 = 1 << 0
	LLDPMAUPMD10BaseTInv      uint16 = 1 << 1
	LLDPMAUPMD10BaseT_FDInv   uint16 = 1 << 2
	LLDPMAUPMD100BaseT4Inv    uint16 = 1 << 3
	LLDPMAUPMD100BaseTXInv    uint16 = 1 << 4
	LLDPMAUPMD100BaseTX_FDInv uint16 = 1 << 5
	LLDPMAUPMD100BaseT2Inv    uint16 = 1 << 6
	LLDPMAUPMD100BaseT2_FDInv uint16 = 1 << 7
	LLDPMAUPMDFDXPAUSEInv     uint16 = 1 << 8
	LLDPMAUPMDFDXAPAUSEInv    uint16 = 1 << 9
	LLDPMAUPMDFDXSPAUSEInv    uint16 = 1 << 10
	LLDPMAUPMDFDXBPAUSEInv    uint16 = 1 << 11
	LLDPMAUPMD1000BaseXInv    uint16 = 1 << 12
	LLDPMAUPMD1000BaseX_FDInv uint16 = 1 << 13
	LLDPMAUPMD1000BaseTInv    uint16 = 1 << 14
	LLDPMAUPMD1000BaseT_FDInv uint16 = 1 << 15
)

Inverted ifMauAutoNegCapAdvertisedBits if required (Some manufacturers misinterpreted the spec - see https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1455)

View Source
const (
	LLDPMDIPowerPortClass    byte = 1 << 0
	LLDPMDIPowerCapability   byte = 1 << 1
	LLDPMDIPowerStatus       byte = 1 << 2
	LLDPMDIPowerPairsAbility byte = 1 << 3
)

MDI Power options

View Source
const (
	LLDP8021QbgEVB   uint8 = 0
	LLDP8021QbgCDCP  uint8 = 1
	LLDP8021QbgVDP   uint8 = 2
	LLDP8021QbgEVB22 uint8 = 13
)

IEEE 802.1Qbg TLV Subtypes

View Source
const (
	LLDPEVBCapsSTD uint16 = 1 << 7
	LLDPEVBCapsRR  uint16 = 1 << 6
	LLDPEVBCapsRTE uint16 = 1 << 2
	LLDPEVBCapsECP uint16 = 1 << 1
	LLDPEVBCapsVDP uint16 = 1 << 0
)

LLDPEVBCapabilities Types

View Source
const (
	LLDPMediaCapsLLDP      uint16 = 1 << 0
	LLDPMediaCapsNetwork   uint16 = 1 << 1
	LLDPMediaCapsLocation  uint16 = 1 << 2
	LLDPMediaCapsPowerPSE  uint16 = 1 << 3
	LLDPMediaCapsPowerPD   uint16 = 1 << 4
	LLDPMediaCapsInventory uint16 = 1 << 5
)

LLDPMediaCapabilities Types

View Source
const (
	LLDPCiscoPSESupport   uint8 = 1 << 0
	LLDPCiscoArchShared   uint8 = 1 << 1
	LLDPCiscoPDSparePair  uint8 = 1 << 2
	LLDPCiscoPSESparePair uint8 = 1 << 3
)
View Source
const (
	PrismType1MessageCode uint16 = 0x00000044
	PrismType2MessageCode uint16 = 0x00000041
)
View Source
const (
	RadioTapMCSFlagsBandwidthMask RadioTapMCSFlags = 0x03
	RadioTapMCSFlagsShortGI                        = 0x04
	RadioTapMCSFlagsGreenfield                     = 0x08
	RadioTapMCSFlagsFECLDPC                        = 0x10
	RadioTapMCSFlagsSTBCMask                       = 0x60
	RadioTapMCSFlagsNESS0                          = 0x80
)
View Source
const (
	SCTPProtocolReserved  SCTPPayloadProtocol = 0
	SCTPPayloadUIA                            = 1
	SCTPPayloadM2UA                           = 2
	SCTPPayloadM3UA                           = 3
	SCTPPayloadSUA                            = 4
	SCTPPayloadM2PA                           = 5
	SCTPPayloadV5UA                           = 6
	SCTPPayloadH248                           = 7
	SCTPPayloadBICC                           = 8
	SCTPPayloadTALI                           = 9
	SCTPPayloadDUA                            = 10
	SCTPPayloadASAP                           = 11
	SCTPPayloadENRP                           = 12
	SCTPPayloadH323                           = 13
	SCTPPayloadQIPC                           = 14
	SCTPPayloadSIMCO                          = 15
	SCTPPayloadDDPSegment                     = 16
	SCTPPayloadDDPStream                      = 17
	SCTPPayloadS1AP                           = 18
)

SCTPPayloadProtocol constonts from http://www.iana.org/assignments/sctp-parameters/sctp-parameters.xhtml

View Source
const (
	TCPOptionKindEndList                         = 0
	TCPOptionKindNop                             = 1
	TCPOptionKindMSS                             = 2  // len = 4
	TCPOptionKindWindowScale                     = 3  // len = 3
	TCPOptionKindSACKPermitted                   = 4  // len = 2
	TCPOptionKindSACK                            = 5  // len = n
	TCPOptionKindEcho                            = 6  // len = 6, obsolete
	TCPOptionKindEchoReply                       = 7  // len = 6, obsolete
	TCPOptionKindTimestamps                      = 8  // len = 10
	TCPOptionKindPartialOrderConnectionPermitted = 9  // len = 2, obsolete
	TCPOptionKindPartialOrderServiceProfile      = 10 // len = 3, obsolete
	TCPOptionKindCC                              = 11 // obsolete
	TCPOptionKindCCNew                           = 12 // obsolete
	TCPOptionKindCCEcho                          = 13 // obsolete
	TCPOptionKindAltChecksum                     = 14 // len = 3, obsolete
	TCPOptionKindAltChecksumData                 = 15 // len = n, obsolete
)
View Source
const (
	IPv6HopByHopOptionJumbogram = 0xC2 // RFC 2675
)

Variables

View Source
var (
	// We use two different endpoint types for IPv4 vs IPv6 addresses, so that
	// ordering with endpointA.LessThan(endpointB) sanely groups all IPv4
	// addresses and all IPv6 addresses, such that IPv6 > IPv4 for all addresses.
	EndpointIPv4 = gopacket.RegisterEndpointType(1, gopacket.EndpointTypeMetadata{Name: "IPv4", Formatter: func(b []byte) string {
		return net.IP(b).String()
	}})
	EndpointIPv6 = gopacket.RegisterEndpointType(2, gopacket.EndpointTypeMetadata{Name: "IPv6", Formatter: func(b []byte) string {
		return net.IP(b).String()
	}})

	EndpointMAC = gopacket.RegisterEndpointType(3, gopacket.EndpointTypeMetadata{Name: "MAC", Formatter: func(b []byte) string {
		return net.HardwareAddr(b).String()
	}})
	EndpointTCPPort = gopacket.RegisterEndpointType(4, gopacket.EndpointTypeMetadata{Name: "TCP", Formatter: func(b []byte) string {
		return strconv.Itoa(int(binary.BigEndian.Uint16(b)))
	}})
	EndpointUDPPort = gopacket.RegisterEndpointType(5, gopacket.EndpointTypeMetadata{Name: "UDP", Formatter: func(b []byte) string {
		return strconv.Itoa(int(binary.BigEndian.Uint16(b)))
	}})
	EndpointSCTPPort = gopacket.RegisterEndpointType(6, gopacket.EndpointTypeMetadata{Name: "SCTP", Formatter: func(b []byte) string {
		return strconv.Itoa(int(binary.BigEndian.Uint16(b)))
	}})
	EndpointRUDPPort = gopacket.RegisterEndpointType(7, gopacket.EndpointTypeMetadata{Name: "RUDP", Formatter: func(b []byte) string {
		return strconv.Itoa(int(b[0]))
	}})
	EndpointUDPLitePort = gopacket.RegisterEndpointType(8, gopacket.EndpointTypeMetadata{Name: "UDPLite", Formatter: func(b []byte) string {
		return strconv.Itoa(int(binary.BigEndian.Uint16(b)))
	}})
	EndpointPPP = gopacket.RegisterEndpointType(9, gopacket.EndpointTypeMetadata{Name: "PPP", Formatter: func([]byte) string {
		return "point"
	}})
)
View Source
var (
	// Each of the following arrays contains mappings of how to handle enum
	// values for various enum types in gopacket/layers.
	//
	// So, EthernetTypeMetadata[2] contains information on how to handle EthernetType
	// 2, including which name to give it and which decoder to use to decode
	// packet data of that type.  These arrays are filled by default with all of the
	// protocols gopacket/layers knows how to handle, but users of the library can
	// add new decoders or override existing ones.  For example, if you write a better
	// TCP decoder, you can override IPProtocolMetadata[IPProtocolTCP].DecodeWith
	// with your new decoder, and all gopacket/layers decoding will use your new
	// decoder whenever they encounter that IPProtocol.
	EthernetTypeMetadata     [65536]EnumMetadata
	IPProtocolMetadata       [265]EnumMetadata
	SCTPChunkTypeMetadata    [265]EnumMetadata
	PPPTypeMetadata          [65536]EnumMetadata
	PPPoECodeMetadata        [256]EnumMetadata
	LinkTypeMetadata         [256]EnumMetadata
	FDDIFrameControlMetadata [256]EnumMetadata
	EAPOLTypeMetadata        [256]EnumMetadata
	ProtocolFamilyMetadata   [256]EnumMetadata
	Dot11TypeMetadata        [256]EnumMetadata
	USBTypeMetadata          [256]EnumMetadata
)
View Source
var (
	LayerTypeARP                         = gopacket.RegisterLayerType(10, gopacket.LayerTypeMetadata{Name: "ARP", Decoder: gopacket.DecodeFunc(decodeARP)})
	LayerTypeCiscoDiscovery              = gopacket.RegisterLayerType(11, gopacket.LayerTypeMetadata{Name: "CiscoDiscovery", Decoder: gopacket.DecodeFunc(decodeCiscoDiscovery)})
	LayerTypeEthernetCTP                 = gopacket.RegisterLayerType(12, gopacket.LayerTypeMetadata{Name: "EthernetCTP", Decoder: gopacket.DecodeFunc(decodeEthernetCTP)})
	LayerTypeEthernetCTPForwardData      = gopacket.RegisterLayerType(13, gopacket.LayerTypeMetadata{Name: "EthernetCTPForwardData", Decoder: nil})
	LayerTypeEthernetCTPReply            = gopacket.RegisterLayerType(14, gopacket.LayerTypeMetadata{Name: "EthernetCTPReply", Decoder: nil})
	LayerTypeDot1Q                       = gopacket.RegisterLayerType(15, gopacket.LayerTypeMetadata{Name: "Dot1Q", Decoder: gopacket.DecodeFunc(decodeDot1Q)})
	LayerTypeEtherIP                     = gopacket.RegisterLayerType(16, gopacket.LayerTypeMetadata{Name: "EtherIP", Decoder: gopacket.DecodeFunc(decodeEtherIP)})
	LayerTypeEthernet                    = gopacket.RegisterLayerType(17, gopacket.LayerTypeMetadata{Name: "Ethernet", Decoder: gopacket.DecodeFunc(decodeEthernet)})
	LayerTypeGRE                         = gopacket.RegisterLayerType(18, gopacket.LayerTypeMetadata{Name: "GRE", Decoder: gopacket.DecodeFunc(decodeGRE)})
	LayerTypeICMPv4                      = gopacket.RegisterLayerType(19, gopacket.LayerTypeMetadata{Name: "ICMPv4", Decoder: gopacket.DecodeFunc(decodeICMPv4)})
	LayerTypeIPv4                        = gopacket.RegisterLayerType(20, gopacket.LayerTypeMetadata{Name: "IPv4", Decoder: gopacket.DecodeFunc(decodeIPv4)})
	LayerTypeIPv6                        = gopacket.RegisterLayerType(21, gopacket.LayerTypeMetadata{Name: "IPv6", Decoder: gopacket.DecodeFunc(decodeIPv6)})
	LayerTypeLLC                         = gopacket.RegisterLayerType(22, gopacket.LayerTypeMetadata{Name: "LLC", Decoder: gopacket.DecodeFunc(decodeLLC)})
	LayerTypeSNAP                        = gopacket.RegisterLayerType(23, gopacket.LayerTypeMetadata{Name: "SNAP", Decoder: gopacket.DecodeFunc(decodeSNAP)})
	LayerTypeMPLS                        = gopacket.RegisterLayerType(24, gopacket.LayerTypeMetadata{Name: "MPLS", Decoder: gopacket.DecodeFunc(decodeMPLS)})
	LayerTypePPP                         = gopacket.RegisterLayerType(25, gopacket.LayerTypeMetadata{Name: "PPP", Decoder: gopacket.DecodeFunc(decodePPP)})
	LayerTypePPPoE                       = gopacket.RegisterLayerType(26, gopacket.LayerTypeMetadata{Name: "PPPoE", Decoder: gopacket.DecodeFunc(decodePPPoE)})
	LayerTypeRUDP                        = gopacket.RegisterLayerType(27, gopacket.LayerTypeMetadata{Name: "RUDP", Decoder: gopacket.DecodeFunc(decodeRUDP)})
	LayerTypeSCTP                        = gopacket.RegisterLayerType(28, gopacket.LayerTypeMetadata{Name: "SCTP", Decoder: gopacket.DecodeFunc(decodeSCTP)})
	LayerTypeSCTPUnknownChunkType        = gopacket.RegisterLayerType(29, gopacket.LayerTypeMetadata{Name: "SCTPUnknownChunkType", Decoder: nil})
	LayerTypeSCTPData                    = gopacket.RegisterLayerType(30, gopacket.LayerTypeMetadata{Name: "SCTPData", Decoder: nil})
	LayerTypeSCTPInit                    = gopacket.RegisterLayerType(31, gopacket.LayerTypeMetadata{Name: "SCTPInit", Decoder: nil})
	LayerTypeSCTPSack                    = gopacket.RegisterLayerType(32, gopacket.LayerTypeMetadata{Name: "SCTPSack", Decoder: nil})
	LayerTypeSCTPHeartbeat               = gopacket.RegisterLayerType(33, gopacket.LayerTypeMetadata{Name: "SCTPHeartbeat", Decoder: nil})
	LayerTypeSCTPError                   = gopacket.RegisterLayerType(34, gopacket.LayerTypeMetadata{Name: "SCTPError", Decoder: nil})
	LayerTypeSCTPShutdown                = gopacket.RegisterLayerType(35, gopacket.LayerTypeMetadata{Name: "SCTPShutdown", Decoder: nil})
	LayerTypeSCTPShutdownAck             = gopacket.RegisterLayerType(36, gopacket.LayerTypeMetadata{Name: "SCTPShutdownAck", Decoder: nil})
	LayerTypeSCTPCookieEcho              = gopacket.RegisterLayerType(37, gopacket.LayerTypeMetadata{Name: "SCTPCookieEcho", Decoder: nil})
	LayerTypeSCTPEmptyLayer              = gopacket.RegisterLayerType(38, gopacket.LayerTypeMetadata{Name: "SCTPEmptyLayer", Decoder: nil})
	LayerTypeSCTPInitAck                 = gopacket.RegisterLayerType(39, gopacket.LayerTypeMetadata{Name: "SCTPInitAck", Decoder: nil})
	LayerTypeSCTPHeartbeatAck            = gopacket.RegisterLayerType(40, gopacket.LayerTypeMetadata{Name: "SCTPHeartbeatAck", Decoder: nil})
	LayerTypeSCTPAbort                   = gopacket.RegisterLayerType(41, gopacket.LayerTypeMetadata{Name: "SCTPAbort", Decoder: nil})
	LayerTypeSCTPShutdownComplete        = gopacket.RegisterLayerType(42, gopacket.LayerTypeMetadata{Name: "SCTPShutdownComplete", Decoder: nil})
	LayerTypeSCTPCookieAck               = gopacket.RegisterLayerType(43, gopacket.LayerTypeMetadata{Name: "SCTPCookieAck", Decoder: nil})
	LayerTypeTCP                         = gopacket.RegisterLayerType(44, gopacket.LayerTypeMetadata{Name: "TCP", Decoder: gopacket.DecodeFunc(decodeTCP)})
	LayerTypeUDP                         = gopacket.RegisterLayerType(45, gopacket.LayerTypeMetadata{Name: "UDP", Decoder: gopacket.DecodeFunc(decodeUDP)})
	LayerTypeIPv6HopByHop                = gopacket.RegisterLayerType(46, gopacket.LayerTypeMetadata{Name: "IPv6HopByHop", Decoder: gopacket.DecodeFunc(decodeIPv6HopByHop)})
	LayerTypeIPv6Routing                 = gopacket.RegisterLayerType(47, gopacket.LayerTypeMetadata{Name: "IPv6Routing", Decoder: gopacket.DecodeFunc(decodeIPv6Routing)})
	LayerTypeIPv6Fragment                = gopacket.RegisterLayerType(48, gopacket.LayerTypeMetadata{Name: "IPv6Fragment", Decoder: gopacket.DecodeFunc(decodeIPv6Fragment)})
	LayerTypeIPv6Destination             = gopacket.RegisterLayerType(49, gopacket.LayerTypeMetadata{Name: "IPv6Destination", Decoder: gopacket.DecodeFunc(decodeIPv6Destination)})
	LayerTypeIPSecAH                     = gopacket.RegisterLayerType(50, gopacket.LayerTypeMetadata{Name: "IPSecAH", Decoder: gopacket.DecodeFunc(decodeIPSecAH)})
	LayerTypeIPSecESP                    = gopacket.RegisterLayerType(51, gopacket.LayerTypeMetadata{Name: "IPSecESP", Decoder: gopacket.DecodeFunc(decodeIPSecESP)})
	LayerTypeUDPLite                     = gopacket.RegisterLayerType(52, gopacket.LayerTypeMetadata{Name: "UDPLite", Decoder: gopacket.DecodeFunc(decodeUDPLite)})
	LayerTypeFDDI                        = gopacket.RegisterLayerType(53, gopacket.LayerTypeMetadata{Name: "FDDI", Decoder: gopacket.DecodeFunc(decodeFDDI)})
	LayerTypeLoopback                    = gopacket.RegisterLayerType(54, gopacket.LayerTypeMetadata{Name: "Loopback", Decoder: gopacket.DecodeFunc(decodeLoopback)})
	LayerTypeEAP                         = gopacket.RegisterLayerType(55, gopacket.LayerTypeMetadata{Name: "EAP", Decoder: gopacket.DecodeFunc(decodeEAP)})
	LayerTypeEAPOL                       = gopacket.RegisterLayerType(56, gopacket.LayerTypeMetadata{Name: "EAPOL", Decoder: gopacket.DecodeFunc(decodeEAPOL)})
	LayerTypeICMPv6                      = gopacket.RegisterLayerType(57, gopacket.LayerTypeMetadata{Name: "ICMPv6", Decoder: gopacket.DecodeFunc(decodeICMPv6)})
	LayerTypeLinkLayerDiscovery          = gopacket.RegisterLayerType(58, gopacket.LayerTypeMetadata{Name: "LinkLayerDiscovery", Decoder: gopacket.DecodeFunc(decodeLinkLayerDiscovery)})
	LayerTypeCiscoDiscoveryInfo          = gopacket.RegisterLayerType(59, gopacket.LayerTypeMetadata{Name: "CiscoDiscoveryInfo", Decoder: gopacket.DecodeFunc(decodeCiscoDiscoveryInfo)})
	LayerTypeLinkLayerDiscoveryInfo      = gopacket.RegisterLayerType(60, gopacket.LayerTypeMetadata{Name: "LinkLayerDiscoveryInfo", Decoder: nil})
	LayerTypeNortelDiscovery             = gopacket.RegisterLayerType(61, gopacket.LayerTypeMetadata{Name: "NortelDiscovery", Decoder: gopacket.DecodeFunc(decodeNortelDiscovery)})
	LayerTypeIGMP                        = gopacket.RegisterLayerType(62, gopacket.LayerTypeMetadata{Name: "IGMP", Decoder: gopacket.DecodeFunc(decodeIGMP)})
	LayerTypePFLog                       = gopacket.RegisterLayerType(63, gopacket.LayerTypeMetadata{Name: "PFLog", Decoder: gopacket.DecodeFunc(decodePFLog)})
	LayerTypeRadioTap                    = gopacket.RegisterLayerType(64, gopacket.LayerTypeMetadata{Name: "RadioTap", Decoder: gopacket.DecodeFunc(decodeRadioTap)})
	LayerTypeDot11                       = gopacket.RegisterLayerType(65, gopacket.LayerTypeMetadata{Name: "Dot11", Decoder: gopacket.DecodeFunc(decodeDot11)})
	LayerTypeDot11Ctrl                   = gopacket.RegisterLayerType(66, gopacket.LayerTypeMetadata{Name: "Dot11Ctrl", Decoder: gopacket.DecodeFunc(decodeDot11Ctrl)})
	LayerTypeDot11Data                   = gopacket.RegisterLayerType(67, gopacket.LayerTypeMetadata{Name: "Dot11Data", Decoder: gopacket.DecodeFunc(decodeDot11Data)})
	LayerTypeDot11DataCFAck              = gopacket.RegisterLayerType(68, gopacket.LayerTypeMetadata{Name: "Dot11DataCFAck", Decoder: gopacket.DecodeFunc(decodeDot11DataCFAck)})
	LayerTypeDot11DataCFPoll             = gopacket.RegisterLayerType(69, gopacket.LayerTypeMetadata{Name: "Dot11DataCFPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataCFPoll)})
	LayerTypeDot11DataCFAckPoll          = gopacket.RegisterLayerType(70, gopacket.LayerTypeMetadata{Name: "Dot11DataCFAckPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataCFAckPoll)})
	LayerTypeDot11DataNull               = gopacket.RegisterLayerType(71, gopacket.LayerTypeMetadata{Name: "Dot11DataNull", Decoder: gopacket.DecodeFunc(decodeDot11DataNull)})
	LayerTypeDot11DataCFAckNoData        = gopacket.RegisterLayerType(72, gopacket.LayerTypeMetadata{Name: "Dot11DataCFAck", Decoder: gopacket.DecodeFunc(decodeDot11DataCFAck)})
	LayerTypeDot11DataCFPollNoData       = gopacket.RegisterLayerType(73, gopacket.LayerTypeMetadata{Name: "Dot11DataCFPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataCFPoll)})
	LayerTypeDot11DataCFAckPollNoData    = gopacket.RegisterLayerType(74, gopacket.LayerTypeMetadata{Name: "Dot11DataCFAckPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataCFAckPoll)})
	LayerTypeDot11DataQOSData            = gopacket.RegisterLayerType(75, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSData", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSData)})
	LayerTypeDot11DataQOSDataCFAck       = gopacket.RegisterLayerType(76, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSDataCFAck", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSDataCFAck)})
	LayerTypeDot11DataQOSDataCFPoll      = gopacket.RegisterLayerType(77, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSDataCFPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSDataCFPoll)})
	LayerTypeDot11DataQOSDataCFAckPoll   = gopacket.RegisterLayerType(78, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSDataCFAckPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSDataCFAckPoll)})
	LayerTypeDot11DataQOSNull            = gopacket.RegisterLayerType(79, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSNull", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSNull)})
	LayerTypeDot11DataQOSCFPollNoData    = gopacket.RegisterLayerType(80, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSCFPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSCFPollNoData)})
	LayerTypeDot11DataQOSCFAckPollNoData = gopacket.RegisterLayerType(81, gopacket.LayerTypeMetadata{Name: "Dot11DataQOSCFAckPoll", Decoder: gopacket.DecodeFunc(decodeDot11DataQOSCFAckPollNoData)})
	LayerTypeDot11InformationElement     = gopacket.RegisterLayerType(82, gopacket.LayerTypeMetadata{Name: "Dot11InformationElement", Decoder: gopacket.DecodeFunc(decodeDot11InformationElement)})
	LayerTypeDot11CtrlCTS                = gopacket.RegisterLayerType(83, gopacket.LayerTypeMetadata{Name: "Dot11CtrlCTS", Decoder: gopacket.DecodeFunc(decodeDot11CtrlCTS)})
	LayerTypeDot11CtrlRTS                = gopacket.RegisterLayerType(84, gopacket.LayerTypeMetadata{Name: "Dot11CtrlRTS", Decoder: gopacket.DecodeFunc(decodeDot11CtrlRTS)})
	LayerTypeDot11CtrlBlockAckReq        = gopacket.RegisterLayerType(85, gopacket.LayerTypeMetadata{Name: "Dot11CtrlBlockAckReq", Decoder: gopacket.DecodeFunc(decodeDot11CtrlBlockAckReq)})
	LayerTypeDot11CtrlBlockAck           = gopacket.RegisterLayerType(86, gopacket.LayerTypeMetadata{Name: "Dot11CtrlBlockAck", Decoder: gopacket.DecodeFunc(decodeDot11CtrlBlockAck)})
	LayerTypeDot11CtrlPowersavePoll      = gopacket.RegisterLayerType(87, gopacket.LayerTypeMetadata{Name: "Dot11CtrlPowersavePoll", Decoder: gopacket.DecodeFunc(decodeDot11CtrlPowersavePoll)})
	LayerTypeDot11CtrlAck                = gopacket.RegisterLayerType(88, gopacket.LayerTypeMetadata{Name: "Dot11CtrlAck", Decoder: gopacket.DecodeFunc(decodeDot11CtrlAck)})
	LayerTypeDot11CtrlCFEnd              = gopacket.RegisterLayerType(89, gopacket.LayerTypeMetadata{Name: "Dot11CtrlCFEnd", Decoder: gopacket.DecodeFunc(decodeDot11CtrlCFEnd)})
	LayerTypeDot11CtrlCFEndAck           = gopacket.RegisterLayerType(90, gopacket.LayerTypeMetadata{Name: "Dot11CtrlCFEndAck", Decoder: gopacket.DecodeFunc(decodeDot11CtrlCFEndAck)})
	LayerTypeDot11MgmtAssociationReq     = gopacket.RegisterLayerType(91, gopacket.LayerTypeMetadata{Name: "Dot11MgmtAssociationReq", Decoder: gopacket.DecodeFunc(decodeDot11MgmtAssociationReq)})
	LayerTypeDot11MgmtAssociationResp    = gopacket.RegisterLayerType(92, gopacket.LayerTypeMetadata{Name: "Dot11MgmtAssociationResp", Decoder: gopacket.DecodeFunc(decodeDot11MgmtAssociationResp)})
	LayerTypeDot11MgmtReassociationReq   = gopacket.RegisterLayerType(93, gopacket.LayerTypeMetadata{Name: "Dot11MgmtReassociationReq", Decoder: gopacket.DecodeFunc(decodeDot11MgmtReassociationReq)})
	LayerTypeDot11MgmtReassociationResp  = gopacket.RegisterLayerType(94, gopacket.LayerTypeMetadata{Name: "Dot11MgmtReassociationResp", Decoder: gopacket.DecodeFunc(decodeDot11MgmtReassociationResp)})
	LayerTypeDot11MgmtProbeReq           = gopacket.RegisterLayerType(95, gopacket.LayerTypeMetadata{Name: "Dot11MgmtProbeReq", Decoder: gopacket.DecodeFunc(decodeDot11MgmtProbeReq)})
	LayerTypeDot11MgmtProbeResp          = gopacket.RegisterLayerType(96, gopacket.LayerTypeMetadata{Name: "Dot11MgmtProbeResp", Decoder: gopacket.DecodeFunc(decodeDot11MgmtProbeResp)})
	LayerTypeDot11MgmtMeasurementPilot   = gopacket.RegisterLayerType(97, gopacket.LayerTypeMetadata{Name: "Dot11MgmtMeasurementPilot", Decoder: gopacket.DecodeFunc(decodeDot11MgmtMeasurementPilot)})
	LayerTypeDot11MgmtBeacon             = gopacket.RegisterLayerType(98, gopacket.LayerTypeMetadata{Name: "Dot11MgmtBeacon", Decoder: gopacket.DecodeFunc(decodeDot11MgmtBeacon)})
	LayerTypeDot11MgmtATIM               = gopacket.RegisterLayerType(99, gopacket.LayerTypeMetadata{Name: "Dot11MgmtATIM", Decoder: gopacket.DecodeFunc(decodeDot11MgmtATIM)})
	LayerTypeDot11MgmtDisassociation     = gopacket.RegisterLayerType(100, gopacket.LayerTypeMetadata{Name: "Dot11MgmtDisassociation", Decoder: gopacket.DecodeFunc(decodeDot11MgmtDisassociation)})
	LayerTypeDot11MgmtAuthentication     = gopacket.RegisterLayerType(101, gopacket.LayerTypeMetadata{Name: "Dot11MgmtAuthentication", Decoder: gopacket.DecodeFunc(decodeDot11MgmtAuthentication)})
	LayerTypeDot11MgmtDeauthentication   = gopacket.RegisterLayerType(102, gopacket.LayerTypeMetadata{Name: "Dot11MgmtDeauthentication", Decoder: gopacket.DecodeFunc(decodeDot11MgmtDeauthentication)})
	LayerTypeDot11MgmtAction             = gopacket.RegisterLayerType(103, gopacket.LayerTypeMetadata{Name: "Dot11MgmtAction", Decoder: gopacket.DecodeFunc(decodeDot11MgmtAction)})
	LayerTypeDot11MgmtActionNoAck        = gopacket.RegisterLayerType(104, gopacket.LayerTypeMetadata{Name: "Dot11MgmtActionNoAck", Decoder: gopacket.DecodeFunc(decodeDot11MgmtActionNoAck)})
	LayerTypeDot11MgmtArubaWLAN          = gopacket.RegisterLayerType(105, gopacket.LayerTypeMetadata{Name: "Dot11MgmtArubaWLAN", Decoder: gopacket.DecodeFunc(decodeDot11MgmtArubaWLAN)})
	LayerTypeDot11WEP                    = gopacket.RegisterLayerType(106, gopacket.LayerTypeMetadata{Name: "Dot11WEP", Decoder: gopacket.DecodeFunc(decodeDot11WEP)})
	LayerTypeDNS                         = gopacket.RegisterLayerType(107, gopacket.LayerTypeMetadata{Name: "DNS", Decoder: gopacket.DecodeFunc(decodeDNS)})
	LayerTypeUSB                         = gopacket.RegisterLayerType(108, gopacket.LayerTypeMetadata{Name: "USB", Decoder: gopacket.DecodeFunc(decodeUSB)})
	LayerTypeUSBRequestBlockSetup        = gopacket.RegisterLayerType(109, gopacket.LayerTypeMetadata{Name: "USBRequestBlockSetup", Decoder: gopacket.DecodeFunc(decodeUSBRequestBlockSetup)})
	LayerTypeUSBControl                  = gopacket.RegisterLayerType(110, gopacket.LayerTypeMetadata{Name: "USBControl", Decoder: gopacket.DecodeFunc(decodeUSBControl)})
	LayerTypeUSBInterrupt                = gopacket.RegisterLayerType(111, gopacket.LayerTypeMetadata{Name: "USBInterrupt", Decoder: gopacket.DecodeFunc(decodeUSBInterrupt)})
	LayerTypeUSBBulk                     = gopacket.RegisterLayerType(112, gopacket.LayerTypeMetadata{Name: "USBBulk", Decoder: gopacket.DecodeFunc(decodeUSBBulk)})
	LayerTypeLinuxSLL                    = gopacket.RegisterLayerType(113, gopacket.LayerTypeMetadata{Name: "Linux SLL", Decoder: gopacket.DecodeFunc(decodeLinuxSLL)})
	LayerTypeSFlow                       = gopacket.RegisterLayerType(114, gopacket.LayerTypeMetadata{Name: "SFlow", Decoder: gopacket.DecodeFunc(decodeSFlow)})
	LayerTypePrismHeader                 = gopacket.RegisterLayerType(115, gopacket.LayerTypeMetadata{Name: "Prism monitor mode header", Decoder: gopacket.DecodeFunc(decodePrismHeader)})
	LayerTypeVXLAN                       = gopacket.RegisterLayerType(116, gopacket.LayerTypeMetadata{Name: "VXLAN", Decoder: gopacket.DecodeFunc(decodeVXLAN)})
	LayerTypeNTP                         = gopacket.RegisterLayerType(117, gopacket.LayerTypeMetadata{Name: "NTP", Decoder: gopacket.DecodeFunc(decodeNTP)})
	LayerTypeDHCPv4                      = gopacket.RegisterLayerType(118, gopacket.LayerTypeMetadata{Name: "DHCPv4", Decoder: gopacket.DecodeFunc(decodeDHCPv4)})
	LayerTypeVRRP                        = gopacket.RegisterLayerType(119, gopacket.LayerTypeMetadata{Name: "VRRP", Decoder: gopacket.DecodeFunc(decodeVRRP)})
)
View Source
var (
	// LayerClassIPNetwork contains TCP/IP network layer types.
	LayerClassIPNetwork = gopacket.NewLayerClass([]gopacket.LayerType{
		LayerTypeIPv4,
		LayerTypeIPv6,
	})
	// LayerClassIPTransport contains TCP/IP transport layer types.
	LayerClassIPTransport = gopacket.NewLayerClass([]gopacket.LayerType{
		LayerTypeTCP,
		LayerTypeUDP,
		LayerTypeSCTP,
	})
	// LayerClassIPControl contains TCP/IP control protocols.
	LayerClassIPControl = gopacket.NewLayerClass([]gopacket.LayerType{
		LayerTypeICMPv4,
		LayerTypeICMPv6,
	})
	// LayerClassSCTPChunk contains SCTP chunk types (not the top-level SCTP
	// layer).
	LayerClassSCTPChunk = gopacket.NewLayerClass([]gopacket.LayerType{
		LayerTypeSCTPUnknownChunkType,
		LayerTypeSCTPData,
		LayerTypeSCTPInit,
		LayerTypeSCTPSack,
		LayerTypeSCTPHeartbeat,
		LayerTypeSCTPError,
		LayerTypeSCTPShutdown,
		LayerTypeSCTPShutdownAck,
		LayerTypeSCTPCookieEcho,
		LayerTypeSCTPEmptyLayer,
		LayerTypeSCTPInitAck,
		LayerTypeSCTPHeartbeatAck,
		LayerTypeSCTPAbort,
		LayerTypeSCTPShutdownComplete,
		LayerTypeSCTPCookieAck,
	})
	// LayerClassIPv6Extension contains IPv6 extension headers.
	LayerClassIPv6Extension = gopacket.NewLayerClass([]gopacket.LayerType{
		LayerTypeIPv6HopByHop,
		LayerTypeIPv6Routing,
		LayerTypeIPv6Fragment,
		LayerTypeIPv6Destination,
	})
	LayerClassIPSec = gopacket.NewLayerClass([]gopacket.LayerType{
		LayerTypeIPSecAH,
		LayerTypeIPSecESP,
	})
)
View Source
var DHCPMagic uint32 = 0x63825363

DHCPMagic is the RFC 2131 "magic cooke" for DHCP.

View Source
var ErrPrismExpectedMoreData = errors.New("Expected more data.")
View Source
var ErrPrismInvalidCode = errors.New("Invalid header code.")
View Source
var EthernetBroadcast = net.HardwareAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}

EthernetBroadcast is the broadcast MAC address used by Ethernet.

MPLSPayloadDecoder is the decoder used to data encapsulated by each MPLS layer. MPLS contains no type information, so we have to explicitly decide which decoder to use. This is initially set to ProtocolGuessingDecoder, our simple attempt at guessing protocols based on the first few bytes of data available to us. However, if you know that in your environment MPLS always encapsulates a specific protocol, you may reset this.

PPPEndpoint is a singleton endpoint for PPP. Since there is no actual addressing for the two ends of a PPP connection, we use a singleton value named 'point' for each endpoint.

PPPFlow is a singleton flow for PPP. Since there is no actual addressing for the two ends of a PPP connection, we use a singleton value to represent the flow for all PPP connections.

View Source
var RUDPPortNames = map[RUDPPort]string{}

RUDPPortNames contains the string names for all RUDP ports.

View Source
var SCTPPortNames = sctpPortNames

SCTPPortNames contains the port names for all SCTP ports.

View Source
var TCPPortNames = tcpPortNames

TCPPortNames contains the port names for all TCP ports.

View Source
var UDPLitePortNames = map[UDPLitePort]string{}

UDPLitePortNames contains the string names for all UDPLite ports.

View Source
var UDPPortNames = udpPortNames

UDPPortNames contains the port names for all UDP ports.

Functions

func NewIPEndpoint

func NewIPEndpoint(a net.IP) gopacket.Endpoint

NewIPEndpoint creates a new IP (v4 or v6) endpoint from a net.IP address. It returns gopacket.InvalidEndpoint if the IP address is invalid.

func NewMACEndpoint

func NewMACEndpoint(a net.HardwareAddr) gopacket.Endpoint

NewMACEndpoint returns a new MAC address endpoint.

func NewRUDPPortEndpoint

func NewRUDPPortEndpoint(p RUDPPort) gopacket.Endpoint

NewRUDPPortEndpoint returns an endpoint based on a RUDP port.

func NewSCTPPortEndpoint

func NewSCTPPortEndpoint(p SCTPPort) gopacket.Endpoint

NewSCTPPortEndpoint returns an endpoint based on a SCTP port.

func NewTCPPortEndpoint

func NewTCPPortEndpoint(p TCPPort) gopacket.Endpoint

NewTCPPortEndpoint returns an endpoint based on a TCP port.

func NewUDPLitePortEndpoint

func NewUDPLitePortEndpoint(p UDPLitePort) gopacket.Endpoint

NewUDPLitePortEndpoint returns an endpoint based on a UDPLite port.

func NewUDPPortEndpoint

func NewUDPPortEndpoint(p UDPPort) gopacket.Endpoint

NewUDPPortEndpoint returns an endpoint based on a UDP port.

Types

type ARP

type ARP struct {
	BaseLayer
	AddrType          LinkType
	Protocol          EthernetType
	HwAddressSize     uint8
	ProtAddressSize   uint8
	Operation         uint16
	SourceHwAddress   []byte
	SourceProtAddress []byte
	DstHwAddress      []byte
	DstProtAddress    []byte
}

ARP is a ARP packet header.

func (*ARP) CanDecode

func (arp *ARP) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*ARP) DecodeFromBytes

func (arp *ARP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*ARP) LayerType

func (arp *ARP) LayerType() gopacket.LayerType

LayerType returns LayerTypeARP

func (*ARP) NextLayerType

func (arp *ARP) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

func (*ARP) SerializeTo added in v1.0.1

func (arp *ARP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

type BaseLayer

type BaseLayer struct {
	// Contents is the set of bytes that make up this layer.  IE: for an
	// Ethernet packet, this would be the set of bytes making up the
	// Ethernet frame.
	Contents []byte
	// Payload is the set of bytes contained by (but not part of) this
	// Layer.  Again, to take Ethernet as an example, this would be the
	// set of bytes encapsulated by the Ethernet protocol.
	Payload []byte
}

BaseLayer is a convenience struct which implements the LayerData and LayerPayload functions of the Layer interface.

func (*BaseLayer) LayerContents

func (b *BaseLayer) LayerContents() []byte

LayerContents returns the bytes of the packet layer.

func (*BaseLayer) LayerPayload

func (b *BaseLayer) LayerPayload() []byte

LayerPayload returns the bytes contained within the packet layer.

type CDPAddressType

type CDPAddressType uint64
const (
	CDPAddressTypeCLNP      CDPAddressType = 0x81
	CDPAddressTypeIPV4      CDPAddressType = 0xcc
	CDPAddressTypeIPV6      CDPAddressType = 0xaaaa030000000800
	CDPAddressTypeDECNET    CDPAddressType = 0xaaaa030000006003
	CDPAddressTypeAPPLETALK CDPAddressType = 0xaaaa03000000809b
	CDPAddressTypeIPX       CDPAddressType = 0xaaaa030000008137
	CDPAddressTypeVINES     CDPAddressType = 0xaaaa0300000080c4
	CDPAddressTypeXNS       CDPAddressType = 0xaaaa030000000600
	CDPAddressTypeAPOLLO    CDPAddressType = 0xaaaa030000008019
)

CDP Address types.

func (CDPAddressType) String

func (a CDPAddressType) String() (s string)

type CDPCapabilities

type CDPCapabilities struct {
	L3Router        bool
	TBBridge        bool
	SPBridge        bool
	L2Switch        bool
	IsHost          bool
	IGMPFilter      bool
	L1Repeater      bool
	IsPhone         bool
	RemotelyManaged bool
}

CDPCapabilities represents the capabilities of a device

type CDPCapability

type CDPCapability uint32
const (
	CDPCapMaskRouter     CDPCapability = 0x0001
	CDPCapMaskTBBridge   CDPCapability = 0x0002
	CDPCapMaskSPBridge   CDPCapability = 0x0004
	CDPCapMaskSwitch     CDPCapability = 0x0008
	CDPCapMaskHost       CDPCapability = 0x0010
	CDPCapMaskIGMPFilter CDPCapability = 0x0020
	CDPCapMaskRepeater   CDPCapability = 0x0040
	CDPCapMaskPhone      CDPCapability = 0x0080
	CDPCapMaskRemote     CDPCapability = 0x0100
)

type CDPEnergyWise

type CDPEnergyWise struct {
	EncryptedData  []byte
	Unknown1       uint32
	SequenceNumber uint32
	ModelNumber    string
	Unknown2       uint16
	HardwareID     string
	SerialNum      string
	Unknown3       []byte
	Role           string
	Domain         string
	Name           string
	ReplyUnknown1  []byte
	ReplyPort      []byte
	ReplyAddress   []byte
	ReplyUnknown2  []byte
	ReplyUnknown3  []byte
}

type CDPEnergyWiseSubtype

type CDPEnergyWiseSubtype uint32
const (
	CDPEnergyWiseRole    CDPEnergyWiseSubtype = 0x00000007
	CDPEnergyWiseDomain  CDPEnergyWiseSubtype = 0x00000008
	CDPEnergyWiseName    CDPEnergyWiseSubtype = 0x00000009
	CDPEnergyWiseReplyTo CDPEnergyWiseSubtype = 0x00000017
)

func (CDPEnergyWiseSubtype) String

func (t CDPEnergyWiseSubtype) String() (s string)

type CDPHello

type CDPHello struct {
	OUI              []byte
	ProtocolID       uint16
	ClusterMaster    net.IP
	Unknown1         net.IP
	Version          byte
	SubVersion       byte
	Status           byte
	Unknown2         byte
	ClusterCommander net.HardwareAddr
	SwitchMAC        net.HardwareAddr
	Unknown3         byte
	ManagementVLAN   uint16
}

CDPHello is a Cisco Hello message (undocumented, hence the "Unknown" fields)

type CDPLocation

type CDPLocation struct {
	Type     uint8 // Undocumented
	Location string
}

type CDPPowerDialogue

type CDPPowerDialogue struct {
	ID     uint16
	MgmtID uint16
	Values []uint32
}

CDPPowerDialogue encapsulates a Power Query/Reply

type CDPSparePairPoE

type CDPSparePairPoE struct {
	PSEFourWire  bool // Supported / Not supported
	PDArchShared bool // Shared / Independent
	PDRequestOn  bool // On / Off
	PSEOn        bool // On / Off
}

type CDPTLVType

type CDPTLVType uint16

CDPTLVType is the type of each TLV value in a CiscoDiscovery packet.

const (
	CDPTLVDevID              CDPTLVType = 0x0001
	CDPTLVAddress            CDPTLVType = 0x0002
	CDPTLVPortID             CDPTLVType = 0x0003
	CDPTLVCapabilities       CDPTLVType = 0x0004
	CDPTLVVersion            CDPTLVType = 0x0005
	CDPTLVPlatform           CDPTLVType = 0x0006
	CDPTLVIPPrefix           CDPTLVType = 0x0007
	CDPTLVHello              CDPTLVType = 0x0008
	CDPTLVVTPDomain          CDPTLVType = 0x0009
	CDPTLVNativeVLAN         CDPTLVType = 0x000a
	CDPTLVFullDuplex         CDPTLVType = 0x000b
	CDPTLVVLANReply          CDPTLVType = 0x000e
	CDPTLVVLANQuery          CDPTLVType = 0x000f
	CDPTLVPower              CDPTLVType = 0x0010
	CDPTLVMTU                CDPTLVType = 0x0011
	CDPTLVExtendedTrust      CDPTLVType = 0x0012
	CDPTLVUntrustedCOS       CDPTLVType = 0x0013
	CDPTLVSysName            CDPTLVType = 0x0014
	CDPTLVSysOID             CDPTLVType = 0x0015
	CDPTLVMgmtAddresses      CDPTLVType = 0x0016
	CDPTLVLocation           CDPTLVType = 0x0017
	CDPTLVExternalPortID     CDPTLVType = 0x0018
	CDPTLVPowerRequested     CDPTLVType = 0x0019
	CDPTLVPowerAvailable     CDPTLVType = 0x001a
	CDPTLVPortUnidirectional CDPTLVType = 0x001b
	CDPTLVEnergyWise         CDPTLVType = 0x001d
	CDPTLVSparePairPOE       CDPTLVType = 0x001f
)

func (CDPTLVType) String

func (t CDPTLVType) String() (s string)

type CDPVLANDialogue

type CDPVLANDialogue struct {
	ID   uint8
	VLAN uint16
}

CDPVLANDialogue encapsulates a VLAN Query/Reply

type CiscoDiscovery

type CiscoDiscovery struct {
	BaseLayer
	Version  byte
	TTL      byte
	Checksum uint16
	Values   []CiscoDiscoveryValue
}

CiscoDiscovery is a packet layer containing the Cisco Discovery Protocol. See http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm#31885

func (*CiscoDiscovery) LayerType

func (c *CiscoDiscovery) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeCiscoDiscovery.

type CiscoDiscoveryInfo

type CiscoDiscoveryInfo struct {
	BaseLayer
	CDPHello
	DeviceID         string
	Addresses        []net.IP
	PortID           string
	Capabilities     CDPCapabilities
	Version          string
	Platform         string
	IPPrefixes       []net.IPNet
	VTPDomain        string
	NativeVLAN       uint16
	FullDuplex       bool
	VLANReply        CDPVLANDialogue
	VLANQuery        CDPVLANDialogue
	PowerConsumption uint16
	MTU              uint32
	ExtendedTrust    uint8
	UntrustedCOS     uint8
	SysName          string
	SysOID           string
	MgmtAddresses    []net.IP
	Location         CDPLocation
	PowerRequest     CDPPowerDialogue
	PowerAvailable   CDPPowerDialogue
	SparePairPoe     CDPSparePairPoE
	EnergyWise       CDPEnergyWise
	Unknown          []CiscoDiscoveryValue
}

CiscoDiscoveryInfo represents the decoded details for a set of CiscoDiscoveryValues

func (*CiscoDiscoveryInfo) LayerType

func (c *CiscoDiscoveryInfo) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeCiscoDiscoveryInfo.

type CiscoDiscoveryValue

type CiscoDiscoveryValue struct {
	Type   CDPTLVType
	Length uint16
	Value  []byte
}

CiscoDiscoveryValue is a TLV value inside a CiscoDiscovery packet layer.

type DHCPMsgType added in v1.1.12

type DHCPMsgType byte

DHCPMsgType represents a DHCP operation

const (
	DHCPMsgTypeUnspecified DHCPMsgType = iota
	DHCPMsgTypeDiscover
	DHCPMsgTypeOffer
	DHCPMsgTypeRequest
	DHCPMsgTypeDecline
	DHCPMsgTypeAck
	DHCPMsgTypeNak
	DHCPMsgTypeRelease
	DHCPMsgTypeInform
)

Constants that represent DHCP operations

func (DHCPMsgType) String added in v1.1.12

func (o DHCPMsgType) String() string

String returns a string version of a DHCPMsgType.

type DHCPOp added in v1.1.12

type DHCPOp byte

DHCPOp rerprents a bootp operation

const (
	DHCPOpRequest DHCPOp = 1
	DHCPOpReply   DHCPOp = 2
)

bootp operations

func (DHCPOp) String added in v1.1.12

func (o DHCPOp) String() string

String returns a string version of a DHCPOp.

type DHCPOpt added in v1.1.12

type DHCPOpt byte

DHCPOpt represents a DHCP option or parameter from RFC-2132

const (
	DHCPOptPad                   DHCPOpt = 0
	DHCPOptSubnetMask            DHCPOpt = 1   // 4, net.IP
	DHCPOptTimeOffset            DHCPOpt = 2   // 4, int32 (signed seconds from UTC)
	DHCPOptRouter                DHCPOpt = 3   // n*4, [n]net.IP
	DHCPOptTimeServer            DHCPOpt = 4   // n*4, [n]net.IP
	DHCPOptNameServer            DHCPOpt = 5   // n*4, [n]net.IP
	DHCPOptDNS                   DHCPOpt = 6   // n*4, [n]net.IP
	DHCPOptLogServer             DHCPOpt = 7   // n*4, [n]net.IP
	DHCPOptCookieServer          DHCPOpt = 8   // n*4, [n]net.IP
	DHCPOptLPRServer             DHCPOpt = 9   // n*4, [n]net.IP
	DHCPOptImpressServer         DHCPOpt = 10  // n*4, [n]net.IP
	DHCPOptResLocServer          DHCPOpt = 11  // n*4, [n]net.IP
	DHCPOptHostname              DHCPOpt = 12  // n, string
	DHCPOptBootfileSize          DHCPOpt = 13  // 2, uint16
	DHCPOptMeritDumpFile         DHCPOpt = 14  // >1, string
	DHCPOptDomainName            DHCPOpt = 15  // n, string
	DHCPOptSwapServer            DHCPOpt = 16  // n*4, [n]net.IP
	DHCPOptRootPath              DHCPOpt = 17  // n, string
	DHCPOptExtensionsPath        DHCPOpt = 18  // n, string
	DHCPOptIPForwarding          DHCPOpt = 19  // 1, bool
	DHCPOptSourceRouting         DHCPOpt = 20  // 1, bool
	DHCPOptPolicyFilter          DHCPOpt = 21  // 8*n, [n]{net.IP/net.IP}
	DHCPOptDatagramMTU           DHCPOpt = 22  // 2, uint16
	DHCPOptDefaultTTL            DHCPOpt = 23  // 1, byte
	DHCPOptPathMTUAgingTimeout   DHCPOpt = 24  // 4, uint32
	DHCPOptPathPlateuTableOption DHCPOpt = 25  // 2*n, []uint16
	DHCPOptInterfaceMTU          DHCPOpt = 26  // 2, uint16
	DHCPOptAllSubsLocal          DHCPOpt = 27  // 1, bool
	DHCPOptBroadcastAddr         DHCPOpt = 28  // 4, net.IP
	DHCPOptMaskDiscovery         DHCPOpt = 29  // 1, bool
	DHCPOptMaskSupplier          DHCPOpt = 30  // 1, bool
	DHCPOptRouterDiscovery       DHCPOpt = 31  // 1, bool
	DHCPOptSolicitAddr           DHCPOpt = 32  // 4, net.IP
	DHCPOptStaticRoute           DHCPOpt = 33  // n*8, [n]{net.IP/net.IP} -- note the 2nd is router not mask
	DHCPOptARPTrailers           DHCPOpt = 34  // 1, bool
	DHCPOptARPTimeout            DHCPOpt = 35  // 4, uint32
	DHCPOptEthernetEncap         DHCPOpt = 36  // 1, bool
	DHCPOptTCPTTL                DHCPOpt = 37  // 1, byte
	DHCPOptTCPKeepAliveInt       DHCPOpt = 38  // 4, uint32
	DHCPOptTCPKeepAliveGarbage   DHCPOpt = 39  // 1, bool
	DHCPOptNISDomain             DHCPOpt = 40  // n, string
	DHCPOptNISServers            DHCPOpt = 41  // 4*n,  [n]net.IP
	DHCPOptNTPServers            DHCPOpt = 42  // 4*n, [n]net.IP
	DHCPOptVendorOption          DHCPOpt = 43  // n, [n]byte // may be encapsulated.
	DHCPOptNetBIOSTCPNS          DHCPOpt = 44  // 4*n, [n]net.IP
	DHCPOptNetBIOSTCPDDS         DHCPOpt = 45  // 4*n, [n]net.IP
	DHCPOptNETBIOSTCPNodeType    DHCPOpt = 46  // 1, magic byte
	DHCPOptNetBIOSTCPScope       DHCPOpt = 47  // n, string
	DHCPOptXFontServer           DHCPOpt = 48  // n, string
	DHCPOptXDisplayManager       DHCPOpt = 49  // n, string
	DHCPOptRequestIP             DHCPOpt = 50  // 4, net.IP
	DHCPOptLeaseTime             DHCPOpt = 51  // 4, uint32
	DHCPOptExtOptions            DHCPOpt = 52  // 1, 1/2/3
	DHCPOptMessageType           DHCPOpt = 53  // 1, 1-7
	DHCPOptServerID              DHCPOpt = 54  // 4, net.IP
	DHCPOptParamsRequest         DHCPOpt = 55  // n, []byte
	DHCPOptMessage               DHCPOpt = 56  // n, 3
	DHCPOptMaxMessageSize        DHCPOpt = 57  // 2, uint16
	DHCPOptT1                    DHCPOpt = 58  // 4, uint32
	DHCPOptT2                    DHCPOpt = 59  // 4, uint32
	DHCPOptClassID               DHCPOpt = 60  // n, []byte
	DHCPOptClientID              DHCPOpt = 61  // n >=  2, []byte
	DHCPOptDomainSearch          DHCPOpt = 119 // n, string
	DHCPOptSIPServers            DHCPOpt = 120 // n, url
	DHCPOptClasslessStaticRoute  DHCPOpt = 121 //
	DHCPOptEnd                   DHCPOpt = 255
)

Constants for the DHCPOpt options.

func (DHCPOpt) String added in v1.1.12

func (o DHCPOpt) String() string

String returns a string version of a DHCPOpt.

type DHCPOption added in v1.1.12

type DHCPOption struct {
	Type   DHCPOpt
	Length uint8
	Data   []byte
}

DHCPOption rerpresents a DHCP option.

func NewDHCPOption added in v1.1.12

func NewDHCPOption(t DHCPOpt, data []byte) DHCPOption

NewDHCPOption constructs a new DHCPOption with a given type and data.

func (DHCPOption) String added in v1.1.12

func (o DHCPOption) String() string

String returns a string version of a DHCP Option.

type DHCPOptions added in v1.1.12

type DHCPOptions []DHCPOption

DHCPOptions is used to get nicely printed option lists which would normally be cut off after 5 options.

func (DHCPOptions) String added in v1.1.12

func (o DHCPOptions) String() string

String returns a string version of the options list.

type DHCPv4 added in v1.1.12

type DHCPv4 struct {
	BaseLayer
	Operation    DHCPOp
	HardwareType LinkType
	HardwareLen  uint8
	HardwareOpts uint8
	Xid          uint32
	Secs         uint16
	Flags        uint16
	ClientIP     net.IP
	YourClientIP net.IP
	NextServerIP net.IP
	RelayAgentIP net.IP
	ClientHWAddr net.HardwareAddr
	ServerName   []byte
	File         []byte
	Options      DHCPOptions
}

DHCPv4 contains data for a single DHCP packet.

func (*DHCPv4) CanDecode added in v1.1.12

func (d *DHCPv4) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*DHCPv4) DecodeFromBytes added in v1.1.12

func (d *DHCPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*DHCPv4) LayerType added in v1.1.12

func (d *DHCPv4) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeDHCPv4

func (*DHCPv4) Len added in v1.1.12

func (d *DHCPv4) Len() uint16

Len returns the length of a DHCPv4 packet.

func (*DHCPv4) NextLayerType added in v1.1.12

func (d *DHCPv4) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

func (*DHCPv4) SerializeTo added in v1.1.12

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

type DNS added in v1.1.7

type DNS struct {
	BaseLayer

	// Header fields
	ID     uint16
	QR     bool
	OpCode DNSOpCode

	AA bool  // Authoritative answer
	TC bool  // Truncated
	RD bool  // Recursion desired
	RA bool  // Recursion available
	Z  uint8 // Resrved for future use

	ResponseCode DNSResponseCode
	QDCount      uint16 // Number of questions to expect
	ANCount      uint16 // Number of answers to expect
	NSCount      uint16 // Number of authorities to expect
	ARCount      uint16 // Number of additional records to expect

	// Entries
	Questions   []DNSQuestion
	Answers     []DNSResourceRecord
	Authorities []DNSResourceRecord
	Additionals []DNSResourceRecord
	// contains filtered or unexported fields
}

DNS contains data from a single Domain Name Service packet.

func (*DNS) CanDecode added in v1.1.7

func (d *DNS) CanDecode() gopacket.LayerClass

func (*DNS) DecodeFromBytes added in v1.1.7

func (d *DNS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the slice into the DNS struct.

func (*DNS) LayerType added in v1.1.7

func (d *DNS) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeDNS.

func (*DNS) NextLayerType added in v1.1.7

func (d *DNS) NextLayerType() gopacket.LayerType

func (*DNS) Payload added in v1.1.7

func (d *DNS) Payload() []byte

func (*DNS) SerializeTo added in v1.1.12

func (d *DNS) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.

type DNSClass added in v1.1.7

type DNSClass uint16
const (
	DNSClassIN  DNSClass = 1   // Internet
	DNSClassCS  DNSClass = 2   // the CSNET class (Obsolete)
	DNSClassCH  DNSClass = 3   // the CHAOS class
	DNSClassHS  DNSClass = 4   // Hesiod [Dyer 87]
	DNSClassAny DNSClass = 255 // AnyClass
)

type DNSMX added in v1.1.7

type DNSMX struct {
	Preference uint16
	Name       []byte
}

type DNSOpCode added in v1.1.7

type DNSOpCode uint8
const (
	DNSOpCodeQuery  DNSOpCode = 0 // Query                  [RFC1035]
	DNSOpCodeIQuery DNSOpCode = 1 // Inverse Query Obsolete [RFC3425]
	DNSOpCodeStatus DNSOpCode = 2 // Status                 [RFC1035]
	DNSOpCodeNotify DNSOpCode = 4 // Notify                 [RFC1996]
	DNSOpCodeUpdate DNSOpCode = 5 // Update                 [RFC2136]
)

type DNSQuestion added in v1.1.7

type DNSQuestion struct {
	Name  []byte
	Type  DNSType
	Class DNSClass
}

type DNSResourceRecord added in v1.1.7

type DNSResourceRecord struct {
	// Header
	Name  []byte
	Type  DNSType
	Class DNSClass
	TTL   uint32

	// RDATA Raw Values
	DataLength uint16
	Data       []byte

	// RDATA Decoded Values
	IP             net.IP
	NS, CNAME, PTR []byte
	TXTs           [][]byte
	SOA            DNSSOA
	SRV            DNSSRV
	MX             DNSMX

	// Undecoded TXT for backward compatibility
	TXT []byte
}

func (*DNSResourceRecord) String added in v1.1.7

func (rr *DNSResourceRecord) String() string

type DNSResponseCode added in v1.1.7

type DNSResponseCode uint8
const (
	DNSResponseCodeNoErr    DNSResponseCode = 0  // No error
	DNSResponseCodeFormErr  DNSResponseCode = 1  // Format Error                       [RFC1035]
	DNSResponseCodeServFail DNSResponseCode = 2  // Server Failure                     [RFC1035]
	DNSResponseCodeNXDomain DNSResponseCode = 3  // Non-Existent Domain                [RFC1035]
	DNSResponseCodeNotImp   DNSResponseCode = 4  // Not Implemented                    [RFC1035]
	DNSResponseCodeRefused  DNSResponseCode = 5  // Query Refused                      [RFC1035]
	DNSResponseCodeYXDomain DNSResponseCode = 6  // Name Exists when it should not     [RFC2136]
	DNSResponseCodeYXRRSet  DNSResponseCode = 7  // RR Set Exists when it should not   [RFC2136]
	DNSResponseCodeNXRRSet  DNSResponseCode = 8  // RR Set that should exist does not  [RFC2136]
	DNSResponseCodeNotAuth  DNSResponseCode = 9  // Server Not Authoritative for zone  [RFC2136]
	DNSResponseCodeNotZone  DNSResponseCode = 10 // Name not contained in zone         [RFC2136]
	DNSResponseCodeBadVers  DNSResponseCode = 16 // Bad OPT Version                    [RFC2671]
	DNSResponseCodeBadSig   DNSResponseCode = 16 // TSIG Signature Failure             [RFC2845]
	DNSResponseCodeBadKey   DNSResponseCode = 17 // Key not recognized                 [RFC2845]
	DNSResponseCodeBadTime  DNSResponseCode = 18 // Signature out of time window       [RFC2845]
	DNSResponseCodeBadMode  DNSResponseCode = 19 // Bad TKEY Mode                      [RFC2930]
	DNSResponseCodeBadName  DNSResponseCode = 20 // Duplicate key name                 [RFC2930]
	DNSResponseCodeBadAlg   DNSResponseCode = 21 // Algorithm not supported            [RFC2930]
	DNSResponseCodeBadTruc  DNSResponseCode = 22 // Bad Truncation                     [RFC4635]
)

func (DNSResponseCode) String added in v1.1.7

func (drc DNSResponseCode) String() string

type DNSSOA added in v1.1.7

type DNSSOA struct {
	MName, RName                            []byte
	Serial, Refresh, Retry, Expire, Minimum uint32
}

type DNSSRV added in v1.1.7

type DNSSRV struct {
	Priority, Weight, Port uint16
	Name                   []byte
}

type DNSType added in v1.1.7

type DNSType uint16
const (
	DNSTypeA     DNSType = 1  // a host address
	DNSTypeNS    DNSType = 2  // an authoritative name server
	DNSTypeMD    DNSType = 3  // a mail destination (Obsolete - use MX)
	DNSTypeMF    DNSType = 4  // a mail forwarder (Obsolete - use MX)
	DNSTypeCNAME DNSType = 5  // the canonical name for an alias
	DNSTypeSOA   DNSType = 6  // marks the start of a zone of authority
	DNSTypeMB    DNSType = 7  // a mailbox domain name (EXPERIMENTAL)
	DNSTypeMG    DNSType = 8  // a mail group member (EXPERIMENTAL)
	DNSTypeMR    DNSType = 9  // a mail rename domain name (EXPERIMENTAL)
	DNSTypeNULL  DNSType = 10 // a null RR (EXPERIMENTAL)
	DNSTypeWKS   DNSType = 11 // a well known service description
	DNSTypePTR   DNSType = 12 // a domain name pointer
	DNSTypeHINFO DNSType = 13 // host information
	DNSTypeMINFO DNSType = 14 // mailbox or mail list information
	DNSTypeMX    DNSType = 15 // mail exchange
	DNSTypeTXT   DNSType = 16 // text strings
	DNSTypeAAAA  DNSType = 28 // a IPv6 host address [RFC3596]
	DNSTypeSRV   DNSType = 33 // server discovery [RFC2782] [RFC6195]
)

type Dot11 added in v1.1.4

type Dot11 struct {
	BaseLayer
	Type           Dot11Type
	Proto          uint8
	Flags          Dot11Flags
	DurationID     uint16
	Address1       net.HardwareAddr
	Address2       net.HardwareAddr
	Address3       net.HardwareAddr
	Address4       net.HardwareAddr
	SequenceNumber uint16
	FragmentNumber uint16
	Checksum       uint32
}

Dot11 provides an IEEE 802.11 base packet header. See http://standards.ieee.org/findstds/standard/802.11-2012.html for excrutiating detail.

func (*Dot11) CanDecode added in v1.1.4

func (m *Dot11) CanDecode() gopacket.LayerClass

func (*Dot11) ChecksumValid added in v1.1.4

func (m *Dot11) ChecksumValid() bool

func (*Dot11) DecodeFromBytes added in v1.1.4

func (m *Dot11) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11) LayerType added in v1.1.4

func (m *Dot11) LayerType() gopacket.LayerType

func (*Dot11) NextLayerType added in v1.1.4

func (m *Dot11) NextLayerType() gopacket.LayerType

func (Dot11) SerializeTo added in v1.1.12

type Dot11AckPolicy added in v1.1.4

type Dot11AckPolicy uint8
const (
	Dot11AckPolicyNormal     Dot11AckPolicy = 0
	Dot11AckPolicyNone       Dot11AckPolicy = 1
	Dot11AckPolicyNoExplicit Dot11AckPolicy = 2
	Dot11AckPolicyBlock      Dot11AckPolicy = 3
)

func (Dot11AckPolicy) String added in v1.1.4

func (a Dot11AckPolicy) String() string

String provides a human readable string for Dot11AckPolicy. This string is possibly subject to change over time; if you're storing this persistently, you should probably store the Dot11AckPolicy value, not its string.

type Dot11Algorithm added in v1.1.4

type Dot11Algorithm uint16
const (
	Dot11AlgorithmOpen      Dot11Algorithm = 0
	Dot11AlgorithmSharedKey Dot11Algorithm = 1
)

func (Dot11Algorithm) String added in v1.1.4

func (a Dot11Algorithm) String() string

String provides a human readable string for Dot11Algorithm. This string is possibly subject to change over time; if you're storing this persistently, you should probably store the Dot11Algorithm value, not its string.

type Dot11Ctrl added in v1.1.4

type Dot11Ctrl struct {
	BaseLayer
}

Dot11Ctrl is a base for all IEEE 802.11 control layers.

func (*Dot11Ctrl) CanDecode added in v1.1.4

func (m *Dot11Ctrl) CanDecode() gopacket.LayerClass

func (*Dot11Ctrl) DecodeFromBytes added in v1.1.4

func (m *Dot11Ctrl) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11Ctrl) LayerType added in v1.1.4

func (m *Dot11Ctrl) LayerType() gopacket.LayerType

func (*Dot11Ctrl) NextLayerType added in v1.1.4

func (m *Dot11Ctrl) NextLayerType() gopacket.LayerType

type Dot11CtrlAck added in v1.1.4

type Dot11CtrlAck struct {
	Dot11Ctrl
}

func (*Dot11CtrlAck) CanDecode added in v1.1.4

func (m *Dot11CtrlAck) CanDecode() gopacket.LayerClass

func (*Dot11CtrlAck) DecodeFromBytes added in v1.1.4

func (m *Dot11CtrlAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11CtrlAck) LayerType added in v1.1.4

func (m *Dot11CtrlAck) LayerType() gopacket.LayerType

type Dot11CtrlBlockAck added in v1.1.4

type Dot11CtrlBlockAck struct {
	Dot11Ctrl
}

func (*Dot11CtrlBlockAck) CanDecode added in v1.1.4

func (m *Dot11CtrlBlockAck) CanDecode() gopacket.LayerClass

func (*Dot11CtrlBlockAck) DecodeFromBytes added in v1.1.4

func (m *Dot11CtrlBlockAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11CtrlBlockAck) LayerType added in v1.1.4

func (m *Dot11CtrlBlockAck) LayerType() gopacket.LayerType

type Dot11CtrlBlockAckReq added in v1.1.4

type Dot11CtrlBlockAckReq struct {
	Dot11Ctrl
}

func (*Dot11CtrlBlockAckReq) CanDecode added in v1.1.4

func (m *Dot11CtrlBlockAckReq) CanDecode() gopacket.LayerClass

func (*Dot11CtrlBlockAckReq) DecodeFromBytes added in v1.1.4

func (m *Dot11CtrlBlockAckReq) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11CtrlBlockAckReq) LayerType added in v1.1.4

func (m *Dot11CtrlBlockAckReq) LayerType() gopacket.LayerType

type Dot11CtrlCFEnd added in v1.1.4

type Dot11CtrlCFEnd struct {
	Dot11Ctrl
}

func (*Dot11CtrlCFEnd) CanDecode added in v1.1.4

func (m *Dot11CtrlCFEnd) CanDecode() gopacket.LayerClass

func (*Dot11CtrlCFEnd) DecodeFromBytes added in v1.1.4

func (m *Dot11CtrlCFEnd) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11CtrlCFEnd) LayerType added in v1.1.4

func (m *Dot11CtrlCFEnd) LayerType() gopacket.LayerType

type Dot11CtrlCFEndAck added in v1.1.4

type Dot11CtrlCFEndAck struct {
	Dot11Ctrl
}

func (*Dot11CtrlCFEndAck) CanDecode added in v1.1.4

func (m *Dot11CtrlCFEndAck) CanDecode() gopacket.LayerClass

func (*Dot11CtrlCFEndAck) DecodeFromBytes added in v1.1.4

func (m *Dot11CtrlCFEndAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11CtrlCFEndAck) LayerType added in v1.1.4

func (m *Dot11CtrlCFEndAck) LayerType() gopacket.LayerType

type Dot11CtrlCTS added in v1.1.4

type Dot11CtrlCTS struct {
	Dot11Ctrl
}

func (*Dot11CtrlCTS) CanDecode added in v1.1.4

func (m *Dot11CtrlCTS) CanDecode() gopacket.LayerClass

func (*Dot11CtrlCTS) DecodeFromBytes added in v1.1.4

func (m *Dot11CtrlCTS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11CtrlCTS) LayerType added in v1.1.4

func (m *Dot11CtrlCTS) LayerType() gopacket.LayerType

type Dot11CtrlPowersavePoll added in v1.1.4

type Dot11CtrlPowersavePoll struct {
	Dot11Ctrl
}

func (*Dot11CtrlPowersavePoll) CanDecode added in v1.1.4

func (*Dot11CtrlPowersavePoll) DecodeFromBytes added in v1.1.4

func (m *Dot11CtrlPowersavePoll) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11CtrlPowersavePoll) LayerType added in v1.1.4

func (m *Dot11CtrlPowersavePoll) LayerType() gopacket.LayerType

type Dot11CtrlRTS added in v1.1.4

type Dot11CtrlRTS struct {
	Dot11Ctrl
}

func (*Dot11CtrlRTS) CanDecode added in v1.1.4

func (m *Dot11CtrlRTS) CanDecode() gopacket.LayerClass

func (*Dot11CtrlRTS) DecodeFromBytes added in v1.1.4

func (m *Dot11CtrlRTS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11CtrlRTS) LayerType added in v1.1.4

func (m *Dot11CtrlRTS) LayerType() gopacket.LayerType

type Dot11Data added in v1.1.4

type Dot11Data struct {
	BaseLayer
}

Dot11Data is a base for all IEEE 802.11 data layers.

func (*Dot11Data) CanDecode added in v1.1.4

func (m *Dot11Data) CanDecode() gopacket.LayerClass

func (*Dot11Data) DecodeFromBytes added in v1.1.4

func (m *Dot11Data) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11Data) LayerType added in v1.1.4

func (m *Dot11Data) LayerType() gopacket.LayerType

func (*Dot11Data) NextLayerType added in v1.1.4

func (m *Dot11Data) NextLayerType() gopacket.LayerType

type Dot11DataCFAck added in v1.1.4

type Dot11DataCFAck struct {
	Dot11Data
}

func (*Dot11DataCFAck) CanDecode added in v1.1.4

func (m *Dot11DataCFAck) CanDecode() gopacket.LayerClass

func (*Dot11DataCFAck) DecodeFromBytes added in v1.1.4

func (m *Dot11DataCFAck) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11DataCFAck) LayerType added in v1.1.4

func (m *Dot11DataCFAck) LayerType() gopacket.LayerType

type Dot11DataCFAckNoData added in v1.1.4

type Dot11DataCFAckNoData struct {
	Dot11Data
}

func (*Dot11DataCFAckNoData) CanDecode added in v1.1.4

func (m *Dot11DataCFAckNoData) CanDecode() gopacket.LayerClass

func (*Dot11DataCFAckNoData) DecodeFromBytes added in v1.1.4

func (m *Dot11DataCFAckNoData) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11DataCFAckNoData) LayerType added in v1.1.4

func (m *Dot11DataCFAckNoData) LayerType() gopacket.LayerType

type Dot11DataCFAckPoll added in v1.1.4

type Dot11DataCFAckPoll struct {
	Dot11Data
}

func (*Dot11DataCFAckPoll) CanDecode added in v1.1.4

func (m *Dot11DataCFAckPoll) CanDecode() gopacket.LayerClass

func (*Dot11DataCFAckPoll) DecodeFromBytes added in v1.1.4

func (m *Dot11DataCFAckPoll) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11DataCFAckPoll) LayerType added in v1.1.4

func (m *Dot11DataCFAckPoll) LayerType() gopacket.LayerType

type Dot11DataCFAckPollNoData added in v1.1.4

type Dot11DataCFAckPollNoData struct {
	Dot11Data
}

func (*Dot11DataCFAckPollNoData) CanDecode added in v1.1.4

func (*Dot11DataCFAckPollNoData) DecodeFromBytes added in v1.1.4

func (m *Dot11DataCFAckPollNoData) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11DataCFAckPollNoData) LayerType added in v1.1.4

type Dot11DataCFPoll added in v1.1.4

type Dot11DataCFPoll struct {
	Dot11Data
}

func (*Dot11DataCFPoll) CanDecode added in v1.1.4

func (m *Dot11DataCFPoll) CanDecode() gopacket.LayerClass

func (*Dot11DataCFPoll) DecodeFromBytes added in v1.1.4

func (m *Dot11DataCFPoll) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11DataCFPoll) LayerType added in v1.1.4

func (m *Dot11DataCFPoll) LayerType() gopacket.LayerType

type Dot11DataCFPollNoData added in v1.1.4

type Dot11DataCFPollNoData struct {
	Dot11Data
}

func (*Dot11DataCFPollNoData) CanDecode added in v1.1.4

func (m *Dot11DataCFPollNoData) CanDecode() gopacket.LayerClass

func (*Dot11DataCFPollNoData) DecodeFromBytes added in v1.1.4

func (m *Dot11DataCFPollNoData) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11DataCFPollNoData) LayerType added in v1.1.4

func (m *Dot11DataCFPollNoData) LayerType() gopacket.LayerType

type Dot11DataNull added in v1.1.4

type Dot11DataNull struct {
	Dot11Data
}

func (*Dot11DataNull) CanDecode added in v1.1.4

func (m *Dot11DataNull) CanDecode() gopacket.LayerClass

func (*Dot11DataNull) DecodeFromBytes added in v1.1.4

func (m *Dot11DataNull) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11DataNull) LayerType added in v1.1.4

func (m *Dot11DataNull) LayerType() gopacket.LayerType

type Dot11DataQOS added in v1.1.4

type Dot11DataQOS struct {
	Dot11Ctrl
	TID       uint8 /* Traffic IDentifier */
	EOSP      bool  /* End of service period */
	AckPolicy Dot11AckPolicy
	TXOP      uint8
}

func (*Dot11DataQOS) DecodeFromBytes added in v1.1.4

func (m *Dot11DataQOS) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

type Dot11DataQOSCFAckPollNoData added in v1.1.4

type Dot11DataQOSCFAckPollNoData struct {
	Dot11DataQOS
}

func (*Dot11DataQOSCFAckPollNoData) CanDecode added in v1.1.4

func (*Dot11DataQOSCFAckPollNoData) LayerType added in v1.1.4

func (*Dot11DataQOSCFAckPollNoData) NextLayerType added in v1.1.4

func (m *Dot11DataQOSCFAckPollNoData) NextLayerType() gopacket.LayerType

type Dot11DataQOSCFPollNoData added in v1.1.4

type Dot11DataQOSCFPollNoData struct {
	Dot11DataQOS
}

func (*Dot11DataQOSCFPollNoData) CanDecode added in v1.1.4

func (*Dot11DataQOSCFPollNoData) LayerType added in v1.1.4

func (*Dot11DataQOSCFPollNoData) NextLayerType added in v1.1.4

func (m *Dot11DataQOSCFPollNoData) NextLayerType() gopacket.LayerType

type Dot11DataQOSData added in v1.1.4

type Dot11DataQOSData struct {
	Dot11DataQOS
}

func (*Dot11DataQOSData) CanDecode added in v1.1.4

func (m *Dot11DataQOSData) CanDecode() gopacket.LayerClass

func (*Dot11DataQOSData) LayerType added in v1.1.4

func (m *Dot11DataQOSData) LayerType() gopacket.LayerType

func (*Dot11DataQOSData) NextLayerType added in v1.1.4

func (m *Dot11DataQOSData) NextLayerType() gopacket.LayerType

type Dot11DataQOSDataCFAck added in v1.1.4

type Dot11DataQOSDataCFAck struct {
	Dot11DataQOS
}

func (*Dot11DataQOSDataCFAck) CanDecode added in v1.1.4

func (m *Dot11DataQOSDataCFAck) CanDecode() gopacket.LayerClass

func (*Dot11DataQOSDataCFAck) LayerType added in v1.1.4

func (m *Dot11DataQOSDataCFAck) LayerType() gopacket.LayerType

func (*Dot11DataQOSDataCFAck) NextLayerType added in v1.1.4

func (m *Dot11DataQOSDataCFAck) NextLayerType() gopacket.LayerType

type Dot11DataQOSDataCFAckPoll added in v1.1.4

type Dot11DataQOSDataCFAckPoll struct {
	Dot11DataQOS
}

func (*Dot11DataQOSDataCFAckPoll) CanDecode added in v1.1.4

func (*Dot11DataQOSDataCFAckPoll) LayerType added in v1.1.4

func (*Dot11DataQOSDataCFAckPoll) NextLayerType added in v1.1.4

func (m *Dot11DataQOSDataCFAckPoll) NextLayerType() gopacket.LayerType

type Dot11DataQOSDataCFPoll added in v1.1.4

type Dot11DataQOSDataCFPoll struct {
	Dot11DataQOS
}

func (*Dot11DataQOSDataCFPoll) CanDecode added in v1.1.4

func (*Dot11DataQOSDataCFPoll) LayerType added in v1.1.4

func (m *Dot11DataQOSDataCFPoll) LayerType() gopacket.LayerType

func (*Dot11DataQOSDataCFPoll) NextLayerType added in v1.1.4

func (m *Dot11DataQOSDataCFPoll) NextLayerType() gopacket.LayerType

type Dot11DataQOSNull added in v1.1.4

type Dot11DataQOSNull struct {
	Dot11DataQOS
}

func (*Dot11DataQOSNull) CanDecode added in v1.1.4

func (m *Dot11DataQOSNull) CanDecode() gopacket.LayerClass

func (*Dot11DataQOSNull) LayerType added in v1.1.4

func (m *Dot11DataQOSNull) LayerType() gopacket.LayerType

func (*Dot11DataQOSNull) NextLayerType added in v1.1.4

func (m *Dot11DataQOSNull) NextLayerType() gopacket.LayerType

type Dot11Flags added in v1.1.4

type Dot11Flags uint8

Dot11Flags contains the set of 8 flags in the IEEE 802.11 frame control header, all in one place.

const (
	Dot11FlagsToDS Dot11Flags = 1 << iota
	Dot11FlagsFromDS
	Dot11FlagsMF
	Dot11FlagsRetry
	Dot11FlagsPowerManagement
	Dot11FlagsMD
	Dot11FlagsWEP
	Dot11FlagsOrder
)

func (Dot11Flags) FromDS added in v1.1.4

func (d Dot11Flags) FromDS() bool

func (Dot11Flags) MD added in v1.1.4

func (d Dot11Flags) MD() bool

func (Dot11Flags) MF added in v1.1.4

func (d Dot11Flags) MF() bool

func (Dot11Flags) Order added in v1.1.4

func (d Dot11Flags) Order() bool

func (Dot11Flags) PowerManagement added in v1.1.4

func (d Dot11Flags) PowerManagement() bool

func (Dot11Flags) Retry added in v1.1.4

func (d Dot11Flags) Retry() bool

func (Dot11Flags) String added in v1.1.4

func (a Dot11Flags) String() string

String provides a human readable string for Dot11Flags. This string is possibly subject to change over time; if you're storing this persistently, you should probably store the Dot11Flags value, not its string.

func (Dot11Flags) ToDS added in v1.1.4

func (d Dot11Flags) ToDS() bool

func (Dot11Flags) WEP added in v1.1.4

func (d Dot11Flags) WEP() bool

type Dot11InformationElement added in v1.1.4

type Dot11InformationElement struct {
	BaseLayer
	ID     Dot11InformationElementID
	Length uint8
	OUI    []byte
	Info   []byte
}

func (*Dot11InformationElement) CanDecode added in v1.1.4

func (*Dot11InformationElement) DecodeFromBytes added in v1.1.4

func (m *Dot11InformationElement) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11InformationElement) LayerType added in v1.1.4

func (*Dot11InformationElement) NextLayerType added in v1.1.4

func (m *Dot11InformationElement) NextLayerType() gopacket.LayerType

func (Dot11InformationElement) SerializeTo added in v1.1.11

func (*Dot11InformationElement) String added in v1.1.4

func (d *Dot11InformationElement) String() string

type Dot11InformationElementID added in v1.1.4

type Dot11InformationElementID uint8
const (
	Dot11InformationElementIDSSID          Dot11InformationElementID = 0
	Dot11InformationElementIDRates         Dot11InformationElementID = 1
	Dot11InformationElementIDFHSet         Dot11InformationElementID = 2
	Dot11InformationElementIDDSSet         Dot11InformationElementID = 3
	Dot11InformationElementIDCFSet         Dot11InformationElementID = 4
	Dot11InformationElementIDTIM           Dot11InformationElementID = 5
	Dot11InformationElementIDIBSSSet       Dot11InformationElementID = 6
	Dot11InformationElementIDChallenge     Dot11InformationElementID = 16
	Dot11InformationElementIDERPInfo       Dot11InformationElementID = 42
	Dot11InformationElementIDQOSCapability Dot11InformationElementID = 46
	Dot11InformationElementIDERPInfo2      Dot11InformationElementID = 47
	Dot11InformationElementIDRSNInfo       Dot11InformationElementID = 48
	Dot11InformationElementIDESRates       Dot11InformationElementID = 50
	Dot11InformationElementIDVendor        Dot11InformationElementID = 221
	Dot11InformationElementIDReserved      Dot11InformationElementID = 68
)

func (Dot11InformationElementID) String added in v1.1.4

func (a Dot11InformationElementID) String() string

String provides a human readable string for Dot11InformationElementID. This string is possibly subject to change over time; if you're storing this persistently, you should probably store the Dot11InformationElementID value, not its string.

type Dot11Mgmt added in v1.1.4

type Dot11Mgmt struct {
	BaseLayer
}

Dot11Mgmt is a base for all IEEE 802.11 management layers.

func (*Dot11Mgmt) DecodeFromBytes added in v1.1.4

func (m *Dot11Mgmt) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11Mgmt) NextLayerType added in v1.1.4

func (m *Dot11Mgmt) NextLayerType() gopacket.LayerType

type Dot11MgmtATIM added in v1.1.4

type Dot11MgmtATIM struct {
	Dot11Mgmt
}

func (*Dot11MgmtATIM) CanDecode added in v1.1.4

func (m *Dot11MgmtATIM) CanDecode() gopacket.LayerClass

func (*Dot11MgmtATIM) LayerType added in v1.1.4

func (m *Dot11MgmtATIM) LayerType() gopacket.LayerType

type Dot11MgmtAction added in v1.1.4

type Dot11MgmtAction struct {
	Dot11Mgmt
}

func (*Dot11MgmtAction) CanDecode added in v1.1.4

func (m *Dot11MgmtAction) CanDecode() gopacket.LayerClass

func (*Dot11MgmtAction) LayerType added in v1.1.4

func (m *Dot11MgmtAction) LayerType() gopacket.LayerType

type Dot11MgmtActionNoAck added in v1.1.4

type Dot11MgmtActionNoAck struct {
	Dot11Mgmt
}

func (*Dot11MgmtActionNoAck) CanDecode added in v1.1.4

func (m *Dot11MgmtActionNoAck) CanDecode() gopacket.LayerClass

func (*Dot11MgmtActionNoAck) LayerType added in v1.1.4

func (m *Dot11MgmtActionNoAck) LayerType() gopacket.LayerType

type Dot11MgmtArubaWLAN added in v1.1.4

type Dot11MgmtArubaWLAN struct {
	Dot11Mgmt
}

func (*Dot11MgmtArubaWLAN) CanDecode added in v1.1.4

func (m *Dot11MgmtArubaWLAN) CanDecode() gopacket.LayerClass

func (*Dot11MgmtArubaWLAN) LayerType added in v1.1.4

func (m *Dot11MgmtArubaWLAN) LayerType() gopacket.LayerType

type Dot11MgmtAssociationReq added in v1.1.4

type Dot11MgmtAssociationReq struct {
	Dot11Mgmt
	CapabilityInfo uint16
	ListenInterval uint16
}

func (*Dot11MgmtAssociationReq) CanDecode added in v1.1.4

func (*Dot11MgmtAssociationReq) DecodeFromBytes added in v1.1.4

func (m *Dot11MgmtAssociationReq) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11MgmtAssociationReq) LayerType added in v1.1.4

func (*Dot11MgmtAssociationReq) NextLayerType added in v1.1.4

func (m *Dot11MgmtAssociationReq) NextLayerType() gopacket.LayerType

func (Dot11MgmtAssociationReq) SerializeTo added in v1.1.12

type Dot11MgmtAssociationResp added in v1.1.4

type Dot11MgmtAssociationResp struct {
	Dot11Mgmt
	CapabilityInfo uint16
	Status         Dot11Status
	AID            uint16
}

func (*Dot11MgmtAssociationResp) CanDecode added in v1.1.4

func (*Dot11MgmtAssociationResp) DecodeFromBytes added in v1.1.4

func (m *Dot11MgmtAssociationResp) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11MgmtAssociationResp) LayerType added in v1.1.4

func (*Dot11MgmtAssociationResp) NextLayerType added in v1.1.4

func (m *Dot11MgmtAssociationResp) NextLayerType() gopacket.LayerType

func (Dot11MgmtAssociationResp) SerializeTo added in v1.1.12

type Dot11MgmtAuthentication added in v1.1.4

type Dot11MgmtAuthentication struct {
	Dot11Mgmt
	Algorithm Dot11Algorithm
	Sequence  uint16
	Status    Dot11Status
}

func (*Dot11MgmtAuthentication) CanDecode added in v1.1.4

func (*Dot11MgmtAuthentication) DecodeFromBytes added in v1.1.4

func (m *Dot11MgmtAuthentication) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11MgmtAuthentication) LayerType added in v1.1.4

func (*Dot11MgmtAuthentication) NextLayerType added in v1.1.4

func (m *Dot11MgmtAuthentication) NextLayerType() gopacket.LayerType

func (Dot11MgmtAuthentication) SerializeTo added in v1.1.12

type Dot11MgmtBeacon added in v1.1.4

type Dot11MgmtBeacon struct {
	Dot11Mgmt
	Timestamp uint64
	Interval  uint16
	Flags     uint16
}

func (*Dot11MgmtBeacon) CanDecode added in v1.1.4

func (m *Dot11MgmtBeacon) CanDecode() gopacket.LayerClass

func (*Dot11MgmtBeacon) DecodeFromBytes added in v1.1.4

func (m *Dot11MgmtBeacon) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11MgmtBeacon) LayerType added in v1.1.4

func (m *Dot11MgmtBeacon) LayerType() gopacket.LayerType

func (*Dot11MgmtBeacon) NextLayerType added in v1.1.4

func (m *Dot11MgmtBeacon) NextLayerType() gopacket.LayerType

func (Dot11MgmtBeacon) SerializeTo added in v1.1.12

type Dot11MgmtDeauthentication added in v1.1.4

type Dot11MgmtDeauthentication struct {
	Dot11Mgmt
	Reason Dot11Reason
}

func (*Dot11MgmtDeauthentication) CanDecode added in v1.1.4

func (*Dot11MgmtDeauthentication) DecodeFromBytes added in v1.1.4

func (m *Dot11MgmtDeauthentication) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11MgmtDeauthentication) LayerType added in v1.1.4

func (Dot11MgmtDeauthentication) SerializeTo added in v1.1.12

type Dot11MgmtDisassociation added in v1.1.4

type Dot11MgmtDisassociation struct {
	Dot11Mgmt
	Reason Dot11Reason
}

func (*Dot11MgmtDisassociation) CanDecode added in v1.1.4

func (*Dot11MgmtDisassociation) DecodeFromBytes added in v1.1.4

func (m *Dot11MgmtDisassociation) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11MgmtDisassociation) LayerType added in v1.1.4

func (Dot11MgmtDisassociation) SerializeTo added in v1.1.12

type Dot11MgmtMeasurementPilot added in v1.1.4

type Dot11MgmtMeasurementPilot struct {
	Dot11Mgmt
}

func (*Dot11MgmtMeasurementPilot) CanDecode added in v1.1.4

func (*Dot11MgmtMeasurementPilot) LayerType added in v1.1.4

type Dot11MgmtProbeReq added in v1.1.4

type Dot11MgmtProbeReq struct {
	Dot11Mgmt
}

func (*Dot11MgmtProbeReq) CanDecode added in v1.1.4

func (m *Dot11MgmtProbeReq) CanDecode() gopacket.LayerClass

func (*Dot11MgmtProbeReq) LayerType added in v1.1.4

func (m *Dot11MgmtProbeReq) LayerType() gopacket.LayerType

func (*Dot11MgmtProbeReq) NextLayerType added in v1.1.4

func (m *Dot11MgmtProbeReq) NextLayerType() gopacket.LayerType

type Dot11MgmtProbeResp added in v1.1.4

type Dot11MgmtProbeResp struct {
	Dot11Mgmt
	Timestamp uint64
	Interval  uint16
	Flags     uint16
}

func (*Dot11MgmtProbeResp) CanDecode added in v1.1.4

func (m *Dot11MgmtProbeResp) CanDecode() gopacket.LayerClass

func (*Dot11MgmtProbeResp) DecodeFromBytes added in v1.1.12

func (m *Dot11MgmtProbeResp) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11MgmtProbeResp) LayerType added in v1.1.4

func (m *Dot11MgmtProbeResp) LayerType() gopacket.LayerType

func (*Dot11MgmtProbeResp) NextLayerType added in v1.1.4

func (m *Dot11MgmtProbeResp) NextLayerType() gopacket.LayerType

func (Dot11MgmtProbeResp) SerializeTo added in v1.1.12

type Dot11MgmtReassociationReq added in v1.1.4

type Dot11MgmtReassociationReq struct {
	Dot11Mgmt
	CapabilityInfo   uint16
	ListenInterval   uint16
	CurrentApAddress net.HardwareAddr
}

func (*Dot11MgmtReassociationReq) CanDecode added in v1.1.4

func (*Dot11MgmtReassociationReq) DecodeFromBytes added in v1.1.4

func (m *Dot11MgmtReassociationReq) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11MgmtReassociationReq) LayerType added in v1.1.4

func (*Dot11MgmtReassociationReq) NextLayerType added in v1.1.4

func (m *Dot11MgmtReassociationReq) NextLayerType() gopacket.LayerType

func (Dot11MgmtReassociationReq) SerializeTo added in v1.1.12

type Dot11MgmtReassociationResp added in v1.1.4

type Dot11MgmtReassociationResp struct {
	Dot11Mgmt
}

func (*Dot11MgmtReassociationResp) CanDecode added in v1.1.4

func (*Dot11MgmtReassociationResp) LayerType added in v1.1.4

func (*Dot11MgmtReassociationResp) NextLayerType added in v1.1.4

func (m *Dot11MgmtReassociationResp) NextLayerType() gopacket.LayerType

type Dot11Reason added in v1.1.4

type Dot11Reason uint16
const (
	Dot11ReasonReserved          Dot11Reason = 1
	Dot11ReasonUnspecified       Dot11Reason = 2
	Dot11ReasonAuthExpired       Dot11Reason = 3
	Dot11ReasonDeauthStLeaving   Dot11Reason = 4
	Dot11ReasonInactivity        Dot11Reason = 5
	Dot11ReasonApFull            Dot11Reason = 6
	Dot11ReasonClass2FromNonAuth Dot11Reason = 7
	Dot11ReasonClass3FromNonAss  Dot11Reason = 8
	Dot11ReasonDisasStLeaving    Dot11Reason = 9
	Dot11ReasonStNotAuth         Dot11Reason = 10
)

func (Dot11Reason) String added in v1.1.4

func (a Dot11Reason) String() string

String provides a human readable string for Dot11Reason. This string is possibly subject to change over time; if you're storing this persistently, you should probably store the Dot11Reason value, not its string.

type Dot11Status added in v1.1.4

type Dot11Status uint16
const (
	Dot11StatusSuccess                      Dot11Status = 0
	Dot11StatusFailure                      Dot11Status = 1  // Unspecified failure
	Dot11StatusCannotSupportAllCapabilities Dot11Status = 10 // Cannot support all requested capabilities in the Capability Information field
	Dot11StatusInabilityExistsAssociation   Dot11Status = 11 // Reassociation denied due to inability to confirm that association exists
	Dot11StatusAssociationDenied            Dot11Status = 12 // Association denied due to reason outside the scope of this standard
	Dot11StatusAlgorithmUnsupported         Dot11Status = 13 // Responding station does not support the specified authentication algorithm
	Dot11StatusOufOfExpectedSequence        Dot11Status = 14 // Received an Authentication frame with authentication transaction sequence number out of expected sequence
	Dot11StatusChallengeFailure             Dot11Status = 15 // Authentication rejected because of challenge failure
	Dot11StatusTimeout                      Dot11Status = 16 // Authentication rejected due to timeout waiting for next frame in sequence
	Dot11StatusAPUnableToHandle             Dot11Status = 17 // Association denied because AP is unable to handle additional associated stations
	Dot11StatusRateUnsupported              Dot11Status = 18 // Association denied due to requesting station not supporting all of the data rates in the BSSBasicRateSet parameter
)

func (Dot11Status) String added in v1.1.4

func (a Dot11Status) String() string

String provides a human readable string for Dot11Status. This string is possibly subject to change over time; if you're storing this persistently, you should probably store the Dot11Status value, not its string.

type Dot11Type added in v1.1.4

type Dot11Type uint8

Dot11Type is a combination of IEEE 802.11 frame's Type and Subtype fields. By combining these two fields together into a single type, we're able to provide a String function that correctly displays the subtype given the top-level type.

If you just care about the top-level type, use the MainType function.

const (
	Dot11TypeMgmt     Dot11Type = 0x00
	Dot11TypeCtrl     Dot11Type = 0x01
	Dot11TypeData     Dot11Type = 0x02
	Dot11TypeReserved Dot11Type = 0x03

	// Management
	Dot11TypeMgmtAssociationReq    Dot11Type = 0x00
	Dot11TypeMgmtAssociationResp   Dot11Type = 0x04
	Dot11TypeMgmtReassociationReq  Dot11Type = 0x08
	Dot11TypeMgmtReassociationResp Dot11Type = 0x0c
	Dot11TypeMgmtProbeReq          Dot11Type = 0x10
	Dot11TypeMgmtProbeResp         Dot11Type = 0x14
	Dot11TypeMgmtMeasurementPilot  Dot11Type = 0x18
	Dot11TypeMgmtBeacon            Dot11Type = 0x20
	Dot11TypeMgmtATIM              Dot11Type = 0x24
	Dot11TypeMgmtDisassociation    Dot11Type = 0x28
	Dot11TypeMgmtAuthentication    Dot11Type = 0x2c
	Dot11TypeMgmtDeauthentication  Dot11Type = 0x30
	Dot11TypeMgmtAction            Dot11Type = 0x34
	Dot11TypeMgmtActionNoAck       Dot11Type = 0x38

	// Control
	Dot11TypeCtrlWrapper       Dot11Type = 0x1d
	Dot11TypeCtrlBlockAckReq   Dot11Type = 0x21
	Dot11TypeCtrlBlockAck      Dot11Type = 0x25
	Dot11TypeCtrlPowersavePoll Dot11Type = 0x29
	Dot11TypeCtrlRTS           Dot11Type = 0x2d
	Dot11TypeCtrlCTS           Dot11Type = 0x31
	Dot11TypeCtrlAck           Dot11Type = 0x35
	Dot11TypeCtrlCFEnd         Dot11Type = 0x39
	Dot11TypeCtrlCFEndAck      Dot11Type = 0x3d

	// Data
	Dot11TypeDataCFAck              Dot11Type = 0x06
	Dot11TypeDataCFPoll             Dot11Type = 0x0a
	Dot11TypeDataCFAckPoll          Dot11Type = 0x0e
	Dot11TypeDataNull               Dot11Type = 0x12
	Dot11TypeDataCFAckNoData        Dot11Type = 0x16
	Dot11TypeDataCFPollNoData       Dot11Type = 0x1a
	Dot11TypeDataCFAckPollNoData    Dot11Type = 0x1e
	Dot11TypeDataQOSData            Dot11Type = 0x22
	Dot11TypeDataQOSDataCFAck       Dot11Type = 0x26
	Dot11TypeDataQOSDataCFPoll      Dot11Type = 0x2a
	Dot11TypeDataQOSDataCFAckPoll   Dot11Type = 0x2e
	Dot11TypeDataQOSNull            Dot11Type = 0x32
	Dot11TypeDataQOSCFPollNoData    Dot11Type = 0x3a
	Dot11TypeDataQOSCFAckPollNoData Dot11Type = 0x3e
)

func (Dot11Type) Decode added in v1.1.4

func (a Dot11Type) Decode(data []byte, p gopacket.PacketBuilder) error

func (Dot11Type) LayerType added in v1.1.4

func (a Dot11Type) LayerType() gopacket.LayerType

func (Dot11Type) MainType added in v1.1.4

func (d Dot11Type) MainType() Dot11Type

MainType strips the subtype information from the given type, returning just the overarching type (Mgmt, Ctrl, Data, Reserved).

func (Dot11Type) String added in v1.1.4

func (a Dot11Type) String() string

type Dot11WEP added in v1.1.4

type Dot11WEP struct {
	BaseLayer
}

Dot11WEP contains WEP encrpted IEEE 802.11 data.

func (*Dot11WEP) CanDecode added in v1.1.4

func (m *Dot11WEP) CanDecode() gopacket.LayerClass

func (*Dot11WEP) DecodeFromBytes added in v1.1.4

func (m *Dot11WEP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Dot11WEP) LayerType added in v1.1.4

func (m *Dot11WEP) LayerType() gopacket.LayerType

func (*Dot11WEP) NextLayerType added in v1.1.4

func (m *Dot11WEP) NextLayerType() gopacket.LayerType

type Dot1Q

type Dot1Q struct {
	BaseLayer
	Priority       uint8
	DropEligible   bool
	VLANIdentifier uint16
	Type           EthernetType
}

Dot1Q is the packet layer for 802.1Q VLAN headers.

func (*Dot1Q) CanDecode

func (d *Dot1Q) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*Dot1Q) DecodeFromBytes

func (d *Dot1Q) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*Dot1Q) LayerType

func (d *Dot1Q) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeDot1Q

func (*Dot1Q) NextLayerType

func (d *Dot1Q) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

func (*Dot1Q) SerializeTo

func (d *Dot1Q) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

type EAP

type EAP struct {
	BaseLayer
	Code     EAPCode
	Id       uint8
	Length   uint16
	Type     EAPType
	TypeData []byte
}

EAP defines an Extensible Authentication Protocol (rfc 3748) layer.

func (*EAP) CanDecode

func (e *EAP) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*EAP) DecodeFromBytes

func (e *EAP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*EAP) LayerType

func (e *EAP) LayerType() gopacket.LayerType

LayerType returns LayerTypeEAP.

func (*EAP) NextLayerType

func (e *EAP) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

func (*EAP) SerializeTo added in v1.0.1

func (e *EAP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

type EAPCode

type EAPCode uint8

type EAPOL

type EAPOL struct {
	BaseLayer
	Version uint8
	Type    EAPOLType
}

EAPOL defines an EAP over LAN (802.1x) layer.

func (*EAPOL) CanDecode

func (e *EAPOL) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*EAPOL) DecodeFromBytes

func (e *EAPOL) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*EAPOL) LayerType

func (e *EAPOL) LayerType() gopacket.LayerType

LayerType returns LayerTypeEAPOL.

func (*EAPOL) NextLayerType

func (e *EAPOL) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

type EAPOLType

type EAPOLType uint8

EAPOLType is an enumeration of EAPOL packet types.

const (
	EAPOLTypeEAP      EAPOLType = 0
	EAPOLTypeStart    EAPOLType = 1
	EAPOLTypeLogOff   EAPOLType = 2
	EAPOLTypeKey      EAPOLType = 3
	EAPOLTypeASFAlert EAPOLType = 4
)

func (EAPOLType) Decode

func (a EAPOLType) Decode(data []byte, p gopacket.PacketBuilder) error

func (EAPOLType) LayerType

func (a EAPOLType) LayerType() gopacket.LayerType

func (EAPOLType) String

func (a EAPOLType) String() string

type EAPType

type EAPType uint8

type EnumMetadata

type EnumMetadata struct {
	// DecodeWith is the decoder to use to decode this protocol's data.
	DecodeWith gopacket.Decoder
	// Name is the name of the enumeration value.
	Name string
	// LayerType is the layer type implied by the given enum.
	LayerType gopacket.LayerType
}

EnumMetadata keeps track of a set of metadata for each enumeration value for protocol enumerations.

type EtherIP

type EtherIP struct {
	BaseLayer
	Version  uint8
	Reserved uint16
}

EtherIP is the struct for storing RFC 3378 EtherIP packet headers.

func (*EtherIP) CanDecode

func (e *EtherIP) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*EtherIP) DecodeFromBytes

func (e *EtherIP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*EtherIP) LayerType

func (e *EtherIP) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeEtherIP.

func (*EtherIP) NextLayerType

func (e *EtherIP) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

type Ethernet

type Ethernet struct {
	BaseLayer
	SrcMAC, DstMAC net.HardwareAddr
	EthernetType   EthernetType
	// Length is only set if a length field exists within this header.  Ethernet
	// headers follow two different standards, one that uses an EthernetType, the
	// other which defines a length the follows with a LLC header (802.3).  If the
	// former is the case, we set EthernetType and Length stays 0.  In the latter
	// case, we set Length and EthernetType = EthernetTypeLLC.
	Length uint16
}

Ethernet is the layer for Ethernet frame headers.

func (*Ethernet) CanDecode

func (eth *Ethernet) CanDecode() gopacket.LayerClass

func (*Ethernet) DecodeFromBytes

func (eth *Ethernet) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*Ethernet) LayerType

func (e *Ethernet) LayerType() gopacket.LayerType

LayerType returns LayerTypeEthernet

func (*Ethernet) LinkFlow

func (e *Ethernet) LinkFlow() gopacket.Flow

func (*Ethernet) NextLayerType

func (eth *Ethernet) NextLayerType() gopacket.LayerType

func (*Ethernet) SerializeTo

func (eth *Ethernet) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

type EthernetCTP

type EthernetCTP struct {
	BaseLayer
	SkipCount uint16
}

EthernetCTP implements the EthernetCTP protocol, see http://www.mit.edu/people/jhawk/ctp.html. We split EthernetCTP up into the top-level EthernetCTP layer, followed by zero or more EthernetCTPForwardData layers, followed by a final EthernetCTPReply layer.

func (*EthernetCTP) LayerType

func (c *EthernetCTP) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeEthernetCTP.

type EthernetCTPForwardData

type EthernetCTPForwardData struct {
	BaseLayer
	Function       EthernetCTPFunction
	ForwardAddress []byte
}

EthernetCTPForwardData is the ForwardData layer inside EthernetCTP. See EthernetCTP's docs for more details.

func (*EthernetCTPForwardData) ForwardEndpoint

func (c *EthernetCTPForwardData) ForwardEndpoint() gopacket.Endpoint

ForwardEndpoint returns the EthernetCTPForwardData ForwardAddress as an endpoint.

func (*EthernetCTPForwardData) LayerType

func (c *EthernetCTPForwardData) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeEthernetCTPForwardData.

type EthernetCTPFunction

type EthernetCTPFunction uint16

EthernetCTPFunction is the function code used by the EthernetCTP protocol to identify each EthernetCTP layer.

const (
	EthernetCTPFunctionReply       EthernetCTPFunction = 1
	EthernetCTPFunctionForwardData EthernetCTPFunction = 2
)

type EthernetCTPReply

type EthernetCTPReply struct {
	BaseLayer
	Function      EthernetCTPFunction
	ReceiptNumber uint16
	Data          []byte
}

EthernetCTPReply is the Reply layer inside EthernetCTP. See EthernetCTP's docs for more details.

func (*EthernetCTPReply) LayerType

func (c *EthernetCTPReply) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeEthernetCTPReply.

func (*EthernetCTPReply) Payload

func (c *EthernetCTPReply) Payload() []byte

Payload returns the EthernetCTP reply's Data bytes.

type EthernetType

type EthernetType uint16

EthernetType is an enumeration of ethernet type values, and acts as a decoder for any type it supports.

const (
	// EthernetTypeLLC is not an actual ethernet type.  It is instead a
	// placeholder we use in Ethernet frames that use the 802.3 standard of
	// srcmac|dstmac|length|LLC instead of srcmac|dstmac|ethertype.
	EthernetTypeLLC                         EthernetType = 0
	EthernetTypeIPv4                        EthernetType = 0x0800
	EthernetTypeARP                         EthernetType = 0x0806
	EthernetTypeIPv6                        EthernetType = 0x86DD
	EthernetTypeCiscoDiscovery              EthernetType = 0x2000
	EthernetTypeNortelDiscovery             EthernetType = 0x01a2
	EthernetTypeTransparentEthernetBridging EthernetType = 0x6558
	EthernetTypeDot1Q                       EthernetType = 0x8100
	EthernetTypePPPoEDiscovery              EthernetType = 0x8863
	EthernetTypePPPoESession                EthernetType = 0x8864
	EthernetTypeMPLSUnicast                 EthernetType = 0x8847
	EthernetTypeMPLSMulticast               EthernetType = 0x8848
	EthernetTypeEAPOL                       EthernetType = 0x888e
	EthernetTypeQinQ                        EthernetType = 0x88a8
	EthernetTypeLinkLayerDiscovery          EthernetType = 0x88cc
	EthernetTypeEthernetCTP                 EthernetType = 0x9000
)

func (EthernetType) Decode

func (a EthernetType) Decode(data []byte, p gopacket.PacketBuilder) error

func (EthernetType) LayerType

func (a EthernetType) LayerType() gopacket.LayerType

func (EthernetType) String

func (a EthernetType) String() string

type FDDI

type FDDI struct {
	BaseLayer
	FrameControl   FDDIFrameControl
	Priority       uint8
	SrcMAC, DstMAC net.HardwareAddr
}

FDDI contains the header for FDDI frames.

func (*FDDI) LayerType

func (f *FDDI) LayerType() gopacket.LayerType

LayerType returns LayerTypeFDDI.

func (*FDDI) LinkFlow

func (f *FDDI) LinkFlow() gopacket.Flow

LinkFlow returns a new flow of type EndpointMAC.

type FDDIFrameControl

type FDDIFrameControl uint8

FDDIFrameControl is an enumeration of FDDI frame control bytes.

const (
	FDDIFrameControlLLC FDDIFrameControl = 0x50
)

func (FDDIFrameControl) Decode

func (a FDDIFrameControl) Decode(data []byte, p gopacket.PacketBuilder) error

func (FDDIFrameControl) String

func (a FDDIFrameControl) String() string

type GRE

type GRE struct {
	BaseLayer
	ChecksumPresent, RoutingPresent, KeyPresent, SeqPresent, StrictSourceRoute bool
	RecursionControl, Flags, Version                                           uint8
	Protocol                                                                   EthernetType
	Checksum, Offset                                                           uint16
	Key, Seq                                                                   uint32
	*GRERouting
}

GRE is a Generic Routing Encapsulation header.

func (*GRE) CanDecode

func (g *GRE) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*GRE) DecodeFromBytes

func (g *GRE) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*GRE) LayerType

func (g *GRE) LayerType() gopacket.LayerType

LayerType returns gopacket.LayerTypeGRE.

func (*GRE) NextLayerType

func (g *GRE) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

func (*GRE) SerializeTo added in v1.1.12

func (g *GRE) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

type GRERouting

type GRERouting struct {
	AddressFamily        uint16
	SREOffset, SRELength uint8
	RoutingInformation   []byte
	Next                 *GRERouting
}

GRERouting is GRE routing information, present if the RoutingPresent flag is set.

type IANAAddressFamily

type IANAAddressFamily byte
const (
	IANAAddressFamilyReserved IANAAddressFamily = 0
	IANAAddressFamilyIPV4     IANAAddressFamily = 1
	IANAAddressFamilyIPV6     IANAAddressFamily = 2
	IANAAddressFamilyNSAP     IANAAddressFamily = 3
	IANAAddressFamilyHDLC     IANAAddressFamily = 4
	IANAAddressFamilyBBN1822  IANAAddressFamily = 5
	IANAAddressFamily802      IANAAddressFamily = 6
	IANAAddressFamilyE163     IANAAddressFamily = 7
	IANAAddressFamilyE164     IANAAddressFamily = 8
	IANAAddressFamilyF69      IANAAddressFamily = 9
	IANAAddressFamilyX121     IANAAddressFamily = 10
	IANAAddressFamilyIPX      IANAAddressFamily = 11
	IANAAddressFamilyAtalk    IANAAddressFamily = 12
	IANAAddressFamilyDecnet   IANAAddressFamily = 13
	IANAAddressFamilyBanyan   IANAAddressFamily = 14
	IANAAddressFamilyE164NSAP IANAAddressFamily = 15
	IANAAddressFamilyDNS      IANAAddressFamily = 16
	IANAAddressFamilyDistname IANAAddressFamily = 17
	IANAAddressFamilyASNumber IANAAddressFamily = 18
	IANAAddressFamilyXTPIPV4  IANAAddressFamily = 19
	IANAAddressFamilyXTPIPV6  IANAAddressFamily = 20
	IANAAddressFamilyXTP      IANAAddressFamily = 21
	IANAAddressFamilyFcWWPN   IANAAddressFamily = 22
	IANAAddressFamilyFcWWNN   IANAAddressFamily = 23
	IANAAddressFamilyGWID     IANAAddressFamily = 24
	IANAAddressFamilyL2VPN    IANAAddressFamily = 25
)

LLDP Management Address Subtypes http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xml

func (IANAAddressFamily) String

func (t IANAAddressFamily) String() (s string)

type ICMPv4

type ICMPv4 struct {
	BaseLayer
	TypeCode ICMPv4TypeCode
	Checksum uint16
	Id       uint16
	Seq      uint16
}

ICMPv4 is the layer for IPv4 ICMP packet data.

func (*ICMPv4) CanDecode

func (i *ICMPv4) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*ICMPv4) DecodeFromBytes

func (i *ICMPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*ICMPv4) LayerType

func (i *ICMPv4) LayerType() gopacket.LayerType

LayerType returns LayerTypeICMPv4.

func (*ICMPv4) NextLayerType

func (i *ICMPv4) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

func (*ICMPv4) SerializeTo added in v1.0.1

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

type ICMPv4TypeCode

type ICMPv4TypeCode uint16

func CreateICMPv4TypeCode added in v1.1.12

func CreateICMPv4TypeCode(typ uint8, code uint8) ICMPv4TypeCode

CreateICMPv4TypeCode is a convenience function to create an ICMPv4TypeCode gopacket type from the ICMPv4 type and code values.

func (ICMPv4TypeCode) Code added in v1.1.12

func (a ICMPv4TypeCode) Code() uint8

Code returns the ICMPv4 code field.

func (ICMPv4TypeCode) GoString added in v1.1.12

func (a ICMPv4TypeCode) GoString() string

func (ICMPv4TypeCode) SerializeTo added in v1.1.12

func (a ICMPv4TypeCode) SerializeTo(bytes []byte)

SerializeTo writes the ICMPv4TypeCode value to the 'bytes' buffer.

func (ICMPv4TypeCode) String

func (a ICMPv4TypeCode) String() string

func (ICMPv4TypeCode) Type added in v1.1.12

func (a ICMPv4TypeCode) Type() uint8

Type returns the ICMPv4 type field.

type ICMPv6

type ICMPv6 struct {
	BaseLayer
	TypeCode  ICMPv6TypeCode
	Checksum  uint16
	TypeBytes []byte
	// contains filtered or unexported fields
}

ICMPv6 is the layer for IPv6 ICMP packet data

func (*ICMPv6) CanDecode

func (i *ICMPv6) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*ICMPv6) DecodeFromBytes

func (i *ICMPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*ICMPv6) LayerType

func (i *ICMPv6) LayerType() gopacket.LayerType

LayerType returns LayerTypeICMPv6.

func (*ICMPv6) NextLayerType

func (i *ICMPv6) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

func (*ICMPv6) SerializeTo added in v1.0.1

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

func (*ICMPv6) SetNetworkLayerForChecksum added in v1.0.1

func (i *ICMPv6) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error

SetNetworkLayerForChecksum tells this layer which network layer is wrapping it. This is needed for computing the checksum when serializing, since TCP/IP transport layer checksums depends on fields in the IPv4 or IPv6 layer that contains it. The passed in layer must be an *IPv4 or *IPv6.

type ICMPv6TypeCode

type ICMPv6TypeCode uint16

func CreateICMPv6TypeCode added in v1.1.12

func CreateICMPv6TypeCode(typ uint8, code uint8) ICMPv6TypeCode

CreateICMPv6TypeCode is a convenience function to create an ICMPv6TypeCode gopacket type from the ICMPv6 type and code values.

func (ICMPv6TypeCode) Code added in v1.1.12

func (a ICMPv6TypeCode) Code() uint8

Code returns the ICMPv6 code field.

func (ICMPv6TypeCode) GoString added in v1.1.12

func (a ICMPv6TypeCode) GoString() string

func (ICMPv6TypeCode) SerializeTo added in v1.1.12

func (a ICMPv6TypeCode) SerializeTo(bytes []byte)

SerializeTo writes the ICMPv6TypeCode value to the 'bytes' buffer.

func (ICMPv6TypeCode) String

func (a ICMPv6TypeCode) String() string

func (ICMPv6TypeCode) Type added in v1.1.12

func (a ICMPv6TypeCode) Type() uint8

Type returns the ICMPv6 type field.

type IEEEOUI

type IEEEOUI uint32
const (
	IEEEOUI8021     IEEEOUI = 0x0080c2
	IEEEOUI8023     IEEEOUI = 0x00120f
	IEEEOUI80211    IEEEOUI = 0x000fac
	IEEEOUI8021Qbg  IEEEOUI = 0x0013BF
	IEEEOUICisco2   IEEEOUI = 0x000142
	IEEEOUIMedia    IEEEOUI = 0x0012bb // TR-41
	IEEEOUIProfinet IEEEOUI = 0x000ecf
	IEEEOUIDCBX     IEEEOUI = 0x001b21
)

http://standards.ieee.org/develop/regauth/oui/oui.txt

type IGMP

type IGMP struct {
	BaseLayer
	Type                    IGMPType
	MaxResponseTime         time.Duration
	Checksum                uint16
	GroupAddress            net.IP
	SupressRouterProcessing bool
	RobustnessValue         uint8
	IntervalTime            time.Duration
	SourceAddresses         []net.IP
	NumberOfGroupRecords    uint16
	NumberOfSources         uint16
	GroupRecords            []IGMPv3GroupRecord
	Version                 uint8 // IGMP protocol version
}

IGMP represents an IGMPv3 message.

func (*IGMP) CanDecode

func (i *IGMP) CanDecode() gopacket.LayerClass

CanDecode returns the set of layer types that this DecodingLayer can decode.

func (*IGMP) DecodeFromBytes

func (i *IGMP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*IGMP) LayerType

func (i *IGMP) LayerType() gopacket.LayerType

LayerType returns LayerTypeIGMP for the V1,2,3 message protocol formats.

func (*IGMP) NextLayerType

func (i *IGMP) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type contained by this DecodingLayer.

type IGMPType

type IGMPType uint8
const (
	IGMPMembershipQuery    IGMPType = 0x11 // General or group specific query
	IGMPMembershipReportV1 IGMPType = 0x12 // Version 1 Membership Report
	IGMPMembershipReportV2 IGMPType = 0x16 // Version 2 Membership Report
	IGMPLeaveGroup         IGMPType = 0x17 // Leave Group
	IGMPMembershipReportV3 IGMPType = 0x22 // Version 3 Membership Report
)

func (IGMPType) String added in v1.1.12

func (i IGMPType) String() string

String conversions for IGMP message types

type IGMPv1or2 added in v1.1.12

type IGMPv1or2 struct {
	BaseLayer
	Type            IGMPType      // IGMP message type
	MaxResponseTime time.Duration // meaningful only in Membership Query messages
	Checksum        uint16        // 16-bit checksum of entire ip payload
	GroupAddress    net.IP        // either 0 or an IP multicast address
	Version         uint8
}

IGMPv1or2 stores header details for an IGMPv1 or IGMPv2 packet.

0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Max Resp Time | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Group Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func (*IGMPv1or2) CanDecode added in v1.1.12

func (i *IGMPv1or2) CanDecode() gopacket.LayerClass

func (*IGMPv1or2) DecodeFromBytes added in v1.1.12

func (i *IGMPv1or2) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*IGMPv1or2) LayerType added in v1.1.12

func (i *IGMPv1or2) LayerType() gopacket.LayerType

func (*IGMPv1or2) NextLayerType added in v1.1.12

func (i *IGMPv1or2) NextLayerType() gopacket.LayerType

type IGMPv3GroupRecord added in v1.1.12

type IGMPv3GroupRecord struct {
	Type             IGMPv3GroupRecordType
	AuxDataLen       uint8 // this should always be 0 as per IGMPv3 spec.
	NumberOfSources  uint16
	MulticastAddress net.IP
	SourceAddresses  []net.IP
	AuxData          uint32 // NOT USED
}

IGMPv3GroupRecord stores individual group records for a V3 Membership Report message.

type IGMPv3GroupRecordType added in v1.1.12

type IGMPv3GroupRecordType uint8
const (
	IGMPIsIn  IGMPv3GroupRecordType = 0x01 // Type MODE_IS_INCLUDE, source addresses x
	IGMPIsEx  IGMPv3GroupRecordType = 0x02 // Type MODE_IS_EXCLUDE, source addresses x
	IGMPToIn  IGMPv3GroupRecordType = 0x03 // Type CHANGE_TO_INCLUDE_MODE, source addresses x
	IGMPToEx  IGMPv3GroupRecordType = 0x04 // Type CHANGE_TO_EXCLUDE_MODE, source addresses x
	IGMPAllow IGMPv3GroupRecordType = 0x05 // Type ALLOW_NEW_SOURCES, source addresses x
	IGMPBlock IGMPv3GroupRecordType = 0x06 // Type BLOCK_OLD_SOURCES, source addresses x
)

func (IGMPv3GroupRecordType) String added in v1.1.12

func (i IGMPv3GroupRecordType) String() string

type IPProtocol

type IPProtocol uint8

IPProtocol is an enumeration of IP protocol values, and acts as a decoder for any type it supports.

const (
	IPProtocolIPv6HopByHop    IPProtocol = 0
	IPProtocolICMPv4          IPProtocol = 1
	IPProtocolIGMP            IPProtocol = 2
	IPProtocolIPv4            IPProtocol = 4
	IPProtocolTCP             IPProtocol = 6
	IPProtocolUDP             IPProtocol = 17
	IPProtocolRUDP            IPProtocol = 27
	IPProtocolIPv6            IPProtocol = 41
	IPProtocolIPv6Routing     IPProtocol = 43
	IPProtocolIPv6Fragment    IPProtocol = 44
	IPProtocolGRE             IPProtocol = 47
	IPProtocolESP             IPProtocol = 50
	IPProtocolAH              IPProtocol = 51
	IPProtocolICMPv6          IPProtocol = 58
	IPProtocolNoNextHeader    IPProtocol = 59
	IPProtocolIPv6Destination IPProtocol = 60
	IPProtocolIPIP            IPProtocol = 94
	IPProtocolEtherIP         IPProtocol = 97
	IPProtocolVRRP            IPProtocol = 112
	IPProtocolSCTP            IPProtocol = 132
	IPProtocolUDPLite         IPProtocol = 136
	IPProtocolMPLSInIP        IPProtocol = 137
)

func (IPProtocol) Decode

func (a IPProtocol) Decode(data []byte, p gopacket.PacketBuilder) error

func (IPProtocol) LayerType

func (a IPProtocol) LayerType() gopacket.LayerType

func (IPProtocol) String

func (a IPProtocol) String() string

type IPSecAH

type IPSecAH struct {
	Reserved           uint16
	SPI, Seq           uint32
	AuthenticationData []byte
	// contains filtered or unexported fields
}

IPSecAH is the authentication header for IPv4/6 defined in http://tools.ietf.org/html/rfc2402

func (*IPSecAH) LayerType

func (i *IPSecAH) LayerType() gopacket.LayerType

LayerType returns LayerTypeIPSecAH.

type IPSecESP

type IPSecESP struct {
	BaseLayer
	SPI, Seq uint32
	// Encrypted contains the encrypted set of bytes sent in an ESP
	Encrypted []byte
}

IPSecESP is the encapsulating security payload defined in http://tools.ietf.org/html/rfc2406

func (*IPSecESP) LayerType

func (i *IPSecESP) LayerType() gopacket.LayerType

LayerType returns LayerTypeIPSecESP.

type IPv4

type IPv4 struct {
	BaseLayer
	Version    uint8
	IHL        uint8
	TOS        uint8
	Length     uint16
	Id         uint16
	Flags      IPv4Flag
	FragOffset uint16
	TTL        uint8
	Protocol   IPProtocol
	Checksum   uint16
	SrcIP      net.IP
	DstIP      net.IP
	Options    []IPv4Option
	Padding    []byte
}

IPv4 is the header of an IP packet.

func (*IPv4) AddressTo4 added in v1.1.11

func (ip *IPv4) AddressTo4() error

func (*IPv4) CanDecode

func (i *IPv4) CanDecode() gopacket.LayerClass

func (*IPv4) DecodeFromBytes

func (ip *IPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes decodes the given bytes into this layer.

func (*IPv4) LayerType

func (i *IPv4) LayerType() gopacket.LayerType

LayerType returns LayerTypeIPv4

func (*IPv4) NetworkFlow

func (i *IPv4) NetworkFlow() gopacket.Flow

func (*IPv4) NextLayerType

func (i *IPv4) NextLayerType() gopacket.LayerType

func (*IPv4) SerializeTo

func (ip *IPv4) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.

type IPv4Flag

type IPv4Flag uint8
const (
	IPv4EvilBit       IPv4Flag = 1 << 2 // http://tools.ietf.org/html/rfc3514 ;)
	IPv4DontFragment  IPv4Flag = 1 << 1
	IPv4MoreFragments IPv4Flag = 1 << 0
)

func (IPv4Flag) String

func (f IPv4Flag) String() string

type IPv4Option

type IPv4Option struct {
	OptionType   uint8
	OptionLength uint8
	OptionData   []byte
}

func (IPv4Option) String

func (i IPv4Option) String() string

type IPv6

type IPv6 struct {
	// http://www.networksorcery.com/enp/protocol/ipv6.htm
	BaseLayer
	Version      uint8
	TrafficClass uint8
	FlowLabel    uint32
	Length       uint16
	NextHeader   IPProtocol
	HopLimit     uint8
	SrcIP        net.IP
	DstIP        net.IP
	HopByHop     *IPv6HopByHop
	// contains filtered or unexported fields
}

IPv6 is the layer for the IPv6 header.

func (*IPv6) AddressTo16 added in v1.1.11

func (ip *IPv6) AddressTo16() error

func (*IPv6) CanDecode

func (i *IPv6) CanDecode() gopacket.LayerClass

func (*IPv6) DecodeFromBytes

func (ip6 *IPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*IPv6) LayerType

func (i *IPv6) LayerType() gopacket.LayerType

LayerType returns LayerTypeIPv6

func (*IPv6) NetworkFlow

func (i *IPv6) NetworkFlow() gopacket.Flow

func (*IPv6) NextLayerType

func (i *IPv6) NextLayerType() gopacket.LayerType

func (*IPv6) SerializeTo

func (ip6 *IPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

type IPv6Destination

type IPv6Destination struct {
	Options []*IPv6DestinationOption
	// contains filtered or unexported fields
}

IPv6Destination is the IPv6 destination options header.

func (*IPv6Destination) DecodeFromBytes added in v1.1.11

func (i *IPv6Destination) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*IPv6Destination) LayerType

func (i *IPv6Destination) LayerType() gopacket.LayerType

LayerType returns LayerTypeIPv6Destination.

func (*IPv6Destination) SerializeTo added in v1.1.6

SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.

type IPv6DestinationOption

type IPv6DestinationOption ipv6HeaderTLVOption

IPv6DestinationOption is a TLV option present in an IPv6 destination options extension.

type IPv6ExtensionSkipper

type IPv6ExtensionSkipper struct {
	NextHeader IPProtocol
	BaseLayer
}

IPv6ExtensionSkipper is a DecodingLayer which decodes and ignores v6 extensions. You can use it with a DecodingLayerParser to handle IPv6 stacks which may or may not have extensions.

func (*IPv6ExtensionSkipper) CanDecode

func (i *IPv6ExtensionSkipper) CanDecode() gopacket.LayerClass

func (*IPv6ExtensionSkipper) DecodeFromBytes

func (i *IPv6ExtensionSkipper) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*IPv6ExtensionSkipper) NextLayerType

func (i *IPv6ExtensionSkipper) NextLayerType() gopacket.LayerType

type IPv6Fragment

type IPv6Fragment struct {
	BaseLayer
	NextHeader IPProtocol
	// Reserved1 is bits [8-16), from least to most significant, 0-indexed
	Reserved1      uint8
	FragmentOffset uint16
	// Reserved2 is bits [29-31), from least to most significant, 0-indexed
	Reserved2      uint8
	MoreFragments  bool
	Identification uint32
}

IPv6Fragment is the IPv6 fragment header, used for packet fragmentation/defragmentation.

func (*IPv6Fragment) LayerType

func (i *IPv6Fragment) LayerType() gopacket.LayerType

LayerType returns LayerTypeIPv6Fragment.

type IPv6HopByHop

type IPv6HopByHop struct {
	Options []*IPv6HopByHopOption
	// contains filtered or unexported fields
}

IPv6HopByHop is the IPv6 hop-by-hop extension.

func (*IPv6HopByHop) DecodeFromBytes

func (i *IPv6HopByHop) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*IPv6HopByHop) LayerType

func (i *IPv6HopByHop) LayerType() gopacket.LayerType

LayerType returns LayerTypeIPv6HopByHop.

func (*IPv6HopByHop) SerializeTo added in v1.1.11

type