Documentation
¶
Overview ¶
Package sflow decodes sFlow packets
Index ¶
Constants ¶
View Source
const ( // DataFlowSample defines packet flow sampling DataFlowSample = 1 // DataCounterSample defines counter sampling DataCounterSample = 2 )
View Source
const ( // SFDataRawHeader is sFlow Raw Packet Header number SFDataRawHeader = 1 // SFDataExtSwitch is sFlow Extended Switch Data number SFDataExtSwitch = 1001 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtSwitchData ¶
type ExtSwitchData struct {
SrcVlan uint32 // The 802.1Q VLAN id of incoming frame
SrcPriority uint32 // The 802.1p priority of incoming frame
DstVlan uint32 // The 802.1Q VLAN id of outgoing frame
DstPriority uint32 // The 802.1p priority of outgoing frame
}
ExtSwitchData represents Extended Switch Data
type FlowSample ¶
type FlowSample struct {
SequenceNo uint32 // Incremented with each flow sample
SourceID byte // sfSourceID
SamplingRate uint32 // sfPacketSamplingRate
SamplePool uint32 // Total number of packets that could have been sampled
Drops uint32 // Number of times a packet was dropped due to lack of resources
Input uint32 // SNMP ifIndex of input interface
Output uint32 // SNMP ifIndex of input interface
RecordsNo uint32 // Number of records to follow
}
FlowSample represents single flow sample
type Message ¶
type Message struct {
Header *SFDatagram
ExtSWData *ExtSwitchData
Sample *FlowSample
Packet *packet.Packet
}
Message represents flow sample decoded packet
type SFDatagram ¶
type SFDatagram struct {
Version uint32 // Datagram version
IPVersion uint32 // Data gram sFlow version
AgentSubID uint32 // Identifies a source of sFlow data
SequenceNo uint32 // Sequence of sFlow Datagrams
SysUpTime uint32 // Current time (in milliseconds since device last booted
SamplesNo uint32 // Number of samples
IPAddress net.IP // Agent IP address
}
SFDatagram represents sFlow datagram
type SFDecoder ¶
type SFDecoder struct {
// contains filtered or unexported fields
}
SFDecoder represents sFlow decoder
func NewSFDecoder ¶
func NewSFDecoder(r io.ReadSeeker, f []uint32) SFDecoder
NewSFDecoder constructs new sflow decoder
type SFSampledHeader ¶
type SFSampledHeader struct {
HeaderProtocol uint32 // (enum SFHeaderProtocol)
FrameLength uint32 // Original length of packet before sampling
Stripped uint32 // Header/trailer bytes stripped by sender
HeaderLength uint32 // Length of sampled header bytes to follow
HeaderBytes []byte // Header bytes
}
SFSampledHeader represents sFlow sample header
type SampledHeader ¶
type SampledHeader struct {
Protocol uint32 // (enum SFLHeader_protocol)
FrameLength uint32 // Original length of packet before sampling
Stripped uint32 // Header/trailer bytes stripped by sender
HeaderLength uint32 // Length of sampled header bytes to follow
Header []byte // Header bytes
}
SampledHeader represents sampled header
Click to show internal directories.
Click to hide internal directories.