Documentation ¶
Overview ¶
Package ndni implements NDN layer 2 and layer 3 packet representations for internal use.
Index ¶
- Constants
- Variables
- type DataGen
- type DataGenConfig
- type DataSatisfyResult
- type InterestTemplate
- type InterestTemplateConfig
- type LNamePrefixFilterBuilder
- type Mempools
- type PName
- type Packet
- func (pkt *Packet) Clone(mp *Mempools, align PacketTxAlign) *Packet
- func (pkt *Packet) Close() error
- func (pkt *Packet) ComputeDataImplicitDigest() []byte
- func (pkt *Packet) Mbuf() *pktmbuf.Packet
- func (pkt *Packet) PName() *PName
- func (pkt *Packet) PitToken() (token []byte)
- func (pkt *Packet) Ptr() unsafe.Pointer
- func (pkt *Packet) SetPitToken(token []byte)
- func (pkt *Packet) ToNPacket() (npkt ndn.Packet)
- func (pkt *Packet) Type() PktType
- type ParseFor
- type PktType
Constants ¶
const ( // LpHeaderHeadroom is the required headroom to prepend NDNLPv2 header. LpHeaderHeadroom = 0 + 1 + 5 + 1 + 1 + 8 + 1 + 1 + 2 + 1 + 1 + 2 + 1 + 1 + 8 + 3 + 1 + 3 + 1 + 1 + 3 + 1 + 1 + 1 + 5 // Payload TL // LpMaxFragments is the maximum number of NDNLPv2 fragments. LpMaxFragments = 31 // L3TypeLengthHeadroom is the required headroom to prepend Interest/Data TLV-TYPE TLV-LENGTH fields. L3TypeLengthHeadroom = 1 + 3 // NameMaxLength is the maximum TLV-LENGTH for Name. NameMaxLength = 2048 // ImplicitDigestLength is the TLV-LENGTH of ImplicitDigestNameComponent. ImplicitDigestLength = 32 // ImplicitDigestSize is size of ImplicitDigestNameComponent TLV. ImplicitDigestSize = 34 // PNameCachedComponents is the number of cached component boundaries and hashes in PName struct. PNameCachedComponents = 17 // PInterestMaxFwHints is the maximum number of decoded forwarding hints on Interest. // Additional forwarding hints are ignored. PInterestMaxFwHints = 4 // DefaultInterestLifetime is the default value of InterestLifetime. DefaultInterestLifetime = 4000 // InterestTemplateBufLen is the buffer length for InterestTemplate. // It can accommodate two forwarding hints. InterestTemplateBufLen = 2*NameMaxLength + 256 // InterestTemplateDataroom is the required dataroom to encode Interest with InterestTemplate. InterestTemplateDataroom = 0 + 1 + 5 + 1 + 3 + NameMaxLength + InterestTemplateBufLen // other fields // DataEncNullSigLen is the required tailroom in DataEnc to append NullSignature. DataEncNullSigLen = 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 // DSigValue // DataGenBufLen is the buffer length for DataGen. DataGenBufLen = 0 + 1 + 3 + NameMaxLength + 1 + 1 + 1 + 1 + 4 + 1 + 3 + 0 + 39 // Signature // DataGenDataroom is the required dataroom to encode Data with DataGen. DataGenDataroom = 0 + 1 + 5 + 1 + 3 + NameMaxLength // Name prefix )
Variables ¶
var ( GqlNameType *graphql.Scalar GqlInterestTemplateInput *graphql.InputObject GqlInterestTemplateFieldTypes gqlserver.FieldTypes GqlDataGenInput *graphql.InputObject )
GraphQL types.
var ( // PacketMempool is a mempool template for receiving packets. // This is an alias of pktmbuf.Direct. PacketMempool pktmbuf.Template // IndirectMempool is a mempool template for referencing buffers. // This is an alias of pktmbuf.Indirect. IndirectMempool pktmbuf.Template // HeaderMempool is a mempool template for packet headers. // This includes T-L portion of an L3 packet, NDNLP header, and Ethernet header. // It is also used for Interest guiders. HeaderMempool pktmbuf.Template // InterestMempool is a mempool template for encoding Interests. InterestMempool pktmbuf.Template // DataMempool is a mempool template for encoding Data headers. DataMempool pktmbuf.Template // PayloadMempool is a mempool template for encoding Data payload. PayloadMempool pktmbuf.Template )
Predefined mempool templates.
Functions ¶
This section is empty.
Types ¶
type DataGen ¶
DataGen is a Data encoder optimized for traffic generator.
func DataGenFromPtr ¶
DataGenFromPtr converts *C.DataGen pointer to DataGen.
func (*DataGen) Init ¶
Init initializes a DataGen. m is a pktmbuf with at least DataGenBufLen + len(content) buffer size; it can be allocated from PayloadMempool. Arguments should be acceptable to ndn.MakeData. Name (used as name suffix), MetaInfo, and Content are saved; other fields are skipped. Panics on error.
type DataGenConfig ¶
type DataGenConfig struct { Suffix ndn.Name `json:"suffix,omitempty"` FreshnessPeriod nnduration.Milliseconds `json:"freshnessPeriod,omitempty"` PayloadLen int `json:"payloadLen,omitempty"` }
DataGenConfig is a JSON serializable object that can construct DataGen.
type DataSatisfyResult ¶
type DataSatisfyResult int
DataSatisfyResult indicates the result of Data.CanSatisfy function.
const ( DataSatisfyYes DataSatisfyResult = 0 // Data satisfies Interest DataSatisfyNo DataSatisfyResult = 1 // Data does not satisfy Interest DataSatisfyNeedDigest DataSatisfyResult = 2 // need Data digest to determine )
DataSatisfyResult values.
type InterestTemplate ¶
type InterestTemplate C.InterestTemplate
InterestTemplate is a template for Interest encoding. A zero InterestTemplate is invalid. It must be initialized before use.
func InterestTemplateFromPtr ¶
func InterestTemplateFromPtr(ptr unsafe.Pointer) *InterestTemplate
InterestTemplateFromPtr converts *C.InterestTemplate to InterestTemplate.
func (*InterestTemplate) Init ¶
func (tpl *InterestTemplate) Init(args ...any)
Init initializes InterestTemplate. Arguments should be acceptable to ndn.MakeInterest. Name is used as name prefix. Panics on error.
type InterestTemplateConfig ¶
type InterestTemplateConfig struct { Prefix ndn.Name `json:"prefix"` CanBePrefix bool `json:"canBePrefix,omitempty"` MustBeFresh bool `json:"mustBeFresh,omitempty"` InterestLifetime nnduration.Milliseconds `json:"interestLifetime,omitempty"` HopLimit ndn.HopLimit `json:"hopLimit,omitempty"` }
InterestTemplateConfig is a JSON serializable object that can construct InterestTemplate.
func (InterestTemplateConfig) Apply ¶
func (cfg InterestTemplateConfig) Apply(tpl *InterestTemplate)
Apply initializes InterestTemplate.
type LNamePrefixFilterBuilder ¶
type LNamePrefixFilterBuilder struct {
// contains filtered or unexported fields
}
LNamePrefixFilterBuilder prepares vector for C.LNamePrefixFilter_Find.
func NewLNamePrefixFilterBuilder ¶
func NewLNamePrefixFilterBuilder(prefixL unsafe.Pointer, sizeL uintptr, prefixV unsafe.Pointer, sizeV uintptr) (b *LNamePrefixFilterBuilder)
NewLNamePrefixFilterBuilder constructs LNamePrefixFilterBuilder.
func (*LNamePrefixFilterBuilder) Append ¶
func (b *LNamePrefixFilterBuilder) Append(name ndn.Name) error
Append adds a name.
func (*LNamePrefixFilterBuilder) Len ¶
func (b *LNamePrefixFilterBuilder) Len() int
Len returns number of prefixes added.
type Mempools ¶
type Mempools C.PacketMempools
Mempools is a set of mempools for packet modification.
type Packet ¶
Packet represents a NDN network layer packet with parsed LP and Interest/Data headers.
func PacketFromPtr ¶
PacketFromPtr converts *C.Packet or *C.struct_rte_mbuf pointer to Packet.
func (*Packet) Clone ¶
Clone clones this packet to new mbufs, with specified alignment requirement. Returns nil upon allocation error.
func (*Packet) ComputeDataImplicitDigest ¶
ComputeDataImplicitDigest computes and stores implicit digest in *C.PData. Panics on non-Data.
func (*Packet) SetPitToken ¶
SetPitToken updates the PIT token.
type PktType ¶
type PktType int
PktType indicates packet type in mbuf.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ndnitestenv contains helper functions to construct NDN packets in test code.
|
Package ndnitestenv contains helper functions to construct NDN packets in test code. |