packet

package
v0.0.3-pre4.0...-0ec3cfc Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P2PHelloMinLen = 20
	ISISHeaderLen  = 8
	L2CircuitType  = 2
)
View Source
const (
	L1_LAN_HELLO_TYPE = 0x0f
	L1_LS_PDU_TYPE    = 0x18
	L1_CSNP_TYPE      = 0x24
	L1_PSNP_TYPE      = 0x26
	L2_LAN_HELLO_TYPE = 0x10
	L2_LS_PDU_TYPE    = 0x14
	L2_CSNP_TYPE      = 0x19
	L2_PSNP_TYPE      = 0x1b
	P2P_HELLO         = 0x11

	DOWN_STATE         = 2
	INITIALIZING_STATE = 1
	UP_STATE           = 0
)
View Source
const (
	LSPIDLen    = 8
	LSPDUMinLen = 19
	MODX        = 5802
)
View Source
const (
	// ExtendedIPReachabilityTLVType is the type value of an Extended IP Reachability TLV
	ExtendedIPReachabilityTLVType = 135

	// ExtendedIPReachabilityLength is the length of an Extended IP Reachability excluding Sub TLVs
	ExtendedIPReachabilityLength = 9
)
View Source
const (
	// ExtendedISReachabilityType is the type value of an Extended IS Reachability TLV
	ExtendedISReachabilityType = 22

	// LinkLocalRemoteIdentifiersSubTLVType is the type value of an Link Local/Remote Indentifiers Sub TLV
	LinkLocalRemoteIdentifiersSubTLVType = 4

	// IPv4InterfaceAddressSubTLVType is the type value of an IPv4 interface address sub TLV
	IPv4InterfaceAddressSubTLVType = 6

	// IPv4NeighborAddressSubTLVType is the type value of an IPv4 neighbor address sub TLV
	IPv4NeighborAddressSubTLVType = 8
)
View Source
const (
	// P2PAdjacencyStateTLVType is the type value of an P2P adjacency state TLV
	P2PAdjacencyStateTLVType = uint8(240)
	// P2PAdjacencyStateTLVLenWithoutNeighbor is the length of this TLV without a neighbor
	P2PAdjacencyStateTLVLenWithoutNeighbor = 5
	//P2PAdjacencyStateTLVLenWithNeighbor is the length of this TLV including a neighbor
	P2PAdjacencyStateTLVLenWithNeighbor = 15
)
View Source
const (
	// ProtocolsSupportedTLVType is the type value of an protocols supported TLV
	ProtocolsSupportedTLVType = 129

	// NLPIDIPv4 is the Network Layer Protocol ID for IPv4
	NLPIDIPv4 = uint8(0xcc)

	// NLPIDIPv6 is the Network Layer Protocol ID for IPv6
	NLPIDIPv6 = uint8(0x8e)
)
View Source
const AreaAddressesTLVType = 1

AreaAddressesTLVType is the type value of an area address TLV

View Source
const AuthenticationType = 10

AuthenticationType is the type value of an authentication TLV

View Source
const (
	// CSNPMinLen is the minimal length of a CSNP
	CSNPMinLen = PSNPMinLen + 16
)
View Source
const ChecksumTLVType = 12

ChecksumTLVType is the type value of a checksum TLV

View Source
const DynamicHostNameTLVType = 137

DynamicHostNameTLVType is the type value of dynamic hostname TLV

View Source
const (
	HeaderLen = 8
)
View Source
const IPInterfaceAddressesTLVType = 132

IPInterfaceAddressesTLVType is the type value of an IP interface address TLV

View Source
const ISNeighborsTLVLength = 8

ISNeighborsTLVLength is the length of an IS Neighbor TLV

View Source
const ISNeighborsTLVType = 6

ISNeighborsTLVType is the type value of an IS Neighbor TLV

View Source
const ISReachabilityTLVType = 2

ISReachabilityTLVType is the type value of an IS reachability TLV

View Source
const (
	// LSPEntriesTLVType is the type value of an LSP Entries TLV
	LSPEntriesTLVType = uint8(9)
)
View Source
const (
	// LSPEntryLen is the lenth of an LSPEntry
	LSPEntryLen = 16
)
View Source
const (
	// PSNPMinLen is the minimal length of PSNP PDU
	PSNPMinLen = 17
)
View Source
const PaddingType = 8

