bmp

package
v3.31.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 5

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
	BMP_PEER_TYPE_LOCAL
	BMP_PEER_TYPE_LOCAL_RIB
)
View Source
const (
	BMP_PEER_FLAG_IPV6        = 1 << 7
	BMP_PEER_FLAG_POST_POLICY = 1 << 6
	BMP_PEER_FLAG_TWO_AS      = 1 << 5
	BMP_PEER_FLAG_ADJ_RIB_TYP = 1 << 4
)
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
	BMP_STAT_TYPE_PER_AFI_SAFI_ADJ_RIB_IN
	BMP_STAT_TYPE_PER_AFI_SAFI_LOC_RIB
	BMP_STAT_TYPE_WITHDRAW_UPDATE
	BMP_STAT_TYPE_WITHDRAW_PREFIX
	BMP_STAT_TYPE_DUPLICATE_UPDATE
	BMP_STAT_TYPE_ADJ_RIB_OUT_PRE_POLICY
	BMP_STAT_TYPE_ADJ_RIB_OUT_POST_POLICY
	BMP_STAT_TYPE_PER_AFI_SAFI_ADJ_RIB_OUT_PRE_POLICY
	BMP_STAT_TYPE_PER_AFI_SAFI_ADJ_RIB_OUT_POST_POLICY
)
View Source
const (
	BMP_peerDownByUnknownReason = 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
	BMP_PEER_DOWN_REASON_PEER_DE_CONFIGURED
)
View Source
const (
	BMP_INIT_TLV_TYPE_STRING = iota
	BMP_INIT_TLV_TYPE_SYS_DESCR
	BMP_INIT_TLV_TYPE_SYS_NAME
)
View Source
const (
	BMP_TERM_TLV_TYPE_STRING = iota
	BMP_TERM_TLV_TYPE_REASON
)
View Source
const (
	BMP_TERM_REASON_ADMIN = iota
	BMP_TERM_REASON_UNSPEC
	BMP_TERM_REASON_OUT_OF_RESOURCES
	BMP_TERM_REASON_REDUNDANT_CONNECTION
	BMP_TERM_REASON_PERMANENTLY_ADMIN
)
View Source
const (
	BMP_ROUTE_MIRRORING_TLV_TYPE_BGP_MSG = iota
	BMP_ROUTE_MIRRORING_TLV_TYPE_INFO
)
View Source
const (
	BMP_ROUTE_MIRRORING_INFO_ERR_PDU = iota
	BMP_ROUTE_MIRRORING_INFO_MSG_LOST
)
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
	BMP_MSG_ROUTE_MIRRORING
)
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, ...*bgp.MarshallingOption) error
	Serialize(...*bgp.MarshallingOption) ([]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 BMPInfoTLV

type BMPInfoTLV struct {
	Type   uint16
	Length uint16
}

type BMPInfoTLVInterface

type BMPInfoTLVInterface interface {
	ParseValue([]byte) error
	Serialize() ([]byte, error)
}

type BMPInfoTLVString

type BMPInfoTLVString struct {
	BMPInfoTLV
	Value string
}

func NewBMPInfoTLVString

func NewBMPInfoTLVString(t uint16, v string) *BMPInfoTLVString

func (*BMPInfoTLVString) ParseValue

func (s *BMPInfoTLVString) ParseValue(data []byte) error

func (*BMPInfoTLVString) Serialize

func (s *BMPInfoTLVString) Serialize() ([]byte, error)

type BMPInfoTLVUnknown

type BMPInfoTLVUnknown struct {
	BMPInfoTLV
	Value []byte
}

func NewBMPInfoTLVUnknown

func NewBMPInfoTLVUnknown(t uint16, v []byte) *BMPInfoTLVUnknown

func (*BMPInfoTLVUnknown) ParseValue

func (s *BMPInfoTLVUnknown) ParseValue(data []byte) error

func (*BMPInfoTLVUnknown) Serialize

func (s *BMPInfoTLVUnknown) Serialize() ([]byte, error)

type BMPInitiation

type BMPInitiation struct {
	Info []BMPInfoTLVInterface
}

func (*BMPInitiation) ParseBody

func (body *BMPInitiation) ParseBody(msg *BMPMessage, data []byte, options ...*bgp.MarshallingOption) error

func (*BMPInitiation) Serialize

func (body *BMPInitiation) Serialize(options ...*bgp.MarshallingOption) ([]byte, error)

type BMPMessage

type BMPMessage struct {
	Header     BMPHeader
	PeerHeader BMPPeerHeader
	Body       BMPBody
}

func NewBMPInitiation

func NewBMPInitiation(info []BMPInfoTLVInterface) *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 NewBMPRouteMirroring

func NewBMPRouteMirroring(p BMPPeerHeader, info []BMPRouteMirrTLVInterface) *BMPMessage

func NewBMPRouteMonitoring

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

func NewBMPStatisticsReport

func NewBMPStatisticsReport(p BMPPeerHeader, stats []BMPStatsTLVInterface) *BMPMessage

func NewBMPTermination

func NewBMPTermination(info []BMPTermTLVInterface) *BMPMessage

func ParseBMPMessage

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

func ParseBMPMessageWithOptions added in v3.6.0

func ParseBMPMessageWithOptions(data []byte, options func(BMPPeerHeader) []*bgp.MarshallingOption) (msg *BMPMessage, err error)

func (*BMPMessage) Len

func (msg *BMPMessage) Len() int

func (*BMPMessage) Serialize

func (msg *BMPMessage) Serialize(options ...*bgp.MarshallingOption) ([]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, options ...*bgp.MarshallingOption) error

func (*BMPPeerDownNotification) Serialize

func (body *BMPPeerDownNotification) Serialize(options ...*bgp.MarshallingOption) ([]byte, error)

type BMPPeerHeader

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

func NewBMPPeerHeader

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

func (*BMPPeerHeader) DecodeFromBytes

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

func (*BMPPeerHeader) IsAdjRIBOut added in v3.3.0

func (h *BMPPeerHeader) IsAdjRIBOut() bool

func (*BMPPeerHeader) IsPostPolicy

func (h *BMPPeerHeader) IsPostPolicy() bool

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, options ...*bgp.MarshallingOption) error

func (*BMPPeerUpNotification) Serialize

func (body *BMPPeerUpNotification) Serialize(options ...*bgp.MarshallingOption) ([]byte, error)

type BMPRouteMirrTLV

type BMPRouteMirrTLV struct {
	Type   uint16
	Length uint16
}

type BMPRouteMirrTLV16

type BMPRouteMirrTLV16 struct {
	BMPRouteMirrTLV
	Value uint16
}

func NewBMPRouteMirrTLV16

func NewBMPRouteMirrTLV16(t uint16, v uint16) *BMPRouteMirrTLV16

func (*BMPRouteMirrTLV16) ParseValue

func (s *BMPRouteMirrTLV16) ParseValue(data []byte) error

func (*BMPRouteMirrTLV16) Serialize

func (s *BMPRouteMirrTLV16) Serialize() ([]byte, error)

type BMPRouteMirrTLVBGPMsg

type BMPRouteMirrTLVBGPMsg struct {
	BMPRouteMirrTLV
	Value *bgp.BGPMessage
}

func NewBMPRouteMirrTLVBGPMsg

func NewBMPRouteMirrTLVBGPMsg(t uint16, v *bgp.BGPMessage) *BMPRouteMirrTLVBGPMsg

func (*BMPRouteMirrTLVBGPMsg) ParseValue

func (s *BMPRouteMirrTLVBGPMsg) ParseValue(data []byte) error

func (*BMPRouteMirrTLVBGPMsg) Serialize

func (s *BMPRouteMirrTLVBGPMsg) Serialize() ([]byte, error)

type BMPRouteMirrTLVInterface

type BMPRouteMirrTLVInterface interface {
	ParseValue([]byte) error
	Serialize() ([]byte, error)
}

type BMPRouteMirrTLVUnknown

type BMPRouteMirrTLVUnknown struct {
	BMPRouteMirrTLV
	Value []byte
}

func NewBMPRouteMirrTLVUnknown

func NewBMPRouteMirrTLVUnknown(t uint16, v []byte) *BMPRouteMirrTLVUnknown

func (*BMPRouteMirrTLVUnknown) ParseValue

func (s *BMPRouteMirrTLVUnknown) ParseValue(data []byte) error

func (*BMPRouteMirrTLVUnknown) Serialize

func (s *BMPRouteMirrTLVUnknown) Serialize() ([]byte, error)

type BMPRouteMirroring

type BMPRouteMirroring struct {
	Info []BMPRouteMirrTLVInterface
}

func (*BMPRouteMirroring) ParseBody

func (body *BMPRouteMirroring) ParseBody(msg *BMPMessage, data []byte, options ...*bgp.MarshallingOption) error

func (*BMPRouteMirroring) Serialize

func (body *BMPRouteMirroring) Serialize(options ...*bgp.MarshallingOption) ([]byte, error)

type BMPRouteMonitoring

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

func (*BMPRouteMonitoring) ParseBody

func (body *BMPRouteMonitoring) ParseBody(msg *BMPMessage, data []byte, options ...*bgp.MarshallingOption) error

func (*BMPRouteMonitoring) Serialize

