ASN1C C/C++ Common Runtime
ASN1C v7.8.x
|
#include <ASN1CBitStr.h>
Public Member Functions | |
EXTRTMETHOD | ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSSIZE nbits) |
EXTRTMETHOD | ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSOCTET *bitStr, OSUINT32 &numbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0) |
EXTRTMETHOD | ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSOCTET *bitStr, OSUINT8 &numbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0) |
EXTRTMETHOD | ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSOCTET *bitStr, OSUINT16 &numbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0) |
EXTRTMETHOD | ASN1CBitStr (OSRTMessageBufferIF &msgbuf, OSOCTET *bitStr, OSSIZE maxNumbits_) |
EXTRTMETHOD | ASN1CBitStr (OSRTMessageBufferIF &msgBuf, ASN1TDynBitStr &bitStr) |
EXTRTMETHOD | ASN1CBitStr (OSRTMessageBufferIF &msgBuf, ASN1TDynBitStr64 &bitStr) |
EXTRTMETHOD | ASN1CBitStr (OSRTContext &ctxt, OSSIZE nbits) |
EXTRTMETHOD | ASN1CBitStr (OSRTContext &ctxt, OSOCTET *bitStr, OSUINT32 &octsNumbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0) |
EXTRTMETHOD | ASN1CBitStr (OSRTContext &ctxt, OSOCTET *bitStr, OSUINT8 &octsNumbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0) |
EXTRTMETHOD | ASN1CBitStr (OSRTContext &ctxt, OSOCTET *bitStr, OSUINT16 &octsNumbits, OSSIZE maxNumbits_, OSOCTET **ppExtData=0) |
EXTRTMETHOD | ASN1CBitStr (OSRTContext &ctxt, OSOCTET *bitStr, OSSIZE maxNumbits_) |
EXTRTMETHOD | ASN1CBitStr (OSRTContext &ctxt, ASN1TDynBitStr &bitStr) |
EXTRTMETHOD | ASN1CBitStr (OSRTContext &ctxt, ASN1TDynBitStr64 &bitStr) |
EXTRTMETHOD | ASN1CBitStr (const ASN1CBitStr &bitStr) |
EXTRTMETHOD | ASN1CBitStr (const ASN1CBitStr &bitStr, OSBOOL extendable) |
EXTRTMETHOD int | set (OSSIZE bitIndex) |
EXTRTMETHOD int | set (OSSIZE fromIndex, OSSIZE toIndex) |
int | change (OSSIZE bitIndex, OSBOOL value) |
EXTRTMETHOD int | clear (OSSIZE bitIndex) |
EXTRTMETHOD int | clear (OSSIZE fromIndex, OSSIZE toIndex) |
EXTRTMETHOD void | clear () |
EXTRTMETHOD int | invert (OSSIZE bitIndex) |
EXTRTMETHOD int | invert (OSSIZE fromIndex, OSSIZE toIndex) |
EXTRTMETHOD OSBOOL | get (OSSIZE bitIndex) |
OSBOOL | isSet (OSSIZE bitIndex) |
OSBOOL | isEmpty () |
EXTRTMETHOD OSSIZE | size () const |
EXTRTMETHOD OSSIZE | length () const |
EXTRTMETHOD OSSIZE | cardinality () const |
EXTRTMETHOD int | getBytes (OSOCTET *pBuf, OSSIZE bufSz) |
EXTRTMETHOD int | get (OSSIZE fromIndex, OSSIZE toIndex, OSOCTET *pBuf, OSSIZE bufSz) |
EXTRTMETHOD int | doAnd (const OSOCTET *pOctstr, OSSIZE octsNumbits) |
int | doAnd (const ASN1TDynBitStr &bitStr) |
int | doAnd (const ASN1CBitStr &bitStr) |
EXTRTMETHOD int | doOr (const OSOCTET *pOctstr, OSSIZE octsNumbits) |
int | doOr (const ASN1TDynBitStr &bitStr) |
int | doOr (const ASN1CBitStr &bitStr) |
EXTRTMETHOD int | doXor (const OSOCTET *pOctstr, OSSIZE octsNumbits) |
int | doXor (const ASN1TDynBitStr &bitStr) |
int | doXor (const ASN1CBitStr &bitStr) |
EXTRTMETHOD int | doAndNot (const OSOCTET *pOctstr, OSSIZE octsNumbits) |
int | doAndNot (const ASN1TDynBitStr &bitStr) |
int | doAndNot (const ASN1CBitStr &bitStr) |
EXTRTMETHOD int | shiftLeft (OSSIZE shift) |
EXTRTMETHOD int | shiftRight (OSSIZE shift) |
EXTRTMETHOD OSUINT32 | unusedBitsInLastUnit () |
EXTRTMETHOD | operator ASN1TDynBitStr () |
EXTRTMETHOD | operator ASN1TDynBitStr * () |
Public Member Functions inherited from ASN1CType | |
EXTRTMETHOD | ASN1CType (OSRTMessageBufferIF &msgBuf) |
EXTRTMETHOD | ASN1CType (const ASN1CType &orig) |
virtual | ~ASN1CType () |
void | append (OSRTDList &llist, void *pdata) |
OSRTCtxtPtr | getContext () |
OSCTXT * | getCtxtPtr () |
char * | getErrorText (char *textbuf=(char *) 0, OSSIZE bufsize=0) |
int | getStatus () const |
void * | memAlloc (OSSIZE numocts) |
void * | memAllocZ (OSSIZE numocts) |
void | memFreeAll () |
void * | memRealloc (void *ptr, OSSIZE numocts) |
void | memReset () |
void | memFreePtr (void *ptr) |
void | printErrorInfo () |
void | resetError () |
OSBOOL | setDiag (OSBOOL value) |
virtual EXTRTMETHOD int | Encode () |
virtual EXTRTMETHOD int | Decode (OSBOOL free=FALSE) |
virtual int | EncodeTo (OSRTMessageBufferIF &) |
virtual int | DecodeFrom (OSRTMessageBufferIF &, OSBOOL free=TRUE) |
virtual void | MemFree () |
Protected Member Functions | |
EXTRTMETHOD | ASN1CBitStr (OSRTMessageBufferIF &msgBuf) |
EXTRTMETHOD | ASN1CBitStr (OSRTContext &ctxt) |
EXTRTMETHOD | ASN1CBitStr (OSOCTET *pBits, OSUINT32 &numbits, OSSIZE maxNumbits, OSOCTET **ppExtData=0) |
EXTRTMETHOD | ASN1CBitStr (OSOCTET *pBits, OSUINT8 &numbits, OSSIZE maxNumbits, OSOCTET **ppExtData=0) |
EXTRTMETHOD | ASN1CBitStr (OSOCTET *pBits, OSUINT16 &numbits, OSSIZE maxNumbits, OSOCTET **ppExtData=0) |
EXTRTMETHOD | ASN1CBitStr (OSOCTET *pBits, OSSIZE maxNumbits) |
EXTRTMETHOD | ASN1CBitStr (ASN1TDynBitStr &bitStr) |
EXTRTMETHOD | ASN1CBitStr (ASN1TDynBitStr64 &bitStr) |
void | initBase (OSOCTET *pBits, OSSIZE numbits, OSSIZE maxNumbits) |
EXTRTMETHOD void | init (OSOCTET *pBits, OSUINT32 &numbits, OSSIZE maxNumbits) |
EXTRTMETHOD void | init (OSOCTET *pBits, OSUINT8 &numbits, OSSIZE maxNumbits) |
EXTRTMETHOD void | init (OSOCTET *pBits, OSUINT16 &numbits, OSSIZE maxNumbits) |
EXTRTMETHOD void | init (ASN1TDynBitStr &bitStr) |
Protected Member Functions inherited from ASN1CType | |
EXTRTMETHOD | ASN1CType () |
EXTRTMETHOD | ASN1CType (OSRTContext &ctxt) |
EXTRTMETHOD int | setMsgBuf (OSRTMessageBufferIF &msgBuf, OSBOOL initBuf=FALSE) |
EXTRTMETHOD int | setRunTimeKey (const OSOCTET *key, OSSIZE keylen) |
Protected Attributes | |
OSOCTET ** | mpUnits |
OSOCTET ** | mppExtData |
OSSIZE | mMaxNumBits |
ASN1CBitStrSizeHolder * | mpNumBits |
OSSIZE | mUnitsUsed |
OSSIZE | mUnitsAllocated |
OSBOOL | mDynAlloc |
Protected Attributes inherited from ASN1CType | |
OSRTCtxtPtr | mpContext |
OSRTMessageBufferIF * | mpMsgBuf |
ASN.1 bit string control class. The ASN1CBitStr class is derived from the ASN1CType base class. It is used as the base class for generated control classes for the ASN.1 BIT STRING type. This class provides utility methods for operating on the bit string referenced by the generated class. This class can also be used inline to operate on bits within generated BIT STRING elements in a SEQUENCE, SET, or CHOICE construct.
EXTRTMETHOD ASN1CBitStr::ASN1CBitStr | ( | OSRTMessageBufferIF & | msgbuf, |
OSSIZE | nbits | ||
) |
This constructor creates an empty bit string. If the nbits
argument is zero, the bit string is set to be dynamic; otherwise, the capacity is set to nbits
.
msgbuf | - ASN.1 message buffer or stream object. |
nbits | - Number of bits this bit string can contain (zero if unbounded. |
EXTRTMETHOD ASN1CBitStr::ASN1CBitStr | ( | OSRTMessageBufferIF & | msgbuf, |
OSOCTET * | bitStr, | ||
OSUINT32 & | numbits, | ||
OSSIZE | maxNumbits_, | ||
OSOCTET ** | ppExtData = 0 |
||
) |
This constructor creates a bit string from an array of bits. The constructor does not copy the bit string data, it just references the given data variables. All operations on the bit string cause the referenced items to be updated directly.
msgbuf | - ASN.1 message buffer or stream object. |
bitStr | - Pointer to static byte array |
numbits | - Reference to length of bit string (in bits) |
maxNumbits_ | - sets maximum length in bits |
EXTRTMETHOD OSSIZE ASN1CBitStr::cardinality | ( | ) | const |
This method calculates the cardinality of the target bit string.
Cardinality of the bit string is the number of bits set to 1.
- | none |
|
inline |
Changes the bit at the specified index to the specified value.
bitIndex | Relative index of bit to set in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
value | Boolean value to which the bit is to be set. |
EXTRTMETHOD int ASN1CBitStr::clear | ( | OSSIZE | bitIndex | ) |
This version of the clear method sets the given bit in the target string to zero.
bitIndex | Relative index of bit in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
EXTRTMETHOD int ASN1CBitStr::clear | ( | OSSIZE | fromIndex, |
OSSIZE | toIndex | ||
) |
This version of the clear method sets the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to zero.
fromIndex | Relative start index (inclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
toIndex | Relative end index (exclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
EXTRTMETHOD void ASN1CBitStr::clear | ( | ) |
This version of the clear method sets all bits in the bit string to zero.
- | none |
EXTRTMETHOD int ASN1CBitStr::doAnd | ( | const OSOCTET * | pOctstr, |
OSSIZE | octsNumbits | ||
) |
Performs a logical AND of this target bit set with the argument bit set.
Returns: 0 - if succeed, or ASN_E_INVLEN - if 'octsNumbits' is negative, or RTERR_INVPARAM - if pOctstr is the same bit string as this or null, or other error codes (see asn1type.h).
pOctstr | A pointer to octets of another bit string for performing logical operation. |
octsNumbits | A number of bits in arguent bit string. |
|
inline |
This method performs a logical AND of the target bit string with the argument bit string.
bitStr | A reference t another bit string represented by ASN1TDynBitStr type for performing logical operation. |
|
inline |
This method performs a logical AND of the target bit string with the argument bit string.
bitStr | A reference to another bit string represented by ASN1CBitStr type for performing logical operation. |
References length().
EXTRTMETHOD int ASN1CBitStr::doAndNot | ( | const OSOCTET * | pOctstr, |
OSSIZE | octsNumbits | ||
) |
This method performs a logical ANDNOT of the target bit string with the argument bit string.
Logical ANDNOT clars all of the bits in this bit string whose corresponding bit is set in the specified bit string.
pOctstr | A pointer to octets of another bit string for performing logical operation. |
octsNumbits | A number of bits in arguent bit string. |
|
inline |
This method performs a logical ANDNOT of the target bit string with the argument bit string.
Logical ANDNOT clears all of the bits in this bit string whose corresponding bit is set in the specified bit string.
bitStr | A reference t another bit string represented by ASN1TDynBitStr type for performing logical operation. |
|
inline |
This method performs a logical ANDNOT of the target bit string with the argument bit string.
Logical ANDNOT clears all of the bits in this bit string whose corresponding bit is set in the specified bit string.
bitStr | A reference to another bit string represented by ASN1CBitStr type for performing logical operation. |
References length().
EXTRTMETHOD int ASN1CBitStr::doOr | ( | const OSOCTET * | pOctstr, |
OSSIZE | octsNumbits | ||
) |
Performs a logical OR of this target bit set with the argument bit set.
Returns: 0 - if succeed, or ASN_E_INVLEN - if 'octsNumbits' is negative, or RTERR_INVPARAM - if pOctstr is the same bit string as this or null, or other error codes (see asn1type.h).
pOctstr | A pointer to octets of another bit string for performing logical operation. |
octsNumbits | A number of bits in arguent bit string. |
|
inline |
This method performs a logical OR of the target bit string with the argument bit string.
bitStr | A reference t another bit string represented by ASN1TDynBitStr type for performing logical operation. |
|
inline |
This method performs a logical OR of the target bit string with the argument bit string.
bitStr | A reference to another bit string represented by ASN1CBitStr type for performing logical operation. |
References length().
EXTRTMETHOD int ASN1CBitStr::doXor | ( | const OSOCTET * | pOctstr, |
OSSIZE | octsNumbits | ||
) |
Performs a logical XOR of this target bit set with the argument bit set.
Returns: 0 - if succeed, or ASN_E_INVLEN - if 'octsNumbits' is negative, or RTERR_INVPARAM - if pOctstr is null, or other error codes (see asn1type.h).
pOctstr | A pointer to octets of another bit string for performing logical operation. |
octsNumbits | A number of bits in arguent bit string. |
|
inline |
This method performs a logical XOR of the target bit string with the argument bit string.
bitStr | A reference t another bit string represented by ASN1TDynBitStr type for performing logical operation. |
|
inline |
This method performs a logical OR of the target bit string with the argument bit string.
bitStr | A reference to another bit string represented by ASN1CBitStr type for performing logical operation. |
References length().
EXTRTMETHOD OSBOOL ASN1CBitStr::get | ( | OSSIZE | bitIndex | ) |
This method returns the value of the bit with the specified index.
bitIndex | Relative index of bit in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
EXTRTMETHOD int ASN1CBitStr::get | ( | OSSIZE | fromIndex, |
OSSIZE | toIndex, | ||
OSOCTET * | pBuf, | ||
OSSIZE | bufSz | ||
) |
This version of the get method copies the bit string composed of bits from this bit string from the specified fromIndex (inclusive) to the specified toIndex (exclusive) into the given buffer.
fromIndex | Relative start index (inclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
toIndex | Relative end index (exclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
pBuf | Pointer to destination buffer where bytes will be copied. |
bufSz | Size of the destination buffer. If the size of the buffer is not large enough to receive the entire bit string, a negative status value (RTERR_BUFOVFLOW) will be returned. |
EXTRTMETHOD int ASN1CBitStr::getBytes | ( | OSOCTET * | pBuf, |
OSSIZE | bufSz | ||
) |
This method copies the bit string to the given buffer.
pBuf | Pointer to the destination buffer where bytes will be copied. |
bufSz | Size of the destination buffer. If the size of the buffer is not large enough to receive the entire bit string, a negative status value (RTERR_BUFOVFLOW) will be returned. |
EXTRTMETHOD int ASN1CBitStr::invert | ( | OSSIZE | bitIndex | ) |
This version of the invert method inverts the given bit in the target string.
If the bit in the bit string is a zero, it will be set to 1; if the bit is a one, it will be set to 0.
bitIndex | Relative index of bit in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
EXTRTMETHOD int ASN1CBitStr::invert | ( | OSSIZE | fromIndex, |
OSSIZE | toIndex | ||
) |
This version inverts the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive).
If the bit in the bit string is a zero, it will be set to 1; if the bit is a one, it will be set to 0.
fromIndex | Relative start index (inclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
toIndex | Relative end index (exclusive) of bits in string. Bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from left to right (MS to LS bits). |
|
inline |
This method returns TRUE if this bit string contains no bits that are set to 1.
- | none |
|
inline |
This method is the same as ASN1CBitStr::get.
EXTRTMETHOD OSSIZE ASN1CBitStr::length | ( | ) | const |
This method calculates the "logical size" of the bit string.
The "logical size" is calculated by noting the index of the highest set bit in the bit string, plus one. Zero will be returned if the bit string contains no set bits. The highest bit in the bit string is the least significant bit in the last octet set to 1.
- | none |
Referenced by doAnd(), doAndNot(), doOr(), and doXor().
EXTRTMETHOD ASN1CBitStr::operator ASN1TDynBitStr | ( | ) |
This method returns a filled ANSDITDynBitStr variable.
Memory is not allocated when calling this method; only a pointer is assigned. Thus, the ASN1TDynBitStr variable is only valid while this ASN1CBitStr is in scope, and could become invalid if this object is modified. Upon return, retval.data will point to this bit string and retval.numbits will equal length().
Do not call this function if length() is outside the range of OSUINT32.
- | none |
EXTRTMETHOD ASN1CBitStr::operator ASN1TDynBitStr * | ( | ) |
This method returns a pointer to a newly allocated ASN1TDynBitStr object. Upon return, retval->data will point to newly allocated copy of the data in this bit string and retval->numbits will equal length().
Do not call this function if length() is outside the range of OSUINT32.
Memory for the ASN1DynBitStr variable is alloced using memory memAlloc and bits are copied into it.
- | none |
EXTRTMETHOD int ASN1CBitStr::set | ( | OSSIZE | bitIndex | ) |
This version of the set method sets the given bit in the target string.
bitIndex | Relative index of the bit to set in the string. The bit idex 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from the left to right (MS to LS). |
EXTRTMETHOD int ASN1CBitStr::set | ( | OSSIZE | fromIndex, |
OSSIZE | toIndex | ||
) |
This version of teh set method sets the bits from the specified fromIndex (inclusive) to the specified toIndex (exclusive) to one.
fromIndex | Relative start index (inclusive) of bits in the string. The bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from the left to right (MS to LS). |
toIndex | Relative end index (exclusive) of bits in the string. The bit index 0 refers to the MS bit (bit 8) in the first octet. The index values then progress from the left to right (MS to LS). |
EXTRTMETHOD int ASN1CBitStr::shiftLeft | ( | OSSIZE | shift | ) |
This method shifts all bits to the left by the number of specified in the shift operand.
If the bit string can dynamically grow, then the length of the bit string will be decreased by shift bits. Otherwise, bits that are shifted into the bitstring are filled with zeros from the right. Most left bits are lost.
shift | Number of bits to be shifted. |
EXTRTMETHOD int ASN1CBitStr::shiftRight | ( | OSSIZE | shift | ) |
This method shifts all bits to the right by the number of specified in the shift operand.
If the bit string can dynamically grow, then the length of the bit string will be decreased by shift bits. Otherwise, bits that are shifted into the bitstring are filled with zeros from the left. Most right bits are lost.
shift | Number of bits to be shifted. |
EXTRTMETHOD OSSIZE ASN1CBitStr::size | ( | ) | const |
This method returns the number of bytes of space actually in use by this bit string to represent bit values.
- | none |
EXTRTMETHOD OSUINT32 ASN1CBitStr::unusedBitsInLastUnit | ( | ) |
This method returns the number of unused bits in the last octet.