PaddingType is the type value of a padding TLV

View Source
const (
	// TrafficEngineeringRouterIDTLVType is the type value of an Traffic Engineering Router ID TLV
	TrafficEngineeringRouterIDTLVType = 134
)

Variables

View Source
var (
	AllL1ISS  = [6]byte{0x01, 0x80, 0xC2, 0x00, 0x00, 0x14}
	AllL2ISS  = [6]byte{0x01, 0x80, 0xC2, 0x00, 0x00, 0x15}
	AllP2PISS = [6]byte{0x09, 0x00, 0x2b, 0x00, 0x00, 0x05}
	AllISS    = [6]byte{0x09, 0x00, 0x2B, 0x00, 0x00, 0x05}
	AllESS    = [6]byte{0x09, 0x00, 0x2B, 0x00, 0x00, 0x04}
)

Functions

This section is empty.

Types

type AreaAddressesTLV

type AreaAddressesTLV struct {
	TLVType   uint8
	TLVLength uint8
	AreaIDs   []types.AreaID
}

AreaAddressesTLV represents an area address TLV

func NewAreaAddressesTLV

func NewAreaAddressesTLV(areas []types.AreaID) *AreaAddressesTLV

NewAreaAddressesTLV creates a new area addresses TLV

func (*AreaAddressesTLV) Length

func (a *AreaAddressesTLV) Length() uint8

Length gets the length of the TLV

func (*AreaAddressesTLV) Serialize

func (a *AreaAddressesTLV) Serialize(buf *bytes.Buffer)

Serialize serializes an area address TLV

func (*AreaAddressesTLV) Type

func (a *AreaAddressesTLV) Type() uint8

Type gets the type of the TLV

func (*AreaAddressesTLV) Value

func (a *AreaAddressesTLV) Value() interface{}

Value gets the TLV itself

type AuthenticationTLV

type AuthenticationTLV struct {
	TLVType            uint8
	TLVLength          uint8
	AuthenticationType uint8
	Password           []byte
}

AuthenticationTLV represents an authentication TLV

type CSNP

type CSNP struct {
	PDULength  uint16
	SourceID   types.SourceID
	StartLSPID LSPID
	EndLSPID   LSPID
	TLVs       []TLV
}

CSNP represents a Complete Sequence Number PDU

func DecodeCSNP

func DecodeCSNP(buf *bytes.Buffer) (*CSNP, error)

DecodeCSNP decodes Complete Sequence Number PDUs

func NewCSNPs

func NewCSNPs(sourceID types.SourceID, lspEntries []*LSPEntry, maxPDULen int) []CSNP

NewCSNPs creates the necessary number of CSNP PDUs to carry all LSPEntries

func (*CSNP) GetLSPEntries

func (c *CSNP) GetLSPEntries() []*LSPEntry

GetLSPEntries returns LSP Entries from the LSP Entries TLV

func (*CSNP) Serialize

func (c *CSNP) Serialize(buf *bytes.Buffer)

Serialize serializes CSNPs

type ChecksumTLV

type ChecksumTLV struct {
	TLVType   uint8
	TLVLength uint8
	Checksum  uint16
}

ChecksumTLV represents a checksum TLV

func (ChecksumTLV) Length

func (c ChecksumTLV) Length() uint8

Length gets the length of the TLV

func (*ChecksumTLV) Serialize

func (c *ChecksumTLV) Serialize(buf *bytes.Buffer)

Serialize serializes a checksum TLV

func (ChecksumTLV) Type

func (c ChecksumTLV) Type() uint8

Type gets the type of the TLV

func (ChecksumTLV) Value

func (c ChecksumTLV) Value() interface{}

Value returns the TLV itself

type DynamicHostNameTLV

type DynamicHostNameTLV struct {
	TLVType   uint8
	TLVLength uint8
	Hostname  []byte
}

DynamicHostNameTLV represents a dynamic Hostname TLV

func NewDynamicHostnameTLV

func NewDynamicHostnameTLV(name []byte) *DynamicHostNameTLV

NewDynamicHostnameTLV creates a new dynamic hostname TLV

