layers

package
Version: v1.1.19 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: BSD-3-Clause Imports: 15 Imported by: 2,090

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
)

Potential values for ARP.Operation.

View Source
const (
	// ASFDCMIEnterprise is the IANA-assigned Enterprise Number of the Data
	// Center Manageability Interface Forum. The Presence Pong response's
	// Enterprise field being set to this value indicates support for DCMI. The
	// DCMI spec regards the OEM field as reserved, so these should be null.
	ASFDCMIEnterprise uint32 = 36465

	// ASFPresencePongEntityIPMI ANDs with Presence Pong's supported entities
	// field if the managed system supports IPMI.
	ASFPresencePongEntityIPMI ASFEntity = 1 << 7

	// ASFPresencePongEntityASFv1 ANDs with Presence Pong's supported entities
	// field if the managed system supports ASF v1.0.
	ASFPresencePongEntityASFv1 ASFEntity = 1

	// ASFPresencePongInteractionSecurityExtensions ANDs with Presence Pong's
	// supported interactions field if the managed system supports RMCP v2.0
	// security extensions. See section 3.2.3.
	ASFPresencePongInteractionSecurityExtensions ASFInteraction = 1 << 7

	// ASFPresencePongInteractionDASH ANDs with Presence Pong's supported
	// interactions field if the managed system supports DMTF DASH. See
	// https://www.dmtf.org/standards/dash.
	ASFPresencePongInteractionDASH ASFInteraction = 1 << 5
)
View Source
const (
	CDPPoEFourWire  byte = 0x01
	CDPPoEPDArch    byte = 0x02
	CDPPoEPDRequest byte = 0x04
	CDPPoEPSE       byte = 0x08
)

CDP Power-over-Ethernet values.

View Source
const (
	CDPProtocolTypeNLPID byte = 1
	CDPProtocolType802_2 byte = 2
)

CDP Protocol Types

View Source
const (
	// DecOptionNotEnoughData is returned when there is not enough data during option's decode process
	DecOptionNotEnoughData = DHCPv4Error("Not enough data to decode")
	// DecOptionMalformed is returned when the option is malformed
	DecOptionMalformed = DHCPv4Error("Option is malformed")
	// InvalidMagicCookie is returned when Magic cookie is missing into BOOTP header
	InvalidMagicCookie = DHCPv4Error("Bad DHCP header")
)
View Source
const (
	Dot11CodingTypeBCC  = 0
	Dot11CodingTypeLDPC = 1
)
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 (
	//ERSPANIIVersionObsolete - The obsolete value for the version field
	ERSPANIIVersionObsolete = 0x0
	// ERSPANIIVersion - The current value for the version field
	ERSPANIIVersion = 0x1
)
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

	// The following are from RFC 2710
	ICMPv6TypeMLDv1MulticastListenerQueryMessage  = 130
	ICMPv6TypeMLDv1MulticastListenerReportMessage = 131
	ICMPv6TypeMLDv1MulticastListenerDoneMessage   = 132

	// The following are from RFC 3810
	ICMPv6TypeMLDv2MulticastListenerReportMessageV2 = 143
)
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 (
	// LCMShortHeaderMagic is the LCM small message header magic number
	LCMShortHeaderMagic uint32 = 0x4c433032
	// LCMFragmentedHeaderMagic is the LCM fragmented message header magic number
	LCMFragmentedHeaderMagic uint32 = 0x4c433033
)
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 (
	RouterLSAtypeV2         = 0x1
	RouterLSAtype           = 0x2001
	NetworkLSAtypeV2        = 0x2
	NetworkLSAtype          = 0x2002
	SummaryLSANetworktypeV2 = 0x3
	InterAreaPrefixLSAtype  = 0x2003
	SummaryLSAASBRtypeV2    = 0x4
	InterAreaRouterLSAtype  = 0x2004
	ASExternalLSAtypeV2     = 0x5
	ASExternalLSAtype       = 0x4005
	NSSALSAtype             = 0x2007
	NSSALSAtypeV2           = 0x7
	LinkLSAtype             = 0x0008
	IntraAreaPrefixLSAtype  = 0x2009
)

LSA Function Codes for LSAheader.LSType

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 (
	// RMCPVersion1 identifies RMCP v1.0 in the Version header field. Lower
	// values are considered legacy, while higher values are reserved by the
	// specification.
	RMCPVersion1 uint8 = 0x06

	// RMCPNormal indicates a "normal" message, i.e. not an acknowledgement.
	RMCPNormal uint8 = 0

	// RMCPAck indicates a message is acknowledging a received normal message.
	RMCPAck uint8 = 1 << 7

	// RMCPClassASF identifies an RMCP message as containing an ASF-RMCP
	// payload.
	RMCPClassASF RMCPClass = 0x06

	// RMCPClassIPMI identifies an RMCP message as containing an IPMI payload.
	RMCPClassIPMI RMCPClass = 0x07

	// RMCPClassOEM identifies an RMCP message as containing an OEM-defined
	// payload.
	RMCPClassOEM RMCPClass = 0x08
)
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 (
	TLSAlertWarning      TLSAlertLevel = 1
	TLSAlertFatal        TLSAlertLevel = 2
	TLSAlertUnknownLevel TLSAlertLevel = 255

	TLSAlertCloseNotify               TLSAlertDescr = 0
	TLSAlertUnexpectedMessage         TLSAlertDescr = 10
	TLSAlertBadRecordMac              TLSAlertDescr = 20
	TLSAlertDecryptionFailedRESERVED  TLSAlertDescr = 21
	TLSAlertRecordOverflow            TLSAlertDescr = 22
	TLSAlertDecompressionFailure      TLSAlertDescr = 30
	TLSAlertHandshakeFailure          TLSAlertDescr = 40
	TLSAlertNoCertificateRESERVED     TLSAlertDescr = 41
	TLSAlertBadCertificate            TLSAlertDescr = 42
	TLSAlertUnsupportedCertificate    TLSAlertDescr = 43
	TLSAlertCertificateRevoked        TLSAlertDescr = 44
	TLSAlertCertificateExpired        TLSAlertDescr = 45
	TLSAlertCertificateUnknown        TLSAlertDescr = 46
	TLSAlertIllegalParameter          TLSAlertDescr = 47
	TLSAlertUnknownCa                 TLSAlertDescr = 48
	TLSAlertAccessDenied              TLSAlertDescr = 49
	TLSAlertDecodeError               TLSAlertDescr = 50
	TLSAlertDecryptError              TLSAlertDescr = 51
	TLSAlertExportRestrictionRESERVED TLSAlertDescr = 60
	TLSAlertProtocolVersion           TLSAlertDescr = 70
	TLSAlertInsufficientSecurity      TLSAlertDescr = 71
	TLSAlertInternalError             TLSAlertDescr = 80
	TLSAlertUserCanceled              TLSAlertDescr = 90
	TLSAlertNoRenegotiation           TLSAlertDescr = 100
	TLSAlertUnsupportedExtension      TLSAlertDescr = 110
	TLSAlertUnknownDescription        TLSAlertDescr = 255
)
View Source
const (
	// ASFRMCPEnterprise is the IANA-assigned Enterprise Number of the ASF-RMCP.
	ASFRMCPEnterprise uint32 = 4542
)
View Source
const (
	// IPv6HopByHopOptionJumbogram code as defined in RFC 2675
	IPv6HopByHopOptionJumbogram = 0xC2
)

Variables

View Source
var (
	// ASFDataIdentifierPresencePong is the message type of the response to a
	// Presence Ping message. It indicates the sender is ASF-RMCP-aware.
	ASFDataIdentifierPresencePong = ASFDataIdentifier{
		Enterprise: ASFRMCPEnterprise,
		Type:       0x40,
	}

	// ASFDataIdentifierPresencePing is a message type sent to a managed client
	// to solicit a Presence Pong response. Clients may ignore this if the RMCP
	// version is unsupported. Sending this message with a sequence number <255
	// is the recommended way of finding out whether an implementation sends
	// RMCP ACKs (e.g. iDRAC does, Super Micro does not).
	//
	// Systems implementing IPMI must respond to this ping to conform to the
	// spec, so it is a good substitute for an ICMP ping.
	ASFDataIdentifierPresencePing = ASFDataIdentifier{
		Enterprise: ASFRMCPEnterprise,
		Type:       0x80,
	}
)
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 (
	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)})
	LayerTypeGeneve                       = gopacket.RegisterLayerType(120, gopacket.LayerTypeMetadata{Name: "Geneve", Decoder: gopacket.DecodeFunc(decodeGeneve)})
	LayerTypeSTP                          = gopacket.RegisterLayerType(121, gopacket.LayerTypeMetadata{Name: "STP", Decoder: gopacket.DecodeFunc(decodeSTP)})
	LayerTypeBFD                          = gopacket.RegisterLayerType(122, gopacket.LayerTypeMetadata{Name: "BFD", Decoder: gopacket.DecodeFunc(decodeBFD)})
	LayerTypeOSPF                         = gopacket.RegisterLayerType(123, gopacket.LayerTypeMetadata{Name: "OSPF", Decoder: gopacket.DecodeFunc(decodeOSPF)})
	LayerTypeICMPv6RouterSolicitation     = gopacket.RegisterLayerType(124, gopacket.LayerTypeMetadata{Name: "ICMPv6RouterSolicitation", Decoder: gopacket.DecodeFunc(decodeICMPv6RouterSolicitation)})
	LayerTypeICMPv6RouterAdvertisement    = gopacket.RegisterLayerType(125, gopacket.LayerTypeMetadata{Name: "ICMPv6RouterAdvertisement", Decoder: gopacket.DecodeFunc(decodeICMPv6RouterAdvertisement)})
	LayerTypeICMPv6NeighborSolicitation   = gopacket.RegisterLayerType(126, gopacket.LayerTypeMetadata{Name: "ICMPv6NeighborSolicitation", Decoder: gopacket.DecodeFunc(decodeICMPv6NeighborSolicitation)})
	LayerTypeICMPv6NeighborAdvertisement  = gopacket.RegisterLayerType(127, gopacket.LayerTypeMetadata{Name: "ICMPv6NeighborAdvertisement", Decoder: gopacket.DecodeFunc(decodeICMPv6NeighborAdvertisement)})
	LayerTypeICMPv6Redirect               = gopacket.RegisterLayerType(128, gopacket.LayerTypeMetadata{Name: "ICMPv6Redirect", Decoder: gopacket.DecodeFunc(decodeICMPv6Redirect)})
	LayerTypeGTPv1U                       = gopacket.RegisterLayerType(129, gopacket.LayerTypeMetadata{Name: "GTPv1U", Decoder: gopacket.DecodeFunc(decodeGTPv1u)})
	LayerTypeEAPOLKey                     = gopacket.RegisterLayerType(130, gopacket.LayerTypeMetadata{Name: "EAPOLKey", Decoder: gopacket.DecodeFunc(decodeEAPOLKey)})
	LayerTypeLCM                          = gopacket.RegisterLayerType(131, gopacket.LayerTypeMetadata{Name: "LCM", Decoder: gopacket.DecodeFunc(decodeLCM)})
	LayerTypeICMPv6Echo                   = gopacket.RegisterLayerType(132, gopacket.LayerTypeMetadata{Name: "ICMPv6Echo", Decoder: gopacket.DecodeFunc(decodeICMPv6Echo)})
	LayerTypeSIP                          = gopacket.RegisterLayerType(133, gopacket.LayerTypeMetadata{Name: "SIP", Decoder: gopacket.DecodeFunc(decodeSIP)})
	LayerTypeDHCPv6                       = gopacket.RegisterLayerType(134, gopacket.LayerTypeMetadata{Name: "DHCPv6", Decoder: gopacket.DecodeFunc(decodeDHCPv6)})
	LayerTypeMLDv1MulticastListenerReport = gopacket.RegisterLayerType(135, gopacket.LayerTypeMetadata{Name: "MLDv1MulticastListenerReport", Decoder: gopacket.DecodeFunc(decodeMLDv1MulticastListenerReport)})
	LayerTypeMLDv1MulticastListenerDone   = gopacket.RegisterLayerType(136, gopacket.LayerTypeMetadata{Name: "MLDv1MulticastListenerDone", Decoder: gopacket.DecodeFunc(decodeMLDv1MulticastListenerDone)})
	LayerTypeMLDv1MulticastListenerQuery  = gopacket.RegisterLayerType(137, gopacket.LayerTypeMetadata{Name: "MLDv1MulticastListenerQuery", Decoder: gopacket.DecodeFunc(decodeMLDv1MulticastListenerQuery)})
	LayerTypeMLDv2MulticastListenerReport = gopacket.RegisterLayerType(138, gopacket.LayerTypeMetadata{Name: "MLDv2MulticastListenerReport", Decoder: gopacket.DecodeFunc(decodeMLDv2MulticastListenerReport)})
	LayerTypeMLDv2MulticastListenerQuery  = gopacket.RegisterLayerType(139, gopacket.LayerTypeMetadata{Name: "MLDv2MulticastListenerQuery", Decoder: gopacket.DecodeFunc(decodeMLDv2MulticastListenerQuery)})
	LayerTypeTLS                          = gopacket.RegisterLayerType(140, gopacket.LayerTypeMetadata{Name: "TLS", Decoder: gopacket.DecodeFunc(decodeTLS)})
	LayerTypeModbusTCP                    = gopacket.RegisterLayerType(141, gopacket.LayerTypeMetadata{Name: "ModbusTCP", Decoder: gopacket.DecodeFunc(decodeModbusTCP)})
	LayerTypeRMCP                         = gopacket.RegisterLayerType(142, gopacket.LayerTypeMetadata{Name: "RMCP", Decoder: gopacket.DecodeFunc(decodeRMCP)})
	LayerTypeASF                          = gopacket.RegisterLayerType(143, gopacket.LayerTypeMetadata{Name: "ASF", Decoder: gopacket.DecodeFunc(decodeASF)})
	LayerTypeASFPresencePong              = gopacket.RegisterLayerType(144, gopacket.LayerTypeMetadata{Name: "ASFPresencePong", Decoder: gopacket.DecodeFunc(decodeASFPresencePong)})
	LayerTypeERSPANII                     = gopacket.RegisterLayerType(145, gopacket.LayerTypeMetadata{Name: "ERSPAN Type II", Decoder: gopacket.DecodeFunc(decodeERSPANII)})
	LayerTypeRADIUS                       = gopacket.RegisterLayerType(146, gopacket.LayerTypeMetadata{Name: "RADIUS", Decoder: gopacket.DecodeFunc(decodeRADIUS)})
)
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,
	})
	// LayerClassICMPv6NDP contains ICMPv6 neighbor discovery protocol
	// messages.
	LayerClassICMPv6NDP = gopacket.NewLayerClass([]gopacket.LayerType{
		LayerTypeICMPv6RouterSolicitation,
		LayerTypeICMPv6RouterAdvertisement,
		LayerTypeICMPv6NeighborSolicitation,
		LayerTypeICMPv6NeighborAdvertisement,
		LayerTypeICMPv6Redirect,
	})
	// LayerClassMLDv1 contains multicast listener discovery protocol
	LayerClassMLDv1 = gopacket.NewLayerClass([]gopacket.LayerType{
		LayerTypeMLDv1MulticastListenerQuery,
		LayerTypeMLDv1MulticastListenerReport,
		LayerTypeMLDv1MulticastListenerDone,
	})
	// LayerClassMLDv2 contains multicast listener discovery protocol v2
	LayerClassMLDv2 = gopacket.NewLayerClass([]gopacket.LayerType{
		LayerTypeMLDv1MulticastListenerReport,
		LayerTypeMLDv1MulticastListenerDone,
		LayerTypeMLDv2MulticastListenerReport,
		LayerTypeMLDv1MulticastListenerQuery,
		LayerTypeMLDv2MulticastListenerQuery,
	})
)
View Source
var DHCPMagic uint32 = 0x63825363

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

View Source
var Dot11TypeMetadata [256]EnumMetadata
View Source
var EAPOLTypeMetadata [256]EnumMetadata
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.

View Source
var EthernetTypeMetadata [65536]EnumMetadata
View Source
var FDDIFrameControlMetadata [256]EnumMetadata
View Source
var IPProtocolMetadata [256]EnumMetadata
View Source
var LinkTypeMetadata [256]EnumMetadata

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 PPPTypeMetadata [65536]EnumMetadata
View Source
var PPPoECodeMetadata [256]EnumMetadata
View Source
var ProtocolFamilyMetadata [256]EnumMetadata
View Source
var RUDPPortNames = map[RUDPPort]string{}

RUDPPortNames contains the string names for all RUDP ports.

View Source
var SCTPChunkTypeMetadata [256]EnumMetadata
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.

View Source
var USBTransportTypeMetadata [256]EnumMetadata

Functions

func FuzzLayer added in v1.1.18

func FuzzLayer(data []byte) int

FuzzLayer is a fuzz target for the layers package of gopacket A fuzz target is a function processing a binary blob (byte slice) The process here is to interpret this data as a packet, and print the layers contents. The decoding options and the starting layer are encoded in the first bytes. The function returns 1 if this is a valid packet (no error layer)

func GetLCMLayerType added in v1.1.15

func GetLCMLayerType(fingerprint LCMFingerprint) gopacket.LayerType

GetLCMLayerType returns the underlying LCM message's LayerType. This LayerType has to be registered by using RegisterLCMLayerType.

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.

func RegisterASFLayerType added in v1.1.18

func RegisterASFLayerType(a ASFDataIdentifier, l gopacket.LayerType)

RegisterASFLayerType allows specifying that the data block of ASF packets with a given enterprise number and type should be processed by a given layer type. This overrides any existing registrations, including defaults.

func RegisterLCMLayerType added in v1.1.15

func RegisterLCMLayerType(num int, name string, fingerprint LCMFingerprint,
	decoder gopacket.Decoder) gopacket.LayerType

RegisterLCMLayerType allows users to register decoders for the underlying LCM payload. This is done based on the fingerprint that every LCM message contains and which identifies it uniquely. If num is not the zero value it will be used when registering with RegisterLayerType towards gopacket, otherwise an incremental value starting from 1001 will be used.

func RegisterRMCPLayerType added in v1.1.18

func RegisterRMCPLayerType(c RMCPClass, l gopacket.LayerType)

RegisterRMCPLayerType allows specifying that the payload of a RMCP packet of a certain class should processed by the provided layer type. This overrides any existing registrations, including defaults.

func RegisterTCPPortLayerType added in v1.1.13

func RegisterTCPPortLayerType(port TCPPort, layerType gopacket.LayerType)

RegisterTCPPortLayerType creates a new mapping between a TCPPort and an underlaying LayerType.

func RegisterUDPPortLayerType added in v1.1.13

func RegisterUDPPortLayerType(port UDPPort, layerType gopacket.LayerType)

RegisterUDPPortLayerType creates a new mapping between a UDPPort and an underlaying LayerType.

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 ASExternalLSA added in v1.1.15

type ASExternalLSA struct {
	Flags             uint8
	Metric            uint32
	PrefixLength      uint8
	PrefixOptions     uint8
	RefLSType         uint16
	AddressPrefix     []byte
	ForwardingAddress []byte
	ExternalRouteTag  uint32
	RefLinkStateID    uint32
}

ASExternalLSA is the struct from RFC 5340 A.4.7.

type ASExternalLSAV2 added in v1.1.15

type ASExternalLSAV2 struct {
	NetworkMask       uint32
	ExternalBit       uint8
	Metric            uint32
	ForwardingAddress uint32
	ExternalRouteTag  uint32
}

ASExternalLSAV2 is the struct from RFC 2328 A.4.5.

type ASF added in v1.1.18

type ASF struct {
	BaseLayer
	ASFDataIdentifier

	// Tag is used to match request/response pairs. The tag of a response is set
	// to that of the message it is responding to. If a message is
	// unidirectional, i.e. not part of a request/response pair, this is set to
	// 255.
	Tag uint8

	// Length is the length of this layer's payload in bytes.
	Length uint8
}

ASF defines ASF's generic RMCP message Data block format. See section 3.2.2.3.

func (*ASF) CanDecode added in v1.1.18

func (a *ASF) CanDecode() gopacket.LayerClass

CanDecode returns LayerTypeASF. It partially satisfies DecodingLayer.

func (*ASF) DecodeFromBytes added in v1.1.18

func (a *ASF) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes makes the layer represent the provided bytes. It partially satisfies DecodingLayer.

func (*ASF) LayerType added in v1.1.18

func (*ASF) LayerType() gopacket.LayerType

LayerType returns LayerTypeASF. It partially satisfies Layer and SerializableLayer.

func (*ASF) NextLayerType added in v1.1.18

func (a *ASF) NextLayerType() gopacket.LayerType

NextLayerType returns the layer type corresponding to the message type of this ASF data layer. This partially satisfies DecodingLayer.

func (*ASF) SerializeTo added in v1.1.18

func (a *ASF) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error

SerializeTo writes the serialized fom of this layer into the SerializeBuffer, partially satisfying SerializableLayer.

type ASFDataIdentifier added in v1.1.18

type ASFDataIdentifier struct {

	// Enterprise is the IANA Enterprise Number associated with the entity that
	// defines the message type. A list can be found at
	// https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers.
	// This can be thought of as the namespace for the message type.
	Enterprise uint32

	// Type is the message type, defined by the entity associated with the
	// enterprise above. No pressure, but in the context of EN 4542, 1 byte is
	// the difference between sending a ping and telling a machine to do an
	// unconditional power down (0x80 and 0x12 respectively).
	Type uint8
}

ASFDataIdentifier encapsulates fields used to uniquely identify the format of the data block.

While the enterprise number is almost always 4542 (ASF-RMCP), we support registering layers using structs of this type as a key in case any users are using OEM-extensions.

func (ASFDataIdentifier) LayerType added in v1.1.18

func (a ASFDataIdentifier) LayerType() gopacket.LayerType

LayerType returns the payload layer type corresponding to an ASF message type.

type ASFEntity added in v1.1.18

type ASFEntity uint8

ASFEntity is the type of individual entities that a Presence Pong response can indicate support of. The entities currently implemented by the spec are IPMI and ASFv1.

type ASFInteraction added in v1.1.18

type ASFInteraction uint8

ASFInteraction is the type of individual interactions that a Presence Pong response can indicate support for. The interactions currently implemented by the spec are RMCP security extensions. Although not specified, IPMI uses this field to indicate support for DASH, which is supported as well.

type ASFPresencePong added in v1.1.18

type ASFPresencePong struct {
	BaseLayer

	// Enterprise is the IANA Enterprise Number of an entity that has defined
	// OEM-specific capabilities for the managed client. If no such capabilities
	// exist, this is set to ASF's IANA Enterprise Number.
	Enterprise uint32

	// OEM identifies OEM-specific capabilities. Its structure is defined by the
	// OEM. This is set to 0s if no OEM-specific capabilities exist. This
	// implementation does not change byte order from the wire for this field.
	OEM [4]byte

	// IPMI is true if IPMI is supported by the managed system. There is no
	// explicit version in the specification, however given the dates, this is
	// assumed to be IPMI v1.0.  Support for IPMI is contained in the "supported
	// entities" field of the presence pong payload.
	IPMI bool

	// ASFv1 indicates support for ASF v1.0. This seems somewhat redundant as
	// ASF must be supported in order to receive a response. This is contained
	// in the "supported entities" field of the presence pong payload.
	ASFv1 bool

	// SecurityExtensions indicates support for RMCP Security Extensions,
	// specified in ASF v2.0. This will always be false for v1.x
	// implementations. This is contained in the "supported interactions" field
	// of the presence pong payload. This field is defined in ASF v1.0, but has
	// no useful value.
	SecurityExtensions bool

	// DASH is true if DMTF DASH is supported. This is not specified in ASF
	// v2.0, but in IPMI v2.0, however the former does not preclude it, so we
	// support it.
	DASH bool
}

ASFPresencePong defines the structure of a Presence Pong message's payload. See section 3.2.4.3.

func (*ASFPresencePong) CanDecode added in v1.1.18

func (a *ASFPresencePong) CanDecode() gopacket.LayerClass

CanDecode returns LayerTypeASFPresencePong. It partially satisfies DecodingLayer.

func (*ASFPresencePong) DecodeFromBytes added in v1.1.18

func (a *ASFPresencePong) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

DecodeFromBytes makes the layer represent the provided bytes. It partially satisfies DecodingLayer.

func (*ASFPresencePong) LayerType added in v1.1.18

func (*ASFPresencePong) LayerType() gopacket.LayerType

LayerType returns LayerTypeASFPresencePong. It partially satisfies Layer and SerializableLayer.

func (*ASFPresencePong) NextLayerType added in v1.1.18

func (a *ASFPresencePong) NextLayerType() gopacket.LayerType

NextLayerType returns LayerTypePayload, as there are no further layers to decode. This partially satisfies DecodingLayer.

func (*ASFPresencePong) SerializeTo added in v1.1.18

SerializeTo writes the serialized fom of this layer into the SerializeBuffer, partially satisfying SerializableLayer.

func (*ASFPresencePong) SupportsDCMI added in v1.1.18

func (a *ASFPresencePong) SupportsDCMI() bool

SupportsDCMI returns whether the Presence Pong message indicates support for the Data Center Management Interface, which is an extension of IPMI v2.0.

type BFD added in v1.1.15

type BFD struct {
	BaseLayer // Stores the packet bytes and payload bytes.

	Version                   BFDVersion          // Version of the BFD protocol.
	Diagnostic                BFDDiagnostic       // Diagnostic code for last state change
	State                     BFDState            // Current state
	Poll                      bool                // Requesting verification
	Final                     bool                // Responding to a received BFD Control packet that had the Poll (P) bit set.
	ControlPlaneIndependent   bool                // BFD implementation does not share fate with its control plane
	AuthPresent               bool                // Authentication Section is present and the session is to be authenticated
	Demand                    bool                // Demand mode is active
	Multipoint                bool                // For future point-to-multipoint extensions. Must always be zero
	DetectMultiplier          BFDDetectMultiplier // Detection time multiplier
	MyDiscriminator           BFDDiscriminator    // A unique, nonzero discriminator value
	YourDiscriminator         BFDDiscriminator    // discriminator received from the remote system.
	DesiredMinTxInterval      BFDTimeInterval     // Minimum interval, in microseconds,  the local system would like to use when transmitting BFD Control packets
	RequiredMinRxInterval     BFDTimeInterval     // Minimum interval, in microseconds, between received BFD Control packets that this system is capable of supporting
	RequiredMinEchoRxInterval BFDTimeInterval     // Minimum interval, in microseconds, between received BFD Echo packets that this system is capable of supporting
	AuthHeader                *BFDAuthHeader      // Authentication data, variable length.
}

BFD represents a BFD control message packet whose payload contains the control information required to for a BFD session.

References ----------

Wikipedia's BFD entry:

https://en.wikipedia.org/wiki/Bidirectional_Forwarding_Detection
This is the best place to get an overview of BFD.

RFC 5880 "Bidirectional Forwarding Detection (BFD)" (2010)

https://tools.ietf.org/html/rfc5880
This is the original BFD specification.

RFC 5881 "Bidirectional Forwarding Detection (BFD) for IPv4 and IPv6 (Single Hop)" (2010)

https://tools.ietf.org/html/rfc5881
Describes the use of the Bidirectional Forwarding Detection (BFD)
protocol over IPv4 and IPv6 for single IP hops.

func (*BFD) CanDecode added in v1.1.15

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

CanDecode returns a set of layers that BFD objects can decode. As BFD objects can only decide the BFD layer, we can return just that layer. Apparently a single layer type implements LayerClass.

func (*BFD) DecodeFromBytes added in v1.1.15

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

DecodeFromBytes analyses a byte slice and attempts to decode it as a BFD control packet.

Upon succeeds, it loads the BFD object with information about the packet and returns nil. Upon failure, it returns an error (non nil).

func (*BFD) LayerType added in v1.1.15

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

LayerType returns the layer type of the BFD object, which is LayerTypeBFD.

func (*BFD) Length added in v1.1.15

func (d *BFD) Length() int

Length returns the data length of a BFD Control message which changes based on the presence and type of authentication contained in the message

func (*BFD) NextLayerType added in v1.1.15

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

NextLayerType specifies the next layer that GoPacket should attempt to analyse after this (BFD) layer. As BFD packets do not contain any payload bytes, there are no further layers to analyse.

