![]() |
Home | Libraries | People | FAQ | More |
boost::asn1::asn_base_t —
class asn_base_t : public boost::asn1::asn_base_type_t { public: // construct/copy/destruct asn_base_t(const primitives_t, const classification_t, const construction_t); asn_base_t(const uint32_t, const classification_t, const construction_t); ~asn_base_t(); // public member functions const bool isValid() ; const bool isIndefinate() const; const classification_t classification() const; const construction_t construction() const; const primitives_t tagid() const; const uint32_t appid() const; const uint32_t appid(const uint32_t) ; const uint32_t tagLength() const; const uint32_t lenLength() const; const uint32_t length() ; const uint32_t length(const uint32_t) ; void assign(const asn_base_ptr &) ; void assign(const asn_base_t *) ; asn_base_t & append(asn_base_t &) ; asn_base_t & append(const asn_base_t &) ; asn_base_t & append(asn_base_ptr &) ; asn_base_t & append(const asn_base_ptr &) ; const size_t count() ; const asn_base_ptr & get(const size_t = 0) ; void setIndefinate(const bool) ; uint32_t accept(asn_visitor_t &) ; asn_base_ptr clone() const; uint32_t encode(asn_visitor_t &) ; uint32_t decode(asn_visitor_t &) ; size_t size_of() ; // protected member functions void calcTagLength() ; const bool setValid(const bool) ; };
ASN1 base data type
OverviewAll ASN1 data objects inherit from the asn_base_t class. The common functionality that the asn_base_t class provides are tag and length storage, visitor interface, and the required interface methods that every derived ASN1 data object must provide, those being the clone(), encode() and decode() methods.
MemoryThe ASN1 library relies heavily on the Boost Smart Pointer Library for pointer storage. The create() and clone() methods return a asn_base_ptr object. This is declared as a typedef:
typedef shared_ptr<asn_base_t> asn_base_ptr;
The asn_base_t class is declared using the Boost shared_ptr template enable_shared_from_this.
ValiditySometimes, data that is stored in an ASN1 type object does not meet the requirements of valid data. For instance, the time objects require a valid date. It is suggested to use the isValid() method prior to encoding data. When data is stored in a ASN1 container, the container inherits it's validity from all the children present. This makes it easier to know if you have a valid packet of data prior to encoding and transmitting it.
VisitorEvery ASN1 object must provide it's own encode() and decode() methods. These methods are used by the asn_visitor_t objects that execute the encoding and decoding of ASN1 data packets. [NOT COMPLETE]
asn_base_t construct/copy/destructasn_base_t(const primitives_t primitive, const classification_t classification, const construction_t construction);
Consructor for building a primitive ASN1 object.
asn_base_t(const uint32_t appid, const classification_t classification, const construction_t construction);
Constructor for building a application ASN1 object.
~asn_base_t();
asn_base_t public member functionsconst bool isValid() ;
Gets whether the ASN1 object is valid
const bool isIndefinate() const;
Gets whether the ASN1 object has an indefinate length.
const classification_t classification() const;
Gets the classification of the ASN1 object.
const construction_t construction() const;
Gets the construction type of the ASN1 object.
const primitives_t tagid() const;
Gets the primitive type of the ASN1 object.
const uint32_t appid() const;
Gets the application ID of the ASN1 object.
const uint32_t appid(const uint32_t appid) ;
Sets the application ID of the ASN1 object.
const uint32_t tagLength() const;
Gets the length of the tag field for the ASN1 object.
const uint32_t lenLength() const;
Gets the length of the len field for the ASN1 object.
const uint32_t length() ;
Gets the length of the payload for the ASN1 object
const uint32_t length(const uint32_t v) ;
Sets the length of the payload for the ASN1 object
void assign(const asn_base_ptr & asn_object) ;
| Parameters: |
|
void assign(const asn_base_t * asn_object) ;
| Parameters: |
|
asn_base_t & append(asn_base_t & v) ;
Appends an asn_base_t& object to a ASN1 object. This functionality is only used for ASN1 container objects.
| Parameters: |
|
asn_base_t & append(const asn_base_t & v) ;
Appends an asn_base_t& object to a ASN1 object. This functionality is only used for ASN1 container objects.
| Parameters: |
|
asn_base_t & append(asn_base_ptr & v) ;
Appends an asn_base_ptr& object to a ASN1 object. This functionality is only used for ASN1 container objects.
| Parameters: |
|
asn_base_t & append(const asn_base_ptr & v) ;
Appends an asn_base_ptr& object to a ASN1 object. This functionality is only used for ASN1 container objects.
| Parameters: |
|
const size_t count() ;
Gets the number of ASN1 objects added to this ASN1 object.
const asn_base_ptr & get(const size_t element = 0) ;
Gets a asn_base_t* from the ASN1 objects added to this ASN1 object.
| Parameters: |
|
void setIndefinate(const bool v) ;
Sets whether this ASN1 object is using the indefinate length form.
uint32_t accept(asn_visitor_t & visitor) ;
| Parameters: |
|
||
| Returns: | Number of bytes visited. |
asn_base_ptr clone() const;
Clone an ASN1 object
All derived classes must support the clone member function. This is used to copy construct a ASN1 object.
| Returns: | An asn_base_ptr with the appropriate subclassed object |
uint32_t encode(asn_visitor_t & visitor) ;
Encodes a ASN1 object.
All derived classes must support the encode member function. This function will encode the ASN1 object using the proper encoding method specified by the ASN1 standard.
| Parameters: |
|
||
| Returns: | The number of bytes used to encode the ASN1 object's data |
uint32_t decode(asn_visitor_t & visitor) ;
Decodes a ASN1 object.
All derived classes must support the decode member function. This function will decode the ASN1 object using the proper decoding method specified by the ASN1 standard.
| Parameters: |
|
||
| Returns: | The number of bytes used to decode the ASN1 object's data |
size_t size_of() ;
Gets the size of the ASN1 object
Returns the size of the ASN1 class object sizeof(ASN1)
| Copyright © 2007 Andreas Haberstroh |