func (*DynamicHostNameTLV) Length

func (d *DynamicHostNameTLV) Length() uint8

Length gets the length of the TLV

func (*DynamicHostNameTLV) Serialize

func (d *DynamicHostNameTLV) Serialize(buf *bytes.Buffer)

Serialize serializes a dynamic hostname TLV

func (*DynamicHostNameTLV) Type

func (d *DynamicHostNameTLV) Type() uint8

Type gets the type of the TLV

func (*DynamicHostNameTLV) Value

func (d *DynamicHostNameTLV) Value() interface{}

Value returns the TLV itself

type ExtendedIPReachability

type ExtendedIPReachability struct {
	Metric         uint32
	UDSubBitPfxLen uint8
	Address        uint32
	SubTLVs        []TLV
}

ExtendedIPReachability is the Extended IP Reachability Part of an ExtendedIPReachabilityTLV

func (*ExtendedIPReachability) PfxLen

func (e *ExtendedIPReachability) PfxLen() uint8

PfxLen returns the prefix length

func (*ExtendedIPReachability) Serialize

func (e *ExtendedIPReachability) Serialize(buf *bytes.Buffer)

Serialize serializes an ExtendedIPReachability

type ExtendedIPReachabilityTLV

type ExtendedIPReachabilityTLV struct {
	TLVType                  uint8
	TLVLength                uint8
	ExtendedIPReachabilities []*ExtendedIPReachability
}

ExtendedIPReachabilityTLV is an Extended IP Reachability TLV

func NewExtendedIPReachabilityTLV

func NewExtendedIPReachabilityTLV() *ExtendedIPReachabilityTLV

NewExtendedIPReachabilityTLV creates a new ExtendedIPReachabilityTLV

func (*ExtendedIPReachabilityTLV) Length

func (e *ExtendedIPReachabilityTLV) Length() uint8

Length gets the length of the TLV

func (*ExtendedIPReachabilityTLV) Serialize

func (e *ExtendedIPReachabilityTLV) Serialize(buf *bytes.Buffer)

Serialize serializes an ExtendedIPReachabilityTLV

func (*ExtendedIPReachabilityTLV) Type

func (e *ExtendedIPReachabilityTLV) Type() uint8

Type gets the type of the TLV

func (*ExtendedIPReachabilityTLV) Value

func (e *ExtendedIPReachabilityTLV) Value() interface{}

Value returns the TLV itself

type ExtendedISReachabilityNeighbor

type ExtendedISReachabilityNeighbor struct {
	NeighborID   types.SourceID
	Metric       [3]byte
	SubTLVLength uint8
	SubTLVs      []TLV
}

ExtendedISReachabilityNeighbor is an extended IS Reachability Neighbor

func NewExtendedISReachabilityNeighbor

func NewExtendedISReachabilityNeighbor(neighborID types.SourceID, metric [3]byte) *ExtendedISReachabilityNeighbor

NewExtendedISReachabilityNeighbor creates a new ExtendedISReachabilityNeighbor

func (*ExtendedISReachabilityNeighbor) AddSubTLV

func (e *ExtendedISReachabilityNeighbor) AddSubTLV(tlv TLV)

AddSubTLV adds a sub TLV to the ExtendedISReachabilityNeighbor

func (*ExtendedISReachabilityNeighbor) Serialize

func (e *ExtendedISReachabilityNeighbor) Serialize(buf *bytes.Buffer)

Serialize serializes an ExtendedISReachabilityNeighbor

type ExtendedISReachabilityTLV

type ExtendedISReachabilityTLV struct {
	TLVType   uint8
	TLVLength uint8
	Neighbors []*ExtendedISReachabilityNeighbor
}

ExtendedISReachabilityTLV is an Extended IS Reachability TLV

func NewExtendedISReachabilityTLV

func NewExtendedISReachabilityTLV() *ExtendedISReachabilityTLV

NewExtendedISReachabilityTLV creates a new Extended IS Reachability TLV

func (*ExtendedISReachabilityTLV) Length

func (e *ExtendedISReachabilityTLV) Length() uint8

Length gets the length of the TLV

func (*ExtendedISReachabilityTLV) Serialize

func (e *ExtendedISReachabilityTLV) Serialize(buf *bytes.Buffer)

