本文整理汇总了Python中pyndn.interest.Interest.setLinkWireEncoding方法的典型用法代码示例。如果您正苦于以下问题:Python Interest.setLinkWireEncoding方法的具体用法?Python Interest.setLinkWireEncoding怎么用?Python Interest.setLinkWireEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyndn.interest.Interest
的用法示例。
在下文中一共展示了Interest.setLinkWireEncoding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _sendKeyInterest
# 需要导入模块: from pyndn.interest import Interest [as 别名]
# 或者: from pyndn.interest.Interest import setLinkWireEncoding [as 别名]
def _sendKeyInterest(self, interest, timeSlot, onEncryptedKeys, onError):
"""
Send an interest with the given name through the face with callbacks to
_handleCoveringKey, _handleTimeout and _handleNetworkNack.
:param Interest interest: The interest to send.
:param float timeSlot: The time slot, passed to _handleCoveringKey,
_handleTimeout and _handleNetworkNack.
:param onEncryptedKeys: The OnEncryptedKeys callback, passed to
_handleCoveringKey, _handleTimeout and _handleNetworkNack.
:type onEncryptedKeys: function object
:param onError: This calls onError(errorCode, message) for an error.
:type onError: function object
"""
def onKey(interest, data):
self._handleCoveringKey(interest, data, timeSlot, onEncryptedKeys, onError)
def onTimeout(interest):
self._handleTimeout(interest, timeSlot, onEncryptedKeys, onError)
def onNetworkNack(interest, networkNack):
self._handleNetworkNack(interest, networkNack, timeSlot, onEncryptedKeys, onError)
if self._keyRetrievalLink.getDelegations().size() == 0:
# We can use the supplied interest without copying.
request = interest
else:
# Copy the supplied interest and add the Link.
request = Interest(interest)
# This will use a cached encoding if available.
request.setLinkWireEncoding(self._keyRetrievalLink.wireEncode())
self._face.expressInterest(request, onKey, onTimeout, onNetworkNack)