func (*BFD) Payload added in v1.1.15

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

Payload returns an empty byte slice as BFD packets do not carry a payload

func (*BFD) SerializeTo added in v1.1.15

func (d *BFD) 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 BFDAuthData added in v1.1.15

type BFDAuthData []byte

BFDAuthData represents the authentication key or digest

type BFDAuthHeader added in v1.1.15

type BFDAuthHeader struct {
	AuthType       BFDAuthType
	KeyID          BFDAuthKeyID
	SequenceNumber BFDAuthSequenceNumber
	Data           BFDAuthData
}

BFDAuthHeader represents authentication data used in the BFD session

func (*BFDAuthHeader) Length added in v1.1.15

func (h *BFDAuthHeader) Length() int

Length returns the data length of the BFDAuthHeader based on the authentication type

type BFDAuthKeyID added in v1.1.15

type BFDAuthKeyID uint8

BFDAuthKeyID represents the authentication key ID in use for this packet. This allows multiple keys to be active simultaneously.

type BFDAuthSequenceNumber added in v1.1.15

type BFDAuthSequenceNumber uint32

BFDAuthSequenceNumber represents the sequence number for this packet. For Keyed Authentication, this value is incremented occasionally. For Meticulous Keyed Authentication, this value is incremented for each successive packet transmitted for a session. This provides protection against replay attacks.

type BFDAuthType added in v1.1.15

type BFDAuthType uint8

BFDAuthType represents the authentication used in the BFD session

const (
	BFDAuthTypeNone                BFDAuthType = 0 // No Auth
	BFDAuthTypePassword            BFDAuthType = 1 // Simple Password
	BFDAuthTypeKeyedMD5            BFDAuthType = 2 // Keyed MD5
	BFDAuthTypeMeticulousKeyedMD5  BFDAuthType = 3 // Meticulous Keyed MD5
	BFDAuthTypeKeyedSHA1           BFDAuthType = 4 // Keyed SHA1
	BFDAuthTypeMeticulousKeyedSHA1 BFDAuthType = 5 // Meticulous Keyed SHA1
)

constants that define the BFDAuthType

func (BFDAuthType) String added in v1.1.15

func (at BFDAuthType) String() string

String returns a string version of BFDAuthType

type BFDDetectMultiplier added in v1.1.15

type BFDDetectMultiplier uint8

BFDDetectMultiplier represents the negotiated transmit interval, multiplied by this value, provides the Detection Time for the receiving system in Asynchronous mode.

type BFDDiagnostic added in v1.1.15

type BFDDiagnostic uint8

BFDDiagnostic represents diagnostic infomation about a BFD session

const (
	BFDDiagnosticNone               BFDDiagnostic = 0 // No Diagnostic
	BFDDiagnosticTimeExpired        BFDDiagnostic = 1 // Control Detection Time Expired
	BFDDiagnosticEchoFailed         BFDDiagnostic = 2 // Echo Function Failed
	BFDDiagnosticNeighborSignalDown BFDDiagnostic = 3 // Neighbor Signaled Session Down
	BFDDiagnosticForwardPlaneReset  BFDDiagnostic = 4 // Forwarding Plane Reset
	BFDDiagnosticPathDown           BFDDiagnostic = 5 // Path Down
	BFDDiagnosticConcatPathDown     BFDDiagnostic = 6 // Concatenated Path Down
	BFDDiagnosticAdminDown          BFDDiagnostic = 7 // Administratively Down
	BFDDiagnosticRevConcatPathDown  BFDDiagnostic = 8 // Reverse Concatenated Path Dow
)

constants that define BFDDiagnostic flags

func (BFDDiagnostic) String added in v1.1.15

func (bd BFDDiagnostic) String() string

String returns a string version of BFDDiagnostic

type BFDDiscriminator added in v1.1.15

type BFDDiscriminator uint32

BFDDiscriminator is a unique, nonzero discriminator value used to demultiplex multiple BFD sessions between the same pair of systems.

type BFDState added in v1.1.15

type BFDState uint8

BFDState represents the state of a BFD session

const (
	BFDStateAdminDown BFDState = 0
	BFDStateDown      BFDState = 1
	BFDStateInit      BFDState = 2
	BFDStateUp        BFDState = 3
)

constants that define BFDState

func (BFDState) String added in v1.1.15

func (s BFDState) String() string

String returns a string version of BFDState

type BFDTimeInterval added in v1.1.15

type BFDTimeInterval uint32

BFDTimeInterval represents a time interval in microseconds

type BFDVersion added in v1.1.15

type BFDVersion uint8

BFDVersion represents the version as decoded from the BFD control message

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

CDPAddressType is used to define TLV values within CDP addresses.

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

CDPCapability is the set of capabilities advertised by a CDP device.

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
)

CDPCapability values.

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
}

CDPEnergyWise is used by CDP to monitor and control power usage.

type CDPEnergyWiseSubtype

type CDPEnergyWiseSubtype uint32

CDPEnergyWiseSubtype is used within CDP to define TLV values.

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

CDPEnergyWiseSubtype values.

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
}

CDPLocation provides location information for a CDP device.

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
}

CDPSparePairPoE provides information on PoE.

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
)

CDPTLVType values.

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 DHCPv4Error added in v1.1.15

type DHCPv4Error string

DHCPv4Error is used for constant errors for DHCPv4. It is needed for test asserts.

func (DHCPv4Error) Error added in v1.1.15

func (d DHCPv4Error) Error() string

DHCPv4Error implements error interface.

type DHCPv6 added in v1.1.15

type DHCPv6 struct {
	BaseLayer
	MsgType       DHCPv6MsgType
	HopCount      uint8
	LinkAddr      net.IP
	PeerAddr      net.IP
	TransactionID []byte
	Options       DHCPv6Options
}

DHCPv6 contains data for a single DHCP packet.

func (*DHCPv6) CanDecode added in v1.1.15

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

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

func (*DHCPv6) DecodeFromBytes added in v1.1.15

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

DecodeFromBytes decodes the given bytes into this layer.

func (*DHCPv6) LayerType added in v1.1.15

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

LayerType returns gopacket.LayerTypeDHCPv6

func (*DHCPv6) Len added in v1.1.15

func (d *DHCPv6) Len() int

Len returns the length of a DHCPv6 packet.

func (*DHCPv6) NextLayerType added in v1.1.15

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

NextLayerType returns the layer type contained by this DecodingLayer.

func (*DHCPv6) SerializeTo added in v1.1.15

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

type DHCPv6DUID added in v1.1.15

type DHCPv6DUID struct {
	Type DHCPv6DUIDType
	// LLT, LL
	HardwareType []byte
	// EN
	EnterpriseNumber []byte
	// LLT
	Time []byte
	// LLT, LL
	LinkLayerAddress net.HardwareAddr
	// EN
	Identifier []byte
}