Serialize serializes an ExtendedISReachabilityTLV

func (*ExtendedISReachabilityTLV) Type

func (e *ExtendedISReachabilityTLV) Type() uint8

Type gets the type of the TLV

func (*ExtendedISReachabilityTLV) Value

func (e *ExtendedISReachabilityTLV) Value() interface{}

Value returns the TLV itself

type IPInterfaceAddressesTLV

type IPInterfaceAddressesTLV struct {
	TLVType       uint8
	TLVLength     uint8
	IPv4Addresses []uint32
}

IPInterfaceAddressesTLV represents an IP interface TLV

func NewIPInterfaceAddressesTLV

func NewIPInterfaceAddressesTLV(addrs []uint32) *IPInterfaceAddressesTLV

NewIPInterfaceAddressesTLV creates a new IPInterfaceAddressesTLV

func (IPInterfaceAddressesTLV) Length

func (i IPInterfaceAddressesTLV) Length() uint8

Length returns the length of the TLV

func (IPInterfaceAddressesTLV) Serialize

func (i IPInterfaceAddressesTLV) Serialize(buf *bytes.Buffer)

Serialize serializes an IP interfaces address TLV

func (IPInterfaceAddressesTLV) Type

func (i IPInterfaceAddressesTLV) Type() uint8

Type returns the type of the TLV

func (IPInterfaceAddressesTLV) Value

func (i IPInterfaceAddressesTLV) Value() interface{}

Value gets the TLV itself

type IPv4AddressSubTLV

type IPv4AddressSubTLV struct {
	TLVType   uint8
	TLVLength uint8
	Address   uint32
}

IPv4AddressSubTLV is an IPv4 Address Sub TLV (used for both interface and neighbor)

func NewIPv4InterfaceAddressSubTLV

func NewIPv4InterfaceAddressSubTLV(addr uint32) *IPv4AddressSubTLV

NewIPv4InterfaceAddressSubTLV creates a new IPv4 Interface Address Sub TLV

func NewIPv4NeighborAddressSubTLV

func NewIPv4NeighborAddressSubTLV(addr uint32) *IPv4AddressSubTLV

NewIPv4NeighborAddressSubTLV creates a new IPv4 Neighbor Address Sub TLV

func (*IPv4AddressSubTLV) Length

func (s *IPv4AddressSubTLV) Length() uint8

Length gets the length of the TLV

func (*IPv4AddressSubTLV) Serialize

func (s *IPv4AddressSubTLV) Serialize(buf *bytes.Buffer)

Serialize serializes an IPv4 address sub TLV

func (*IPv4AddressSubTLV) Type

func (s *IPv4AddressSubTLV) Type() uint8

Type gets the type of the TLV

func (*IPv4AddressSubTLV) Value

func (s *IPv4AddressSubTLV) Value() interface{}

Value returns the TLV itself

type ISISHeader

type ISISHeader struct {
	ProtoDiscriminator  uint8
	LengthIndicator     uint8
	ProtocolIDExtension uint8
	IDLength            uint8
	PDUType             uint8
	Version             uint8
	MaxAreaAddresses    uint8
}

ISISHeader represents an ISIS header

func DecodeHeader

func DecodeHeader(buf *bytes.Buffer) (*ISISHeader, error)

DecodeHeader decodes an ISIS header

func (*ISISHeader) Serialize

func (h *ISISHeader) Serialize(buf *bytes.Buffer)

Serialize serializes an ISIS header

type ISISPacket

type ISISPacket struct {
	Header *ISISHeader
	Body   interface{}
}

ISISPacket represents an ISIS packet

func Decode

func Decode(buf *bytes.Buffer) (*ISISPacket, error)

Decode decodes ISIS packets

type ISNeighborsTLV

type ISNeighborsTLV struct {
	TLVType      uint8
	TLVLength    uint8
	NeighborSNPA types.SystemID
}

ISNeighborsTLV represents an IS Neighbor TLV

func (ISNeighborsTLV) Length

func (i ISNeighborsTLV) Length() uint8

Length returns the length of the TLV

func (ISNeighborsTLV) Serialize

func (i ISNeighborsTLV) Serialize(buf *bytes.Buffer)

Serialize serializes an WriteByte into a buffer

func (ISNeighborsTLV) Type

func (i ISNeighborsTLV) Type() uint8

Type returns the type of the TLV

func (ISNeighborsTLV) Value

func (i ISNeighborsTLV) Value() interface{}

Value returns the TLV itself

type ISReachabilityTLV

type ISReachabilityTLV struct {
	TLVType          uint8
	TLVLength        uint8
	VirtualFlag      uint8
	RIEDefaultMetric uint8
	SIEDelayMetric   uint8
	SIEExpenseMetric uint8
	SIEErrorMetric   uint8
	NeighborID       [7]byte
}

ISReachabilityTLV represents an IS reachability TLV

type L2Hello

type L2Hello struct {
	CircuitType  uint8
	SystemID     [6]byte
	HoldingTimer uint16
	PDULength    uint16
	Priority     uint8
	DesignatedIS [6]byte
	TLVs         []TLV
}

L2Hello represents a broadcast L2 hello

func DecodeL2Hello

func DecodeL2Hello(buf *bytes.Buffer) (*L2Hello, error)

DecodeL2Hello decodes an ISIS broadcast L2 hello

type LSPDU

type LSPDU struct {
	Length            uint16
	RemainingLifetime uint16
	LSPID             LSPID
	SequenceNumber    uint32
	Checksum          uint16
	TypeBlock         uint8
	TLVs              []TLV
}

LSPDU represents a link state PDU

func DecodeLSPDU

func DecodeLSPDU(buf *bytes.Buffer) (*LSPDU, error)

DecodeLSPDU decodes an LSPDU

func (*LSPDU) Serialize

func (l *LSPDU) Serialize(buf *bytes.Buffer)

Serialize serializes a linke state PDU

func (*LSPDU) SerializeChecksumRelevant

func (l *LSPDU) SerializeChecksumRelevant(buf *bytes.Buffer)

SerializeChecksumRelevant serializes all fields after the Remaining Lifetime field.

func (*LSPDU) SetChecksum

func (l *LSPDU) SetChecksum()

SetChecksum sets the checksum of an LSPDU

type LSPEntriesTLV

type LSPEntriesTLV struct {
	TLVType    uint8
	TLVLength  uint8
	LSPEntries []*LSPEntry
}

LSPEntriesTLV is an LSP Entries TLV carried in PSNP/CSNP

func NewLSPEntriesTLV

func NewLSPEntriesTLV(LSPEntries []*LSPEntry) *LSPEntriesTLV

NewLSPEntriesTLV creates a nbew LSP Entries TLV

func (*LSPEntriesTLV) Length

func (l *LSPEntriesTLV) Length() uint8

Length returns the length of the TLV

func (*LSPEntriesTLV) Serialize

func (l *LSPEntriesTLV) Serialize(buf *bytes.Buffer)

Serialize serializes an LSP Entries TLV

func (*LSPEntriesTLV) Type

func (l *LSPEntriesTLV) Type() uint8

Type returns the type of the TLV

func (*LSPEntriesTLV) Value

func (l *LSPEntriesTLV) Value() interface{}

Value returns self

type LSPEntry

type LSPEntry struct {
	RemainingLifetime uint16
	LSPID             LSPID
	SequenceNumber    uint32
	LSPChecksum       uint16
}

LSPEntry represents an LSP entry in a CSNP PDU

func (*LSPEntry) Serialize

func (l *LSPEntry) Serialize(buf *bytes.Buffer)

Serialize serializes an LSPEntry

type LSPID

type LSPID struct {
	SystemID     types.SystemID
	PseudonodeID uint8
	LSPNumber    uint8
}

LSPID represents a Link State Packet ID

func (*LSPID) Compare

func (l *LSPID) Compare(m LSPID) int

Compare returns 1 if l is bigger m, 0 if they are equal, else -1

func (*LSPID) Serialize

func (l *LSPID) Serialize(buf *bytes.Buffer)

Serialize serializes an LSPID

func (*LSPID) String

func (l *LSPID) String() string

type LinkLocalRemoteIdentifiersSubTLV

type LinkLocalRemoteIdentifiersSubTLV struct {
	TLVType   uint8
	TLVLength uint8
	Local     uint32
	Remote    uint32
}

