packet

package
v0.0.3-pre4.0...-0ec3cfc Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinLen is the minimal length of a BMP message
	MinLen = 6

	RouteMonitoringType       = 0
	StatisticsReportType      = 1
	PeerDownNotificationType  = 2
	PeerUpNotificationType    = 3
	InitiationMessageType     = 4
	TerminationMessageType    = 5
	RouteMirroringMessageType = 6

	BGPMessage     = 0
	BGPInformation = 1

	ErroredPDU  = 0
	MessageLost = 1

	// BMPVersion is the supported BMP version
	BMPVersion = 3
)
View Source
const (
	// CommonHeaderLen is the length of a common header
	CommonHeaderLen = 6
)
View Source
const (
	MinInformationTLVLen = 4
)
View Source
const (
	// OpenMsgMinLen is the minimal length of a BGP open message
	OpenMsgMinLen = 29
)
View Source
const (
	// PerPeerHeaderLen is the length of a per peer header
	PerPeerHeaderLen = 42
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonHeader

type CommonHeader struct {
	Version   uint8
	MsgLength uint32
	MsgType   uint8
}

CommonHeader represents a common header

func (*CommonHeader) Serialize

func (c *CommonHeader) Serialize(buf *bytes.Buffer)

Serialize serializes a common header

type InformationTLV

type InformationTLV struct {
	InformationType   uint16
	InformationLength uint16
	Information       []byte
}

InformationTLV represents an information TLV

type InitiationMessage

type InitiationMessage struct {
	CommonHeader *CommonHeader
	TLVs         []*InformationTLV
}

InitiationMessage represents an initiation message

func (*InitiationMessage) MsgType

func (im *InitiationMessage) MsgType() uint8

MsgType returns the type of this message

type Msg

type Msg interface {
	MsgType() uint8
}

Msg is an interface that every BMP message must fulfill

func Decode

func Decode(msg []byte) (Msg, error)

Decode decodes a BMP message

type PeerDownNotification

type PeerDownNotification struct {
	CommonHeader  *CommonHeader
	PerPeerHeader *PerPeerHeader
	Reason        uint8
	Data          []byte
}

PeerDownNotification represents a peer down notification

func (*PeerDownNotification) MsgType

func (p *PeerDownNotification) MsgType() uint8

MsgType returns the type of this message

type PeerUpNotification

type PeerUpNotification struct {
	CommonHeader    *CommonHeader
	PerPeerHeader   *PerPeerHeader
	LocalAddress    [16]byte
	LocalPort       uint16
	RemotePort      uint16
	SentOpenMsg     []byte
	ReceivedOpenMsg []byte
	Information     []byte
}

PeerUpNotification represents a peer up notification

func (*PeerUpNotification) MsgType

func (p *PeerUpNotification) MsgType() uint8

MsgType returns the type of this message

type PerPeerHeader

type PerPeerHeader struct {
	PeerType              uint8
	PeerFlags             uint8
	PeerDistinguisher     uint64
	PeerAddress           [16]byte
	PeerAS                uint32
	PeerBGPID             uint32
	Timestamp             uint32
	TimestampMicroSeconds uint32
}

PerPeerHeader represents a BMP per peer header

func (*PerPeerHeader) GetAFlag

func (p *PerPeerHeader) GetAFlag() bool

GetAFlag checks if the A flag is set

func (*PerPeerHeader) GetIPVersion

func (p *PerPeerHeader) GetIPVersion() uint8

GetIPVersion gets the IP version of the BGP session

func (*PerPeerHeader) Serialize

func (p *PerPeerHeader) Serialize(buf *bytes.Buffer)

Serialize serializes a per peer header

type RouteMirroringMsg

type RouteMirroringMsg struct {
	CommonHeader  *CommonHeader
	PerPeerHeader *PerPeerHeader
	TLVs          []*InformationTLV
}

RouteMirroringMsg represents a route mirroring message

func (*RouteMirroringMsg) MsgType

func (rm *RouteMirroringMsg) MsgType() uint8

MsgType returns the type of this message

type RouteMonitoringMsg

type RouteMonitoringMsg struct {
	CommonHeader  *CommonHeader
	PerPeerHeader *PerPeerHeader
	BGPUpdate     []byte
}

RouteMonitoringMsg represents a Route Monitoring Message

func (*RouteMonitoringMsg) MsgType

func (rm *RouteMonitoringMsg) MsgType() uint8

MsgType returns the type of this message

type StatsReport

type StatsReport struct {
	CommonHeader  *CommonHeader
	PerPeerHeader *PerPeerHeader
	StatsCount    uint32
	Stats         []*InformationTLV
}

StatsReport represents a stats report message

func (*StatsReport) MsgType

func (s *StatsReport) MsgType() uint8

MsgType returns the type of this message

type TerminationMessage

type TerminationMessage struct {
	CommonHeader *CommonHeader
	TLVs         []*InformationTLV
}

TerminationMessage represents a termination message

func (*TerminationMessage) MsgType

func (t *TerminationMessage) MsgType() uint8

MsgType returns the type of this message

Jump to

Keyboard shortcuts

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