DerNode implements the DER node types used in encoding/decoding DER-formatted data.
More...
#include <der-node.hpp>
|
static ptr_lib::shared_ptr
< DerNode > | parse (const uint8_t *inputBuf, size_t inputBufLength, size_t startIdx=0) |
| | Parse the data from the input buffer recursively and return the root as an object of a subclass of DerNode. More...
|
| |
static ptr_lib::shared_ptr
< DerNode > | parse (const Blob &input, size_t startIdx=0) |
| |
static ptr_lib::shared_ptr
< DerNode > | parse (const std::vector< uint8_t > &input, size_t startIdx=0) |
| |
| static DerNode::DerSequence & | getSequence (const std::vector< ptr_lib::shared_ptr< DerNode > > &children, size_t index) |
| | Check that index is in bounds for the children list, cast children[index] to DerSequence and return it. More...
|
| |
|
| | DerNode (DerNodeType nodeType) |
| | Create a generic DER node with the given nodeType. More...
|
| |
| void | encodeHeader (size_t size) |
| | Encode the given size and update the header. More...
|
| |
| size_t | decodeHeader (const uint8_t *inputBuf, size_t inputBufLength, size_t startIdx) |
| | Extract the header from an input buffer and return the size. More...
|
| |
| virtual void | decode (const uint8_t *inputBuf, size_t inputBufLength, size_t startIdx) |
| | Decode and store the data from an input buffer. More...
|
| |
| void | payloadAppend (const uint8_t *value, size_t valueLength) |
| | Call payload_.copy to copy value into payload_ at payloadPosition_. More...
|
| |
DerNode implements the DER node types used in encoding/decoding DER-formatted data.
Create a generic DER node with the given nodeType.
This is a private constructor used by one of the public DerNode subclasses defined below.
- Parameters
-
| nodeType | The DER node type. |
| void ndn::DerNode::decode |
( |
const uint8_t * |
inputBuf, |
|
|
size_t |
inputBufLength, |
|
|
size_t |
startIdx |
|
) |
| |
|
protectedvirtual |
Decode and store the data from an input buffer.
- Parameters
-
| inputBuf | The input buffer to read from. This reads from startIdx. |
| startIdx | The offset into the buffer. |
Reimplemented in ndn::DerNode::DerStructure.
| size_t ndn::DerNode::decodeHeader |
( |
const uint8_t * |
inputBuf, |
|
|
size_t |
inputBufLength, |
|
|
size_t |
startIdx |
|
) |
| |
|
protected |
Extract the header from an input buffer and return the size.
- Parameters
-
| inputBuf | The input buffer to read from. |
| startIdx | The offset into the buffer. |
- Returns
- The parsed size in the header.
| Blob ndn::DerNode::encode |
( |
| ) |
|
|
virtual |
| void ndn::DerNode::encodeHeader |
( |
size_t |
size | ) |
|
|
protected |
Encode the given size and update the header.
- Parameters
-
| size | The size to encode in the header. |
| const std::vector< ptr_lib::shared_ptr< DerNode > > & ndn::DerNode::getChildren |
( |
| ) |
|
|
virtual |
If this object is a DerSequence, get the children of this node.
Otherwise, throw an exception. (DerSequence overrides to implement this method.)
- Returns
- The children as an array of shared_ptr<DerNode>.
- Exceptions
-
Reimplemented in ndn::DerNode::DerStructure.
| Blob ndn::DerNode::getPayload |
( |
| ) |
|
|
inline |
Get a copy of the payload bytes.
- Returns
- A copy of the payload.
Check that index is in bounds for the children list, cast children[index] to DerSequence and return it.
- Parameters
-
| children | The list of DerNode, usually returned by another call to getChildren. |
| index | The index of the children. |
- Returns
- children[index] cast to DerSequence.
- Exceptions
-
| ptr_lib::shared_ptr< DerNode > ndn::DerNode::parse |
( |
const uint8_t * |
inputBuf, |
|
|
size_t |
inputBufLength, |
|
|
size_t |
startIdx = 0 |
|
) |
| |
|
static |
Parse the data from the input buffer recursively and return the root as an object of a subclass of DerNode.
- Parameters
-
| inputBuf | The input buffer to read from. This reads from startIdx. |
| inputBufLength | The number of bytes in the input buffer. |
| startIdx | (optional) The offset into the buffer. If omitted, use 0. |
- Returns
- A shared_ptr for an object of a subclass of DerNode.
| void ndn::DerNode::payloadAppend |
( |
const uint8_t * |
value, |
|
|
size_t |
valueLength |
|
) |
| |
|
inlineprotected |
Call payload_.copy to copy value into payload_ at payloadPosition_.
Update payloadPosition_.
- Parameters
-
| value | The buffer to copy from. |
| valueLength | The length of the value buffer. |
| Blob ndn::DerNode::toVal |
( |
| ) |
|
|
virtual |
The documentation for this class was generated from the following files: