bmp

package
v0.0.0-...-f4239b7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BMP_VERSION          = 3
	BMP_HEADER_SIZE      = 6
	BMP_PEER_HEADER_SIZE = 42
)
View Source
const (
	BMP_PEER_TYPE_GLOBAL uint8 = iota
	BMP_PEER_TYPE_L3VPN
)
View Source
const (
	BMP_STAT_TYPE_REJECTED = iota
	BMP_STAT_TYPE_DUPLICATE_PREFIX
	BMP_STAT_TYPE_DUPLICATE_WITHDRAW
	BMP_STAT_TYPE_INV_UPDATE_DUE_TO_CLUSTER_LIST_LOOP
	BMP_STAT_TYPE_INV_UPDATE_DUE_TO_AS_PATH_LOOP
	BMP_STAT_TYPE_INV_UPDATE_DUE_TO_ORIGINATOR_ID
	BMP_STAT_TYPE_INV_UPDATE_DUE_TO_AS_CONFED_LOOP
	BMP_STAT_TYPE_ADJ_RIB_IN
	BMP_STAT_TYPE_LOC_RIB
)
View Source
const (
	BMP_PEER_DOWN_REASON_UNKNOWN = iota
	BMP_PEER_DOWN_REASON_LOCAL_BGP_NOTIFICATION
	BMP_PEER_DOWN_REASON_LOCAL_NO_NOTIFICATION
	BMP_PEER_DOWN_REASON_REMOTE_BGP_NOTIFICATION
	BMP_PEER_DOWN_REASON_REMOTE_NO_NOTIFICATION
)
View Source
const (
	BMP_MSG_ROUTE_MONITORING = iota
	BMP_MSG_STATISTICS_REPORT
	BMP_MSG_PEER_DOWN_NOTIFICATION
	BMP_MSG_PEER_UP_NOTIFICATION
	BMP_MSG_INITIATION
	BMP_MSG_TERMINATION
)
View Source
const (
	BMP_DEFAULT_PORT = 11019
)

Variables

This section is empty.

Functions

func SplitBMP

func SplitBMP(data []byte, atEOF bool) (advance int, token []byte, err error)

Types

type BMPBody

type BMPBody interface {
	// Sigh, some body messages need a BMPHeader to parse the body
	// data so we need to pass BMPHeader (avoid DecodeFromBytes
	// function name).
	ParseBody(*BMPMessage, []byte) error
	Serialize() ([]byte, error)
}

type BMPHeader

type BMPHeader struct {
	Version uint8
	Length  uint32
	Type    uint8
}

func (*BMPHeader) DecodeFromBytes

func (h *BMPHeader) DecodeFromBytes(data []byte) error

func (*BMPHeader) Serialize

func (h *BMPHeader) Serialize() ([]byte, error)

type BMPInitiation

type BMPInitiation struct {
	Info []BMPTLV
}

func (*BMPInitiation) ParseBody

func (body *BMPInitiation) ParseBody(msg *BMPMessage, data []byte) error

func (*BMPInitiation) Serialize

func (body *BMPInitiation) Serialize() ([]byte, error)

type BMPMessage

type BMPMessage struct {
	Header     BMPHeader
	PeerHeader BMPPeerHeader
	Body       BMPBody
}

func NewBMPInitiation

func NewBMPInitiation(info []BMPTLV) *BMPMessage

func NewBMPPeerDownNotification

func NewBMPPeerDownNotification(p BMPPeerHeader, reason uint8, notification *bgp.BGPMessage, data []byte) *BMPMessage

func NewBMPPeerUpNotification

func NewBMPPeerUpNotification(p BMPPeerHeader, lAddr string, lPort, rPort uint16, sent, recv *bgp.BGPMessage) *BMPMessage

func NewBMPRouteMonitoring

func NewBMPRouteMonitoring(p BMPPeerHeader, update *bgp.BGPMessage) *BMPMessage

func NewBMPTermination

func NewBMPTermination(info []BMPTLV) *BMPMessage

func ParseBMPMessage

func ParseBMPMessage(data []byte) (*BMPMessage, error)

func (*BMPMessage) Len

func (msg *BMPMessage) Len() int

func (*BMPMessage) Serialize

func (msg *BMPMessage) Serialize() ([]byte, error)

type BMPPeerDownNotification

type BMPPeerDownNotification struct {
	Reason          uint8
	BGPNotification *bgp.BGPMessage
	Data            []byte
}

func (*BMPPeerDownNotification) ParseBody

func (body *BMPPeerDownNotification) ParseBody(msg *BMPMessage, data []byte) error

func (*BMPPeerDownNotification) Serialize

func (body *BMPPeerDownNotification) Serialize() ([]byte, error)

type BMPPeerHeader

type BMPPeerHeader struct {
	PeerType          uint8
	IsPostPolicy      bool
	PeerDistinguisher uint64
	PeerAddress       net.IP
	PeerAS            uint32
	PeerBGPID         net.IP
	Timestamp         float64
	Flags             uint8
}

func NewBMPPeerHeader

func NewBMPPeerHeader(t uint8, policy bool, dist uint64, address string, as uint32, id string, stamp float64) *BMPPeerHeader

func (*BMPPeerHeader) DecodeFromBytes

func (h *BMPPeerHeader) DecodeFromBytes(data []byte) error

func (*BMPPeerHeader) Serialize

func (h *BMPPeerHeader) Serialize() ([]byte, error)

type BMPPeerUpNotification

type BMPPeerUpNotification struct {
	LocalAddress    net.IP
	LocalPort       uint16
	RemotePort      uint16
	SentOpenMsg     *bgp.BGPMessage
	ReceivedOpenMsg *bgp.BGPMessage
}

func (*BMPPeerUpNotification) ParseBody

func (body *BMPPeerUpNotification) ParseBody(msg *BMPMessage, data []byte) error

func (*BMPPeerUpNotification) Serialize

func (body *BMPPeerUpNotification) Serialize() ([]byte, error)

type BMPRouteMonitoring

type BMPRouteMonitoring struct {
	BGPUpdate        *bgp.BGPMessage
	BGPUpdatePayload []byte
}

func (*BMPRouteMonitoring) ParseBody

func (body *BMPRouteMonitoring) ParseBody(msg *BMPMessage, data []byte) error

func (*BMPRouteMonitoring) Serialize

func (body *BMPRouteMonitoring) Serialize() ([]byte, error)

type BMPStatisticsReport

type BMPStatisticsReport struct {
	Count uint32
	Stats []BMPStatsTLV
}

func (*BMPStatisticsReport) ParseBody

func (body *BMPStatisticsReport) ParseBody(msg *BMPMessage, data []byte) error

func (*BMPStatisticsReport) Serialize

func (body *BMPStatisticsReport) Serialize() ([]byte, error)

type BMPStatsTLV

type BMPStatsTLV struct {
	Type   uint16
	Length uint16
	Value  uint64
}

type BMPTLV

type BMPTLV struct {
	Type   uint16
	Length uint16
	Value  []byte
}

func NewBMPTLV

func NewBMPTLV(t uint16, v []byte) *BMPTLV

func (*BMPTLV) DecodeFromBytes

func (tlv *BMPTLV) DecodeFromBytes(data []byte) error

func (*BMPTLV) Len

func (tlv *BMPTLV) Len() int

func (*BMPTLV) Serialize

func (tlv *BMPTLV) Serialize() ([]byte, error)

type BMPTermination

type BMPTermination struct {
	Info []BMPTLV
}

func (*BMPTermination) ParseBody

func (body *BMPTermination) ParseBody(msg *BMPMessage, data []byte) error

func (*BMPTermination) Serialize

func (body *BMPTermination) Serialize() ([]byte, error)

Jump to

Keyboard shortcuts

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