forked from named-data/PyCCN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interest.py
32 lines (27 loc) · 824 Bytes
/
interest.py
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
from pyccn import Interest, Name, Key, CCN, _pyccn
import datetime
k = CCN.getDefaultKey()
i = Interest()
i.name = Name('/hello/world')
i.minSuffixComponents = 2
i.maxSuffixComponents = 4
i.publisherPublicKeyDigest = k.publicKeyID
i.exclude = None
i.childSelector = 1
i.answerOriginKind = 4
i.scope = 2
i.interestLifetime = 30.0
i.nonce = b'abababa'
print(i)
print(i.ccn_data)
i2 = _pyccn.Interest_obj_from_ccn(i.ccn_data)
print(i2)
assert(i.name == i2.name)
assert(i.minSuffixComponents == i2.minSuffixComponents)
assert(i.maxSuffixComponents == i2.maxSuffixComponents)
assert(i.publisherPublicKeyDigest == i2.publisherPublicKeyDigest)
assert(i.exclude == i2.exclude)
assert(i.childSelector == i2.childSelector)
assert(i.scope == i2.scope)
assert(i.interestLifetime == i2.interestLifetime)
assert(i.nonce == i2.nonce)