-
Notifications
You must be signed in to change notification settings - Fork 26
/
enum.go
135 lines (105 loc) · 3.62 KB
/
enum.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package ndni
/*
#include "../csrc/ndni/packet.h"
*/
import "C"
import (
"crypto/sha256"
"time"
"github.com/usnistgov/ndn-dpdk/ndn"
)
//go:generate go run ../mk/enumgen/ -guard=NDNDPDK_NDNI_ENUM_H -out=../csrc/ndni/enum.h .
//go:generate go run ../mk/enumgen/ -guard=NDNDPDK_NDNI_AN_H -out=../csrc/ndni/an.h ../ndn/an
const (
// LpHeaderHeadroom is the required headroom to prepend NDNLPv2 header.
LpHeaderHeadroom = 0 +
1 + 5 + // LpPacket TL
1 + 1 + 8 + // SeqNum
1 + 1 + 2 + // FragIndex
1 + 1 + 2 + // FragCount
1 + 1 + 8 + // PitToken
3 + 1 + 3 + 1 + 1 + // Nack
3 + 1 + 1 + // CongestionMark
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 + // Interest TL
1 + 3 + NameMaxLength + // Name
InterestTemplateBufLen // other fields
// DataEncNullSigLen is the required tailroom in DataEnc to append NullSignature.
DataEncNullSigLen = 0 +
1 + 1 + 1 + 1 + 1 + // DSigInfo
1 + 1 // DSigValue
// DataGenBufLen is the buffer length for DataGen.
DataGenBufLen = 0 +
1 + 3 + NameMaxLength + // Name suffix
1 + 1 + 1 + 1 + 4 + // MetaInfo with FreshnessPeriod
1 + 3 + 0 + // Content TL
39 // Signature
// DataGenDataroom is the required dataroom to encode Data with DataGen.
DataGenDataroom = 0 +
1 + 5 + // Data TL
1 + 3 + NameMaxLength // Name prefix
_ = "enumgen"
)
func _() {
var x [1]int
x[ndn.DefaultInterestLifetime-(DefaultInterestLifetime*time.Millisecond)] = 0
x[sha256.Size-ImplicitDigestLength] = 0
}
// ParseFor suggests which fields may be skipped by the decoder.
type ParseFor int
// ParseFor values.
const (
ParseForAny ParseFor = iota
ParseForFw
ParseForApp
_ = "enumgen:ParseFor"
)
// PktType indicates packet type in mbuf.
type PktType int
// PktType values.
const (
PktFragment PktType = iota
PktInterest // Interest
PktData // Data
PktNack // Nack
_
PktSInterest // Interest unparsed
PktSData // Data unparsed
PktSNack // Nack unparsed
PktMax = PktNack + 1 // exclusive maximum excluding slim types
_ = "enumgen:PktType"
)
func (t PktType) String() string {
return C.GoString(C.PktType_ToString(C.PktType(t)))
}
// DataSatisfyResult indicates the result of Data.CanSatisfy function.
type DataSatisfyResult int
// DataSatisfyResult values.
const (
DataSatisfyYes DataSatisfyResult = 0 // Data satisfies Interest
DataSatisfyNo DataSatisfyResult = 1 // Data does not satisfy Interest
DataSatisfyNeedDigest DataSatisfyResult = 2 // need Data digest to determine
_ = "enumgen:DataSatisfyResult"
)