XBinder  Version 2.6.x
Functions
rtxBitDecode.h File Reference

Bit decode functions. More...

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.

Functions

EXTERNRT int rtxDecBit (OSCTXT *pctxt, OSBOOL *pvalue)
 This function will decode a single bit and return the result in an OSBOOL value. More...
 
EXTERNRT int rtxDecBits (OSCTXT *pctxt, OSUINT32 *pvalue, OSSIZE nbits)
 This function decodes up to sizeof(unsigned) bits and returns the result in an unsigned integer value. More...
 
EXTERNRT int rtxDecBitsToSize (OSCTXT *pctxt, OSSIZE *pvalue, OSSIZE nbits)
 This function decodes up to sizeof(size_t) bits and returns the result in a size-typed value. More...
 
EXTERNRT int rtxDecBitsToByte (OSCTXT *pctxt, OSUINT8 *pvalue, OSUINT8 nbits)
 This function decodes bits and returns the result in a byte (octet) value. More...
 
EXTERNRT int rtxDecBitsToUInt16 (OSCTXT *pctxt, OSUINT16 *pvalue, OSUINT8 nbits)
 This function decodes bits and returns the result in an unsigned 16-bit (short) value. More...
 
EXTERNRT int rtxDecBitsToByteArray (OSCTXT *pctxt, OSOCTET *pbuffer, OSSIZE bufsiz, OSSIZE nbits)
 This function decodes bits and returns the result in an octet array. More...
 
EXTERNRT int rtxPeekBit (OSCTXT *pctxt, OSBOOL *pvalue)
 This function decodes the bit at the current position and the resets the bit cursor back to the original position. More...
 
EXTERNRT int rtxSkipBits (OSCTXT *pctxt, OSSIZE nbits)
 This function skips the given number of bits. More...
 

Detailed Description

Bit decode functions.

Definition in file rtxBitDecode.h.

Function Documentation

◆ rtxDecBit()

EXTERNRT int rtxDecBit ( OSCTXT pctxt,
OSBOOL *  pvalue 
)

This function will decode a single bit and return the result in an OSBOOL value.

Parameters
pctxtA pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalueA pointer to the BOOLEAN value to receive the decoded result. A null pointer value may be passed to skip the bit.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ rtxDecBits()

EXTERNRT int rtxDecBits ( OSCTXT pctxt,
OSUINT32 *  pvalue,
OSSIZE  nbits 
)

This function decodes up to sizeof(unsigned) bits and returns the result in an unsigned integer value.

Parameters
pctxtPointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvaluePointer to value to be receive decoded result.
nbitsNumber of bits to read from decode buffer.
Returns
Status of the operation. Zero if successful; a negative status code if failed.

◆ rtxDecBitsToByte()

EXTERNRT int rtxDecBitsToByte ( OSCTXT pctxt,
OSUINT8 *  pvalue,
OSUINT8  nbits 
)

This function decodes bits and returns the result in a byte (octet) value.

Bits are shifted to the right in the decode byte to remove unused bits. For example, if a single bit is decoded from octet 0x80, the decoded byte value will be 1.

Parameters
pctxtPointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvaluePointer to byte value to receive decoded data.
nbitsNumber of bits to read from decode buffer. The maximum that can be read is eight.
Returns
Status of the operation. Zero if successful; a negative status code if failed.

◆ rtxDecBitsToByteArray()

EXTERNRT int rtxDecBitsToByteArray ( OSCTXT pctxt,
OSOCTET *  pbuffer,
OSSIZE  bufsiz,
OSSIZE  nbits 
)

This function decodes bits and returns the result in an octet array.

Parameters
pctxtPointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pbufferAddress of buffer to receive decoded binary data.
bufsizSize of output buffer.
nbitsNumber of bits to read from decode buffer.
Returns
Status of the operation. Zero if successful; a negative status code if failed.

◆ rtxDecBitsToSize()

EXTERNRT int rtxDecBitsToSize ( OSCTXT pctxt,
OSSIZE *  pvalue,
OSSIZE  nbits 
)

This function decodes up to sizeof(size_t) bits and returns the result in a size-typed value.

Parameters
pctxtPointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvaluePointer to value to be receive decoded result.
nbitsNumber of bits to read from decode buffer.
Returns
Status of the operation. Zero if successful; a negative status code if failed.

◆ rtxDecBitsToUInt16()

EXTERNRT int rtxDecBitsToUInt16 ( OSCTXT pctxt,
OSUINT16 *  pvalue,
OSUINT8  nbits 
)

This function decodes bits and returns the result in an unsigned 16-bit (short) value.

Bits are shifted to the right in the decode byte to remove unused bits. For example, if a single bit is decoded from octet 0x80, the decoded byte value will be 1.

Parameters
pctxtPointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvaluePointer to byte value to receive decoded data.
nbitsNumber of bits to read from decode buffer. The maximum that can be read is sixteen.
Returns
Status of the operation. Zero if successful; a negative status code if failed.

◆ rtxPeekBit()

EXTERNRT int rtxPeekBit ( OSCTXT pctxt,
OSBOOL *  pvalue 
)

This function decodes the bit at the current position and the resets the bit cursor back to the original position.

Parameters
pctxtA pointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalueA pointer to the BOOLEAN value to receive the decoded result. A null pointer value may be passed to skip the bit.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ rtxSkipBits()

EXTERNRT int rtxSkipBits ( OSCTXT pctxt,
OSSIZE  nbits 
)

This function skips the given number of bits.

Parameters
pctxtPointer to a context structure. This provides a storage area for the function to store all working variables that must be maintained between function calls.
nbitsNumber of bits to skip.
Returns
Status of the operation. Zero if successful; a negative status code if failed.