Documentation ¶
Index ¶
- Constants
- func OSPFv3Checksum(data []byte, src, dst net.IP) uint16
- type ASExternalLSA
- type AreaLinkDescription
- type AreaLinkDescriptionType
- type DBFlags
- type DatabaseDescription
- type FloodingScope
- type Hello
- type ID
- type InterAreaPrefixLSA
- type InterAreaRouterLSA
- type IntraAreaPrefixLSA
- type LSA
- type LSAPrefix
- type LSAType
- type LinkLSA
- type LinkStateAcknowledgement
- type LinkStateRequest
- type LinkStateRequestMsg
- type LinkStateUpdate
- type NetworkLSA
- type OSPFMessageType
- type OSPFv3Message
- type PrefixOptions
- type RouterLSA
- type RouterLSAFlags
- type RouterOptions
- type Serializable
- type UnknownLSA
Constants ¶
View Source
const ( RouterOptV6 uint16 = 1 << iota RouterOptE RouterOptN RouterOptR RouterOptDC RouterOptAF )
bitmasks for flags in RouterOptions
View Source
const ( LSATypeUnknown LSAType = 0 LSATypeRouter = 0x2001 LSATypeNetwork = 0x2002 LSATypeInterAreaPrefix = 0x2003 LSATypeInterAreaRouter = 0x2004 LSATypeASExternal = 0x4005 LSATypeDeprecated = 0x2006 LSATypeNSSA = 0x2007 LSATypeLink = 0x0008 LSATypeIntraAreaPrefix = 0x2009 )
OSPF LSA types
View Source
const ( ASExtLSAFlagT uint8 = 1 << iota ASExtLSAFlagF ASExtLSAFlagE )
Bitmasks for flags used in ASExternalLSA
View Source
const ( NUBIT = 1 LABIT = 2 PBIT = 8 DNBIT = 16 )
Prefix Option Bits
View Source
const LSAHeaderLength = 20
View Source
const OSPFProtocolNumber = 89
View Source
const OSPFv3MessageChecksumAtByte = 12
View Source
const OSPFv3MessageHeaderLength = 16
View Source
const OSPFv3MessagePacketLengthAtByte = 2
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ASExternalLSA ¶
type ASExternalLSA struct { Flags uint8 Metric uint32 // max: 24 bit Prefix LSAPrefix ForwardingAddress net.IP // optional ExternalRouteTag uint32 // optional ReferencedLinkStateID ID // optional }
func DeserializeASExternalLSA ¶
func DeserializeASExternalLSA(buf *bytes.Buffer) (*ASExternalLSA, int, error)
func (*ASExternalLSA) FlagE ¶
func (a *ASExternalLSA) FlagE() bool
func (*ASExternalLSA) FlagF ¶
func (a *ASExternalLSA) FlagF() bool
func (*ASExternalLSA) FlagT ¶
func (a *ASExternalLSA) FlagT() bool
func (*ASExternalLSA) Serialize ¶
func (x *ASExternalLSA) Serialize(buf *bytes.Buffer)
type AreaLinkDescription ¶
type AreaLinkDescription struct { Type AreaLinkDescriptionType Metric uint32 // max: 24 bit InterfaceID ID NeighborInterfaceID ID NeighborRouterID ID }
func DeserializeAreaLinkDescription ¶
func DeserializeAreaLinkDescription(buf *bytes.Buffer) (AreaLinkDescription, int, error)
func (*AreaLinkDescription) Serialize ¶
func (x *AreaLinkDescription) Serialize(buf *bytes.Buffer)
type AreaLinkDescriptionType ¶
type AreaLinkDescriptionType uint8
const ( ALDTypePTP AreaLinkDescriptionType ALDTypeTransit ALDTypeReserved ALDTypeVirtualLink )
type DatabaseDescription ¶
type DatabaseDescription struct { Options RouterOptions InterfaceMTU uint16 DBFlags DBFlags DDSequenceNumber uint32 LSAHeaders []*LSA }
func (*DatabaseDescription) Serialize ¶
func (x *DatabaseDescription) Serialize(buf *bytes.Buffer)
type FloodingScope ¶
type FloodingScope uint8
const ( FloodLinkLocal FloodingScope = iota FloodArea FloodAS FloodReserved )
type Hello ¶
type Hello struct { InterfaceID ID RouterPriority uint8 Options RouterOptions HelloInterval uint16 RouterDeadInterval uint16 DesignatedRouterID ID BackupDesignatedRouterID ID Neighbors []ID }
func DeserializeHello ¶
type InterAreaPrefixLSA ¶
func DeserializeInterAreaPrefixLSA ¶
func DeserializeInterAreaPrefixLSA(buf *bytes.Buffer) (*InterAreaPrefixLSA, int, error)
func (*InterAreaPrefixLSA) Serialize ¶
func (x *InterAreaPrefixLSA) Serialize(buf *bytes.Buffer)
type InterAreaRouterLSA ¶
type InterAreaRouterLSA struct { Options RouterOptions Metric uint32 // max: 24 bit DestinationRouterID ID }
func DeserializeInterAreaRouterLSA ¶
func DeserializeInterAreaRouterLSA(buf *bytes.Buffer) (*InterAreaRouterLSA, int, error)
func (*InterAreaRouterLSA) Serialize ¶
func (x *InterAreaRouterLSA) Serialize(buf *bytes.Buffer)
type IntraAreaPrefixLSA ¶
type IntraAreaPrefixLSA struct { ReferencedLSType LSAType ReferencedLinkStateID ID ReferencedAdvertisingRouter ID Prefixes []LSAPrefix }
func DeserializeIntraAreaPrefixLSA ¶
func DeserializeIntraAreaPrefixLSA(buf *bytes.Buffer) (*IntraAreaPrefixLSA, int, error)
func (*IntraAreaPrefixLSA) Serialize ¶
func (x *IntraAreaPrefixLSA) Serialize(buf *bytes.Buffer)
type LSA ¶
type LSA struct { Age uint16 Type LSAType ID ID AdvertisingRouter ID SequenceNumber uint32 Checksum uint16 Length uint16 Body Serializable }
func (*LSA) SerializeHeader ¶
type LSAPrefix ¶
type LSAPrefix struct { PrefixLength uint8 Options PrefixOptions // this may represent different things // used for metric or referenced LSType Special uint16 Address net.IP }
func (*LSAPrefix) ToNetPrefix ¶
type LSAType ¶
type LSAType uint16
func (LSAType) FloodIfUnknown ¶
func (LSAType) FloodingScope ¶
func (t LSAType) FloodingScope() FloodingScope
type LinkLSA ¶
type LinkStateAcknowledgement ¶
type LinkStateAcknowledgement []*LSA
func (LinkStateAcknowledgement) Serialize ¶
func (x LinkStateAcknowledgement) Serialize(buf *bytes.Buffer)
type LinkStateRequest ¶
func DeserializeLinkStateRequest ¶
func DeserializeLinkStateRequest(buf *bytes.Buffer) (LinkStateRequest, int, error)
func (*LinkStateRequest) Serialize ¶
func (x *LinkStateRequest) Serialize(buf *bytes.Buffer)
type LinkStateRequestMsg ¶
type LinkStateRequestMsg []LinkStateRequest
func (LinkStateRequestMsg) Serialize ¶
func (x LinkStateRequestMsg) Serialize(buf *bytes.Buffer)
type LinkStateUpdate ¶
type LinkStateUpdate []*LSA
func DeserializeLinkStateUpdate ¶
func DeserializeLinkStateUpdate(buf *bytes.Buffer) (LinkStateUpdate, int, error)
func (LinkStateUpdate) Serialize ¶
func (x LinkStateUpdate) Serialize(buf *bytes.Buffer)
type NetworkLSA ¶
type NetworkLSA struct { Options RouterOptions AttachedRouter []ID }
func DeserializeNetworkLSA ¶
func (*NetworkLSA) Serialize ¶
func (x *NetworkLSA) Serialize(buf *bytes.Buffer)
type OSPFMessageType ¶
type OSPFMessageType uint8
const ( MsgTypeUnknown OSPFMessageType = iota MsgTypeHello MsgTypeDatabaseDescription MsgTypeLinkStateRequest MsgTypeLinkStateUpdate MsgTypeLinkStateAcknowledgment )
OSPF message types
type OSPFv3Message ¶
type OSPFv3Message struct { Version uint8 Type OSPFMessageType PacketLength uint16 RouterID ID AreaID ID Checksum uint16 InstanceID uint8 Body Serializable }
type PrefixOptions ¶
type PrefixOptions struct { NoUnicast bool // NU-bit LocalAddress bool // LA-bit Propagate bool // P-bit DN bool // DN-bit }
func (PrefixOptions) Serialize ¶
func (o PrefixOptions) Serialize(buf *bytes.Buffer)
type RouterLSA ¶
type RouterLSA struct { Flags RouterLSAFlags Options RouterOptions LinkDescriptions []AreaLinkDescription }
func DeserializeRouterLSA ¶
type RouterLSAFlags ¶
type RouterLSAFlags uint8
const ( RouterLSAFlagBorder RouterLSAFlags = 1 << iota RouterLSAFlagExternal RouterLSAFlagVirtualLink RouterLSAFlagNSSATranslation )
func RouterLSAFlagsFrom ¶
func RouterLSAFlagsFrom(flags ...RouterLSAFlags) RouterLSAFlags
func (RouterLSAFlags) HasFlag ¶
func (f RouterLSAFlags) HasFlag(flag uint8) bool
func (RouterLSAFlags) SetFlag ¶
func (f RouterLSAFlags) SetFlag(flag uint8) uint8
type RouterOptions ¶
type RouterOptions struct { Flags uint16 // contains filtered or unexported fields }
func OptionsFromFlags ¶
func OptionsFromFlags(flags ...uint16) RouterOptions
func (RouterOptions) HasFlag ¶
func (r RouterOptions) HasFlag(flag uint16) bool
func (*RouterOptions) Serialize ¶
func (r *RouterOptions) Serialize(buf *bytes.Buffer)
func (RouterOptions) SetFlag ¶
func (r RouterOptions) SetFlag(flag uint16) RouterOptions
type Serializable ¶
Serializable represents any packet which can be serialized to bytes to be on the wire
type UnknownLSA ¶
type UnknownLSA []byte
func (UnknownLSA) Serialize ¶
func (u UnknownLSA) Serialize(buf *bytes.Buffer)
Click to show internal directories.
Click to hide internal directories.