DerNode implements the DER node types used in encoding/decoding DER-formatted data. More...
#include <der-node.hpp>
Classes | |
| class | DerBitString |
| A DerBitString extends DerNode to handle a bit string. More... | |
| class | DerBoolean |
| DerBoolean extends DerNode to encode a boolean value. More... | |
| class | DerByteString |
| A DerByteString extends DerNode to handle byte strings. More... | |
| class | DerGeneralizedTime |
| A DerGeneralizedTime extends DerNode to represent a date and time, with millisecond accuracy. More... | |
| class | DerInteger |
| DerInteger extends DerNode to encode an integer value. More... | |
| class | DerNull |
| A DerNull extends DerNode to encode a null value. More... | |
| class | DerOctetString |
| DerOctetString extends DerByteString to encode a string of bytes. More... | |
| class | DerOid |
| A DerOid extends DerNode to represent an object identifier. More... | |
| class | DerPrintableString |
| A DerPrintableString extends DerByteString to handle a a printable string. More... | |
| class | DerSequence |
| class | DerStructure |
| A DerStructure extends DerNode to hold other DerNodes. More... | |
Public Member Functions | |
| virtual size_t | getSize () |
| virtual Blob | encode () |
| Get the raw data encoding for this node. More... | |
| virtual Blob | toVal () |
| Convert the encoded data to a standard representation. More... | |
| virtual const std::vector< ptr_lib::shared_ptr< DerNode > > & | getChildren () |
| If this object is a DerSequence, get the children of this node. More... | |
Static Public Member Functions | |
| static ptr_lib::shared_ptr< DerNode > | parse (const uint8_t *inputBuf, 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 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... | |
Protected Member Functions | |
| 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 startIdx) |
| Extract the header from an input buffer and return the size. More... | |
| virtual void | decode (const uint8_t *inputBuf, 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... | |
Protected Attributes | |
| DerStructure * | parent_ |
| DerNodeType | nodeType_ |
| std::vector< uint8_t > | header_ |
| DynamicUInt8Vector | payload_ |
| size_t | payloadPosition_ |
DerNode implements the DER node types used in encoding/decoding DER-formatted data.
|
inlineprotected |
Create a generic DER node with the given nodeType.
This is a private constructor used by one of the public DerNode subclasses defined below.
| nodeType | The DER node type. |
|
protectedvirtual |
Decode and store the data from an input buffer.
| inputBuf | The input buffer to read from. This reads from startIdx. |
| startIdx | The offset into the buffer. |
Reimplemented in ndn::DerNode::DerStructure.
|
protected |
Extract the header from an input buffer and return the size.
| inputBuf | The input buffer to read from. |
| startIdx | The offset into the buffer. |
|
virtual |
Get the raw data encoding for this node.
Reimplemented in ndn::DerNode::DerStructure.
|
protected |
Encode the given size and update the header.
| size | The size to encode in the header. |
|
virtual |
If this object is a DerSequence, get the children of this node.
Otherwise, throw an exception. (DerSequence overrides to implement this method.)
| DerDecodingException | if this object is not a DerSequence. |
Reimplemented in ndn::DerNode::DerStructure.
|
static |
Check that index is in bounds for the children list, cast children[index] to DerSequence and return it.
| children | The list of DerNode, usually returned by another call to getChildren. |
| index | The index of the children. |
| DerDecodingException | if index is out of bounds or if children[index] is not a DerSequence. |
|
static |
Parse the data from the input buffer recursively and return the root as an object of a subclass of DerNode.
| inputBuf | The input buffer to read from. This reads from startIdx. |
| startIdx | (optional) The offset into the buffer. If omitted, use 0. |
|
inlineprotected |
Call payload_.copy to copy value into payload_ at payloadPosition_.
Update payloadPosition_.
| value | The buffer to copy from. |
| valueLength | The length of the value buffer. |
|
virtual |
Convert the encoded data to a standard representation.
Overridden by some subclasses (e.g. DerBoolean).
Reimplemented in ndn::DerNode::DerOid, and ndn::DerNode::DerByteString.
1.8.9.1