LinkLocalRemoteIdentifiersSubTLV is an Link Local/Remote Identifiers Sub TLV

func NewLinkLocalRemoteIdentifiersSubTLV

func NewLinkLocalRemoteIdentifiersSubTLV(local uint32, remote uint32) *LinkLocalRemoteIdentifiersSubTLV

NewLinkLocalRemoteIdentifiersSubTLV creates a new LinkLocalRemoteIdentifiersSubTLV

func (*LinkLocalRemoteIdentifiersSubTLV) Length

Length gets the length of the TLV

func (*LinkLocalRemoteIdentifiersSubTLV) Serialize

func (l *LinkLocalRemoteIdentifiersSubTLV) Serialize(buf *bytes.Buffer)

Serialize serializes an IPv4 address sub TLV

func (*LinkLocalRemoteIdentifiersSubTLV) Type

Type gets the type of the TLV

func (*LinkLocalRemoteIdentifiersSubTLV) Value

func (l *LinkLocalRemoteIdentifiersSubTLV) Value() interface{}

Value returns the TLV itself

type P2PAdjacencyStateTLV

type P2PAdjacencyStateTLV struct {
	TLVType                        uint8
	TLVLength                      uint8
	AdjacencyState                 uint8
	ExtendedLocalCircuitID         uint32
	NeighborSystemID               types.SystemID
	NeighborExtendedLocalCircuitID uint32
}

P2PAdjacencyStateTLV represents an P2P adjacency state TLV

func NewP2PAdjacencyStateTLV

func NewP2PAdjacencyStateTLV(adjacencyState uint8, extendedLocalCircuitID uint32) *P2PAdjacencyStateTLV

NewP2PAdjacencyStateTLV creates a new P2PAdjacencyStateTLV

func (P2PAdjacencyStateTLV) Length

func (p P2PAdjacencyStateTLV) Length() uint8

Length gets the length of the TLV

func (P2PAdjacencyStateTLV) Serialize

func (p P2PAdjacencyStateTLV) Serialize(buf *bytes.Buffer)

Serialize serializes a protocols supported TLV

func (P2PAdjacencyStateTLV) Type

func (p P2PAdjacencyStateTLV) Type() uint8

Type gets the type of the TLV

func (P2PAdjacencyStateTLV) Value

func (p P2PAdjacencyStateTLV) Value() interface{}

Value gets the TLV itself

type P2PHello

type P2PHello struct {
	CircuitType    uint8
	SystemID       types.SystemID
	HoldingTimer   uint16
	PDULength      uint16
	LocalCircuitID uint8
	TLVs           []TLV
}

P2PHello represents a Point to Point Hello

func DecodeP2PHello

func DecodeP2PHello(buf *bytes.Buffer) (*P2PHello, error)

DecodeP2PHello decodes a P2P Hello

func (*P2PHello) GetAreaAddressesTLV

func (h *P2PHello) GetAreaAddressesTLV() *AreaAddressesTLV

GetAreaAddressesTLV gets the area addresses TLV

func (*P2PHello) GetIPInterfaceAddressesesTLV

func (h *P2PHello) GetIPInterfaceAddressesesTLV() *IPInterfaceAddressesTLV

GetIPInterfaceAddressesesTLV gets the IP Interface Addresses TLV

func (*P2PHello) GetP2PAdjTLV

func (h *P2PHello) GetP2PAdjTLV() *P2PAdjacencyStateTLV

GetP2PAdjTLV gets the P2P Adjacency TLV from the P2P Hello

func (*P2PHello) GetProtocolsSupportedTLV

func (h *P2PHello) GetProtocolsSupportedTLV() *ProtocolsSupportedTLV

GetProtocolsSupportedTLV gets the protocols supported TLV

func (*P2PHello) Serialize

func (h *P2PHello) Serialize(buf *bytes.Buffer)

Serialize serializes a P2P Hello

type PSNP

type PSNP struct {
	PDULength  uint16
	SourceID   types.SourceID
	LSPEntries []*LSPEntry
}

PSNP represents a Partial Sequence Number PDU

func DecodePSNP

func DecodePSNP(buf *bytes.Buffer) (*PSNP, error)