DHCPv6DUID means DHCP Unique Identifier as stated in RFC 3315, section 9 (https://tools.ietf.org/html/rfc3315#page-19)

func (*DHCPv6DUID) DecodeFromBytes added in v1.1.15

func (d *DHCPv6DUID) DecodeFromBytes(data []byte) error

DecodeFromBytes decodes the given bytes into a DHCPv6DUID

func (*DHCPv6DUID) Encode added in v1.1.15

func (d *DHCPv6DUID) Encode() []byte

Encode encodes the DHCPv6DUID in a slice of bytes

func (*DHCPv6DUID) Len added in v1.1.15

func (d *DHCPv6DUID) Len() int

Len returns the length of the DHCPv6DUID, respecting the type

func (*DHCPv6DUID) String added in v1.1.15

func (d *DHCPv6DUID) String() string

type DHCPv6DUIDType added in v1.1.15

type DHCPv6DUIDType uint16

DHCPv6DUIDType represents a DHCP DUID - RFC-3315

const (
	DHCPv6DUIDTypeLLT DHCPv6DUIDType = iota + 1
	DHCPv6DUIDTypeEN
	DHCPv6DUIDTypeLL
)

Constants for the DHCPv6DUIDType.

func (DHCPv6DUIDType) String added in v1.1.15

func (o DHCPv6DUIDType) String() string

String returns a string version of a DHCPv6DUIDType.

type DHCPv6MsgType added in v1.1.15

type DHCPv6MsgType byte

DHCPv6MsgType represents a DHCPv6 operation

const (
	DHCPv6MsgTypeUnspecified DHCPv6MsgType = iota
	DHCPv6MsgTypeSolicit
	DHCPv6MsgTypeAdverstise
	DHCPv6MsgTypeRequest
	DHCPv6MsgTypeConfirm
	DHCPv6MsgTypeRenew
	DHCPv6MsgTypeRebind
	DHCPv6MsgTypeReply
	DHCPv6MsgTypeRelease
	DHCPv6MsgTypeDecline
	DHCPv6MsgTypeReconfigure
	DHCPv6MsgTypeInformationRequest
	DHCPv6MsgTypeRelayForward
	DHCPv6MsgTypeRelayReply
)

Constants that represent DHCP operations

func (DHCPv6MsgType) String added in v1.1.15

func (o DHCPv6MsgType) String() string

String returns a string version of a DHCPv6MsgType.

type DHCPv6Opt added in v1.1.15

type DHCPv6Opt uint16

DHCPv6Opt represents a DHCP option or parameter from RFC-3315

const (
	DHCPv6OptClientID           DHCPv6Opt = 1
	DHCPv6OptServerID           DHCPv6Opt = 2
	DHCPv6OptIANA               DHCPv6Opt = 3
	DHCPv6OptIATA               DHCPv6Opt = 4
	DHCPv6OptIAAddr             DHCPv6Opt = 5
	DHCPv6OptOro                DHCPv6Opt = 6
	DHCPv6OptPreference         DHCPv6Opt = 7
	DHCPv6OptElapsedTime        DHCPv6Opt = 8
	DHCPv6OptRelayMessage       DHCPv6Opt = 9
	DHCPv6OptAuth               DHCPv6Opt = 11
	DHCPv6OptUnicast            DHCPv6Opt = 12
	DHCPv6OptStatusCode         DHCPv6Opt = 13
	DHCPv6OptRapidCommit        DHCPv6Opt = 14
	DHCPv6OptUserClass          DHCPv6Opt = 15
	DHCPv6OptVendorClass        DHCPv6Opt = 16
	DHCPv6OptVendorOpts         DHCPv6Opt = 17
	DHCPv6OptInterfaceID        DHCPv6Opt = 18
	DHCPv6OptReconfigureMessage DHCPv6Opt = 19
	DHCPv6OptReconfigureAccept  DHCPv6Opt = 20

	// RFC 3319 Session Initiation Protocol (SIP)
	DHCPv6OptSIPServersDomainList  DHCPv6Opt = 21
	DHCPv6OptSIPServersAddressList DHCPv6Opt = 22

	// RFC 3646 DNS Configuration
	DHCPv6OptDNSServers DHCPv6Opt = 23
	DHCPv6OptDomainList DHCPv6Opt = 24

	// RFC 3633 Prefix Delegation
	DHCPv6OptIAPD     DHCPv6Opt = 25
	DHCPv6OptIAPrefix DHCPv6Opt = 26

	// RFC 3898 Network Information Service (NIS)
	DHCPv6OptNISServers     DHCPv6Opt = 27
	DHCPv6OptNISPServers    DHCPv6Opt = 28
	DHCPv6OptNISDomainName  DHCPv6Opt = 29
	DHCPv6OptNISPDomainName DHCPv6Opt = 30

	// RFC 4075 Simple Network Time Protocol (SNTP)
	DHCPv6OptSNTPServers DHCPv6Opt = 31

	// RFC 4242 Information Refresh Time Option
	DHCPv6OptInformationRefreshTime DHCPv6Opt = 32

	// RFC 4280 Broadcast and Multicast Control Servers
	DHCPv6OptBCMCSServerDomainNameList DHCPv6Opt = 33
	DHCPv6OptBCMCSServerAddressList    DHCPv6Opt = 34

	// RFC 4776 Civic Address ConfigurationOption
	DHCPv6OptGeoconfCivic DHCPv6Opt = 36

	// RFC 4649 Relay Agent Remote-ID
	DHCPv6OptRemoteID DHCPv6Opt = 37

	// RFC 4580 Relay Agent Subscriber-ID
	DHCPv6OptSubscriberID DHCPv6Opt = 38

	// RFC 4704 Client Full Qualified Domain Name (FQDN)
	DHCPv6OptClientFQDN DHCPv6Opt = 39

	// RFC 5192 Protocol for Carrying Authentication for Network Access (PANA)
	DHCPv6OptPanaAgent DHCPv6Opt = 40

	// RFC 4833 Timezone Options
	DHCPv6OptNewPOSIXTimezone DHCPv6Opt = 41
	DHCPv6OptNewTZDBTimezone  DHCPv6Opt = 42

	// RFC 4994 Relay Agent Echo Request
	DHCPv6OptEchoRequestOption DHCPv6Opt = 43

	// RFC 5007 Leasequery
	DHCPv6OptLQQuery      DHCPv6Opt = 44
	DHCPv6OptCLTTime      DHCPv6Opt = 45
	DHCPv6OptClientData   DHCPv6Opt = 46
	DHCPv6OptLQRelayData  DHCPv6Opt = 47
	DHCPv6OptLQClientLink DHCPv6Opt = 48

	// RFC 6610 Home Information Discovery in Mobile IPv6 (MIPv6)
	DHCPv6OptMIP6HNIDF DHCPv6Opt = 49
	DHCPv6OptMIP6VDINF DHCPv6Opt = 50
	DHCPv6OptMIP6IDINF DHCPv6Opt = 69
	DHCPv6OptMIP6UDINF DHCPv6Opt = 70
	DHCPv6OptMIP6HNP   DHCPv6Opt = 71
	DHCPv6OptMIP6HAA   DHCPv6Opt = 72
	DHCPv6OptMIP6HAF   DHCPv6Opt = 73

	// RFC 5223 Discovering Location-to-Service Translation (LoST) Servers
	DHCPv6OptV6LOST DHCPv6Opt = 51

	// RFC 5417 Control And Provisioning of Wireless Access Points (CAPWAP)
	DHCPv6OptCAPWAPACV6 DHCPv6Opt = 52

	// RFC 5460 Bulk Leasequery
	DHCPv6OptRelayID DHCPv6Opt = 53

	// RFC 5678 IEEE 802.21 Mobility Services (MoS) Discovery
	DHCPv6OptIPv6AddressMoS DHCPv6Opt = 54
	DHCPv6OptIPv6FQDNMoS    DHCPv6Opt = 55

	// RFC 5908 NTP Server Option
	DHCPv6OptNTPServer DHCPv6Opt = 56

	// RFC 5986 Discovering the Local Location Information Server (LIS)
	DHCPv6OptV6AccessDomain DHCPv6Opt = 57

	// RFC 5986 SIP User Agent
	DHCPv6OptSIPUACSList DHCPv6Opt = 58

	// RFC 5970 Options for Network Boot
	DHCPv6OptBootFileURL    DHCPv6Opt = 59
	DHCPv6OptBootFileParam  DHCPv6Opt = 60
	DHCPv6OptClientArchType DHCPv6Opt = 61
	DHCPv6OptNII            DHCPv6Opt = 62

	// RFC 6225 Coordinate-Based Location Configuration Information
	DHCPv6OptGeolocation DHCPv6Opt = 63

	// RFC 6334 Dual-Stack Lite
	DHCPv6OptAFTRName DHCPv6Opt = 64

	// RFC 6440 EAP Re-authentication Protocol (ERP)
	DHCPv6OptERPLocalDomainName DHCPv6Opt = 65

	// RFC 6422 Relay-Supplied DHCP Options
	DHCPv6OptRSOO DHCPv6Opt = 66

	// RFC 6603 Prefix Exclude Option for DHCPv6-based Prefix Delegation
	DHCPv6OptPDExclude DHCPv6Opt = 67

	// RFC 6607 Virtual Subnet Selection
	DHCPv6OptVSS DHCPv6Opt = 68

	// RFC 6731 Improved Recursive DNS Server Selection for Multi-Interfaced Nodes
	DHCPv6OptRDNSSSelection DHCPv6Opt = 74

	// RFC 6784 Kerberos Options for DHCPv6
	DHCPv6OptKRBPrincipalName DHCPv6Opt = 75
	DHCPv6OptKRBRealmName     DHCPv6Opt = 76
	DHCPv6OptKRBKDC           DHCPv6Opt = 77

	// RFC 6939 Client Link-Layer Address Option
	DHCPv6OptClientLinkLayerAddress DHCPv6Opt = 79

	// RFC 6977 Triggering DHCPv6 Reconfiguration from Relay Agents
	DHCPv6OptLinkAddress DHCPv6Opt = 80

	// RFC 7037 RADIUS Option for the DHCPv6 Relay Agent
	DHCPv6OptRADIUS DHCPv6Opt = 81

	// RFC 7083 Modification to Default Values of SOL_MAX_RT and INF_MAX_RT
	DHCPv6OptSolMaxRt DHCPv6Opt = 82
	DHCPv6OptInfMaxRt DHCPv6Opt = 83

	// RFC 7078 Distributing Address Selection Policy
	DHCPv6OptAddrSel      DHCPv6Opt = 84
	DHCPv6OptAddrSelTable DHCPv6Opt = 85

	// RFC 7291 DHCP Options for the Port Control Protocol (PCP)
	DHCPv6OptV6PCPServer DHCPv6Opt = 86

	// RFC 7341 DHCPv4-over-DHCPv6 (DHCP 4o6) Transport
	DHCPv6OptDHCPv4Message          DHCPv6Opt = 87
	DHCPv6OptDHCPv4OverDHCPv6Server DHCPv6Opt = 88

	// RFC 7598 Configuration of Softwire Address and Port-Mapped Clients
	DHCPv6OptS46Rule           DHCPv6Opt = 89
	DHCPv6OptS46BR             DHCPv6Opt = 90
	DHCPv6OptS46DMR            DHCPv6Opt = 91
	DHCPv6OptS46V4V4Bind       DHCPv6Opt = 92
	DHCPv6OptS46PortParameters DHCPv6Opt = 93
	DHCPv6OptS46ContMAPE       DHCPv6Opt = 94
	DHCPv6OptS46ContMAPT       DHCPv6Opt = 95
	DHCPv6OptS46ContLW         DHCPv6Opt = 96

	// RFC 7600 IPv4 Residual Deployment via IPv6
	DHCPv6Opt4RD           DHCPv6Opt = 97
	DHCPv6Opt4RDMapRule    DHCPv6Opt = 98
	DHCPv6Opt4RDNonMapRule DHCPv6Opt = 99

	// RFC 7653 Active Leasequery
	DHCPv6OptLQBaseTime  DHCPv6Opt = 100
	DHCPv6OptLQStartTime DHCPv6Opt = 101
	DHCPv6OptLQEndTime   DHCPv6Opt = 102

	// RFC 7710 Captive-Portal Identification
	DHCPv6OptCaptivePortal DHCPv6Opt = 103

	// RFC 7774 Multicast Protocol for Low-Power and Lossy Networks (MPL) Parameter Configuration
	DHCPv6OptMPLParameters DHCPv6Opt = 104

	// RFC 7839 Access-Network-Identifier (ANI)
	DHCPv6OptANIATT           DHCPv6Opt = 105
	DHCPv6OptANINetworkName   DHCPv6Opt = 106
	DHCPv6OptANIAPName        DHCPv6Opt = 107
	DHCPv6OptANIAPBSSID       DHCPv6Opt = 108
	DHCPv6OptANIOperatorID    DHCPv6Opt = 109
	DHCPv6OptANIOperatorRealm DHCPv6Opt = 110

	// RFC 8026 Unified IPv4-in-IPv6 Softwire Customer Premises Equipment (CPE)
	DHCPv6OptS46Priority DHCPv6Opt = 111

	// draft-ietf-opsawg-mud-25 Manufacturer Usage Description (MUD)
	DHCPv6OptMUDURLV6 DHCPv6Opt = 112

	// RFC 8115 IPv4-Embedded Multicast and Unicast IPv6 Prefixes
	DHCPv6OptV6Prefix64 DHCPv6Opt = 113

	// RFC 8156 DHCPv6 Failover Protocol
	DHCPv6OptFBindingStatus           DHCPv6Opt = 114
	DHCPv6OptFConnectFlags            DHCPv6Opt = 115
	DHCPv6OptFDNSRemovalInfo          DHCPv6Opt = 116
	DHCPv6OptFDNSHostName             DHCPv6Opt = 117
	DHCPv6OptFDNSZoneName             DHCPv6Opt = 118
	DHCPv6OptFDNSFlags                DHCPv6Opt = 119
	DHCPv6OptFExpirationTime          DHCPv6Opt = 120
	DHCPv6OptFMaxUnacknowledgedBNDUPD DHCPv6Opt = 121
	DHCPv6OptFMCLT                    DHCPv6Opt = 122
	DHCPv6OptFPartnerLifetime         DHCPv6Opt = 123
	DHCPv6OptFPartnerLifetimeSent     DHCPv6Opt = 124
	DHCPv6OptFPartnerDownTime         DHCPv6Opt = 125
	DHCPv6OptFPartnerRawCltTime       DHCPv6Opt = 126
	DHCPv6OptFProtocolVersion         DHCPv6Opt = 127
	DHCPv6OptFKeepaliveTime           DHCPv6Opt = 128
	DHCPv6OptFReconfigureData         DHCPv6Opt = 129
	DHCPv6OptFRelationshipName        DHCPv6Opt = 130
	DHCPv6OptFServerFlags             DHCPv6Opt = 131
	DHCPv6OptFServerState             DHCPv6Opt = 132
	DHCPv6OptFStartTimeOfState        DHCPv6Opt = 133
	DHCPv6OptFStateExpirationTime     DHCPv6Opt = 134

	// RFC 8357 Generalized UDP Source Port for DHCP Relay
	DHCPv6OptRelayPort DHCPv6Opt = 135

	// draft-ietf-netconf-zerotouch-25 Zero Touch Provisioning for Networking Devices
	DHCPv6OptV6ZeroTouchRedirect DHCPv6Opt = 136

	// RFC 6153 Access Network Discovery and Selection Function (ANDSF) Discovery
	DHCPv6OptIPV6AddressANDSF DHCPv6Opt = 143
)

Constants for the DHCPv6Opt options.

func (DHCPv6Opt) String added in v1.1.15

func (o DHCPv6Opt) String() string

String returns a string version of a DHCPv6Opt.

type DHCPv6Option added in v1.1.15

type DHCPv6Option struct {
	Code   DHCPv6Opt
	Length uint16
	Data   []byte
}

DHCPv6Option rerpresents a DHCP option.

func NewDHCPv6Option added in v1.1.15

func NewDHCPv6Option(code DHCPv6Opt, data []byte) DHCPv6Option

NewDHCPv6Option constructs a new DHCPv6Option with a given type and data.

func (DHCPv6Option) String added in v1.1.15

func (o DHCPv6Option) String() string

String returns a string version of a DHCP Option.

type DHCPv6Options added in v1.1.15

type DHCPv6Options []DHCPv6Option

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

func (DHCPv6Options) String added in v1.1.15

func (o DHCPv6Options) String() string

String returns a string version of the options list.

type DHCPv6StatusCode added in v1.1.15

type DHCPv6StatusCode uint16

DHCPv6StatusCode represents a DHCP status code - RFC-3315

const (
	DHCPv6StatusCodeSuccess DHCPv6StatusCode = iota
	DHCPv6StatusCodeUnspecFail
	DHCPv6StatusCodeNoAddrsAvail
	DHCPv6StatusCodeNoBinding
	DHCPv6StatusCodeNotOnLink
	DHCPv6StatusCodeUseMulticast
)

Constants for the DHCPv6StatusCode.

func (DHCPv6StatusCode) String added in v1.1.15

func (o DHCPv6StatusCode) String() string

String returns a string version of a DHCPv6StatusCode.

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 // Reserved 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

CanDecode implements gopacket.DecodingLayer.

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

NextLayerType implements gopacket.DecodingLayer.

func (*DNS) Payload added in v1.1.7

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

Payload returns nil.

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

DNSClass defines the class associated with a request/response. Different DNS classes can be thought of as an array of parallel namespace trees.

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
)

