Documentation
¶
Index ¶
- Constants
- Variables
- type BitOption
- type DbDescPayload
- type HelloPayloadV2
- type HelloPayloadV3
- type LSAContent
- type LSAIdentity
- type LSAcknowledgementPayload
- type LSAdv
- type LSAdvPayload
- type LSAdvertisement
- func (p LSAdvertisement) AsV2ASExternalLSA() (ret LSAdv[V2ASExternalLSA], err error)
- func (p LSAdvertisement) AsV2NetworkLSA() (ret LSAdv[V2NetworkLSA], err error)
- func (p LSAdvertisement) AsV2RouterLSA() (ret LSAdv[V2RouterLSA], err error)
- func (p LSAdvertisement) AsV2SummaryLSAType3() (ret LSAdv[V2SummaryLSAType3], err error)
- func (p LSAdvertisement) AsV2SummaryLSAType4() (ret LSAdv[V2SummaryLSAType4], err error)
- func (p *LSAdvertisement) FixLengthAndChkSum() error
- func (p *LSAdvertisement) SerializeToSizedBuffer(b []byte) (err error)
- func (p LSAdvertisement) Size() int
- func (p LSAdvertisement) String() string
- func (p LSAdvertisement) ValidateLSA() error
- type LSAheader
- func (p *LSAheader) Ager(t uint16) uint16
- func (p LSAheader) GetLSAIdentity() LSAIdentity
- func (p LSAheader) GetLSAck() LSAheader
- func (p LSAheader) GetLSReq() LSReq
- func (p LSAheader) IsMoreRecentThan(toCompare LSAheader) bool
- func (p LSAheader) IsSame(toCompare LSAheader) bool
- func (p *LSAheader) PrepareReOriginating(incrSeq bool) (seqIncred bool)
- func (p LSAheader) SerializeToSizedBuffer(b []byte) error
- func (p LSAheader) Size() int
- type LSReq
- type LSRequestPayload
- type LSUpdatePayload
- type LayerOSPFv2
- func (l *LayerOSPFv2) AsDbDescription() (*OSPFv2Packet[DbDescPayload], error)
- func (l *LayerOSPFv2) AsHello() (*OSPFv2Packet[HelloPayloadV2], error)
- func (l *LayerOSPFv2) AsLSAcknowledgment() (*OSPFv2Packet[LSAcknowledgementPayload], error)
- func (l *LayerOSPFv2) AsLSRequest() (*OSPFv2Packet[LSRequestPayload], error)
- func (l *LayerOSPFv2) AsLSUpdate() (ret *OSPFv2Packet[LSUpdatePayload], err error)
- type LegacyTOSInfo
- type OSPFPayloadV2
- type OSPFv2Packet
- type RouterV2
- type SerializableLayerLayerWithType
- type V2ASExternalLSA
- type V2NetworkLSA
- type V2RouterLSA
- type V2SummaryLSAImpl
- type V2SummaryLSAType3
- type V2SummaryLSAType4
Constants ¶
const ( // LSRefreshTime The maximum time between distinct originations of any particular // LSA. If the LS age field of one of the router's self-originated // LSAs reaches the value LSRefreshTime, a new instance of the LSA // is originated, even though the contents of the LSA (apart from // the LSA header) will be the same. The value of LSRefreshTime is // set to 30 minutes. LSRefreshTime = 30 * 60 // MinLSInterval The minimum time between distinct originations of any particular // LSA. The value of MinLSInterval is set to 5 seconds. MinLSInterval = 5 // MinLSArrival For any particular LSA, the minimum time that must elapse // between reception of new LSA instances during flooding. LSA // instances received at higher frequencies are discarded. The // value of MinLSArrival is set to 1 second. MinLSArrival = 1 // MaxAge The maximum age that an LSA can attain. When an LSA's LS age // field reaches MaxAge, it is reflooded in an attempt to flush the // LSA from the routing domain (See Section 14). LSAs of age MaxAge // are not used in the routing table calculation. The value of // MaxAge is set to 1 hour. MaxAge = 60 * 60 // CheckAge When the age of an LSA in the link state database hits a // multiple of CheckAge, the LSA's checksum is verified. An // incorrect checksum at this time indicates a serious error. The // value of CheckAge is set to 5 minutes. CheckAge = 5 * 60 // MaxAgeDiff The maximum time dispersion that can occur, as an LSA is flooded // throughout the AS. Most of this time is accounted for by the // LSAs sitting on router output queues (and therefore not aging) // during the flooding process. The value of MaxAgeDiff is set to // 15 minutes. MaxAgeDiff = 15 * 60 // LSInfinity The metric value indicating that the destination described by an // LSA is unreachable. Used in summary-LSAs and AS-external-LSAs as // an alternative to premature aging (see Section 14.1). It is // defined to be the 24-bit binary value of all ones: 0xffffff. LSInfinity = 0xffffff // DefaultDestination The Destination ID that indicates the default route. This route // is used when no other matching routing table entry can be found. // The default destination can only be advertised in AS-external- // LSAs and in stub areas' type 3 summary-LSAs. Its value is the // IP address 0.0.0.0. Its associated Network Mask is also always // 0.0.0.0. DefaultDestination = 0 // InitialSequenceNumber The value used for LS Sequence Number when originating the first // instance of any LSA. Its value is the signed 32-bit integer // 0x80000001. InitialSequenceNumber = 0x80000001 // MaxSequenceNumber The maximum value that LS Sequence Number can attain. Its value // is the signed 32-bit integer 0x7fffffff. MaxSequenceNumber = 0x7fffffff )
const ( // CapabilityEbit This bit describes the way AS-external-LSAs are flooded, as // described in Sections 3.6, 9.5, 10.8 and 12.1.2 of this memo. CapabilityEbit = 1 // CapabilityMCbit This bit describes whether IP multicast datagrams are forwarded // according to the specifications in [Ref18]. CapabilityMCbit = 2 // CapabilityNPbit This bit describes the handling of Type-7 LSAs, as specified in // [Ref19]. CapabilityNPbit = 3 // CapabilityEAbit This bit describes the router's willingness to receive and // forward External-Attributes-LSAs, as specified in [Ref20]. CapabilityEAbit = 4 // CapabilityDCbit This bit describes the router's handling of demand circuits, as // specified in [Ref21]. CapabilityDCbit = 5 )
const ( // DDFlagMSbit The Master/Slave bit. When set to 1, it indicates that the // router is the master during the Database Exchange process. // Otherwise, the router is the slave. DDFlagMSbit = 0 // DDFlagMbit The More bit. When set to 1, it indicates that more Database // Description Packets are to follow. DDFlagMbit = 1 // DDFlagIbit The Init bit. When set to 1, this packet is the first in the // sequence of Database Description Packets. DDFlagIbit = 2 )
const ( // RouterLSAFlagBbit When set, the router is an area border router (B is for border). RouterLSAFlagBbit = 0 // RouterLSAFlagEbit When set, the router is an AS boundary router (E is for external). RouterLSAFlagEbit = 1 // RouterLSAFlagVbit When set, the router is an endpoint of one or more fully // adjacent virtual links having the described area as Transit area // (V is for virtual link endpoint). RouterLSAFlagVbit = 2 )
const ( // ASExternalLSAFlagEbit The type of external metric. If bit E is set, the metric // specified is a Type 2 external metric. This means the metric is // considered larger than any link state path. If bit E is zero, // the specified metric is a Type 1 external metric. This means // that it is expressed in the same units as the link state metric // i.e., the same units as interface cost). ASExternalLSAFlagEbit = 7 )
Variables ¶
var (
ErrBufferLengthTooShort = errors.New("err buffer length too short")
)
var (
ErrNotImplemented = errors.New("not implemented")
)
var InvalidLSAIdentity = LSAIdentity{}
Functions ¶
This section is empty.
Types ¶
type DbDescPayload ¶
func (DbDescPayload) SerializeToSizedBuffer ¶
func (p DbDescPayload) SerializeToSizedBuffer(b []byte) (err error)
func (DbDescPayload) Size ¶
func (p DbDescPayload) Size() int
func (DbDescPayload) String ¶
func (p DbDescPayload) String() string
type HelloPayloadV2 ¶
type HelloPayloadV2 layers.HelloPkgV2
func (HelloPayloadV2) SerializeToSizedBuffer ¶
func (p HelloPayloadV2) SerializeToSizedBuffer(b []byte) error
func (HelloPayloadV2) Size ¶
func (p HelloPayloadV2) Size() int
func (HelloPayloadV2) String ¶
func (p HelloPayloadV2) String() string
type HelloPayloadV3 ¶
type LSAContent ¶
type LSAContent interface { String() string // contains filtered or unexported methods }
type LSAIdentity ¶
LSAIdentity The LS type, Link State ID, and Advertising Router fields can uniquely identify an LSA. If two LSAs have the same LS type, Link State ID, and Advertising Router fields, the two LSAs are considered to be the same, with one being old and the other being new.
type LSAcknowledgementPayload ¶
type LSAcknowledgementPayload []LSAheader
func (LSAcknowledgementPayload) SerializeToSizedBuffer ¶
func (p LSAcknowledgementPayload) SerializeToSizedBuffer(b []byte) (err error)
func (LSAcknowledgementPayload) Size ¶
func (p LSAcknowledgementPayload) Size() int
func (LSAcknowledgementPayload) String ¶
func (p LSAcknowledgementPayload) String() string
type LSAdv ¶
type LSAdv[T LSAdvPayload] struct { LSAdvertisement Content T }
type LSAdvPayload ¶
type LSAdvPayload interface { V2RouterLSA | V2NetworkLSA | V2SummaryLSAType3 | V2SummaryLSAType4 | V2ASExternalLSA // contains filtered or unexported methods }
type LSAdvertisement ¶
type LSAdvertisement struct { layers.LSA LSAheader Content LSAContent }
func (LSAdvertisement) AsV2ASExternalLSA ¶
func (p LSAdvertisement) AsV2ASExternalLSA() (ret LSAdv[V2ASExternalLSA], err error)
func (LSAdvertisement) AsV2NetworkLSA ¶
func (p LSAdvertisement) AsV2NetworkLSA() (ret LSAdv[V2NetworkLSA], err error)
func (LSAdvertisement) AsV2RouterLSA ¶
func (p LSAdvertisement) AsV2RouterLSA() (ret LSAdv[V2RouterLSA], err error)
func (LSAdvertisement) AsV2SummaryLSAType3 ¶
func (p LSAdvertisement) AsV2SummaryLSAType3() (ret LSAdv[V2SummaryLSAType3], err error)
func (LSAdvertisement) AsV2SummaryLSAType4 ¶
func (p LSAdvertisement) AsV2SummaryLSAType4() (ret LSAdv[V2SummaryLSAType4], err error)
func (*LSAdvertisement) FixLengthAndChkSum ¶
func (p *LSAdvertisement) FixLengthAndChkSum() error
func (*LSAdvertisement) SerializeToSizedBuffer ¶
func (p *LSAdvertisement) SerializeToSizedBuffer(b []byte) (err error)
func (LSAdvertisement) Size ¶
func (p LSAdvertisement) Size() int
func (LSAdvertisement) String ¶
func (p LSAdvertisement) String() string
func (LSAdvertisement) ValidateLSA ¶
func (p LSAdvertisement) ValidateLSA() error
type LSAheader ¶
func (LSAheader) GetLSAIdentity ¶
func (p LSAheader) GetLSAIdentity() LSAIdentity
func (LSAheader) IsMoreRecentThan ¶
func (*LSAheader) PrepareReOriginating ¶
func (LSAheader) SerializeToSizedBuffer ¶
type LSReq ¶
LSReq stands for a single link state request entry.
func (LSReq) GetLSAIdentity ¶
func (p LSReq) GetLSAIdentity() LSAIdentity
func (LSReq) SerializeToSizedBuffer ¶
type LSRequestPayload ¶
type LSRequestPayload []LSReq
func (LSRequestPayload) SerializeToSizedBuffer ¶
func (p LSRequestPayload) SerializeToSizedBuffer(b []byte) (err error)
func (LSRequestPayload) Size ¶
func (p LSRequestPayload) Size() int
func (LSRequestPayload) String ¶
func (p LSRequestPayload) String() string
type LSUpdatePayload ¶
type LSUpdatePayload struct { layers.LSUpdate LSAs []LSAdvertisement }
func (LSUpdatePayload) SerializeToSizedBuffer ¶
func (p LSUpdatePayload) SerializeToSizedBuffer(b []byte) (err error)
func (LSUpdatePayload) Size ¶
func (p LSUpdatePayload) Size() int
func (LSUpdatePayload) String ¶
func (p LSUpdatePayload) String() string
type LayerOSPFv2 ¶
func (*LayerOSPFv2) AsDbDescription ¶
func (l *LayerOSPFv2) AsDbDescription() (*OSPFv2Packet[DbDescPayload], error)
func (*LayerOSPFv2) AsHello ¶
func (l *LayerOSPFv2) AsHello() (*OSPFv2Packet[HelloPayloadV2], error)
func (*LayerOSPFv2) AsLSAcknowledgment ¶
func (l *LayerOSPFv2) AsLSAcknowledgment() (*OSPFv2Packet[LSAcknowledgementPayload], error)
func (*LayerOSPFv2) AsLSRequest ¶
func (l *LayerOSPFv2) AsLSRequest() (*OSPFv2Packet[LSRequestPayload], error)
func (*LayerOSPFv2) AsLSUpdate ¶
func (l *LayerOSPFv2) AsLSUpdate() (ret *OSPFv2Packet[LSUpdatePayload], err error)
type LegacyTOSInfo ¶
type LegacyTOSInfo struct { // IP Type of Service that this metric refers to. The encoding of // TOS in OSPF LSAs is described in RFC 2328 Section 12.3. TOS uint8 // TOS-specific metric information. // Only the lower 3 bytes are used. TOSMetric uint32 }
LegacyTOSInfo for backward compatibility with previous versions of the OSPF specification. aka RFC 1583
type OSPFPayloadV2 ¶
type OSPFPayloadV2 interface { HelloPayloadV2 | DbDescPayload | LSRequestPayload | LSUpdatePayload | LSAcknowledgementPayload String() string // contains filtered or unexported methods }
type OSPFv2Packet ¶
type OSPFv2Packet[T OSPFPayloadV2] struct { layers.OSPFv2 Content T //replace Content interface for marshaling }
OSPFv2Packet wrapper implements SerializeTo. Make it possible to serialize an OSPF message to wire format
func (*OSPFv2Packet[T]) GetType ¶
func (v2 *OSPFv2Packet[T]) GetType() layers.OSPFType
func (*OSPFv2Packet[T]) SerializeTo ¶
func (v2 *OSPFv2Packet[T]) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) (err error)
SerializeTo writes the serialized form of this layer into the SerializationBuffer, implementing gopacket.SerializableLayer.
func (*OSPFv2Packet[T]) String ¶
func (v2 *OSPFv2Packet[T]) String() string
type RouterV2 ¶
type RouterV2 struct { layers.RouterV2 TOSNum uint8 TOSs []LegacyTOSInfo }
func (RouterV2) SerializeToSizedBuffer ¶
type SerializableLayerLayerWithType ¶
type SerializableLayerLayerWithType interface { gopacket.SerializableLayer GetType() layers.OSPFType }
type V2ASExternalLSA ¶
type V2ASExternalLSA layers.ASExternalLSAV2
func (V2ASExternalLSA) SerializeToSizedBuffer ¶
func (p V2ASExternalLSA) SerializeToSizedBuffer(b []byte) (err error)
func (V2ASExternalLSA) Size ¶
func (p V2ASExternalLSA) Size() int
func (V2ASExternalLSA) String ¶
func (p V2ASExternalLSA) String() string
type V2NetworkLSA ¶
type V2NetworkLSA layers.NetworkLSAV2
func (V2NetworkLSA) SerializeToSizedBuffer ¶
func (p V2NetworkLSA) SerializeToSizedBuffer(b []byte) (err error)
func (V2NetworkLSA) Size ¶
func (p V2NetworkLSA) Size() int
func (V2NetworkLSA) String ¶
func (p V2NetworkLSA) String() string
type V2RouterLSA ¶
type V2RouterLSA struct { layers.RouterLSAV2 Routers []RouterV2 }
func (V2RouterLSA) SerializeToSizedBuffer ¶
func (p V2RouterLSA) SerializeToSizedBuffer(b []byte) (err error)
func (V2RouterLSA) Size ¶
func (p V2RouterLSA) Size() int
func (V2RouterLSA) String ¶
func (p V2RouterLSA) String() string
type V2SummaryLSAImpl ¶
type V2SummaryLSAImpl struct { // For Type 3 summary-LSAs, this indicates the destination // network's IP address mask. For example, when advertising the // location of a class A network the value 0xff000000 would be // used. This field is not meaningful and must be zero for Type 4 // summary-LSAs. NetworkMask uint32 // The cost of this route. Expressed in the same units as the // interface costs in the router-LSAs. // Only the lower 3 bytes are used. Metric uint32 }
V2SummaryLSAImpl implements summary LSA marshaling. The format of Type 3 and 4 summary-LSAs is identical.
func (V2SummaryLSAImpl) SerializeToSizedBuffer ¶
func (p V2SummaryLSAImpl) SerializeToSizedBuffer(b []byte) (err error)
func (V2SummaryLSAImpl) Size ¶
func (p V2SummaryLSAImpl) Size() int
func (V2SummaryLSAImpl) String ¶
func (p V2SummaryLSAImpl) String() string
type V2SummaryLSAType3 ¶
type V2SummaryLSAType3 struct {
V2SummaryLSAImpl
}
V2SummaryLSAType3 is alson known as ABR-SummaryLSA or SummaryLSA-IPNetwork. The format of Type 3 and 4 summary-LSAs is identical.
func (V2SummaryLSAType3) String ¶
func (p V2SummaryLSAType3) String() string
type V2SummaryLSAType4 ¶
type V2SummaryLSAType4 struct {
V2SummaryLSAImpl
}
V2SummaryLSAType4 is also known as ASBR-Summary LSA. The format of Type 3 and 4 summary-LSAs is identical.
func (V2SummaryLSAType4) String ¶
func (p V2SummaryLSAType4) String() string