sflow

package
v0.0.0-...-7ed803a Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sflow decodes sFlow packets : ---------------------------------------------------------------------------- : Copyright (C) 2017 Verizon. All Rights Reserved. : All Rights Reserved : : file: decoder.go : details: TODO : author: Mehrdad Arshad Rad : date: 02/01/2017 : : Licensed under the Apache License, Version 2.0 (the "License"); : you may not use this file except in compliance with the License. : You may obtain a copy of the License at : : http://www.apache.org/licenses/LICENSE-2.0 : : Unless required by applicable law or agreed to in writing, software : distributed under the License is distributed on an "AS IS" BASIS, : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. : See the License for the specific language governing permissions and : limitations under the License. : ----------------------------------------------------------------------------

Package sflow decodes sFlow packets : ---------------------------------------------------------------------------- : Copyright (C) 2017 Verizon. All Rights Reserved. : All Rights Reserved : : file: flow_sample.go : details: TODO : author: Mehrdad Arshad Rad : date: 02/01/2017 : : Licensed under the Apache License, Version 2.0 (the "License"); : you may not use this file except in compliance with the License. : You may obtain a copy of the License at : : http://www.apache.org/licenses/LICENSE-2.0 : : Unless required by applicable law or agreed to in writing, software : distributed under the License is distributed on an "AS IS" BASIS, : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. : See the License for the specific language governing permissions and : limitations under the License. : ----------------------------------------------------------------------------

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

func (*SFDecoder) SFDecode

func (d *SFDecoder) SFDecode() ([]interface{}, error)

SFDecode decodes sFlow data

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL