Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeNNI(value []byte) (uint64, error)
- func DecodeNNIBlock(wire *Block) (uint64, error)
- func DecodeTypeLength(bytes []byte) (uint32, int, int, error)
- func DecodeVarNum(in []byte) (uint64, int, error)
- func EncodeNNI(v uint64) []byte
- func EncodeVarNum(in uint64) []byte
- func GetNNIBlockSize(t uint32, v uint64) int
- func IsCritical(tlvType uint32) bool
- type Block
- func (b *Block) Append(block *Block)
- func (b *Block) Clear()
- func (b *Block) DeepCopy() *Block
- func (b *Block) Encode() error
- func (b *Block) Erase(tlvType uint32) bool
- func (b *Block) EraseAll(tlvType uint32) int
- func (b *Block) Find(tlvType uint32) *Block
- func (b *Block) HasWire() bool
- func (b *Block) Insert(in *Block)
- func (b *Block) Parse() error
- func (b *Block) Reset()
- func (b *Block) SetType(tlvType uint32)
- func (b *Block) SetValue(value []byte)
- func (b *Block) Size() int
- func (b *Block) Subelements() []*Block
- func (b *Block) Type() uint32
- func (b *Block) Value() []byte
- func (b *Block) Wire() ([]byte, error)
Constants ¶
const ( // Packet types Interest = 0x05 Data = 0x06 // Name and components Name = 0x07 ImplicitSha256DigestComponent = 0x01 ParametersSha256DigestComponent = 0x02 GenericNameComponent = 0x08 KeywordNameComponent = 0x20 SegmentNameComponent = 0x32 ByteOffsetNameComponent = 0x34 VersionNameComponent = 0x36 TimestampNameComponent = 0x38 SequenceNumNameComponent = 0x3A // Interest packets CanBePrefix = 0x21 MustBeFresh = 0x12 ForwardingHint = 0x1e Nonce = 0x0a InterestLifetime = 0x0c HopLimit = 0x22 ApplicationParameters = 0x24 InterestSignatureInfo = 0x2c InterestSignatureValue = 0x2e // Data packets MetaInfo = 0x14 Content = 0x15 SignatureInfo = 0x16 SignatureValue = 0x17 // Data/MetaInfo ContentType = 0x18 FreshnessPeriod = 0x19 FinalBlockID = 0x1a // Signature SignatureType = 0x1b KeyLocator = 0x1c KeyDigest = 0x1d SignatureNonce = 0x26 SignatureTime = 0x28 SignatureSeqNum = 0x2a // Link Object Delegation = 0x1f Preference = 0x1e // Certificates ValidityPeriod = 0xfd NotBefore = 0xfe NotAfter = 0xff AdditionalDescription = 0x0102 DescriptionEntry = 0x0200 DescriptionKey = 0x0201 DescriptionValue = 0x0202 )
TLV types for NDN.
const ( // Core ControlParameters = 0x68 FaceID = 0x69 URI = 0x72 LocalURI = 0x81 Origin = 0x6F Cost = 0x6A Capacity = 0x83 Count = 0x84 BaseCongestionMarkingInterval = 0x87 DefaultCongestionThreshold = 0x88 MTU = 0x89 Flags = 0x6C Mask = 0x70 Strategy = 0x6B ExpirationPeriod = 0x6D ControlResponse = 0x65 StatusCode = 0x66 StatusText = 0x67 // ForwarderStatus NfdVersion = 0x80 StartTimestamp = 0x81 CurrentTimestamp = 0x82 NNameTreeEntries = 0x83 NFibEntries = 0x84 NPitEntries = 0x85 NMeasurementEntries = 0x86 NCsEntries = 0x87 NInInterests = 0x90 NInData = 0x91 NInNacks = 0x97 NOutInterests = 0x92 NOutData = 0x93 NOutNacks = 0x98 NSatisfiedInterests = 0x99 NUnsatisfiedInterests = 0x9A // FaceMgmt FaceStatus = 0x80 ChannelStatus = 0x82 URIScheme = 0x83 FaceScope = 0x84 FacePersistency = 0x85 LinkType = 0x86 NInBytes = 0x94 NOutBytes = 0x95 FaceQueryFilter = 0x96 FaceEventNotification = 0xC0 FaceEventKind = 0xC1 // FibMgmt FibEntry = 0x80 NextHopRecord = 0x81 // CsMgmt CsInfo = 0x80 NHits = 0x81 NMisses = 0x82 // StrategyMgmt StrategyChoice = 0x80 // MeasurementStatus MeasurementEntry = 0x80 StrategyInfo = 0x81 // RibMgmt RibEntry = 0x80 Route = 0x81 )
TLV types for Management.
const MaxNDNPacketSize = 8800
MaxNDNPacketSize is the maximum allowed NDN packet size
Variables ¶
var ( ErrBufferTooShort = errors.New("TLV length exceeds buffer size") ErrMissingLength = errors.New("missing TLV length") ErrUnexpected = errors.New("unexpected TLV type") ErrUnrecognizedCritical = errors.New("unrecognized critical TLV type") )
TLV errors.
Functions ¶
func DecodeNNIBlock ¶
DecodeNNIBlock decodes a non-negative integer value from a block.
func DecodeTypeLength ¶
DecodeTypeLength decodes the TLV type, TLV length, and total size of the block from a byte slice.
func DecodeVarNum ¶
DecodeVarNum decodes a non-negative integer value from a wire value.
func EncodeVarNum ¶
EncodeVarNum encodes a non-negative integer value for encoding.
func GetNNIBlockSize ¶
GetNNIBlockSize returns the size that a non-negative integer block will take when encoded.
func IsCritical ¶
IsCritical returns whether a TLV type is critical.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block contains an encoded block.
func DecodeBlock ¶
DecodeBlock decodes a block from the wire.
func EncodeNNIBlock ¶
EncodeNNIBlock encodes a non-negative integer value in a block of the specified type.
func NewEmptyBlock ¶
NewEmptyBlock creates an empty encoded block.
func (*Block) Append ¶
Append appends a subelement onto the end of the block's value. this adds a subelement, but then also erases the wire. I assume this is because of the recursive nature of b.wire? Probably a big contributor to runtime.
func (*Block) Erase ¶
Erase erases the first subelement of the specified type and returns whether an element was removed.
func (*Block) EraseAll ¶
EraseAll erases all subelements of the specified type and returns the count of elements removed.
func (*Block) Find ¶
Find returns the first subelement of the specified type, or nil if none exists.
func (*Block) Insert ¶
Insert inserts the subelement in order of ascending TLV type, after any subelements of the same TLV type. Note that this assumes subelements are ordered by increasing TLV type. wonder if insert is even necessary at all
func (*Block) Reset ¶
func (b *Block) Reset()
Reset clears the encoded wire buffer, value, and subelements of the block.
func (*Block) Subelements ¶
Subelements returns the sub-elements of the block.