func (body *BMPRouteMonitoring) Serialize(options ...*bgp.MarshallingOption) ([]byte, error)

type BMPStatisticsReport

type BMPStatisticsReport struct {
	Count uint32
	Stats []BMPStatsTLVInterface
}

func (*BMPStatisticsReport) ParseBody

func (body *BMPStatisticsReport) ParseBody(msg *BMPMessage, data []byte, options ...*bgp.MarshallingOption) error

func (*BMPStatisticsReport) Serialize

func (body *BMPStatisticsReport) Serialize(options ...*bgp.MarshallingOption) ([]byte, error)

type BMPStatsTLV

type BMPStatsTLV struct {
	Type   uint16
	Length uint16
}

type BMPStatsTLV32

type BMPStatsTLV32 struct {
	BMPStatsTLV
	Value uint32
}

func NewBMPStatsTLV32

func NewBMPStatsTLV32(t uint16, v uint32) *BMPStatsTLV32

func (*BMPStatsTLV32) ParseValue

func (s *BMPStatsTLV32) ParseValue(data []byte) error

func (*BMPStatsTLV32) Serialize

func (s *BMPStatsTLV32) Serialize() ([]byte, error)

type BMPStatsTLV64

type BMPStatsTLV64 struct {
	BMPStatsTLV
	Value uint64
}

func NewBMPStatsTLV64

func NewBMPStatsTLV64(t uint16, v uint64) *BMPStatsTLV64

func (*BMPStatsTLV64) ParseValue

func (s *BMPStatsTLV64) ParseValue(data []byte) error

func (*BMPStatsTLV64) Serialize

func (s *BMPStatsTLV64) Serialize() ([]byte, error)

type BMPStatsTLVInterface

type BMPStatsTLVInterface interface {
	ParseValue([]byte) error
	Serialize() ([]byte, error)
}

type BMPStatsTLVPerAfiSafi64

type BMPStatsTLVPerAfiSafi64 struct {
	BMPStatsTLV
	AFI   uint16
	SAFI  uint8
	Value uint64
}

func NewBMPStatsTLVPerAfiSafi64

func NewBMPStatsTLVPerAfiSafi64(t uint16, afi uint16, safi uint8, v uint64) *BMPStatsTLVPerAfiSafi64

func (*BMPStatsTLVPerAfiSafi64) ParseValue

func (s *BMPStatsTLVPerAfiSafi64) ParseValue(data []byte) error

func (*BMPStatsTLVPerAfiSafi64) Serialize

func (s *BMPStatsTLVPerAfiSafi64) Serialize() ([]byte, error)

type BMPTermTLV

type BMPTermTLV struct {
	Type   uint16
	Length uint16
}

type BMPTermTLV16

type BMPTermTLV16 struct {
	BMPTermTLV
	Value uint16
}

func NewBMPTermTLV16

func NewBMPTermTLV16(t uint16, v uint16) *BMPTermTLV16

func (*BMPTermTLV16) ParseValue

func (s *BMPTermTLV16) ParseValue(data []byte) error

func (*BMPTermTLV16) Serialize

func (s *BMPTermTLV16) Serialize() ([]byte, error)

type BMPTermTLVInterface

type BMPTermTLVInterface interface {
	ParseValue([]byte) error
	Serialize() ([]byte, error)
}

type BMPTermTLVString

type BMPTermTLVString struct {
	BMPTermTLV
	Value string
}

func NewBMPTermTLVString

func NewBMPTermTLVString(t uint16, v string) *BMPTermTLVString

func (*BMPTermTLVString) ParseValue

func (s *BMPTermTLVString) ParseValue(data []byte) error

func (*BMPTermTLVString) Serialize

func (s *BMPTermTLVString) Serialize() ([]byte, error)

type BMPTermTLVUnknown

type BMPTermTLVUnknown struct {
	BMPTermTLV
	Value []byte
}

func NewBMPTermTLVUnknown

func NewBMPTermTLVUnknown(t uint16, v []byte) *BMPTermTLVUnknown

func (*BMPTermTLVUnknown) ParseValue

func (s *BMPTermTLVUnknown) ParseValue(data []byte) error

func (*BMPTermTLVUnknown) Serialize

func (s *BMPTermTLVUnknown) Serialize() ([]byte, error)

type BMPTermination

type BMPTermination struct {
	Info []BMPTermTLVInterface
}

func (*BMPTermination) ParseBody

func (body *BMPTermination) ParseBody(msg *BMPMessage, data []byte, options ...*bgp.MarshallingOption) error

func (*BMPTermination) Serialize

func (body *BMPTermination) Serialize(options ...*bgp.MarshallingOption) ([]byte, error)

Jump to

Keyboard shortcuts

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