Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
bio-rd
Commits
0bb46aa8
Commit
0bb46aa8
authored
6 years ago
by
Oliver Herms
Browse files
Options
Downloads
Patches
Plain Diff
Added extended IP reachability TLV
parent
46da9c8b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
protocols/isis/packet/tlv_extended_ip_reachability.go
+66
-5
66 additions, 5 deletions
protocols/isis/packet/tlv_extended_ip_reachability.go
with
66 additions
and
5 deletions
protocols/isis/packet/tlv_extended_ip_reachability.go
+
66
−
5
View file @
0bb46aa8
package
packet
package
packet
import
(
"bytes"
"github.com/taktv6/tflow2/convert"
)
// ExtendedIPReachabilityTLVType is the type code of an Extended IP Reachability TLV
const
ExtendedIPReachabilityTLVType
=
135
const
ExtendedIPReachabilityTLVType
=
135
// ExtendedIPReachabilityTLV represents an Extended IP Reachability TLV
type
ExtendedIPReachabilityTLV
struct
{
type
ExtendedIPReachabilityTLV
struct
{
TLVType
uint8
TLVType
uint8
TLVLength
uint8
TLVLength
uint8
ExtendedIPReachabilities
[]
ExtendedIPReachability
}
// ExtendedIPReachability represents a single Extendend IP Reachability Information
type
ExtendedIPReachability
struct
{
Metric
uint32
Metric
uint32
UDSubBitPfxLen
uint8
UDSubBitPfxLen
uint8
Address
uint32
Address
uint32
SubTLVType
uint8
SubTLVs
[]
TLV
SubTLVLength
uint8
}
SubTLVs
[]
interface
{}
// Type gets the type of the TLV
func
(
e
*
ExtendedIPReachabilityTLV
)
Type
()
uint8
{
return
e
.
TLVType
}
// Length gets the length of the TLV
func
(
e
*
ExtendedIPReachabilityTLV
)
Length
()
uint8
{
return
e
.
TLVLength
}
// Value returns the TLV itself
func
(
e
*
ExtendedIPReachabilityTLV
)
Value
()
interface
{}
{
return
e
}
// Serialize serializes an ExtendedIPReachabilityTLV
func
(
e
*
ExtendedIPReachabilityTLV
)
Serialize
(
buf
*
bytes
.
Buffer
)
{
buf
.
WriteByte
(
ExtendedIPReachabilityTLVType
)
buf
.
WriteByte
(
e
.
TLVLength
)
for
_
,
extIPReach
:=
range
e
.
ExtendedIPReachabilities
{
extIPReach
.
Serialize
(
buf
)
}
}
// Serialize serializes an ExtendedIPReachability
func
(
e
*
ExtendedIPReachability
)
Serialize
(
buf
*
bytes
.
Buffer
)
{
if
len
(
e
.
SubTLVs
)
!=
0
{
e
.
setSFlag
()
}
buf
.
Write
(
convert
.
Uint32Byte
(
e
.
Metric
))
buf
.
WriteByte
(
e
.
UDSubBitPfxLen
)
buf
.
Write
(
convert
.
Uint32Byte
(
e
.
Address
))
for
_
,
tlv
:=
range
e
.
SubTLVs
{
tlv
.
Serialize
(
buf
)
}
}
func
(
e
*
ExtendedIPReachability
)
setSFlag
()
{
sFlag
:=
uint8
(
64
)
e
.
UDSubBitPfxLen
=
e
.
UDSubBitPfxLen
|
sFlag
}
func
(
e
*
ExtendedIPReachability
)
getPfxLen
()
uint8
{
tmp
:=
e
.
UDSubBitPfxLen
tmp
=
tmp
<<
2
tmp
=
tmp
>>
2
return
tmp
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment