Skip to content

Commit 9cd49c3

Browse files
committed
std: document spec methods
1 parent d051628 commit 9cd49c3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

std/ndn/spec_2022/spec.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ func (t *Interest) AppParam() enc.Wire {
221221
return t.ApplicationParameters
222222
}
223223

224+
// MakeData encodes an NDN Data.
224225
func (Spec) MakeData(name enc.Name, config *ndn.DataConfig, content enc.Wire, signer ndn.Signer) (*ndn.EncodedData, error) {
225226
// Create Data packet.
226227
if name == nil {
@@ -314,6 +315,8 @@ func (Spec) MakeData(name enc.Name, config *ndn.DataConfig, content enc.Wire, si
314315
}, nil
315316
}
316317

318+
// ReadData parses a Data from the reader.
319+
// Precondition: reader contains only one TLV.
317320
func (Spec) ReadData(reader enc.WireView) (ndn.Data, enc.Wire, error) {
318321
context := PacketParsingContext{}
319322
context.Init()
@@ -330,6 +333,7 @@ func (Spec) ReadData(reader enc.WireView) (ndn.Data, enc.Wire, error) {
330333
return ret.Data, context.Data_context.sigCovered, nil
331334
}
332335

336+
// MakeInterest encodes an NDN Interest.
333337
func (Spec) MakeInterest(name enc.Name, config *ndn.InterestConfig, appParam enc.Wire, signer ndn.Signer) (*ndn.EncodedInterest, error) {
334338
// Create Interest packet.
335339
if name == nil {
@@ -495,6 +499,8 @@ func checkInterest(val *Interest, context *InterestParsingContext) error {
495499
return nil
496500
}
497501

502+
// ReadInterest parses an Interest from the reader.
503+
// Precondition: reader contains only one TLV.
498504
func (Spec) ReadInterest(reader enc.WireView) (ndn.Interest, enc.Wire, error) {
499505
context := PacketParsingContext{}
500506
context.Init()

0 commit comments

Comments
 (0)