LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
logicalaccess::TLV Class Reference

#include <tlv.hpp>

Public Member Functions

 TLV (uint8_t t)
 
virtual ~TLV ()=default
 
 TLV (const TLV &)=delete
 
 TLV (TLV &&)=delete
 
TLVoperator= (const TLV &)=delete
 
TLVoperator= (TLV &&)=delete
 
uint8_t tag () const
 
void tag (uint8_t t)
 
ByteVector value () const
 
uint8_t value_u1 () const
 
void value (bool v)
 
void value (unsigned char v)
 
void value (const ByteVector &v)
 
void value (TLVPtr tlv)
 
void value (std::vector< TLVPtr > tlv)
 
ByteVector compute () const
 
TLVPtr get_child (uint8_t tag) const
 
std::vector< TLVPtrget_childs () const
 
uint8_t getSizeTag () const
 
void setSizeTag (uint8_t tag)
 
ByteVector getSizeVector () const
 
void setSizeVector (ByteVector size)
 
ByteVector getCompletTLV () const
 

Static Public Member Functions

static TLVPtr get_child (std::vector< TLVPtr > tlvs, uint8_t tag, bool required=true)
 
static std::vector< TLVPtrparse_tlvs (const ByteVector &bytes, size_t &bytes_consumed)
 
static std::vector< TLVPtrparse_tlvs (const ByteVector &bytes, bool strict=false)
 
static ByteVector value_tlvs (std::vector< TLVPtr > tlvs)
 

Private Attributes

ByteVector sizeVector_
 
uint8_t tag_
 
uint8_t sizeTag_
 
ByteVector value_
 
std::vector< TLVPtrsubTLVs_
 

Detailed Description

This is a helper that represents TLV (tag, length, value) datatype.

A few specifications:

A TLV's value can be an other TLV. This scheme is supported.

Constructor & Destructor Documentation

◆ TLV() [1/3]

logicalaccess::TLV::TLV ( uint8_t  t)
explicit

Construct a TLV and specify the tag.

◆ ~TLV()

virtual logicalaccess::TLV::~TLV ( )
virtualdefault

◆ TLV() [2/3]

logicalaccess::TLV::TLV ( const TLV )
delete

◆ TLV() [3/3]

logicalaccess::TLV::TLV ( TLV &&  )
delete

Member Function Documentation

◆ compute()

ByteVector logicalaccess::TLV::compute ( ) const

Return a raw representation of this TLV.

◆ get_child() [1/2]

TLVPtr logicalaccess::TLV::get_child ( std::vector< TLVPtr tlvs,
uint8_t  tag,
bool  required = true 
)
static

◆ get_child() [2/2]

TLVPtr logicalaccess::TLV::get_child ( uint8_t  tag) const

◆ get_childs()

std::vector< TLVPtr > logicalaccess::TLV::get_childs ( ) const

◆ getCompletTLV()

ByteVector logicalaccess::TLV::getCompletTLV ( ) const

◆ getSizeTag()

uint8_t logicalaccess::TLV::getSizeTag ( ) const

◆ getSizeVector()

ByteVector logicalaccess::TLV::getSizeVector ( ) const

◆ operator=() [1/2]

TLV & logicalaccess::TLV::operator= ( const TLV )
delete

◆ operator=() [2/2]

TLV & logicalaccess::TLV::operator= ( TLV &&  )
delete

◆ parse_tlvs() [1/2]

std::vector< TLVPtr > logicalaccess::TLV::parse_tlvs ( const ByteVector bytes,
bool  strict = false 
)
static

◆ parse_tlvs() [2/2]

std::vector< TLVPtr > logicalaccess::TLV::parse_tlvs ( const ByteVector bytes,
size_t &  bytes_consumed 
)
static

◆ setSizeTag()

void logicalaccess::TLV::setSizeTag ( uint8_t  tag)

◆ setSizeVector()

void logicalaccess::TLV::setSizeVector ( ByteVector  size)

◆ tag() [1/2]

uint8_t logicalaccess::TLV::tag ( ) const

◆ tag() [2/2]

void logicalaccess::TLV::tag ( uint8_t  t)

◆ value() [1/6]

ByteVector logicalaccess::TLV::value ( ) const

Return a copy of the "value" of this TLV. If this TLV wraps an other TLV, returns the compute() version of the sub TLV.

◆ value() [2/6]

void logicalaccess::TLV::value ( bool  v)

Set the value.

◆ value() [3/6]

void logicalaccess::TLV::value ( const ByteVector v)

Set the value.

◆ value() [4/6]

void logicalaccess::TLV::value ( std::vector< TLVPtr tlv)

Set the value.

◆ value() [5/6]

void logicalaccess::TLV::value ( TLVPtr  tlv)

Set an other TLV as the value of this TLV.

Parameters
tlvthe other TLV. Must not be NULL. Will not be copied.

◆ value() [6/6]

void logicalaccess::TLV::value ( unsigned char  v)

Set the value.

◆ value_tlvs()

ByteVector logicalaccess::TLV::value_tlvs ( std::vector< TLVPtr tlvs)
static

◆ value_u1()

uint8_t logicalaccess::TLV::value_u1 ( ) const

Return the "value" of this TLV as uint8_t. Throw if the value size is not exactly one byte.

Member Data Documentation

◆ sizeTag_

uint8_t logicalaccess::TLV::sizeTag_
private

◆ sizeVector_

ByteVector logicalaccess::TLV::sizeVector_
private

◆ subTLVs_

std::vector<TLVPtr> logicalaccess::TLV::subTLVs_
private

◆ tag_

uint8_t logicalaccess::TLV::tag_
private

◆ value_

ByteVector logicalaccess::TLV::value_
private

The documentation for this class was generated from the following files: