Documentation ¶
Index ¶
- Constants
- func AFIName(afi uint16) string
- func BytesInAddr(pfxlen uint8) uint8
- func SerializeKeepaliveMsg() []byte
- func SerializeNotificationMsg(msg *BGPNotification) []byte
- func SerializeOpenMsg(msg *BGPOpen) []byte
- type ASN4Capability
- type AddPathCapability
- type AddPathCapabilityTuple
- type BGPError
- type BGPHeader
- type BGPMessage
- type BGPNotification
- type BGPOpen
- type BGPUpdate
- type Capabilities
- type Capability
- type DecodeOptions
- type EncodeOptions
- type MultiProtocolCapability
- type MultiProtocolReachNLRI
- type MultiProtocolUnreachNLRI
- type NLRI
- type OptParam
- type PathAttribute
- type Serializable
Constants ¶
const ( OctetLen = 8 MaxASNsSegment = 255 BGP4Version = 4 MinOpenLen = 29 MarkerLen = 16 HeaderLen = 19 MinLen = 19 MaxLen = 4096 MinUpdateLen = 4 NLRIMaxLen = 5 AFILen = 2 SAFILen = 1 CommunityLen = 4 LargeCommunityLen = 12 IPv4Len = 4 IPv6Len = 16 ClusterIDLen = 4 OpenMsg = 1 UpdateMsg = 2 NotificationMsg = 3 KeepaliveMsg = 4 MessageHeaderError = 1 OpenMessageError = 2 UpdateMessageError = 3 HoldTimeExpired = 4 FiniteStateMachineError = 5 Cease = 6 // Msg Header Errors ConnectionNotSync = 1 BadMessageLength = 2 BadMessageType = 3 // Open Msg Errors UnsupportedVersionNumber = 1 BadPeerAS = 2 BadBGPIdentifier = 3 UnsupportedOptionalParameter = 4 DeprecatedOpenMsgError5 = 5 UnacceptableHoldTime = 6 // Update Msg Errors MalformedAttributeList = 1 UnrecognizedWellKnownAttr = 2 MissingWellKnownAttr = 3 AttrFlagsError = 4 AttrLengthError = 5 InvalidOriginAttr = 6 DeprecatedUpdateMsgError7 = 7 InvalidNextHopAttr = 8 OptionalAttrError = 9 InvalidNetworkField = 10 MalformedASPath = 11 // Notification Msg Subcodes AdministrativeShutdown = 2 AdministrativeReset = 4 // Attribute Type Codes OriginAttr = 1 ASPathAttr = 2 NextHopAttr = 3 MEDAttr = 4 LocalPrefAttr = 5 AtomicAggrAttr = 6 AggregatorAttr = 7 CommunitiesAttr = 8 OriginatorIDAttr = 9 ClusterListAttr = 10 AS4PathAttr = 17 AS4AggregatorAttr = 18 LargeCommunitiesAttr = 32 // ORIGIN values IGP = 0 EGP = 1 INCOMPLETE = 2 // NOTIFICATION Cease error SubCodes (RFC4486) MaxPrefReached = 1 AdminShut = 2 PeerDeconfigured = 3 AdminReset = 4 ConnectionRejected = 5 OtherConfigChange = 6 ConnectionCollisionResolution = 7 OutOfResources = 8 IPv4AFI = 1 IPv6AFI = 2 UnicastSAFI = 1 CapabilitiesParamType = 2 MultiProtocolCapabilityCode = 1 MultiProtocolReachNLRICode = 14 MultiProtocolUnreachNLRICode = 15 AddPathCapabilityCode = 69 ASN4CapabilityCode = 65 AddPathReceive = 1 AddPathSend = 2 AddPathSendReceive = 3 ASTransASN = 23456 )
const (
PathIdentifierLen = 4
)
Variables ¶
This section is empty.
Functions ¶
func BytesInAddr ¶
BytesInAddr gets the amount of bytes needed to encode an NLRI of prefix length pfxlen
func SerializeKeepaliveMsg ¶
func SerializeKeepaliveMsg() []byte
func SerializeNotificationMsg ¶
func SerializeNotificationMsg(msg *BGPNotification) []byte
func SerializeOpenMsg ¶
Types ¶
type ASN4Capability ¶
type ASN4Capability struct {
ASN4 uint32
}
type AddPathCapability ¶
type AddPathCapability []AddPathCapabilityTuple
type AddPathCapabilityTuple ¶
type BGPMessage ¶
type BGPMessage struct { Header *BGPHeader Body interface{} }
func Decode ¶
func Decode(buf *bytes.Buffer, opt *DecodeOptions) (*BGPMessage, error)
Decode decodes a BGP message
type BGPNotification ¶
type BGPOpen ¶
type BGPUpdate ¶
type BGPUpdate struct { WithdrawnRoutesLen uint16 WithdrawnRoutes *NLRI TotalPathAttrLen uint16 PathAttributes *PathAttribute NLRI *NLRI }
func (*BGPUpdate) SerializeUpdate ¶
func (b *BGPUpdate) SerializeUpdate(opt *EncodeOptions) ([]byte, error)
SerializeUpdate serializes an BGPUpdate to wire format
func (*BGPUpdate) SerializeUpdateAddPath ¶
func (b *BGPUpdate) SerializeUpdateAddPath(opt *EncodeOptions) ([]byte, error)
type Capabilities ¶
type Capabilities []Capability
type Capability ¶
type Capability struct { Code uint8 Length uint8 Value Serializable }
type DecodeOptions ¶
DecodeOptions represents options for the BGP message decoder
type EncodeOptions ¶
type MultiProtocolCapability ¶
type MultiProtocolReachNLRI ¶
MultiProtocolReachNLRI represents network layer reachability information for an IP address family (rfc4760)
type MultiProtocolUnreachNLRI ¶
MultiProtocolUnreachNLRI represents network layer withdraw information for one prefix of an IP address family (rfc4760)
type OptParam ¶
type OptParam struct { Type uint8 Length uint8 Value Serializable }
type PathAttribute ¶
type PathAttribute struct { Length uint16 Optional bool Transitive bool Partial bool ExtendedLength bool TypeCode uint8 Value interface{} Next *PathAttribute }
func PathAttributes ¶
PathAttributes converts a path object into a linked list of path attributes
func (*PathAttribute) AddOptionalPathAttributes ¶
func (pa *PathAttribute) AddOptionalPathAttributes(p *route.Path) *PathAttribute
AddOptionalPathAttributes adds optional path attributes to linked list pa
func (*PathAttribute) Copy ¶
func (pa *PathAttribute) Copy() *PathAttribute
Copy create a copy of a path attribute
func (*PathAttribute) Serialize ¶
func (pa *PathAttribute) Serialize(buf *bytes.Buffer, opt *EncodeOptions) uint16
Serialize serializes a path attribute
type Serializable ¶
type Serializable interface {
// contains filtered or unexported methods
}