DNSClass known values.

func (DNSClass) String added in v1.1.13

func (dc DNSClass) String() string

type DNSMX added in v1.1.7

type DNSMX struct {
	Preference uint16
	Name       []byte
}

DNSMX is a mail exchange record, defining a mail server for a recipient's domain.

type DNSOPT added in v1.1.17

type DNSOPT struct {
	Code DNSOptionCode
	Data []byte
}

DNSOPT is a DNS Option, see RFC6891, section 6.1.2

func (DNSOPT) String added in v1.1.17

func (opt DNSOPT) String() string

type DNSOpCode added in v1.1.7

type DNSOpCode uint8

DNSOpCode defines a set of different operation types.

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]
)

DNSOpCode known values.

func (DNSOpCode) String added in v1.1.13

func (doc DNSOpCode) String() string

type DNSOptionCode added in v1.1.17

type DNSOptionCode uint16

DNSOptionCode represents the code of a DNS Option, see RFC6891, section 6.1.2

const (
	DNSOptionCodeNSID             DNSOptionCode = 3
	DNSOptionCodeDAU              DNSOptionCode = 5
	DNSOptionCodeDHU              DNSOptionCode = 6
	DNSOptionCodeN3U              DNSOptionCode = 7
	DNSOptionCodeEDNSClientSubnet DNSOptionCode = 8
	DNSOptionCodeEDNSExpire       DNSOptionCode = 9
	DNSOptionCodeCookie           DNSOptionCode = 10
	DNSOptionCodeEDNSKeepAlive    DNSOptionCode = 11
	DNSOptionCodePadding          DNSOptionCode = 12
	DNSOptionCodeChain            DNSOptionCode = 13
	DNSOptionCodeEDNSKeyTag       DNSOptionCode = 14
	DNSOptionCodeEDNSClientTag    DNSOptionCode = 16
	DNSOptionCodeEDNSServerTag    DNSOptionCode = 17
	DNSOptionCodeDeviceID         DNSOptionCode = 26946
)

