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://code.google.com/p/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
- Variables
- func NewIPEndpoint(a net.IP) gopacket.Endpoint
- func NewMACEndpoint(a net.HardwareAddr) gopacket.Endpoint
- func NewRUDPPortEndpoint(p RUDPPort) gopacket.Endpoint
- func NewSCTPPortEndpoint(p SCTPPort) gopacket.Endpoint
- func NewTCPPortEndpoint(p TCPPort) gopacket.Endpoint
- func NewUDPLitePortEndpoint(p UDPLitePort) gopacket.Endpoint
- func NewUDPPortEndpoint(p UDPPort) gopacket.Endpoint
- type ARP
- func (arp *ARP) CanDecode() gopacket.LayerClass
- func (arp *ARP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (arp *ARP) LayerType() gopacket.LayerType
- func (arp *ARP) NextLayerType() gopacket.LayerType
- func (arp *ARP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type BaseLayer
- type CDPAddressType
- type CDPCapabilities
- type CDPCapability
- type CDPEnergyWise
- type CDPEnergyWiseSubtype
- type CDPHello
- type CDPLocation
- type CDPPowerDialogue
- type CDPSparePairPoE
- type CDPTLVType
- type CDPVLANDialogue
- type CiscoDiscovery
- type CiscoDiscoveryInfo
- type CiscoDiscoveryValue
- type Dot1Q
- func (d *Dot1Q) CanDecode() gopacket.LayerClass
- func (d *Dot1Q) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (d *Dot1Q) LayerType() gopacket.LayerType
- func (d *Dot1Q) NextLayerType() gopacket.LayerType
- func (d *Dot1Q) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type EAP
- func (e *EAP) CanDecode() gopacket.LayerClass
- func (e *EAP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (e *EAP) LayerType() gopacket.LayerType
- func (e *EAP) NextLayerType() gopacket.LayerType
- func (e *EAP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type EAPCode
- type EAPOL
- type EAPOLType
- type EAPType
- type EnumMetadata
- type EtherIP
- type Ethernet
- func (eth *Ethernet) CanDecode() gopacket.LayerClass
- func (eth *Ethernet) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (e *Ethernet) LayerType() gopacket.LayerType
- func (e *Ethernet) LinkFlow() gopacket.Flow
- func (eth *Ethernet) NextLayerType() gopacket.LayerType
- func (eth *Ethernet) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type EthernetCTP
- type EthernetCTPForwardData
- type EthernetCTPFunction
- type EthernetCTPReply
- type EthernetType
- type FDDI
- type FDDIFrameControl
- type GRE
- type GRERouting
- type IANAAddressFamily
- type ICMPv4
- func (i *ICMPv4) CanDecode() gopacket.LayerClass
- func (i *ICMPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (i *ICMPv4) LayerType() gopacket.LayerType
- func (i *ICMPv4) NextLayerType() gopacket.LayerType
- func (i *ICMPv4) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type ICMPv4TypeCode
- type ICMPv6
- func (i *ICMPv6) CanDecode() gopacket.LayerClass
- func (i *ICMPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (i *ICMPv6) LayerType() gopacket.LayerType
- func (i *ICMPv6) NextLayerType() gopacket.LayerType
- func (i *ICMPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- func (i *ICMPv6) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error
- type ICMPv6TypeCode
- type IEEEOUI
- type IGMP
- type IGMPType
- type IPProtocol
- type IPSecAH
- type IPSecESP
- type IPv4
- func (i *IPv4) CanDecode() gopacket.LayerClass
- func (ip *IPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (i *IPv4) LayerType() gopacket.LayerType
- func (i *IPv4) NetworkFlow() gopacket.Flow
- func (i *IPv4) NextLayerType() gopacket.LayerType
- func (ip *IPv4) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type IPv4Flag
- type IPv4Option
- type IPv6
- func (i *IPv6) CanDecode() gopacket.LayerClass
- func (ip6 *IPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (i *IPv6) LayerType() gopacket.LayerType
- func (i *IPv6) NetworkFlow() gopacket.Flow
- func (i *IPv6) NextLayerType() gopacket.LayerType
- func (ip6 *IPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- type IPv6Destination
- type IPv6DestinationOption
- type IPv6ExtensionSkipper
- type IPv6Fragment
- type IPv6HopByHop
- type IPv6HopByHopOption
- type IPv6Routing
- type LLC
- type LLDPApplicationType
- type LLDPCapabilities
- type LLDPChassisID
- type LLDPChassisIDSubType
- type LLDPCisco2Subtype
- type LLDPEVBCapabilities
- type LLDPEVBSettings
- type LLDPInfo8021
- type LLDPInfo8021Qbg
- type LLDPInfo8023
- type LLDPInfoCisco2
- type LLDPInfoMedia
- type LLDPInfoProfinet
- type LLDPInterfaceSubtype
- type LLDPLinkAggregation
- type LLDPLocation
- type LLDPLocationAddress
- type LLDPLocationAddressLine
- type LLDPLocationAddressType
- type LLDPLocationAddressWhat
- type LLDPLocationCoordinate
- type LLDPLocationECS
- type LLDPLocationFormat
- type LLDPMACPHYConfigStatus
- type LLDPMediaCapabilities
- type LLDPMediaClass
- type LLDPMediaSubtype
- type LLDPMgmtAddress
- type LLDPNetworkPolicy
- type LLDPOrgSpecificTLV
- type LLDPPNIODelay
- type LLDPPNIOMRPPortStatus
- type LLDPPNIOPTCPStatus
- type LLDPPNIOPortStatus
- type LLDPPortID
- type LLDPPortIDSubType
- type LLDPPowerPriority
- type LLDPPowerSource
- type LLDPPowerType
- type LLDPPowerViaMDI
- type LLDPPowerViaMDI8023
- type LLDPProfinetSubtype
- type LLDPSysCapabilities
- type LLDPTLVType
- type LinkLayerDiscovery
- type LinkLayerDiscoveryInfo
- func (l *LinkLayerDiscoveryInfo) Decode8021() (info LLDPInfo8021, err error)
- func (l *LinkLayerDiscoveryInfo) Decode8021Qbg() (info LLDPInfo8021Qbg, err error)
- func (l *LinkLayerDiscoveryInfo) Decode8023() (info LLDPInfo8023, err error)
- func (l *LinkLayerDiscoveryInfo) DecodeCisco2() (info LLDPInfoCisco2, err error)
- func (l *LinkLayerDiscoveryInfo) DecodeMedia() (info LLDPInfoMedia, err error)
- func (l *LinkLayerDiscoveryInfo) DecodeProfinet() (info LLDPInfoProfinet, err error)
- func (c *LinkLayerDiscoveryInfo) LayerType() gopacket.LayerType
- type LinkLayerDiscoveryValue
- type LinkType
- type Loopback
- type MPLS
- type NDPBackplaneType
- type NDPChassisType
- type NDPState
- type NortelDiscovery
- type PPP
- type PPPType
- type PPPoE
- type PPPoECode
- type PortProtocolVLANID
- type ProtocolFamily
- type ProtocolGuessingDecoder
- type ProtocolIdentity
- type RUDP
- type RUDPHeaderEACK
- type RUDPHeaderSYN
- type RUDPPort
- type SCTP
- type SCTPChunk
- type SCTPChunkType
- type SCTPCookieEcho
- type SCTPData
- type SCTPEmptyLayer
- type SCTPError
- type SCTPErrorParameter
- type SCTPHeartbeat
- type SCTPHeartbeatParameter
- type SCTPInit
- type SCTPInitParameter
- type SCTPParameter
- type SCTPPort
- type SCTPSack
- type SCTPShutdown
- type SCTPShutdownAck
- type SCTPUnknownChunkType
- type SNAP
- type TCP
- func (t *TCP) CanDecode() gopacket.LayerClass
- func (tcp *TCP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (t *TCP) LayerType() gopacket.LayerType
- func (t *TCP) NextLayerType() gopacket.LayerType
- func (t *TCP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- func (i *TCP) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error
- func (t *TCP) TransportFlow() gopacket.Flow
- type TCPOption
- type TCPPort
- type UDP
- func (u *UDP) CanDecode() gopacket.LayerClass
- func (udp *UDP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
- func (u *UDP) LayerType() gopacket.LayerType
- func (u *UDP) NextLayerType() gopacket.LayerType
- func (u *UDP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
- func (i *UDP) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error
- func (u *UDP) TransportFlow() gopacket.Flow
- type UDPLite
- type UDPLitePort
- type UDPPort
- type VLANName
- Bugs
Constants ¶
const ( CDPPoEFourWire byte = 0x01 CDPPoEPDArch byte = 0x02 CDPPoEPDRequest byte = 0x04 CDPPoEPSE byte = 0x08 )
const ( CDPProtocolTypeNLPID byte = 1 CDPProtocolType802_2 byte = 2 )
CDP Protocol Types
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 )
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 )
const ( 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 )
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
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
const ( LLDPProtocolVLANIDCapability byte = 1 << 1 LLDPProtocolVLANIDStatus byte = 1 << 2 )
VLAN Port Protocol ID options
const ( LLDPAggregationCapability byte = 1 << 0 LLDPAggregationStatus byte = 1 << 1 )
LACP options
const ( LLDP8023SubtypeMACPHY uint8 = 1 LLDP8023SubtypeMDIPower uint8 = 2 LLDP8023SubtypeLinkAggregation uint8 = 3 LLDP8023SubtypeMTU uint8 = 4 )
IEEE 802.3 TLV Subtypes
const ( LLDPMACPHYCapability byte = 1 << 0 LLDPMACPHYStatus byte = 1 << 1 )
MACPHY options
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
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
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)
const ( LLDPMDIPowerPortClass byte = 1 << 0 LLDPMDIPowerCapability byte = 1 << 1 LLDPMDIPowerStatus byte = 1 << 2 LLDPMDIPowerPairsAbility byte = 1 << 3 )
MDI Power options
const ( LLDP8021QbgEVB uint8 = 0 LLDP8021QbgCDCP uint8 = 1 LLDP8021QbgVDP uint8 = 2 LLDP8021QbgEVB22 uint8 = 13 )
IEEE 802.1Qbg TLV Subtypes
const ( LLDPEVBCapsSTD uint16 = 1 << 7 LLDPEVBCapsRR uint16 = 1 << 6 LLDPEVBCapsRTE uint16 = 1 << 2 LLDPEVBCapsECP uint16 = 1 << 1 LLDPEVBCapsVDP uint16 = 1 << 0 )
LLDPEVBCapabilities Types
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
const ( LLDPCiscoPSESupport uint8 = 1 << 0 LLDPCiscoPDSparePair uint8 = 1 << 2 LLDPCiscoPSESparePair uint8 = 1 << 3 )
const (
IPv6HopByHopOptionJumbogram = 0xC2 // RFC 2675
)
Variables ¶
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{"IPv4", func(b []byte) string { return net.IP(b).String() }}) EndpointIPv6 = gopacket.RegisterEndpointType(2, gopacket.EndpointTypeMetadata{"IPv6", func(b []byte) string { return net.IP(b).String() }}) EndpointMAC = gopacket.RegisterEndpointType(3, gopacket.EndpointTypeMetadata{"MAC", func(b []byte) string { return net.HardwareAddr(b).String() }}) EndpointTCPPort = gopacket.RegisterEndpointType(4, gopacket.EndpointTypeMetadata{"TCP", func(b []byte) string { return strconv.Itoa(int(binary.BigEndian.Uint16(b))) }}) EndpointUDPPort = gopacket.RegisterEndpointType(5, gopacket.EndpointTypeMetadata{"UDP", func(b []byte) string { return strconv.Itoa(int(binary.BigEndian.Uint16(b))) }}) EndpointSCTPPort = gopacket.RegisterEndpointType(6, gopacket.EndpointTypeMetadata{"SCTP", func(b []byte) string { return strconv.Itoa(int(binary.BigEndian.Uint16(b))) }}) EndpointRUDPPort = gopacket.RegisterEndpointType(7, gopacket.EndpointTypeMetadata{"RUDP", func(b []byte) string { return strconv.Itoa(int(b[0])) }}) EndpointUDPLitePort = gopacket.RegisterEndpointType(8, gopacket.EndpointTypeMetadata{"UDPLite", func(b []byte) string { return strconv.Itoa(int(binary.BigEndian.Uint16(b))) }}) EndpointPPP = gopacket.RegisterEndpointType(9, gopacket.EndpointTypeMetadata{"PPP", func([]byte) string { return "point" }}) )
var ( // Each of the following arrays contains mappings of how to handle enum // values for various enum types in gopacket/layers. // // So, EthernetTypeMetadata[2] contains information on how to handle EthernetType // 2, including which name to give it and which decoder to use to decode // packet data of that type. These arrays are filled by default with all of the // protocols gopacket/layers knows how to handle, but users of the library can // add new decoders or override existing ones. For example, if you write a better // TCP decoder, you can override IPProtocolMetadata[IPProtocolTCP].DecodeWith // with your new decoder, and all gopacket/layers decoding will use your new // decoder whenever they encounter that IPProtocol. EthernetTypeMetadata [65536]EnumMetadata IPProtocolMetadata [265]EnumMetadata SCTPChunkTypeMetadata [265]EnumMetadata PPPTypeMetadata [65536]EnumMetadata PPPoECodeMetadata [256]EnumMetadata LinkTypeMetadata [256]EnumMetadata FDDIFrameControlMetadata [256]EnumMetadata EAPOLTypeMetadata [256]EnumMetadata ProtocolFamilyMetadata [256]EnumMetadata )
var ( LayerTypeARP = gopacket.RegisterLayerType(10, gopacket.LayerTypeMetadata{"ARP", gopacket.DecodeFunc(decodeARP)}) LayerTypeCiscoDiscovery = gopacket.RegisterLayerType(11, gopacket.LayerTypeMetadata{"CiscoDiscovery", gopacket.DecodeFunc(decodeCiscoDiscovery)}) LayerTypeEthernetCTP = gopacket.RegisterLayerType(12, gopacket.LayerTypeMetadata{"EthernetCTP", gopacket.DecodeFunc(decodeEthernetCTP)}) LayerTypeEthernetCTPForwardData = gopacket.RegisterLayerType(13, gopacket.LayerTypeMetadata{"EthernetCTPForwardData", nil}) LayerTypeEthernetCTPReply = gopacket.RegisterLayerType(14, gopacket.LayerTypeMetadata{"EthernetCTPReply", nil}) LayerTypeDot1Q = gopacket.RegisterLayerType(15, gopacket.LayerTypeMetadata{"Dot1Q", gopacket.DecodeFunc(decodeDot1Q)}) LayerTypeEtherIP = gopacket.RegisterLayerType(16, gopacket.LayerTypeMetadata{"EtherIP", gopacket.DecodeFunc(decodeEtherIP)}) LayerTypeEthernet = gopacket.RegisterLayerType(17, gopacket.LayerTypeMetadata{"Ethernet", gopacket.DecodeFunc(decodeEthernet)}) LayerTypeGRE = gopacket.RegisterLayerType(18, gopacket.LayerTypeMetadata{"GRE", gopacket.DecodeFunc(decodeGRE)}) LayerTypeICMPv4 = gopacket.RegisterLayerType(19, gopacket.LayerTypeMetadata{"ICMPv4", gopacket.DecodeFunc(decodeICMPv4)}) LayerTypeIPv4 = gopacket.RegisterLayerType(20, gopacket.LayerTypeMetadata{"IPv4", gopacket.DecodeFunc(decodeIPv4)}) LayerTypeIPv6 = gopacket.RegisterLayerType(21, gopacket.LayerTypeMetadata{"IPv6", gopacket.DecodeFunc(decodeIPv6)}) LayerTypeLLC = gopacket.RegisterLayerType(22, gopacket.LayerTypeMetadata{"LLC", gopacket.DecodeFunc(decodeLLC)}) LayerTypeSNAP = gopacket.RegisterLayerType(23, gopacket.LayerTypeMetadata{"SNAP", gopacket.DecodeFunc(decodeSNAP)}) LayerTypeMPLS = gopacket.RegisterLayerType(24, gopacket.LayerTypeMetadata{"MPLS", gopacket.DecodeFunc(decodeMPLS)}) LayerTypePPP = gopacket.RegisterLayerType(25, gopacket.LayerTypeMetadata{"PPP", gopacket.DecodeFunc(decodePPP)}) LayerTypePPPoE = gopacket.RegisterLayerType(26, gopacket.LayerTypeMetadata{"PPPoE", gopacket.DecodeFunc(decodePPPoE)}) LayerTypeRUDP = gopacket.RegisterLayerType(27, gopacket.LayerTypeMetadata{"RUDP", gopacket.DecodeFunc(decodeRUDP)}) LayerTypeSCTP = gopacket.RegisterLayerType(28, gopacket.LayerTypeMetadata{"SCTP", gopacket.DecodeFunc(decodeSCTP)}) LayerTypeSCTPUnknownChunkType = gopacket.RegisterLayerType(29, gopacket.LayerTypeMetadata{"SCTPUnknownChunkType", nil}) LayerTypeSCTPData = gopacket.RegisterLayerType(30, gopacket.LayerTypeMetadata{"SCTPData", nil}) LayerTypeSCTPInit = gopacket.RegisterLayerType(31, gopacket.LayerTypeMetadata{"SCTPInit", nil}) LayerTypeSCTPSack = gopacket.RegisterLayerType(32, gopacket.LayerTypeMetadata{"SCTPSack", nil}) LayerTypeSCTPHeartbeat = gopacket.RegisterLayerType(33, gopacket.LayerTypeMetadata{"SCTPHeartbeat", nil}) LayerTypeSCTPError = gopacket.RegisterLayerType(34, gopacket.LayerTypeMetadata{"SCTPError", nil}) LayerTypeSCTPShutdown = gopacket.RegisterLayerType(35, gopacket.LayerTypeMetadata{"SCTPShutdown", nil}) LayerTypeSCTPShutdownAck = gopacket.RegisterLayerType(36, gopacket.LayerTypeMetadata{"SCTPShutdownAck", nil}) LayerTypeSCTPCookieEcho = gopacket.RegisterLayerType(37, gopacket.LayerTypeMetadata{"SCTPCookieEcho", nil}) LayerTypeSCTPEmptyLayer = gopacket.RegisterLayerType(38, gopacket.LayerTypeMetadata{"SCTPEmptyLayer", nil}) LayerTypeSCTPInitAck = gopacket.RegisterLayerType(39, gopacket.LayerTypeMetadata{"LayerTypeSCTPInitAck", nil}) LayerTypeSCTPHeartbeatAck = gopacket.RegisterLayerType(40, gopacket.LayerTypeMetadata{"LayerTypeSCTPHeartbeatAck", nil}) LayerTypeSCTPAbort = gopacket.RegisterLayerType(41, gopacket.LayerTypeMetadata{"LayerTypeSCTPAbort", nil}) LayerTypeSCTPShutdownComplete = gopacket.RegisterLayerType(42, gopacket.LayerTypeMetadata{"LayerTypeSCTPShutdownComplete", nil}) LayerTypeSCTPCookieAck = gopacket.RegisterLayerType(43, gopacket.LayerTypeMetadata{"LayerTypeSCTPCookieAck", nil}) LayerTypeTCP = gopacket.RegisterLayerType(44, gopacket.LayerTypeMetadata{"TCP", gopacket.DecodeFunc(decodeTCP)}) LayerTypeUDP = gopacket.RegisterLayerType(45, gopacket.LayerTypeMetadata{"UDP", gopacket.DecodeFunc(decodeUDP)}) LayerTypeIPv6HopByHop = gopacket.RegisterLayerType(46, gopacket.LayerTypeMetadata{"IPv6HopByHop", gopacket.DecodeFunc(decodeIPv6HopByHop)}) LayerTypeIPv6Routing = gopacket.RegisterLayerType(47, gopacket.LayerTypeMetadata{"IPv6Routing", gopacket.DecodeFunc(decodeIPv6Routing)}) LayerTypeIPv6Fragment = gopacket.RegisterLayerType(48, gopacket.LayerTypeMetadata{"IPv6Fragment", gopacket.DecodeFunc(decodeIPv6Fragment)}) LayerTypeIPv6Destination = gopacket.RegisterLayerType(49, gopacket.LayerTypeMetadata{"IPv6Destination", gopacket.DecodeFunc(decodeIPv6Destination)}) LayerTypeIPSecAH = gopacket.RegisterLayerType(50, gopacket.LayerTypeMetadata{"IPSecAH", gopacket.DecodeFunc(decodeIPSecAH)}) LayerTypeIPSecESP = gopacket.RegisterLayerType(51, gopacket.LayerTypeMetadata{"IPSecESP", gopacket.DecodeFunc(decodeIPSecESP)}) LayerTypeUDPLite = gopacket.RegisterLayerType(52, gopacket.LayerTypeMetadata{"UDPLite", gopacket.DecodeFunc(decodeUDPLite)}) LayerTypeFDDI = gopacket.RegisterLayerType(53, gopacket.LayerTypeMetadata{"FDDI", gopacket.DecodeFunc(decodeFDDI)}) LayerTypeLoopback = gopacket.RegisterLayerType(54, gopacket.LayerTypeMetadata{"Loopback", gopacket.DecodeFunc(decodeLoopback)}) LayerTypeEAP = gopacket.RegisterLayerType(55, gopacket.LayerTypeMetadata{"EAP", gopacket.DecodeFunc(decodeEAP)}) LayerTypeEAPOL = gopacket.RegisterLayerType(56, gopacket.LayerTypeMetadata{"EAPOL", gopacket.DecodeFunc(decodeEAPOL)}) LayerTypeICMPv6 = gopacket.RegisterLayerType(57, gopacket.LayerTypeMetadata{"ICMPv6", gopacket.DecodeFunc(decodeICMPv6)}) LayerTypeLinkLayerDiscovery = gopacket.RegisterLayerType(58, gopacket.LayerTypeMetadata{"LinkLayerDiscovery", gopacket.DecodeFunc(decodeLinkLayerDiscovery)}) LayerTypeCiscoDiscoveryInfo = gopacket.RegisterLayerType(59, gopacket.LayerTypeMetadata{"CiscoDiscoveryInfo", gopacket.DecodeFunc(decodeCiscoDiscoveryInfo)}) LayerTypeLinkLayerDiscoveryInfo = gopacket.RegisterLayerType(60, gopacket.LayerTypeMetadata{"LinkLayerDiscoveryInfo", nil}) LayerTypeNortelDiscovery = gopacket.RegisterLayerType(61, gopacket.LayerTypeMetadata{"NortelDiscovery", gopacket.DecodeFunc(decodeNortelDiscovery)}) LayerTypeIGMP = gopacket.RegisterLayerType(62, gopacket.LayerTypeMetadata{"IGMP", gopacket.DecodeFunc(decodeIGMP)}) )
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, }) )
var MPLSPayloadDecoder gopacket.Decoder = ProtocolGuessingDecoder{}
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.
var PPPEndpoint = gopacket.NewEndpoint(EndpointPPP, nil)
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.
var PPPFlow = gopacket.NewFlow(EndpointPPP, nil, nil)
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.
var RUDPPortNames = map[RUDPPort]string{}
RUDPPortNames contains the string names for all RUDP ports.
var SCTPPortNames = sctpPortNames
SCTPPortNames contains the port names for all SCTP ports.
var TCPPortNames = tcpPortNames
TCPPortNames contains the port names for all TCP ports.
var UDPLitePortNames = map[UDPLitePort]string{}
UDPLitePortNames contains the string names for all UDPLite ports.
var UDPPortNames = udpPortNames
UDPPortNames contains the port names for all UDP ports.
Functions ¶
func NewIPEndpoint ¶
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 ¶
NewRUDPPortEndpoint returns an endpoint based on a RUDP port.
func NewSCTPPortEndpoint ¶
NewSCTPPortEndpoint returns an endpoint based on a SCTP port.
func NewTCPPortEndpoint ¶
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 ¶
NewUDPPortEndpoint returns an endpoint based on a UDP port.
Types ¶
type ARP ¶
type ARP struct { BaseLayer AddrType LinkType Protocol EthernetType HwAddressSize uint8 ProtAddressSize uint8 Operation uint16 SourceHwAddress []byte SourceProtAddress []byte DstHwAddress []byte DstProtAddress []byte }
ARP is a ARP packet header.
func (*ARP) CanDecode ¶
func (arp *ARP) CanDecode() gopacket.LayerClass
CanDecode returns the set of layer types that this DecodingLayer can decode.
func (*ARP) DecodeFromBytes ¶
func (arp *ARP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*ARP) NextLayerType ¶
NextLayerType returns the layer type contained by this DecodingLayer.
func (*ARP) SerializeTo ¶ added in v1.0.1
func (arp *ARP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.
type BaseLayer ¶
type BaseLayer struct { // Contents is the set of bytes that make up this layer. IE: for an // Ethernet packet, this would be the set of bytes making up the // Ethernet frame. Contents []byte // Payload is the set of bytes contained by (but not part of) this // Layer. Again, to take Ethernet as an example, this would be the // set of bytes encapsulated by the Ethernet protocol. Payload []byte }
BaseLayer is a convenience struct which implements the LayerData and LayerPayload functions of the Layer interface.
func (*BaseLayer) LayerContents ¶
LayerContents returns the bytes of the packet layer.
func (*BaseLayer) LayerPayload ¶
LayerPayload returns the bytes contained within the packet layer.
type CDPAddressType ¶
type CDPAddressType uint64
const ( CDPAddressTypeCLNP CDPAddressType = 0x81 CDPAddressTypeIPV4 CDPAddressType = 0xcc CDPAddressTypeIPV6 CDPAddressType = 0xaaaa030000000800 CDPAddressTypeDECNET CDPAddressType = 0xaaaa030000006003 CDPAddressTypeAPPLETALK CDPAddressType = 0xaaaa03000000809b CDPAddressTypeIPX CDPAddressType = 0xaaaa030000008137 CDPAddressTypeVINES CDPAddressType = 0xaaaa0300000080c4 CDPAddressTypeXNS CDPAddressType = 0xaaaa030000000600 CDPAddressTypeAPOLLO CDPAddressType = 0xaaaa030000008019 )
CDP Address types.
func (CDPAddressType) String ¶
func (a CDPAddressType) String() (s string)
type CDPCapabilities ¶
type CDPCapabilities struct { L3Router bool TBBridge bool SPBridge bool L2Switch bool IsHost bool IGMPFilter bool L1Repeater bool IsPhone bool RemotelyManaged bool }
CDPCapabilities represents the capabilities of a device
type CDPCapability ¶
type CDPCapability uint32
const ( CDPCapMaskRouter CDPCapability = 0x0001 CDPCapMaskTBBridge CDPCapability = 0x0002 CDPCapMaskSPBridge CDPCapability = 0x0004 CDPCapMaskSwitch CDPCapability = 0x0008 CDPCapMaskHost CDPCapability = 0x0010 CDPCapMaskIGMPFilter CDPCapability = 0x0020 CDPCapMaskRepeater CDPCapability = 0x0040 CDPCapMaskPhone CDPCapability = 0x0080 CDPCapMaskRemote CDPCapability = 0x0100 )
type CDPEnergyWise ¶
type CDPEnergyWise struct { EncryptedData []byte Unknown1 uint32 SequenceNumber uint32 ModelNumber string Unknown2 uint16 HardwareID string SerialNum string Unknown3 []byte Role string Domain string Name string ReplyUnknown1 []byte ReplyPort []byte ReplyAddress []byte ReplyUnknown2 []byte ReplyUnknown3 []byte }
type CDPEnergyWiseSubtype ¶
type CDPEnergyWiseSubtype uint32
const ( CDPEnergyWiseRole CDPEnergyWiseSubtype = 0x00000007 CDPEnergyWiseDomain CDPEnergyWiseSubtype = 0x00000008 CDPEnergyWiseName CDPEnergyWiseSubtype = 0x00000009 CDPEnergyWiseReplyTo CDPEnergyWiseSubtype = 0x00000017 )
func (CDPEnergyWiseSubtype) String ¶
func (t CDPEnergyWiseSubtype) String() (s string)
type CDPHello ¶
type CDPHello struct { OUI []byte ProtocolID uint16 ClusterMaster net.IP Unknown1 net.IP Version byte SubVersion byte Status byte Unknown2 byte ClusterCommander net.HardwareAddr SwitchMAC net.HardwareAddr Unknown3 byte ManagementVLAN uint16 }
CDPHello is a Cisco Hello message (undocumented, hence the "Unknown" fields)
type CDPLocation ¶
type CDPPowerDialogue ¶
CDPPowerDialogue encapsulates a Power Query/Reply
type CDPSparePairPoE ¶
type CDPTLVType ¶
type CDPTLVType uint16
CDPTLVType is the type of each TLV value in a CiscoDiscovery packet.
const ( CDPTLVDevID CDPTLVType = 0x0001 CDPTLVAddress CDPTLVType = 0x0002 CDPTLVPortID CDPTLVType = 0x0003 CDPTLVCapabilities CDPTLVType = 0x0004 CDPTLVVersion CDPTLVType = 0x0005 CDPTLVPlatform CDPTLVType = 0x0006 CDPTLVIPPrefix CDPTLVType = 0x0007 CDPTLVHello CDPTLVType = 0x0008 CDPTLVVTPDomain CDPTLVType = 0x0009 CDPTLVNativeVLAN CDPTLVType = 0x000a CDPTLVFullDuplex CDPTLVType = 0x000b CDPTLVVLANReply CDPTLVType = 0x000e CDPTLVVLANQuery CDPTLVType = 0x000f CDPTLVPower CDPTLVType = 0x0010 CDPTLVMTU CDPTLVType = 0x0011 CDPTLVExtendedTrust CDPTLVType = 0x0012 CDPTLVUntrustedCOS CDPTLVType = 0x0013 CDPTLVSysName CDPTLVType = 0x0014 CDPTLVSysOID CDPTLVType = 0x0015 CDPTLVMgmtAddresses CDPTLVType = 0x0016 CDPTLVLocation CDPTLVType = 0x0017 CDPTLVExternalPortID CDPTLVType = 0x0018 CDPTLVPowerRequested CDPTLVType = 0x0019 CDPTLVPowerAvailable CDPTLVType = 0x001a CDPTLVPortUnidirectional CDPTLVType = 0x001b CDPTLVEnergyWise CDPTLVType = 0x001d CDPTLVSparePairPOE CDPTLVType = 0x001f )
func (CDPTLVType) String ¶
func (t CDPTLVType) String() (s string)
type CDPVLANDialogue ¶
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 Dot1Q ¶
type Dot1Q struct { BaseLayer Priority uint8 DropEligible bool VLANIdentifier uint16 Type EthernetType }
Dot1Q is the packet layer for 802.1Q VLAN headers.
func (*Dot1Q) CanDecode ¶
func (d *Dot1Q) CanDecode() gopacket.LayerClass
CanDecode returns the set of layer types that this DecodingLayer can decode.
func (*Dot1Q) DecodeFromBytes ¶
func (d *Dot1Q) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*Dot1Q) NextLayerType ¶
NextLayerType returns the layer type contained by this DecodingLayer.
func (*Dot1Q) SerializeTo ¶
func (d *Dot1Q) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.
type EAP ¶
EAP defines an Extensible Authentication Protocol (rfc 3748) layer.
func (*EAP) CanDecode ¶
func (e *EAP) CanDecode() gopacket.LayerClass
CanDecode returns the set of layer types that this DecodingLayer can decode.
func (*EAP) DecodeFromBytes ¶
func (e *EAP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*EAP) NextLayerType ¶
NextLayerType returns the layer type contained by this DecodingLayer.
func (*EAP) SerializeTo ¶ added in v1.0.1
func (e *EAP) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.
type EAPOL ¶
EAPOL defines an EAP over LAN (802.1x) layer.
func (*EAPOL) CanDecode ¶
func (e *EAPOL) CanDecode() gopacket.LayerClass
CanDecode returns the set of layer types that this DecodingLayer can decode.
func (*EAPOL) DecodeFromBytes ¶
func (e *EAPOL) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*EAPOL) NextLayerType ¶
NextLayerType returns the layer type contained by this DecodingLayer.
type EnumMetadata ¶
type EnumMetadata struct { // DecodeWith is the decoder to use to decode this protocol's data. DecodeWith gopacket.Decoder // Name is the name of the enumeration value. Name string // LayerType is the layer type implied by the given enum. LayerType gopacket.LayerType }
EnumMetadata keeps track of a set of metadata for each enumeration value for protocol enumerations.
type EtherIP ¶
EtherIP is the struct for storing RFC 3378 EtherIP packet headers.
func (*EtherIP) CanDecode ¶
func (e *EtherIP) CanDecode() gopacket.LayerClass
CanDecode returns the set of layer types that this DecodingLayer can decode.
func (*EtherIP) DecodeFromBytes ¶
func (e *EtherIP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*EtherIP) NextLayerType ¶
NextLayerType returns the layer type contained by this DecodingLayer.
type Ethernet ¶
type Ethernet struct { BaseLayer SrcMAC, DstMAC net.HardwareAddr EthernetType EthernetType // Length is only set if a length field exists within this header. Ethernet // headers follow two different standards, one that uses an EthernetType, the // other which defines a length the follows with a LLC header (802.3). If the // former is the case, we set EthernetType and Length stays 0. In the latter // case, we set Length and EthernetType = EthernetTypeLLC. Length uint16 }
Ethernet is the layer for Ethernet frame headers.
func (*Ethernet) CanDecode ¶
func (eth *Ethernet) CanDecode() gopacket.LayerClass
func (*Ethernet) DecodeFromBytes ¶
func (eth *Ethernet) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
func (*Ethernet) NextLayerType ¶
func (*Ethernet) SerializeTo ¶
func (eth *Ethernet) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.
type EthernetCTP ¶
EthernetCTP implements the EthernetCTP protocol, see http://www.mit.edu/people/jhawk/ctp.html. We split EthernetCTP up into the top-level EthernetCTP layer, followed by zero or more EthernetCTPForwardData layers, followed by a final EthernetCTPReply layer.
func (*EthernetCTP) LayerType ¶
func (c *EthernetCTP) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeEthernetCTP.
type EthernetCTPForwardData ¶
type EthernetCTPForwardData struct { BaseLayer Function EthernetCTPFunction ForwardAddress []byte }
EthernetCTPForwardData is the ForwardData layer inside EthernetCTP. See EthernetCTP's docs for more details.
func (*EthernetCTPForwardData) ForwardEndpoint ¶
func (c *EthernetCTPForwardData) ForwardEndpoint() gopacket.Endpoint
ForwardEndpoint returns the EthernetCTPForwardData ForwardAddress as an endpoint.
func (*EthernetCTPForwardData) LayerType ¶
func (c *EthernetCTPForwardData) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeEthernetCTPForwardData.
type EthernetCTPFunction ¶
type EthernetCTPFunction uint16
EthernetCTPFunction is the function code used by the EthernetCTP protocol to identify each EthernetCTP layer.
const ( EthernetCTPFunctionReply EthernetCTPFunction = 1 EthernetCTPFunctionForwardData EthernetCTPFunction = 2 )
type EthernetCTPReply ¶
type EthernetCTPReply struct { BaseLayer Function EthernetCTPFunction ReceiptNumber uint16 Data []byte }
EthernetCTPReply is the Reply layer inside EthernetCTP. See EthernetCTP's docs for more details.
func (*EthernetCTPReply) LayerType ¶
func (c *EthernetCTPReply) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeEthernetCTPReply.
func (*EthernetCTPReply) Payload ¶
func (c *EthernetCTPReply) Payload() []byte
Payload returns the EthernetCTP reply's Data bytes.
type EthernetType ¶
type EthernetType uint16
EthernetType is an enumeration of ethernet type values, and acts as a decoder for any type it supports.
const ( // EthernetTypeLLC is not an actual ethernet type. It is instead a // placeholder we use in Ethernet frames that use the 802.3 standard of // srcmac|dstmac|length|LLC instead of srcmac|dstmac|ethertype. EthernetTypeLLC EthernetType = 0 EthernetTypeIPv4 EthernetType = 0x0800 EthernetTypeARP EthernetType = 0x0806 EthernetTypeIPv6 EthernetType = 0x86DD EthernetTypeCiscoDiscovery EthernetType = 0x2000 EthernetTypeNortelDiscovery EthernetType = 0x01a2 EthernetTypeDot1Q EthernetType = 0x8100 EthernetTypePPPoEDiscovery EthernetType = 0x8863 EthernetTypePPPoESession EthernetType = 0x8864 EthernetTypeMPLSUnicast EthernetType = 0x8847 EthernetTypeMPLSMulticast EthernetType = 0x8848 EthernetTypeEAPOL EthernetType = 0x888e EthernetTypeLinkLayerDiscovery EthernetType = 0x88cc EthernetTypeEthernetCTP EthernetType = 0x9000 )
func (EthernetType) Decode ¶
func (a EthernetType) Decode(data []byte, p gopacket.PacketBuilder) error
func (EthernetType) LayerType ¶
func (a EthernetType) LayerType() gopacket.LayerType
func (EthernetType) String ¶
func (a EthernetType) String() string
type FDDI ¶
type FDDI struct { BaseLayer FrameControl FDDIFrameControl Priority uint8 SrcMAC, DstMAC net.HardwareAddr }
FDDI contains the header for FDDI frames.
type FDDIFrameControl ¶
type FDDIFrameControl uint8
FDDIFrameControl is an enumeration of FDDI frame control bytes.
const (
FDDIFrameControlLLC FDDIFrameControl = 0x50
)
func (FDDIFrameControl) Decode ¶
func (a FDDIFrameControl) Decode(data []byte, p gopacket.PacketBuilder) error
func (FDDIFrameControl) String ¶
func (a FDDIFrameControl) String() string
type GRE ¶
type GRE struct { BaseLayer ChecksumPresent, RoutingPresent, KeyPresent, SeqPresent, StrictSourceRoute bool RecursionControl, Flags, Version uint8 Protocol EthernetType Checksum, Offset uint16 Key, Seq uint32 *GRERouting }
GRE is a Generic Routing Encapsulation header.
func (*GRE) CanDecode ¶
func (g *GRE) CanDecode() gopacket.LayerClass
CanDecode returns the set of layer types that this DecodingLayer can decode.
func (*GRE) DecodeFromBytes ¶
func (g *GRE) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*GRE) NextLayerType ¶
NextLayerType returns the layer type contained by this DecodingLayer.
type GRERouting ¶
type GRERouting struct { AddressFamily uint16 SREOffset, SRELength uint8 RoutingInformation []byte }
GRERouting is GRE routing information, present if the RoutingPresent flag is set.
type IANAAddressFamily ¶
type IANAAddressFamily byte
const ( IANAAddressFamilyReserved IANAAddressFamily = 0 IANAAddressFamilyIPV4 IANAAddressFamily = 1 IANAAddressFamilyIPV6 IANAAddressFamily = 2 IANAAddressFamilyNSAP IANAAddressFamily = 3 IANAAddressFamilyHDLC IANAAddressFamily = 4 IANAAddressFamilyBBN1822 IANAAddressFamily = 5 IANAAddressFamily802 IANAAddressFamily = 6 IANAAddressFamilyE163 IANAAddressFamily = 7 IANAAddressFamilyE164 IANAAddressFamily = 8 IANAAddressFamilyF69 IANAAddressFamily = 9 IANAAddressFamilyX121 IANAAddressFamily = 10 IANAAddressFamilyIPX IANAAddressFamily = 11 IANAAddressFamilyAtalk IANAAddressFamily = 12 IANAAddressFamilyDecnet IANAAddressFamily = 13 IANAAddressFamilyBanyan IANAAddressFamily = 14 IANAAddressFamilyE164NSAP IANAAddressFamily = 15 IANAAddressFamilyDNS IANAAddressFamily = 16 IANAAddressFamilyDistname IANAAddressFamily = 17 IANAAddressFamilyASNumber IANAAddressFamily = 18 IANAAddressFamilyXTPIPV4 IANAAddressFamily = 19 IANAAddressFamilyXTPIPV6 IANAAddressFamily = 20 IANAAddressFamilyXTP IANAAddressFamily = 21 IANAAddressFamilyFcWWPN IANAAddressFamily = 22 IANAAddressFamilyFcWWNN IANAAddressFamily = 23 IANAAddressFamilyGWID IANAAddressFamily = 24 IANAAddressFamilyL2VPN IANAAddressFamily = 25 )
LLDP Management Address Subtypes http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xml
func (IANAAddressFamily) String ¶
func (t IANAAddressFamily) String() (s string)
type ICMPv4 ¶
type ICMPv4 struct { BaseLayer TypeCode ICMPv4TypeCode Checksum uint16 Id uint16 Seq uint16 }
ICMPv4 is the layer for IPv4 ICMP packet data.
func (*ICMPv4) CanDecode ¶
func (i *ICMPv4) CanDecode() gopacket.LayerClass
func (*ICMPv4) DecodeFromBytes ¶
func (i *ICMPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
func (*ICMPv4) NextLayerType ¶
func (*ICMPv4) SerializeTo ¶ added in v1.0.1
func (i *ICMPv4) 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 ICMPv4TypeCode ¶
type ICMPv4TypeCode uint16
func (ICMPv4TypeCode) String ¶
func (a ICMPv4TypeCode) String() string
type ICMPv6 ¶
type ICMPv6 struct { BaseLayer TypeCode ICMPv6TypeCode Checksum uint16 TypeBytes []byte // contains filtered or unexported fields }
ICMPv6 is the layer for IPv6 ICMP packet data
func (*ICMPv6) CanDecode ¶
func (i *ICMPv6) CanDecode() gopacket.LayerClass
CanDecode returns the set of layer types that this DecodingLayer can decode.
func (*ICMPv6) DecodeFromBytes ¶
func (i *ICMPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*ICMPv6) NextLayerType ¶
NextLayerType returns the layer type contained by this DecodingLayer.
func (*ICMPv6) SerializeTo ¶ added in v1.0.1
func (i *ICMPv6) 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.
func (*ICMPv6) SetNetworkLayerForChecksum ¶ added in v1.0.1
func (i *ICMPv6) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error
SetNetworkLayerForChecksum tells this layer which network layer is wrapping it. This is needed for computing the checksum when serializing, since TCP/IP transport layer checksums depends on fields in the IPv4 or IPv6 layer that contains it. The passed in layer must be an *IPv4 or *IPv6.
type ICMPv6TypeCode ¶
type ICMPv6TypeCode uint16
func (ICMPv6TypeCode) String ¶
func (a ICMPv6TypeCode) String() string
type IEEEOUI ¶
type IEEEOUI uint32
type IGMP ¶
type IGMP struct { BaseLayer Type IGMPType MaxResponseTime time.Duration Checksum uint16 GroupAddress net.IP // The following are used only by IGMPv3 SupressRouterProcessing bool RobustnessValue uint8 IntervalTime time.Duration SourceAddresses []net.IP }
IGMP is the packet structure for IGMP messages.
func (*IGMP) CanDecode ¶
func (i *IGMP) CanDecode() gopacket.LayerClass
CanDecode returns the set of layer types that this DecodingLayer can decode.
func (*IGMP) DecodeFromBytes ¶
func (i *IGMP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*IGMP) NextLayerType ¶
NextLayerType returns the layer type contained by this DecodingLayer.
type IPProtocol ¶
type IPProtocol uint8
IPProtocol is an enumeration of IP protocol values, and acts as a decoder for any type it supports.
const ( IPProtocolIPv6HopByHop IPProtocol = 0 IPProtocolICMPv4 IPProtocol = 1 IPProtocolIGMP IPProtocol = 2 IPProtocolTCP IPProtocol = 6 IPProtocolUDP IPProtocol = 17 IPProtocolRUDP IPProtocol = 27 IPProtocolIPv6 IPProtocol = 41 IPProtocolIPv6Routing IPProtocol = 43 IPProtocolIPv6Fragment IPProtocol = 44 IPProtocolGRE IPProtocol = 47 IPProtocolESP IPProtocol = 50 IPProtocolAH IPProtocol = 51 IPProtocolICMPv6 IPProtocol = 58 IPProtocolNoNextHeader IPProtocol = 59 IPProtocolIPIP IPProtocol = 94 IPProtocolEtherIP IPProtocol = 97 IPProtocolSCTP IPProtocol = 132 IPProtocolUDPLite IPProtocol = 136 IPProtocolMPLSInIP IPProtocol = 137 )
func (IPProtocol) Decode ¶
func (a IPProtocol) Decode(data []byte, p gopacket.PacketBuilder) error
func (IPProtocol) LayerType ¶
func (a IPProtocol) LayerType() gopacket.LayerType
func (IPProtocol) String ¶
func (a IPProtocol) String() string
type IPSecAH ¶
type IPSecAH struct { Reserved uint16 SPI, Seq uint32 AuthenticationData []byte // contains filtered or unexported fields }
IPSecAH is the authentication header for IPv4/6 defined in http://tools.ietf.org/html/rfc2402
type IPSecESP ¶
type IPSecESP struct { BaseLayer SPI, Seq uint32 // Encrypted contains the encrypted set of bytes sent in an ESP Encrypted []byte }
IPSecESP is the encapsulating security payload defined in http://tools.ietf.org/html/rfc2406
type IPv4 ¶
type IPv4 struct { BaseLayer Version uint8 IHL uint8 TOS uint8 Length uint16 Id uint16 Flags IPv4Flag FragOffset uint16 TTL uint8 Protocol IPProtocol Checksum uint16 SrcIP net.IP DstIP net.IP Options []IPv4Option Padding []byte }
IPv4 is the header of an IP packet.
func (*IPv4) CanDecode ¶
func (i *IPv4) CanDecode() gopacket.LayerClass
func (*IPv4) DecodeFromBytes ¶
func (ip *IPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
DecodeFromBytes decodes the given bytes into this layer.
func (*IPv4) NetworkFlow ¶
func (*IPv4) NextLayerType ¶
func (*IPv4) SerializeTo ¶
func (ip *IPv4) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.
type IPv4Flag ¶
type IPv4Flag uint8
const ( IPv4EvilBit IPv4Flag = 1 << 0 // http://tools.ietf.org/html/rfc3514 ;) IPv4DontFragment IPv4Flag = 1 << 1 IPv4MoreFragments IPv4Flag = 1 << 2 )
type IPv4Option ¶
func (IPv4Option) String ¶
func (i IPv4Option) String() string
type IPv6 ¶
type IPv6 struct { // http://www.networksorcery.com/enp/protocol/ipv6.htm BaseLayer Version uint8 TrafficClass uint8 FlowLabel uint32 Length uint16 NextHeader IPProtocol HopLimit uint8 SrcIP net.IP DstIP net.IP HopByHop *IPv6HopByHop // contains filtered or unexported fields }
IPv6 is the layer for the IPv6 header.
func (*IPv6) CanDecode ¶
func (i *IPv6) CanDecode() gopacket.LayerClass
func (*IPv6) DecodeFromBytes ¶
func (ip6 *IPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
func (*IPv6) NetworkFlow ¶
func (*IPv6) NextLayerType ¶
func (*IPv6) SerializeTo ¶
func (ip6 *IPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer. See the docs for gopacket.SerializableLayer for more info.
type IPv6Destination ¶
type IPv6Destination struct { Options []IPv6DestinationOption // contains filtered or unexported fields }
IPv6Destination is the IPv6 destination options header.
func (*IPv6Destination) LayerType ¶
func (i *IPv6Destination) LayerType() gopacket.LayerType
LayerType returns LayerTypeIPv6Destination.
type IPv6DestinationOption ¶
type IPv6DestinationOption ipv6HeaderTLVOption
IPv6DestinationOption is a TLV option present in an IPv6 destination options extension.
type IPv6ExtensionSkipper ¶
type IPv6ExtensionSkipper struct { NextHeader IPProtocol BaseLayer }
IPv6ExtensionSkipper is a DecodingLayer which decodes and ignores v6 extensions. You can use it with a DecodingLayerParser to handle IPv6 stacks which may or may not have extensions.
func (*IPv6ExtensionSkipper) CanDecode ¶
func (i *IPv6ExtensionSkipper) CanDecode() gopacket.LayerClass
func (*IPv6ExtensionSkipper) DecodeFromBytes ¶
func (i *IPv6ExtensionSkipper) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
func (*IPv6ExtensionSkipper) NextLayerType ¶
func (i *IPv6ExtensionSkipper) NextLayerType() gopacket.LayerType
type IPv6Fragment ¶
type IPv6Fragment struct { BaseLayer NextHeader IPProtocol // Reserved1 is bits [8-16), from least to most significant, 0-indexed Reserved1 uint8 FragmentOffset uint16 // Reserved2 is bits [29-31), from least to most significant, 0-indexed Reserved2 uint8 MoreFragments bool Identification uint32 }
IPv6Fragment is the IPv6 fragment header, used for packet fragmentation/defragmentation.
func (*IPv6Fragment) LayerType ¶
func (i *IPv6Fragment) LayerType() gopacket.LayerType
LayerType returns LayerTypeIPv6Fragment.
type IPv6HopByHop ¶
type IPv6HopByHop struct { Options []IPv6HopByHopOption // contains filtered or unexported fields }
IPv6HopByHop is the IPv6 hop-by-hop extension.
func (*IPv6HopByHop) DecodeFromBytes ¶
func (i *IPv6HopByHop) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
func (*IPv6HopByHop) LayerType ¶
func (i *IPv6HopByHop) LayerType() gopacket.LayerType
LayerType returns LayerTypeIPv6HopByHop.
type IPv6HopByHopOption ¶
type IPv6HopByHopOption ipv6HeaderTLVOption
IPv6HopByHopOption is a TLV option present in an IPv6 hop-by-hop extension.
type IPv6Routing ¶
type IPv6Routing struct { RoutingType uint8 SegmentsLeft uint8 // This segment is supposed to be zero according to RFC2460, the second set of // 4 bytes in the extension. Reserved []byte // SourceRoutingIPs is the set of IPv6 addresses requested for source routing, // set only if RoutingType == 0. SourceRoutingIPs []net.IP // contains filtered or unexported fields }
IPv6Routing is the IPv6 routing extension.
func (*IPv6Routing) LayerType ¶
func (i *IPv6Routing) LayerType() gopacket.LayerType
LayerType returns LayerTypeIPv6Routing.
type LLC ¶
type LLC struct { BaseLayer DSAP uint8 IG bool // true means group, false means individual SSAP uint8 CR bool // true means response, false means command Control uint16 }
LLC is the layer used for 802.2 Logical Link Control headers. See http://standards.ieee.org/getieee802/download/802.2-1998.pdf
type LLDPApplicationType ¶
type LLDPApplicationType uint8
const ( LLDPAppTypeReserved LLDPApplicationType = 0 LLDPAppTypeVoice LLDPApplicationType = 1 LLDPappTypeVoiceSignaling LLDPApplicationType = 2 LLDPappTypeGuestVoice LLDPApplicationType = 3 LLDPappTypeGuestVoiceSignaling LLDPApplicationType = 4 LLDPappTypeSoftphoneVoice LLDPApplicationType = 5 LLDPappTypeVideoConferencing LLDPApplicationType = 6 LLDPappTypeStreamingVideo LLDPApplicationType = 7 LLDPappTypeVideoSignaling LLDPApplicationType = 8 )
func (LLDPApplicationType) String ¶
func (t LLDPApplicationType) String() (s string)
type LLDPCapabilities ¶
type LLDPCapabilities struct { Other bool Repeater bool Bridge bool WLANAP bool Router bool Phone bool DocSis bool StationOnly bool CVLAN bool SVLAN bool TMPR bool }
LLDPCapabilities represents the capabilities of a device
type LLDPChassisID ¶
type LLDPChassisID struct { Subtype LLDPChassisIDSubType ID []byte }
type LLDPChassisIDSubType ¶
type LLDPChassisIDSubType byte
LLDPChassisIDSubType specifies the value type for a single LLDPChassisID.ID
const ( LLDPChassisIDSubTypeReserved LLDPChassisIDSubType = 0 LLDPChassisIDSubTypeChassisComp LLDPChassisIDSubType = 1 LLDPChassisIDSubtypeIfaceAlias LLDPChassisIDSubType = 2 LLDPChassisIDSubTypePortComp LLDPChassisIDSubType = 3 LLDPChassisIDSubTypeMACAddr LLDPChassisIDSubType = 4 LLDPChassisIDSubTypeNetworkAddr LLDPChassisIDSubType = 5 LLDPChassisIDSubtypeIfaceName LLDPChassisIDSubType = 6 LLDPChassisIDSubTypeLocal LLDPChassisIDSubType = 7 )
LLDP Chassis Types
func (LLDPChassisIDSubType) String ¶
func (t LLDPChassisIDSubType) String() (s string)
type LLDPCisco2Subtype ¶
type LLDPCisco2Subtype uint8
const (
LLDPCisco2PowerViaMDI LLDPCisco2Subtype = 1
)
Cisco2 TLV Subtypes
type LLDPEVBCapabilities ¶
type LLDPEVBCapabilities struct { StandardBridging bool ReflectiveRelay bool RetransmissionTimerExponent bool EdgeControlProtocol bool VSIDiscoveryProtocol bool }
LLDPEVBCapabilities represents the EVB capabilities of a device
type LLDPEVBSettings ¶
type LLDPEVBSettings struct { Supported LLDPEVBCapabilities Enabled LLDPEVBCapabilities SupportedVSIs uint16 ConfiguredVSIs uint16 RTEExponent uint8 }
type LLDPInfo8021 ¶
type LLDPInfo8021 struct { PVID uint16 PPVIDs []PortProtocolVLANID VLANNames []VLANName ProtocolIdentities []ProtocolIdentity VIDUsageDigest uint32 ManagementVID uint16 LinkAggregation LLDPLinkAggregation }
LLDPInfo8021 represents the information carried in 802.1 Org-specific TLVs
type LLDPInfo8021Qbg ¶
type LLDPInfo8021Qbg struct {
EVBSettings LLDPEVBSettings
}
LLDPInfo8021Qbg represents the information carried in 802.1Qbg Org-specific TLVs
type LLDPInfo8023 ¶
type LLDPInfo8023 struct { MACPHYConfigStatus LLDPMACPHYConfigStatus PowerViaMDI LLDPPowerViaMDI8023 LinkAggregation LLDPLinkAggregation MTU uint16 }
LLDPInfo8023 represents the information carried in 802.3 Org-specific TLVs
type LLDPInfoCisco2 ¶
type LLDPInfoCisco2 struct { PSEFourWirePoESupported bool PDRequestSparePairPoEOn bool PSESparePairPoEOn bool }
LLDPInfoCisco2 represents the information carried in Cisco Org-specific TLVs
type LLDPInfoMedia ¶
type LLDPInfoMedia struct { MediaCapabilities LLDPMediaCapabilities NetworkPolicy LLDPNetworkPolicy Location LLDPLocation PowerViaMDI LLDPPowerViaMDI HardwareRevision string FirmwareRevision string SoftwareRevision string SerialNumber string Manufacturer string Model string AssetID string }
LLDPInfoMedia represents the information carried in TR-41 Org-specific TLVs
type LLDPInfoProfinet ¶
type LLDPInfoProfinet struct { PNIODelay LLDPPNIODelay PNIOPortStatus LLDPPNIOPortStatus PNIOMRPPortStatus LLDPPNIOMRPPortStatus ChassisMAC []byte PNIOPTCPStatus LLDPPNIOPTCPStatus }
LLDPInfoProfinet represents the information carried in Profinet Org-specific TLVs
type LLDPInterfaceSubtype ¶
type LLDPInterfaceSubtype byte
const ( LLDPInterfaceSubtypeUnknown LLDPInterfaceSubtype = 1 LLDPInterfaceSubtypeifIndex LLDPInterfaceSubtype = 2 LLDPInterfaceSubtypeSysPort LLDPInterfaceSubtype = 3 )
LLDP Interface Subtypes
func (LLDPInterfaceSubtype) String ¶
func (t LLDPInterfaceSubtype) String() (s string)
type LLDPLinkAggregation ¶
IEEE 802 Link Aggregation parameters
type LLDPLocation ¶
type LLDPLocation struct { Format LLDPLocationFormat Coordinate LLDPLocationCoordinate Address LLDPLocationAddress ECS LLDPLocationECS }
LLDP represents a physical location. Only one of the embedded types will contain values, depending on Format.
type LLDPLocationAddress ¶
type LLDPLocationAddress struct { What LLDPLocationAddressWhat CountryCode string AddressLines []LLDPLocationAddressLine }
type LLDPLocationAddressLine ¶
type LLDPLocationAddressLine struct { Type LLDPLocationAddressType Value string }
type LLDPLocationAddressType ¶
type LLDPLocationAddressType uint8
const ( LLDPLocationAddressTypeLanguage LLDPLocationAddressType = 0 LLDPLocationAddressTypeNational LLDPLocationAddressType = 1 LLDPLocationAddressTypeCounty LLDPLocationAddressType = 2 LLDPLocationAddressTypeCity LLDPLocationAddressType = 3 LLDPLocationAddressTypeCityDivision LLDPLocationAddressType = 4 LLDPLocationAddressTypeNeighborhood LLDPLocationAddressType = 5 LLDPLocationAddressTypeStreet LLDPLocationAddressType = 6 LLDPLocationAddressTypeLeadingStreet LLDPLocationAddressType = 16 LLDPLocationAddressTypeTrailingStreet LLDPLocationAddressType = 17 LLDPLocationAddressTypeStreetSuffix LLDPLocationAddressType = 18 LLDPLocationAddressTypeHouseNum LLDPLocationAddressType = 19 LLDPLocationAddressTypeHouseSuffix LLDPLocationAddressType = 20 LLDPLocationAddressTypeLandmark LLDPLocationAddressType = 21 LLDPLocationAddressTypeAdditional LLDPLocationAddressType = 22 LLDPLocationAddressTypeName LLDPLocationAddressType = 23 LLDPLocationAddressTypePostal LLDPLocationAddressType = 24 LLDPLocationAddressTypeBuilding LLDPLocationAddressType = 25 LLDPLocationAddressTypeUnit LLDPLocationAddressType = 26 LLDPLocationAddressTypeFloor LLDPLocationAddressType = 27 LLDPLocationAddressTypeRoom LLDPLocationAddressType = 28 LLDPLocationAddressTypePlace LLDPLocationAddressType = 29 LLDPLocationAddressTypeScript LLDPLocationAddressType = 128 )
func (LLDPLocationAddressType) String ¶
func (t LLDPLocationAddressType) String() (s string)
type LLDPLocationAddressWhat ¶
type LLDPLocationAddressWhat uint8
const ( LLDPLocationAddressWhatDHCP LLDPLocationAddressWhat = 0 LLDPLocationAddressWhatNetwork LLDPLocationAddressWhat = 1 LLDPLocationAddressWhatClient LLDPLocationAddressWhat = 2 )
type LLDPLocationCoordinate ¶
type LLDPLocationECS ¶
type LLDPLocationECS struct {
ELIN string
}
type LLDPLocationFormat ¶
type LLDPLocationFormat uint8
const ( LLDPLocationFormatInvalid LLDPLocationFormat = 0 LLDPLocationFormatCoordinate LLDPLocationFormat = 1 LLDPLocationFormatAddress LLDPLocationFormat = 2 LLDPLocationFormatECS LLDPLocationFormat = 3 )
func (LLDPLocationFormat) String ¶
func (t LLDPLocationFormat) String() (s string)
type LLDPMACPHYConfigStatus ¶
type LLDPMediaCapabilities ¶
type LLDPMediaCapabilities struct { Capabilities bool NetworkPolicy bool Location bool PowerPSE bool PowerPD bool Inventory bool Class LLDPMediaClass }
LLDPMediaCapabilities represents the LLDP Media capabilities of a device
type LLDPMediaClass ¶
type LLDPMediaClass uint8
const ( LLDPMediaClassUndefined LLDPMediaClass = 0 LLDPMediaClassEndpointI LLDPMediaClass = 1 LLDPMediaClassEndpointII LLDPMediaClass = 2 LLDPMediaClassEndpointIII LLDPMediaClass = 3 LLDPMediaClassNetwork LLDPMediaClass = 4 )
Media Class Values
func (LLDPMediaClass) String ¶
func (t LLDPMediaClass) String() (s string)
type LLDPMediaSubtype ¶
type LLDPMediaSubtype uint8
const ( LLDPMediaTypeCapabilities LLDPMediaSubtype = 1 LLDPMediaTypeNetwork LLDPMediaSubtype = 2 LLDPMediaTypeLocation LLDPMediaSubtype = 3 LLDPMediaTypePower LLDPMediaSubtype = 4 LLDPMediaTypeHardware LLDPMediaSubtype = 5 LLDPMediaTypeFirmware LLDPMediaSubtype = 6 LLDPMediaTypeSoftware LLDPMediaSubtype = 7 LLDPMediaTypeSerial LLDPMediaSubtype = 8 LLDPMediaTypeManufacturer LLDPMediaSubtype = 9 LLDPMediaTypeModel LLDPMediaSubtype = 10 LLDPMediaTypeAssetID LLDPMediaSubtype = 11 )
Media TLV Subtypes
func (LLDPMediaSubtype) String ¶
func (t LLDPMediaSubtype) String() (s string)
type LLDPMgmtAddress ¶
type LLDPMgmtAddress struct { Subtype IANAAddressFamily Address []byte InterfaceSubtype LLDPInterfaceSubtype InterfaceNumber uint32 OID string }
type LLDPNetworkPolicy ¶
type LLDPOrgSpecificTLV ¶
LLDPOrgSpecificTLV is an Organisation-specific TLV
type LLDPPNIODelay ¶
type LLDPPNIOMRPPortStatus ¶
type LLDPPNIOPTCPStatus ¶
type LLDPPNIOPortStatus ¶
type LLDPPortID ¶
type LLDPPortID struct { Subtype LLDPPortIDSubType ID []byte }
type LLDPPortIDSubType ¶
type LLDPPortIDSubType byte
LLDPPortIDSubType specifies the value type for a single LLDPPortID.ID
const ( LLDPPortIDSubtypeReserved LLDPPortIDSubType = 0 LLDPPortIDSubtypeIfaceAlias LLDPPortIDSubType = 1 LLDPPortIDSubtypePortComp LLDPPortIDSubType = 2 LLDPPortIDSubtypeMACAddr LLDPPortIDSubType = 3 LLDPPortIDSubtypeNetworkAddr LLDPPortIDSubType = 4 LLDPPortIDSubtypeIfaceName LLDPPortIDSubType = 5 LLDPPortIDSubtypeAgentCircuitID LLDPPortIDSubType = 6 LLDPPortIDSubtypeLocal LLDPPortIDSubType = 7 )
LLDP PortID types
func (LLDPPortIDSubType) String ¶
func (t LLDPPortIDSubType) String() (s string)
type LLDPPowerPriority ¶
type LLDPPowerPriority byte
const ( LLDPPowerPriorityUnknown LLDPPowerPriority = 0 LLDPPowerPriorityMedium LLDPPowerPriority = 1 LLDPPowerPriorityHigh LLDPPowerPriority = 2 LLDPPowerPriorityLow LLDPPowerPriority = 3 )
func (LLDPPowerPriority) String ¶
func (t LLDPPowerPriority) String() (s string)
type LLDPPowerSource ¶
type LLDPPowerSource byte
func (LLDPPowerSource) String ¶
func (t LLDPPowerSource) String() (s string)
type LLDPPowerType ¶
type LLDPPowerType byte
func (LLDPPowerType) String ¶
func (t LLDPPowerType) String() (s string)
type LLDPPowerViaMDI ¶
type LLDPPowerViaMDI struct { Type LLDPPowerType Source LLDPPowerSource Priority LLDPPowerPriority Value uint16 }
type LLDPPowerViaMDI8023 ¶
type LLDPPowerViaMDI8023 struct { PortClassPSE bool // false = PD PSESupported bool PSEEnabled bool PSEPairsAbility bool PSEPowerPair uint8 PSEClass uint8 Type LLDPPowerType Source LLDPPowerSource Priority LLDPPowerPriority Requested uint16 // 1-510 Watts Allocated uint16 // 1-510 Watts }
type LLDPProfinetSubtype ¶
type LLDPProfinetSubtype uint8
Profinet Subtypes
const ( LLDPProfinetPNIODelay LLDPProfinetSubtype = 1 LLDPProfinetPNIOPortStatus LLDPProfinetSubtype = 2 LLDPProfinetPNIOMRPPortStatus LLDPProfinetSubtype = 4 LLDPProfinetPNIOChassisMAC LLDPProfinetSubtype = 5 LLDPProfinetPNIOPTCPStatus LLDPProfinetSubtype = 6 )
type LLDPSysCapabilities ¶
type LLDPSysCapabilities struct { SystemCap LLDPCapabilities EnabledCap LLDPCapabilities }
type LLDPTLVType ¶
type LLDPTLVType byte
LLDPTLVType is the type of each TLV value in a LinkLayerDiscovery packet.
const ( LLDPTLVEnd LLDPTLVType = 0 LLDPTLVChassisID LLDPTLVType = 1 LLDPTLVPortID LLDPTLVType = 2 LLDPTLVTTL LLDPTLVType = 3 LLDPTLVPortDescription LLDPTLVType = 4 LLDPTLVSysName LLDPTLVType = 5 LLDPTLVSysDescription LLDPTLVType = 6 LLDPTLVSysCapabilities LLDPTLVType = 7 LLDPTLVMgmtAddress LLDPTLVType = 8 LLDPTLVOrgSpecific LLDPTLVType = 127 )
func (LLDPTLVType) String ¶
func (t LLDPTLVType) String() (s string)
type LinkLayerDiscovery ¶
type LinkLayerDiscovery struct { BaseLayer ChassisID LLDPChassisID PortID LLDPPortID TTL uint16 Values []LinkLayerDiscoveryValue }
LinkLayerDiscovery is a packet layer containing the LinkLayer Discovery Protocol. See http:http://standards.ieee.org/getieee802/download/802.1AB-2009.pdf ChassisID, PortID and TTL are mandatory TLV's. Other values can be decoded with DecodeValues()
func (*LinkLayerDiscovery) LayerType ¶
func (c *LinkLayerDiscovery) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeLinkLayerDiscovery.
type LinkLayerDiscoveryInfo ¶
type LinkLayerDiscoveryInfo struct { BaseLayer PortDescription string SysName string SysDescription string SysCapabilities LLDPSysCapabilities MgmtAddress LLDPMgmtAddress OrgTLVs []LLDPOrgSpecificTLV // Private TLVs Unknown []LinkLayerDiscoveryValue // undecoded TLVs }
LinkLayerDiscoveryInfo represents the decoded details for a set of LinkLayerDiscoveryValues Organisation-specific TLV's can be decoded using the various Decode() methods
func (*LinkLayerDiscoveryInfo) Decode8021 ¶
func (l *LinkLayerDiscoveryInfo) Decode8021() (info LLDPInfo8021, err error)
func (*LinkLayerDiscoveryInfo) Decode8021Qbg ¶
func (l *LinkLayerDiscoveryInfo) Decode8021Qbg() (info LLDPInfo8021Qbg, err error)
func (*LinkLayerDiscoveryInfo) Decode8023 ¶
func (l *LinkLayerDiscoveryInfo) Decode8023() (info LLDPInfo8023, err error)
func (*LinkLayerDiscoveryInfo) DecodeCisco2 ¶
func (l *LinkLayerDiscoveryInfo) DecodeCisco2() (info LLDPInfoCisco2, err error)
func (*LinkLayerDiscoveryInfo) DecodeMedia ¶
func (l *LinkLayerDiscoveryInfo) DecodeMedia() (info LLDPInfoMedia, err error)
func (*LinkLayerDiscoveryInfo) DecodeProfinet ¶
func (l *LinkLayerDiscoveryInfo) DecodeProfinet() (info LLDPInfoProfinet, err error)
func (*LinkLayerDiscoveryInfo) LayerType ¶
func (c *LinkLayerDiscoveryInfo) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeLinkLayerDiscoveryInfo.
type LinkLayerDiscoveryValue ¶
type LinkLayerDiscoveryValue struct { Type LLDPTLVType Length uint16 Value []byte }
LinkLayerDiscoveryValue is a TLV value inside a LinkLayerDiscovery packet layer.
type LinkType ¶
type LinkType uint8
LinkType is an enumeration of link types, and acts as a decoder for any link type it supports.
const ( // According to pcap-linktype(7). LinkTypeNull LinkType = 0 LinkTypeEthernet LinkType = 1 LinkTypeTokenRing LinkType = 6 LinkTypeArcNet LinkType = 7 LinkTypeSLIP LinkType = 8 LinkTypePPP LinkType = 9 LinkTypeFDDI LinkType = 10 LinkTypeATM_RFC1483 LinkType = 100 LinkTypeRaw LinkType = 101 LinkTypePPP_HDLC LinkType = 50 LinkTypePPPEthernet LinkType = 51 LinkTypeC_HDLC LinkType = 104 LinkTypeIEEE802_11 LinkType = 105 LinkTypeFRelay LinkType = 107 LinkTypeLoop LinkType = 108 LinkTypeLinuxSLL LinkType = 113 LinkTypeLTalk LinkType = 104 LinkTypePFLog LinkType = 117 LinkTypePrismHeader LinkType = 119 LinkTypeIPOverFC LinkType = 122 LinkTypeSunATM LinkType = 123 LinkTypeIEEE80211Radio LinkType = 127 LinkTypeARCNetLinux LinkType = 129 LinkTypeLinuxIRDA LinkType = 144 LinkTypeLinuxLAPD LinkType = 177 )
type Loopback ¶
type Loopback struct { BaseLayer Family ProtocolFamily }
Loopback contains the header for loopback encapsulation. This header is used by both BSD and OpenBSD style loopback decoding (pcap's DLT_NULL and DLT_LOOP, respectively).
type MPLS ¶
MPLS is the MPLS packet header.
func (*MPLS) SerializeTo ¶ added in v1.0.1
func (m *MPLS) 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 NDPBackplaneType ¶
type NDPBackplaneType uint8
const ( NDPBackplaneOther NDPBackplaneType = 1 NDPBackplaneEthernet NDPBackplaneType = 2 NDPBackplaneEthernetTokenring NDPBackplaneType = 3 NDPBackplaneEthernetFDDI NDPBackplaneType = 4 NDPBackplaneEthernetTokenringFDDI NDPBackplaneType = 5 NDPBackplaneEthernetTokenringRedundantPower NDPBackplaneType = 6 NDPBackplaneEthernetTokenringFDDIRedundantPower NDPBackplaneType = 7 NDPBackplaneTokenRing NDPBackplaneType = 8 NDPBackplaneEthernetTokenringFastEthernet NDPBackplaneType = 9 NDPBackplaneEthernetFastEthernet NDPBackplaneType = 10 NDPBackplaneEthernetTokenringFastEthernetRedundantPower NDPBackplaneType = 11 NDPBackplaneEthernetFastEthernetGigabitEthernet NDPBackplaneType = 12 )
Nortel Backplane Types
func (NDPBackplaneType) String ¶
func (t NDPBackplaneType) String() (s string)
type NDPChassisType ¶
type NDPChassisType uint8
const ( NDPChassisother NDPChassisType = 1 NDPChassis3000 NDPChassisType = 2 NDPChassis3030 NDPChassisType = 3 NDPChassis2310 NDPChassisType = 4 NDPChassis2810 NDPChassisType = 5 NDPChassis2912 NDPChassisType = 6 NDPChassis2914 NDPChassisType = 7 NDPChassis271x NDPChassisType = 8 NDPChassis2813 NDPChassisType = 9 NDPChassis2814 NDPChassisType = 10 NDPChassis2915 NDPChassisType = 11 NDPChassis5000 NDPChassisType = 12 NDPChassis2813SA NDPChassisType = 13 NDPChassis2814SA NDPChassisType = 14 NDPChassis810M NDPChassisType = 15 NDPChassisEthercell NDPChassisType = 16 NDPChassis5005 NDPChassisType = 17 NDPChassisAlcatelEWC NDPChassisType = 18 NDPChassis2715SA NDPChassisType = 20 NDPChassis2486 NDPChassisType = 21 NDPChassis28000series NDPChassisType = 22 NDPChassis23000series NDPChassisType = 23 NDPChassis5DN00xseries NDPChassisType = 24 NDPChassisBayStackEthernet NDPChassisType = 25 NDPChassis23100series NDPChassisType = 26 NDPChassis100BaseTHub NDPChassisType = 27 NDPChassis3000FastEthernet NDPChassisType = 28 NDPChassisOrionSwitch NDPChassisType = 29 NDPChassisDDS NDPChassisType = 31 NDPChassisCentillion6slot NDPChassisType = 32 NDPChassisCentillion12slot NDPChassisType = 33 NDPChassisCentillion1slot NDPChassisType = 34 NDPChassisBayStack301 NDPChassisType = 35 NDPChassisBayStackTokenRingHub NDPChassisType = 36 NDPChassisFVCMultimediaSwitch NDPChassisType = 37 NDPChassisSwitchNode NDPChassisType = 38 NDPChassisBayStack302Switch NDPChassisType = 39 NDPChassisBayStack350Switch NDPChassisType = 40 NDPChassisBayStack150EthernetHub NDPChassisType = 41 NDPChassisCentillion50NSwitch NDPChassisType = 42 NDPChassisCentillion50TSwitch NDPChassisType = 43 NDPChassisBayStack303304Switches NDPChassisType = 44 NDPChassisBayStack200EthernetHub NDPChassisType = 45 NDPChassisBayStack25010100EthernetHub NDPChassisType = 46 NDPChassisBayStack450101001000Switches NDPChassisType = 48 NDPChassisBayStack41010100Switches NDPChassisType = 49 NDPChassisPassport1200L3Switch NDPChassisType = 50 NDPChassisPassport1250L3Switch NDPChassisType = 51 NDPChassisPassport1100L3Switch NDPChassisType = 52 NDPChassisPassport1150L3Switch NDPChassisType = 53 NDPChassisPassport1050L3Switch NDPChassisType = 54 NDPChassisPassport1051L3Switch NDPChassisType = 55 NDPChassisPassport8610L3Switch NDPChassisType = 56 NDPChassisPassport8606L3Switch NDPChassisType = 57 NDPChassisPassport8010 NDPChassisType = 58 NDPChassisPassport8006 NDPChassisType = 59 NDPChassisBayStack670wirelessaccesspoint NDPChassisType = 60 NDPChassisPassport740 NDPChassisType = 61 NDPChassisPassport750 NDPChassisType = 62 NDPChassisPassport790 NDPChassisType = 63 NDPChassisBusinessPolicySwitch200010100Switches NDPChassisType = 64 NDPChassisPassport8110L2Switch NDPChassisType = 65 NDPChassisPassport8106L2Switch NDPChassisType = 66 NDPChassisBayStack3580GigSwitch NDPChassisType = 67 NDPChassisBayStack10PowerSupplyUnit NDPChassisType = 68 NDPChassisBayStack42010100Switch NDPChassisType = 69 NDPChassisOPTeraMetro1200EthernetServiceModule NDPChassisType = 70 NDPChassisOPTera8010co NDPChassisType = 71 NDPChassisOPTera8610coL3Switch NDPChassisType = 72 NDPChassisOPTera8110coL2Switch NDPChassisType = 73 NDPChassisOPTera8003 NDPChassisType = 74 NDPChassisOPTera8603L3Switch NDPChassisType = 75 NDPChassisOPTera8103L2Switch NDPChassisType = 76 NDPChassisBayStack380101001000Switch NDPChassisType = 77 NDPChassisEthernetSwitch47048T NDPChassisType = 78 NDPChassisOPTeraMetro1450EthernetServiceModule NDPChassisType = 79 NDPChassisOPTeraMetro1400EthernetServiceModule NDPChassisType = 80 NDPChassisAlteonSwitchFamily NDPChassisType = 81 NDPChassisEthernetSwitch46024TPWR NDPChassisType = 82 NDPChassisOPTeraMetro8010OPML2Switch NDPChassisType = 83 NDPChassisOPTeraMetro8010coOPML2Switch NDPChassisType = 84 NDPChassisOPTeraMetro8006OPML2Switch NDPChassisType = 85 NDPChassisOPTeraMetro8003OPML2Switch NDPChassisType = 86 NDPChassisAlteon180e NDPChassisType = 87 NDPChassisAlteonAD3 NDPChassisType = 88 NDPChassisAlteon184 NDPChassisType = 89 NDPChassisAlteonAD4 NDPChassisType = 90 NDPChassisPassport1424L3Switch NDPChassisType = 91 NDPChassisPassport1648L3Switch NDPChassisType = 92 NDPChassisPassport1612L3Switch NDPChassisType = 93 NDPChassisPassport1624L3Switch NDPChassisType = 94 NDPChassisBayStack38024FFiber1000Switch NDPChassisType = 95 NDPChassisEthernetRoutingSwitch551024T NDPChassisType = 96 NDPChassisEthernetRoutingSwitch551048T NDPChassisType = 97 NDPChassisEthernetSwitch47024T NDPChassisType = 98 NDPChassisNortelNetworksWirelessLANAccessPoint2220 NDPChassisType = 99 NDPChassisPassportRBS2402L3Switch NDPChassisType = 100 NDPChassisAlteonApplicationSwitch2424 NDPChassisType = 101 NDPChassisAlteonApplicationSwitch2224 NDPChassisType = 102 NDPChassisAlteonApplicationSwitch2208 NDPChassisType = 103 NDPChassisAlteonApplicationSwitch2216 NDPChassisType = 104 NDPChassisAlteonApplicationSwitch3408 NDPChassisType = 105 NDPChassisAlteonApplicationSwitch3416 NDPChassisType = 106 NDPChassisNortelNetworksWirelessLANSecuritySwitch2250 NDPChassisType = 107 NDPChassisEthernetSwitch42548T NDPChassisType = 108 NDPChassisEthernetSwitch42524T NDPChassisType = 109 NDPChassisNortelNetworksWirelessLANAccessPoint2221 NDPChassisType = 110 NDPChassisNortelMetroEthernetServiceUnit24TSPFswitch NDPChassisType = 111 NDPChassisNortelMetroEthernetServiceUnit24TLXDCswitch NDPChassisType = 112 NDPChassisPassport830010slotchassis NDPChassisType = 113 NDPChassisPassport83006slotchassis NDPChassisType = 114 NDPChassisEthernetRoutingSwitch552024TPWR NDPChassisType = 115 NDPChassisEthernetRoutingSwitch552048TPWR NDPChassisType = 116 NDPChassisNortelNetworksVPNGateway3050 NDPChassisType = 117 NDPChassisAlteonSSL31010100 NDPChassisType = 118 NDPChassisAlteonSSL31010100Fiber NDPChassisType = 119 NDPChassisAlteonSSL31010100FIPS NDPChassisType = 120 NDPChassisAlteonSSL410101001000 NDPChassisType = 121 NDPChassisAlteonSSL410101001000Fiber NDPChassisType = 122 NDPChassisAlteonApplicationSwitch2424SSL NDPChassisType = 123 NDPChassisEthernetSwitch32524T NDPChassisType = 124 NDPChassisEthernetSwitch32524G NDPChassisType = 125 NDPChassisNortelNetworksWirelessLANAccessPoint2225 NDPChassisType = 126 NDPChassisNortelNetworksWirelessLANSecuritySwitch2270 NDPChassisType = 127 NDPChassis24portEthernetSwitch47024TPWR NDPChassisType = 128 NDPChassis48portEthernetSwitch47048TPWR NDPChassisType = 129 NDPChassisEthernetRoutingSwitch553024TFD NDPChassisType = 130 NDPChassisEthernetSwitch351024T NDPChassisType = 131 NDPChassisNortelMetroEthernetServiceUnit12GACL3Switch NDPChassisType = 132 NDPChassisNortelMetroEthernetServiceUnit12GDCL3Switch NDPChassisType = 133 NDPChassisNortelSecureAccessSwitch NDPChassisType = 134 NDPChassisNortelNetworksVPNGateway3070 NDPChassisType = 135 NDPChassisOPTeraMetro3500 NDPChassisType = 136 NDPChassisSMBBES101024T NDPChassisType = 137 NDPChassisSMBBES101048T NDPChassisType = 138 NDPChassisSMBBES102024TPWR NDPChassisType = 139 NDPChassisSMBBES102048TPWR NDPChassisType = 140 NDPChassisSMBBES201024T NDPChassisType = 141 NDPChassisSMBBES201048T NDPChassisType = 142 NDPChassisSMBBES202024TPWR NDPChassisType = 143 NDPChassisSMBBES202048TPWR NDPChassisType = 144 NDPChassisSMBBES11024T NDPChassisType = 145 NDPChassisSMBBES11048T NDPChassisType = 146 NDPChassisSMBBES12024TPWR NDPChassisType = 147 NDPChassisSMBBES12048TPWR NDPChassisType = 148 NDPChassisSMBBES21024T NDPChassisType = 149 NDPChassisSMBBES21048T NDPChassisType = 150 NDPChassisSMBBES22024TPWR NDPChassisType = 151 NDPChassisSMBBES22048TPWR NDPChassisType = 152 NDPChassisOME6500 NDPChassisType = 153 NDPChassisEthernetRoutingSwitch4548GT NDPChassisType = 154 NDPChassisEthernetRoutingSwitch4548GTPWR NDPChassisType = 155 NDPChassisEthernetRoutingSwitch4550T NDPChassisType = 156 NDPChassisEthernetRoutingSwitch4550TPWR NDPChassisType = 157 NDPChassisEthernetRoutingSwitch4526FX NDPChassisType = 158 NDPChassisEthernetRoutingSwitch250026T NDPChassisType = 159 NDPChassisEthernetRoutingSwitch250026TPWR NDPChassisType = 160 NDPChassisEthernetRoutingSwitch250050T NDPChassisType = 161 NDPChassisEthernetRoutingSwitch250050TPWR NDPChassisType = 162 )
Nortel Chassis Types
func (NDPChassisType) String ¶
func (t NDPChassisType) String() (s string)
type NortelDiscovery ¶
type NortelDiscovery struct { BaseLayer IPAddress net.IP SegmentID []byte Chassis NDPChassisType Backplane NDPBackplaneType State NDPState NumLinks uint8 }
NortelDiscovery is a packet layer containing the Nortel Discovery Protocol.
func (*NortelDiscovery) LayerType ¶
func (c *NortelDiscovery) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeNortelDiscovery.
type PPP ¶
PPP is the layer for PPP encapsulation headers.
func (*PPP) SerializeTo ¶ added in v1.0.1
func (p *PPP) 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 PPPType ¶
type PPPType uint16
PPPType is an enumeration of PPP type values, and acts as a decoder for any type it supports.
type PPPoE ¶
type PPPoE struct { BaseLayer Version uint8 Type uint8 Code PPPoECode SessionId uint16 Length uint16 }
PPPoE is the layer for PPPoE encapsulation headers.
func (*PPPoE) SerializeTo ¶ added in v1.0.1
func (p *PPPoE) 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 PPPoECode ¶
type PPPoECode uint8
PPPoECode is the PPPoE code enum, taken from http://tools.ietf.org/html/rfc2516
type PortProtocolVLANID ¶
type ProtocolFamily ¶
type ProtocolFamily uint8
ProtocolFamily is the set of values defined as PF_* in sys/socket.h
const ( ProtocolFamilyIPv4 ProtocolFamily = C.PF_INET // BSDs use different values for INET6... glory be. These values taken from // tcpdump 4.3.0. ProtocolFamilyIPv6BSD ProtocolFamily = 24 ProtocolFamilyIPv6FreeBSD ProtocolFamily = 28 ProtocolFamilyIPv6Darwin ProtocolFamily = 30 ProtocolFamilyIPv6Linux ProtocolFamily = 10 )
func (ProtocolFamily) Decode ¶
func (a ProtocolFamily) Decode(data []byte, p gopacket.PacketBuilder) error
func (ProtocolFamily) String ¶
func (a ProtocolFamily) String() string
type ProtocolGuessingDecoder ¶
type ProtocolGuessingDecoder struct{}
ProtocolGuessingDecoder attempts to guess the protocol of the bytes it's given, then decode the packet accordingly. Its algorithm for guessing is:
If the packet starts with byte 0x45-0x4F: IPv4 If the packet starts with byte 0x60-0x6F: IPv6 Otherwise: Error
See draft-hsmit-isis-aal5mux-00.txt for more detail on this approach.
func (ProtocolGuessingDecoder) Decode ¶
func (ProtocolGuessingDecoder) Decode(data []byte, p gopacket.PacketBuilder) error
type ProtocolIdentity ¶
type ProtocolIdentity []byte
type RUDP ¶
type RUDP struct { BaseLayer SYN, ACK, EACK, RST, NUL bool Version uint8 HeaderLength uint8 SrcPort, DstPort RUDPPort DataLength uint16 Seq, Ack, Checksum uint32 VariableHeaderArea []byte // RUDPHeaderSyn contains SYN information for the RUDP packet, // if the SYN flag is set *RUDPHeaderSYN // RUDPHeaderEack contains EACK information for the RUDP packet, // if the EACK flag is set. *RUDPHeaderEACK }
func (*RUDP) TransportFlow ¶
type RUDPHeaderEACK ¶
type RUDPHeaderEACK struct {
SeqsReceivedOK []uint32
}
type RUDPHeaderSYN ¶
type RUDPHeaderSYN struct {
MaxOutstandingSegments, MaxSegmentSize, OptionFlags uint16
}
type SCTP ¶
type SCTP struct { BaseLayer SrcPort, DstPort SCTPPort VerificationTag uint32 Checksum uint32 // contains filtered or unexported fields }
SCTP contains information on the top level of an SCTP packet.
func (*SCTP) TransportFlow ¶
TransportFlow returns a flow based on the source and destination SCTP port.
type SCTPChunk ¶
type SCTPChunk struct { BaseLayer Type SCTPChunkType Flags uint8 Length uint16 // ActualLength is the total length of an SCTP chunk, including padding. // SCTP chunks start and end on 4-byte boundaries. So if a chunk has a length // of 18, it means that it has data up to and including byte 18, then padding // up to the next 4-byte boundary, 20. In this case, Length would be 18, and // ActualLength would be 20. ActualLength int }
SCTPChunk contains the common fields in all SCTP chunks.
type SCTPChunkType ¶
type SCTPChunkType uint8
SCTPChunkType is an enumeration of chunk types inside SCTP packets.
const ( SCTPChunkTypeData SCTPChunkType = 0 SCTPChunkTypeInit SCTPChunkType = 1 SCTPChunkTypeInitAck SCTPChunkType = 2 SCTPChunkTypeSack SCTPChunkType = 3 SCTPChunkTypeHeartbeat SCTPChunkType = 4 SCTPChunkTypeHeartbeatAck SCTPChunkType = 5 SCTPChunkTypeAbort SCTPChunkType = 6 SCTPChunkTypeShutdown SCTPChunkType = 7 SCTPChunkTypeShutdownAck SCTPChunkType = 8 SCTPChunkTypeError SCTPChunkType = 9 SCTPChunkTypeCookieEcho SCTPChunkType = 10 SCTPChunkTypeCookieAck SCTPChunkType = 11 SCTPChunkTypeShutdownComplete SCTPChunkType = 14 )
func (SCTPChunkType) Decode ¶
func (a SCTPChunkType) Decode(data []byte, p gopacket.PacketBuilder) error
func (SCTPChunkType) String ¶
func (a SCTPChunkType) String() string
type SCTPCookieEcho ¶
SCTPCookieEcho is the SCTP Cookie Echo layer.
func (*SCTPCookieEcho) LayerType ¶
func (sc *SCTPCookieEcho) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeSCTPCookieEcho.
type SCTPData ¶
type SCTPData struct { SCTPChunk Unordered, BeginFragment, EndFragment bool TSN uint32 StreamId uint16 StreamSequence uint16 PayloadProtocol uint32 PayloadData []byte }
SCTPData is the SCTP Data chunk layer.
type SCTPEmptyLayer ¶
type SCTPEmptyLayer struct {
SCTPChunk
}
This struct is used by all empty SCTP chunks (currently CookieAck and ShutdownComplete).
func (*SCTPEmptyLayer) LayerType ¶
func (sc *SCTPEmptyLayer) LayerType() gopacket.LayerType
LayerType returns either gopacket.LayerTypeSCTPShutdownComplete or LayerTypeSCTPCookieAck.
type SCTPError ¶
type SCTPError struct { SCTPChunk Parameters []SCTPErrorParameter }
SCTPError is the SCTP error layer, also used for SCTP aborts.
type SCTPErrorParameter ¶
type SCTPErrorParameter SCTPParameter
SCTPErrorParameter is the parameter type used by SCTP Abort and Error layers.
type SCTPHeartbeat ¶
type SCTPHeartbeat struct { SCTPChunk Parameters []SCTPHeartbeatParameter }
SCTPHeartbeat is the SCTP heartbeat layer, also used for heatbeat ack.
func (*SCTPHeartbeat) LayerType ¶
func (sc *SCTPHeartbeat) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeSCTPHeartbeat.
type SCTPHeartbeatParameter ¶
type SCTPHeartbeatParameter SCTPParameter
SCTPHeartbeatParameter is the parameter type used by SCTP heartbeat and heartbeat ack layers.
type SCTPInit ¶
type SCTPInit struct { SCTPChunk InitiateTag uint32 AdvertisedReceiverWindowCredit uint32 OutboundStreams, InboundStreams uint16 InitialTSN uint32 Parameters []SCTPInitParameter }
SCTPInit is used as the return value for both SCTPInit and SCTPInitAck messages.
type SCTPInitParameter ¶
type SCTPInitParameter SCTPParameter
SCTPInitParameter is a parameter for an SCTP Init or InitAck packet.
type SCTPParameter ¶
SCTPParameter is a TLV parameter inside a SCTPChunk.
type SCTPSack ¶
type SCTPSack struct { SCTPChunk CumulativeTSNAck uint32 AdvertisedReceiverWindowCredit uint32 NumGapACKs, NumDuplicateTSNs uint16 GapACKs []uint16 DuplicateTSNs []uint32 }
SCTPSack is the SCTP Selective ACK chunk layer.
type SCTPShutdown ¶
SCTPShutdown is the SCTP shutdown layer.
func (*SCTPShutdown) LayerType ¶
func (sc *SCTPShutdown) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeSCTPShutdown.
type SCTPShutdownAck ¶
type SCTPShutdownAck struct {
SCTPChunk
}
SCTPShutdownAck is the SCTP shutdown layer.
func (*SCTPShutdownAck) LayerType ¶
func (sc *SCTPShutdownAck) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeSCTPShutdownAck.
type SCTPUnknownChunkType ¶
type SCTPUnknownChunkType struct { SCTPChunk // contains filtered or unexported fields }
SCTPUnknownChunkType is the layer type returned when we don't recognize the chunk type. Since there's a length in a known location, we can skip over it even if we don't know what it is, and continue parsing the rest of the chunks. This chunk is stored as an ErrorLayer in the packet.
func (*SCTPUnknownChunkType) Error ¶
func (s *SCTPUnknownChunkType) Error() error
Error implements ErrorLayer.
func (*SCTPUnknownChunkType) LayerType ¶
func (s *SCTPUnknownChunkType) LayerType() gopacket.LayerType
LayerType returns gopacket.LayerTypeSCTPUnknownChunkType.
func (*SCTPUnknownChunkType) Payload ¶
func (s *SCTPUnknownChunkType) Payload() []byte
Payload returns all bytes in this header, including the decoded Type, Length, and Flags.
type SNAP ¶
type SNAP struct { BaseLayer OrganizationalCode []byte Type EthernetType }
SNAP is used inside LLC. See http://standards.ieee.org/getieee802/download/802-2001.pdf. From http://en.wikipedia.org/wiki/Subnetwork_Access_Protocol:
"[T]he Subnetwork Access Protocol (SNAP) is a mechanism for multiplexing, on networks using IEEE 802.2 LLC, more protocols than can be distinguished by the 8-bit 802.2 Service Access Point (SAP) fields."
type TCP ¶
type TCP struct { BaseLayer SrcPort, DstPort TCPPort Seq uint32 Ack uint32 DataOffset uint8 FIN, SYN, RST, PSH, ACK, URG, ECE, CWR, NS bool Window uint16 Checksum uint16 Urgent uint16 Options []TCPOption Padding []byte // contains filtered or unexported fields }
TCP is the layer for TCP headers.
func (*TCP) CanDecode ¶
func (t *TCP) CanDecode() gopacket.LayerClass
func (*TCP) DecodeFromBytes ¶
func (tcp *TCP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
func (*TCP) NextLayerType ¶
func (*TCP) SerializeTo ¶
func (t *TCP) 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.
func (*TCP) SetNetworkLayerForChecksum ¶
func (i *TCP) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error
SetNetworkLayerForChecksum tells this layer which network layer is wrapping it. This is needed for computing the checksum when serializing, since TCP/IP transport layer checksums depends on fields in the IPv4 or IPv6 layer that contains it. The passed in layer must be an *IPv4 or *IPv6.
func (*TCP) TransportFlow ¶
type UDP ¶
type UDP struct { BaseLayer SrcPort, DstPort UDPPort Length uint16 Checksum uint16 // contains filtered or unexported fields }
UDP is the layer for UDP headers.
func (*UDP) CanDecode ¶
func (u *UDP) CanDecode() gopacket.LayerClass
func (*UDP) DecodeFromBytes ¶
func (udp *UDP) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error
func (*UDP) NextLayerType ¶
func (*UDP) SerializeTo ¶
func (u *UDP) 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.
func (*UDP) SetNetworkLayerForChecksum ¶
func (i *UDP) SetNetworkLayerForChecksum(l gopacket.NetworkLayer) error
SetNetworkLayerForChecksum tells this layer which network layer is wrapping it. This is needed for computing the checksum when serializing, since TCP/IP transport layer checksums depends on fields in the IPv4 or IPv6 layer that contains it. The passed in layer must be an *IPv4 or *IPv6.
func (*UDP) TransportFlow ¶
type UDPLite ¶
type UDPLite struct { BaseLayer SrcPort, DstPort UDPLitePort ChecksumCoverage uint16 Checksum uint16 // contains filtered or unexported fields }
UDPLite is the layer for UDP-Lite headers (rfc 3828).
func (*UDPLite) TransportFlow ¶
type UDPLitePort ¶
type UDPLitePort uint16
UDPLitePort is a port in a UDPLite layer.
func (UDPLitePort) String ¶
func (a UDPLitePort) String() string
String returns the port as "number(name)" if there's a well-known port name, or just "number" if there isn't. Well-known names are stored in UDPLitePortNames.
Notes ¶
Bugs ¶
When decoding SNAP, we treat the SNAP type as an Ethernet type. This may not actually be an ethernet type in all cases, depending on the organizational code. Right now, we don't check.
Source Files ¶
- arp.go
- base.go
- bytediff.go
- cdp.go
- ctp.go
- doc.go
- dot1q.go
- eap.go
- eapol.go
- endpoints.go
- enums.go
- etherip.go
- ethernet.go
- fddi.go
- gre.go
- iana_ports.go
- icmp4.go
- icmp6.go
- igmp.go
- ip4.go
- ip6.go
- ipsec.go
- layertypes.go
- llc.go
- lldp.go
- loopback.go
- mpls.go
- ndp.go
- ports.go
- ppp.go
- pppoe.go
- rudp.go
- sctp.go
- socket_h.go
- tcp.go
- tcpip.go
- udp.go
- udplite.go