|
ndn-embeds 0.1.0
Lightweight NDN protocol stack for embedded systems
|
Common definitions for the NDN protocol stack. More...
#include <array>#include <cstddef>#include <cstdint>#include <optional>#include <string_view>Go to the source code of this file.
Classes | |
| struct | ndn::Result< T > |
| Result type template. More... | |
Typedefs | |
| using | ndn::FaceId = uint16_t |
| Face identifier. | |
| using | ndn::TimeMs = uint64_t |
| Timestamp type (milliseconds) | |
Enumerations | |
| enum class | ndn::Error : uint8_t { Success = 0 , InvalidParam , BufferTooSmall , DecodeFailed , NotFound , NoMemory , Full , Timeout , SendFailed , InvalidPacket , NameTooLong , TooManyComponents } |
| Error codes. More... | |
| enum class | ndn::ContentType : uint8_t { Blob = 0 , Link = 1 , Key = 2 , Nack = 3 } |
| Content type. More... | |
Functions | |
| constexpr const char * | ndn::errorToString (Error error) |
| Convert error code to string. | |
| TimeMs | ndn::currentTimeMs () |
| Get current time (milliseconds) | |
| uint32_t | ndn::generateRandomNonce () |
| Generate a random Nonce value. | |
Variables | |
| constexpr size_t | ndn::LINK_MAX_DELEGATIONS = 5 |
| Maximum number of Names in a Link. | |
| constexpr FaceId | ndn::FACE_ID_INVALID = 0 |
| Invalid Face ID. | |
| constexpr FaceId | ndn::FACE_ID_LOCAL = 1 |
| Face ID for local application. | |
| constexpr size_t | ndn::NAME_MAX_LENGTH = 128 |
| Maximum Name length (bytes) | |
| constexpr size_t | ndn::NAME_MAX_COMPONENTS = 10 |
| Maximum number of Name components. | |
| constexpr size_t | ndn::DATA_MAX_CONTENT_SIZE = 1440 |
| Maximum content size of a Data packet (bytes) ESP-NOW v2.0: max 1470 bytes - TLV overhead (approx. | |
| constexpr size_t | ndn::PACKET_MAX_SIZE = 1470 |
| Maximum packet size (ESP-NOW v2.0 compatible) | |
| constexpr uint32_t | ndn::INTEREST_DEFAULT_LIFETIME_MS = 4000 |
| Default Interest lifetime (milliseconds) | |
Common definitions for the NDN protocol stack.
Provides fundamental types and definitions used throughout the NDN library, including error codes, constants, and the Result type.
Definition in file common.hpp.
| using ndn::FaceId = typedef uint16_t |
Face identifier.
A 16-bit integer that uniquely identifies each Face.
Definition at line 96 of file common.hpp.
| using ndn::TimeMs = typedef uint64_t |
Timestamp type (milliseconds)
Definition at line 107 of file common.hpp.
|
strong |
Content type.
Represents the content type of a Data packet.
| Enumerator | |
|---|---|
| Blob | Binary data (default) |
| Link | Link Object (list of Names for forwarding hints) |
| Key | Public key. |
| Nack | Network NACK. |
Definition at line 81 of file common.hpp.
|
strong |
Error codes.
Represents errors that may occur in NDN library operations.
| Enumerator | |
|---|---|
| Success | Success. |
| InvalidParam | Invalid parameter. |
| BufferTooSmall | Buffer too small. |
| DecodeFailed | Decode failed. |
| NotFound | Not found. |
| NoMemory | Out of memory. |
| Full | Table is full. |
| Timeout | Timeout. |
| SendFailed | Send failed. |
| InvalidPacket | Invalid packet. |
| NameTooLong | Name is too long. |
| TooManyComponents | Too many components. |
Definition at line 24 of file common.hpp.
| TimeMs ndn::currentTimeMs | ( | ) |
Get current time (milliseconds)
Definition at line 7 of file common.cpp.
References ndn::currentTimeMs().
Referenced by ndn::EspNowFace::addPeer(), ndn::currentTimeMs(), ndn::Pit::insert(), ndn::Forwarder::processEvents(), ndn::Forwarder::putData(), ndn::Interest::signWithDigestSha256(), ndn::Interest::signWithEcdsa(), and ndn::Interest::signWithHmac().
|
constexpr |
Convert error code to string.
| error | Error code |
Definition at line 44 of file common.hpp.
References ndn::errorToString().
Referenced by ndn::errorToString().
| uint32_t ndn::generateRandomNonce | ( | ) |
Generate a random Nonce value.
Definition at line 11 of file common.cpp.
References ndn::generateRandomNonce().
Referenced by ndn::Interest::generateNonce(), and ndn::generateRandomNonce().
|
constexpr |
Maximum content size of a Data packet (bytes) ESP-NOW v2.0: max 1470 bytes - TLV overhead (approx.
30-40 bytes) Measured: max 1434 bytes with /ndn/ping/<seq>
Definition at line 119 of file common.hpp.
Referenced by ndn::Data::fromWire(), ndn::Data::setContent(), and ndn::Link::toData().
|
constexpr |
Invalid Face ID.
Definition at line 99 of file common.hpp.
Referenced by ndn::Forwarder::addFace(), ndn::EspNowFace::addPeer(), and ndn::PitEntry::face().
|
constexpr |
Face ID for local application.
Definition at line 102 of file common.hpp.
Referenced by ndn::Forwarder::expressInterest(), ndn::Forwarder::registerPrefix(), ndn::Forwarder::sendInterest(), and ndn::Forwarder::unregisterPrefix().
|
constexpr |
Default Interest lifetime (milliseconds)
Definition at line 125 of file common.hpp.
Referenced by ndn::Interest::encode().
|
constexpr |
Maximum number of Names in a Link.
Definition at line 89 of file common.hpp.
Referenced by ndn::Link::addDelegation().
|
constexpr |
Maximum number of Name components.
Definition at line 113 of file common.hpp.
|
constexpr |
Maximum Name length (bytes)
Definition at line 110 of file common.hpp.
Referenced by ndn::Name::fromUri().
|
constexpr |
Maximum packet size (ESP-NOW v2.0 compatible)
Definition at line 122 of file common.hpp.
Referenced by ndn::Certificate::encode(), ndn::Data::encode(), ndn::Interest::encode(), ndn::Certificate::signWithDigestSha256(), ndn::Data::signWithDigestSha256(), ndn::Interest::signWithDigestSha256(), ndn::Data::signWithEcdsa(), ndn::Interest::signWithEcdsa(), ndn::Certificate::signWithHmac(), ndn::Data::signWithHmac(), ndn::Interest::signWithHmac(), ndn::Certificate::verifyDigestSha256(), ndn::Data::verifyDigestSha256(), ndn::Interest::verifyDigestSha256(), ndn::Data::verifyEcdsa(), ndn::Interest::verifyEcdsa(), ndn::Certificate::verifyHmac(), ndn::Data::verifyHmac(), and ndn::Interest::verifyHmac().