DNSOptionCode known values. See IANA

func (DNSOptionCode) String added in v1.1.17

func (doc DNSOptionCode) String() string

type DNSQuestion added in v1.1.7

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

DNSQuestion wraps a single request (question) within a DNS query.

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
	OPT            []DNSOPT // See RFC 6891, section 6.1.2
	URI            DNSURI

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

DNSResourceRecord wraps the data from a single DNS resource within a response.

func (*DNSResourceRecord) String added in v1.1.7

func (rr *DNSResourceRecord) String() string

type DNSResponseCode added in v1.1.7

type DNSResponseCode uint8

DNSResponseCode provides response codes for question answers.

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]
	DNSResponseCodeBadCookie DNSResponseCode = 23 // Bad/missing Server Cookie          [RFC7873]
)

DNSResponseCode known values.

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
}

DNSSOA is a Start of Authority record. Each domain requires a SOA record at the cutover where a domain is delegated from its parent.

type DNSSRV added in v1.1.7

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

DNSSRV is a Service record, defining a location (hostname/port) of a server/service.

type DNSType added in v1.1.7

type DNSType uint16

DNSType defines the type of data being requested/returned in a question/answer.

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]
	DNSTypeOPT   DNSType = 41  // OPT Pseudo-RR [RFC6891]
	DNSTypeURI   DNSType = 256 // URI RR [RFC7553]
)

DNSType known values.

func (DNSType) String added in v1.1.13

func (dt DNSType) String() string

type DNSURI added in v1.1.18

type DNSURI struct {
	Priority, Weight uint16
	Target           []byte
}

DNSURI is a URI record, defining a target (URI) of a server/service

type DbDescPkg added in v1.1.15

type DbDescPkg struct {
	Options      uint32
	InterfaceMTU uint16
	Flags        uint16
	DDSeqNumber  uint32
	LSAinfo      []LSAheader
}

DbDescPkg is the struct from RFC 5340 A.3.3.

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
	QOS            *Dot11QOS
	HTControl      *Dot11HTControl
	DataLayer      gopacket.Layer
}

Dot11 provides an IEEE 802.11 base packet header. See http://standards.ieee.org/findstds/standard/802.11-2012.html for excruciating 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.