Miscellaneous packages

ndn.types package

exception ndn.types.InterestCanceled

Raised when an Interest is cancelled due to the loss of connection to NFD.

Note

A very large packet may cause NFD shutting down the connection. More specifically,

  • The face is shutdown.

  • All pending Interests are cancelled with this exception.

  • App.run_forever() returns True.

exception ndn.types.InterestNack(reason)

Raised when receiving a NetworkNack.

Variables

reason (int) – reason for Nack.

exception ndn.types.InterestTimeout

Raised when an Interest times out.

exception ndn.types.NetworkError

Raised when trying to send a packet before connecting to NFD.

ndn.types.Route

An OnInterest callback function for a route.

alias of Callable[[List[Union[bytes, bytearray, memoryview]], ndn.encoding.ndn_format_0_3.InterestParam, Optional[Union[bytes, bytearray, memoryview]]], None]

exception ndn.types.ValidationFailure(name, meta_info, content)

Raised when failing to validate a Data packet.

Variables
  • name (FormalName) – the Name of Data.

  • meta_info (MetaInfo) – the MetaInfo.

  • content (Optional[BinaryStr]) – the Content of Data.

ndn.types.Validator

A validator used to validate an Interest or Data packet.

alias of Callable[[List[Union[bytes, bytearray, memoryview]], ndn.encoding.ndn_format_0_3.SignaturePtrs], Coroutine[Any, None, bool]]

ndn.utils package

ndn.utils.gen_nonce()

Generate a random nonce.

Returns

a random 32-bit unsigned integer.

ndn.utils.gen_nonce_64()

Generate a random 64-bit nonce.

Returns

a random 64-bit unsigned integer.

ndn.utils.timestamp()

Generate a timestamp number.

Returns

the time in milliseconds since the epoch as an integer