1
0
mirror of https://gitee.com/willfree/mlsr.git synced 2026-06-15 20:44:48 +08:00
Files
mlsr/lsa/NameLsaNamePrefixSource.go
T

71 lines
1.5 KiB
Go

// Package lsa
// @Author: Wang Feng
// @Description:
// @Version: 0.1.0
// @Date: 2022/3/17 17:15
// @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
//
package lsa
import (
"minlib/component"
"minlib/encoding"
"mlsr/extensions"
)
//
// NameLsaNamePrefixSource
// @Description: 名称前缀的source。
//
type NameLsaNamePrefixSource struct {
component.CommonString
}
//
// NamePrefixSource
// @Description: 获取source
// @receiver s
// @return string
//
func (s *NameLsaNamePrefixSource) NamePrefixSource() string {
return s.CommonString.Value()
}
//
// SetNamePrefixSource
// @Description: 设置source
// @receiver s
// @param source
//
func (s *NameLsaNamePrefixSource) SetNamePrefixSource(source string) {
s.CommonString.SetValue(source)
}
//
// WireEncode
// @Description: 线速编码
// @receiver s
// @param encoder
// @return int
// @return error
//
func (s *NameLsaNamePrefixSource) WireEncode(encoder *encoding.Encoder) (int,error) {
s.CommonString.SetTlvType(extensions.TlvMlsrNameLsaNamePrefixSource)
return s.CommonString.WireEncode(encoder)
}
//
// WireDecode
// @Description: 线速解码
// @receiver s
// @param block
// @return error
//
func (s *NameLsaNamePrefixSource) WireDecode(block *encoding.Block) error {
// 检查type是否正确
if err := encoding.ExpectType(block.GetType(),extensions.TlvMlsrNameLsaNamePrefixSource); err!=nil {
return err
}
return s.CommonString.WireDecode(block)
}