DecodePSNP decodes a Partion Sequence Number PDU

func NewPSNPs

func NewPSNPs(sourceID types.SourceID, lspEntries []*LSPEntry, maxPDULen int) []PSNP

NewPSNPs creates the necessary number of PSNP PDUs to carry all LSPEntries

func (*PSNP) Serialize

func (c *PSNP) Serialize(buf *bytes.Buffer)

Serialize serializes PSNPs

type PaddingTLV

type PaddingTLV struct {
	TLVType     uint8
	TLVLength   uint8
	PaddingData []byte
}

PaddingTLV represents a padding TLV

func NewPaddingTLV

func NewPaddingTLV(length uint8) *PaddingTLV

NewPaddingTLV creates a new padding TLV

func (*PaddingTLV) Length

func (p *PaddingTLV) Length() uint8

Length gets the length of the TLV

func (*PaddingTLV) Serialize

func (p *PaddingTLV) Serialize(buf *bytes.Buffer)

Serialize serializes a padding TLV

func (*PaddingTLV) Type

func (p *PaddingTLV) Type() uint8

Type gets the type of the TLV

func (*PaddingTLV) Value

func (p *PaddingTLV) Value() interface{}

Value gets the TLV itself

type ProtocolsSupportedTLV

type ProtocolsSupportedTLV struct {
	TLVType                 uint8
	TLVLength               uint8
	NetworkLayerProtocolIDs []uint8
}

ProtocolsSupportedTLV represents a protocols supported TLV

func NewProtocolsSupportedTLV

func NewProtocolsSupportedTLV(protocols []uint8) ProtocolsSupportedTLV

func (ProtocolsSupportedTLV) Length

func (p ProtocolsSupportedTLV) Length() uint8

Length gets the length of the TLV

func (ProtocolsSupportedTLV) Serialize

func (p ProtocolsSupportedTLV) Serialize(buf *bytes.Buffer)

Serialize serializes a protocols supported TLV

func (ProtocolsSupportedTLV) Type

func (p ProtocolsSupportedTLV) Type() uint8

Type gets the type of the TLV

func (ProtocolsSupportedTLV) Value

func (p ProtocolsSupportedTLV) Value() interface{}

Value gets the TLV itself

type TLV

type TLV interface {
	Type() uint8
	Length() uint8
	Serialize(*bytes.Buffer)
	Value() interface{}
}

TLV is an interface that all TLVs must fulfill

type TrafficEngineeringRouterIDTLV

type TrafficEngineeringRouterIDTLV struct {
	TLVType   uint8
	TLVLength uint8
	Address   [4]byte
}

TrafficEngineeringRouterIDTLV is a Traffic Engineering Router ID TLV

func NewTrafficEngineeringRouterIDTLV

func NewTrafficEngineeringRouterIDTLV(addr [4]byte) *TrafficEngineeringRouterIDTLV

NewTrafficEngineeringRouterIDTLV creates a new TrafficEngineeringRouterIDTLV

func (TrafficEngineeringRouterIDTLV) Length

Length gets the length of the TLV

func (*TrafficEngineeringRouterIDTLV) Serialize

func (t *TrafficEngineeringRouterIDTLV) Serialize(buf *bytes.Buffer)

Serialize serializes a TrafficEngineeringRouterIDTLV

func (TrafficEngineeringRouterIDTLV) Type

Type gets the type of the TLV

func (TrafficEngineeringRouterIDTLV) Value

func (t TrafficEngineeringRouterIDTLV) Value() interface{}

Value gets the TLV itself

type UnknownTLV

type UnknownTLV struct {
	TLVType   uint8
	TLVLength uint8
	TLVValue  []byte
}

UnknownTLV represents an unknown TLV

func (UnknownTLV) Length

func (u UnknownTLV) Length() uint8

Length gets the length of the TLV

func (UnknownTLV) Serialize

func (u UnknownTLV) Serialize(buf *bytes.Buffer)

Serialize serializes an unknown TLV

func (UnknownTLV) Type

func (u UnknownTLV) Type() uint8

Type gets the type of the TLV

func (*UnknownTLV) Value

func (u *UnknownTLV) Value() interface{}

Value gets the TLV itself

Jump to

Keyboard shortcuts

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