PER C Encode Functions.
[PER Runtime Library Functions.]

Defines

#define pe_bit(pctxt, value)   rtxEncBit(pctxt,value)
#define pe_bits(pctxt, value, nbits)   rtxEncBits(pctxt,value,nbits)
#define pe_CheckBuffer(pctxt, nbytes)   rtxCheckOutputBuffer(pctxt,nbytes)
#define pe_octets(pctxt, pvalue, nbits)   rtxEncBitsFromByteArray(pctxt,pvalue,nbits)

Functions

int pe_16BitConstrainedString (OSCTXT *pctxt, Asn116BitCharString value, Asn116BitCharSet *pCharSet)
int pe_32BitConstrainedString (OSCTXT *pctxt, Asn132BitCharString value, Asn132BitCharSet *pCharSet)
int pe_2sCompBinInt (OSCTXT *pctxt, OSINT32 value)
int pe_2sCompBinInt64 (OSCTXT *pctxt, OSINT64 value)
int pe_aligned_octets (OSCTXT *pctxt, OSOCTET *pvalue, OSUINT32 nocts)
int pe_BigInteger (OSCTXT *pctxt, const char *pvalue)
int pe_bits64 (OSCTXT *pctxt, OSUINT64 value, OSUINT32 nbits)
int pe_BitString (OSCTXT *pctxt, OSUINT32 numocts, const OSOCTET *data)
int pe_BitString32 (OSCTXT *pctxt, ASN1BitStr32 *pbitstr, OSUINT32 lower, OSUINT32 upper)
int pe_BMPString (OSCTXT *pctxt, ASN1BMPString value, Asn116BitCharSet *permCharSet)
int pe_UniversalString (OSCTXT *pctxt, ASN1UniversalString value, Asn132BitCharSet *permCharSet)
int pe_byte_align (OSCTXT *pctxt)
int pe_ChoiceTypeExt (OSCTXT *pctxt, OSUINT32 numocts, const OSOCTET *data)
int pe_ConsInteger (OSCTXT *pctxt, OSINT32 value, OSINT32 lower, OSINT32 upper)
int pe_ConsInt64 (OSCTXT *pctxt, OSINT64 value, OSINT64 lower, OSINT64 upper)
int pe_ConstrainedString (OSCTXT *pctxt, const char *string, Asn1CharSet *pCharSet)
int pe_ConstrainedStringEx (OSCTXT *pctxt, const char *string, const char *charSet, OSUINT32 abits, OSUINT32 ubits, OSUINT32 canSetBits)
int pe_ConsUnsigned (OSCTXT *pctxt, OSUINT32 value, OSUINT32 lower, OSUINT32 upper)
int pe_ConsUInt64 (OSCTXT *pctxt, OSUINT64 value, OSUINT64 lower, OSUINT64 upper)
int pe_ConsWholeNumber (OSCTXT *pctxt, OSUINT32 adjusted_value, OSUINT32 range_value)
int pe_ConsWholeNumber64 (OSCTXT *pctxt, OSUINT64 adjusted_value, OSUINT64 range_value)
int pe_DateStr (OSCTXT *pctxt, const char *string, OSUINT32 flags)
int pe_DateTimeStr (OSCTXT *pctxt, const char *string, OSUINT32 flags)
int pe_Duration (OSCTXT *pctxt, const char *string, OSBOOL rec)
OSUINT32 pe_GetIntLen (OSUINT32 value)
size_t pe_GetMsgBitCnt (OSCTXT *pctxt)
OSOCTET * pe_GetMsgPtr (OSCTXT *pctxt, OSINT32 *pLength)
OSOCTET * pe_GetMsgPtrU (OSCTXT *pctxt, OSUINT32 *pLength)
int pe_Interval (OSCTXT *pctxt, const char *string, OSBOOL rec, OSUINT32 startFlags, OSUINT32 endFlags)
int pe_Length (OSCTXT *pctxt, OSUINT32 value)
int pe_NonNegBinInt (OSCTXT *pctxt, OSUINT32 value)
int pe_NonNegBinInt64 (OSCTXT *pctxt, OSUINT64 value)
int pe_ObjectIdentifier (OSCTXT *pctxt, ASN1OBJID *pvalue)
int pe_oid64 (OSCTXT *pctxt, ASN1OID64 *pvalue)
int pe_RelativeOID (OSCTXT *pctxt, ASN1OBJID *pvalue)
int pe_OctetString (OSCTXT *pctxt, OSUINT32 numocts, const OSOCTET *data)
int pe_OpenType (OSCTXT *pctxt, OSUINT32 numocts, const OSOCTET *data)
int pe_OpenTypeEnd (OSCTXT *pctxt, OSUINT32 pos, void *pPerField)
int pe_OpenTypeExt (OSCTXT *pctxt, OSRTDList *pElemList)
int pe_OpenTypeExtBits (OSCTXT *pctxt, OSRTDList *pElemList)
int pe_OpenTypeStart (OSCTXT *pctxt, OSUINT32 *pPos, void **ppPerField)
int pe_Real (OSCTXT *pctxt, OSREAL value)
int pe_SmallNonNegWholeNumber (OSCTXT *pctxt, OSUINT32 value)
int pe_SemiConsInteger (OSCTXT *pctxt, OSINT32 value, OSINT32 lower)
int pe_SemiConsInt64 (OSCTXT *pctxt, OSINT64 value, OSINT64 lower)
int pe_SemiConsUnsigned (OSCTXT *pctxt, OSUINT32 value, OSUINT32 lower)
int pe_SemiConsUInt64 (OSCTXT *pctxt, OSUINT64 value, OSUINT64 lower)
int pe_TimeStr (OSCTXT *pctxt, const char *string, OSUINT32 flags)
int pe_UnconsLength (OSCTXT *pctxt, OSUINT32 value)
int pe_UnconsInteger (OSCTXT *pctxt, OSINT32 value)
int pe_UnconsInt64 (OSCTXT *pctxt, OSINT64 value)
int pe_UnconsUnsigned (OSCTXT *pctxt, OSUINT32 value)
int pe_UnconsUInt64 (OSCTXT *pctxt, OSUINT64 value)
int pe_VarWidthCharString (OSCTXT *pctxt, const char *value)
int pe_YearInt (OSCTXT *pctxt, OSINT32 value)
int pe_Real10 (OSCTXT *pctxt, const char *pvalue)
int uperEncConstrString (OSCTXT *pctxt, const char *string, const char *charSet, OSUINT32 nbits, OSUINT32 canSetBits)

Detailed Description

The Per low-level encode functions handle the PER encoding of the primitive ASN.1 data types. Calls to these functions are assembled in the C source code generated by the ASN1C complier to accomplish the encoding of complex ASN.1 structures. These functions are also directly callable from within a user's application program if the need to accomplish a low level encoding function exists.

The procedure to call a low-level encode function is the same as the procedure to call a compiler generated encode function described above. The pu_newContext function must first be called to set a pointer to the buffer into which the variable is to be encoded. A static encode buffer is specified by assigning a pointer to a buffer and a buffer size. Setting the buffer address to NULL and buffer size to 0 specifies a dynamic buffer. The encode function is then invoked. The result of the encoding will start at the beginning of the specified buffer, or, if a dynamic buffer was used, only be obtained by calling pe_GetMsgPtr. The length of the encoded compound is obtained by calling pe_GetMsgLen.


Define Documentation

#define pe_bit ( pctxt,
value   )     rtxEncBit(pctxt,value)

This function will encode a varialbe of the ASN.1 BOOLEAN type in single bit,

Parameters:
pctxt 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.
value The BOOLEAN value to be encoded.
#define pe_bits ( pctxt,
value,
nbits   )     rtxEncBits(pctxt,value,nbits)

This function encodes multiple bits.

Parameters:
pctxt Pointer to context block structure.
value Unsigned integer containing the bits to be encoded.
nbits Number of bits in value to encode.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
#define pe_CheckBuffer ( pctxt,
nbytes   )     rtxCheckOutputBuffer(pctxt,nbytes)

This function will determine if the given number of bytes will fit in the encode buffer. If not, either the buffer is expanded (if it is a dynamic buffer) or an error is signaled.

Parameters:
pctxt A 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.
nbytes Number of bytes of space required to hold the variable to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
#define pe_octets ( pctxt,
pvalue,
nbits   )     rtxEncBitsFromByteArray(pctxt,pvalue,nbits)

This fuction will encode an array of octets. The Octets will be encoded unaligned starting at the current bit offset within the encode buffer.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalue A pointer to an array of octets to encode
nbits The number of Octets to encode
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

Function Documentation

int pe_16BitConstrainedString ( OSCTXT *  pctxt,
Asn116BitCharString  value,
Asn116BitCharSet *  pCharSet 
)

This function will encode a constrained ASN.1 character string. This function is normally not called directly but rather is called from Useful Type Character String encode functions that deal with 16-bit strings. The only function that does that in this release is the pe_BMPString function.

Parameters:
pctxt 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.
value Character string to be encoded. The structure includes a count field containing the number of characters to encode and an array of unsigned short integers to hold the 16-bit characters to be encoded.
pCharSet Pointer to the constraining character set. The contains an array containing all valid characters in the set as well as the aligned and unaligned bit counts required to encode the characters.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_2sCompBinInt ( OSCTXT *  pctxt,
OSINT32  value 
)

This function encodes a two's complement binary integer as specified in Section 10.4 of the X.691 standard.

Parameters:
pctxt Pointer to context block structure.
value Signed integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_2sCompBinInt64 ( OSCTXT *  pctxt,
OSINT64  value 
)

This function encodes a two's complement binary 64-bit integer as specified in Section 10.4 of the X.691 standard.

Parameters:
pctxt Pointer to context block structure.
value Signed 64-bit integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_32BitConstrainedString ( OSCTXT *  pctxt,
Asn132BitCharString  value,
Asn132BitCharSet *  pCharSet 
)

This function will encode a constrained ASN.1 character string. This function is normally not called directly but rather is called from Useful Type Character String encode functions that deal with 32-bit strings. The only function that does that in this release is the pe_UniversalString function.

Parameters:
pctxt 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.
value Character string to be encoded. The structure includes a count field containing the number of characters to encode and an array of unsigned short integers to hold the 32-bit characters to be encoded.
pCharSet Pointer to the constraining character set. The contains an array containing all valid characters in the set as well as the aligned and unaligned bit counts required to encode the characters.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_aligned_octets ( OSCTXT *  pctxt,
OSOCTET *  pvalue,
OSUINT32  nocts 
)
Parameters:
pctxt Pointer to context block structure.
pvalue A pointer to a character string containing the value to be encoded.
nocts The number of octets.
int pe_BigInteger ( OSCTXT *  pctxt,
const char *  pvalue 
)

The pe_BigInteger function will encode a variable of the ASN.1 INTEGER type. In this case, the integer is assumed to be of a larger size than can fit in a C or C++ long type (normally 32 or 64 bits). For example, parameters used to calculate security values are typically larger than these sizes. Items of this type are stored in character string constant variables. They can be represented as decimal strings (with no prefixes), as hexadecimal strings starting with a "0x" prefix, as octal strings starting with a "0o" prefix or as binary strings starting with a "0b" prefix. Other radixes currently are not supported. It is highly recommended to use the hexadecimal or binary strings for better performance.

Parameters:
pctxt Pointer to context block structure.
pvalue A pointer to a character string containing the value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_bits64 ( OSCTXT *  pctxt,
OSUINT64  value,
OSUINT32  nbits 
)

This function encodes multiple bits, using unsigned 64-bit integer to hold bits.

Parameters:
pctxt Pointer to context block structure.
value Unsigned 64-bit integer containing the bits to be encoded.
nbits Number of bits in value to encode.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_BitString ( OSCTXT *  pctxt,
OSUINT32  numocts,
const OSOCTET *  data 
)

This function will encode a value of the ASN.1 bit string type.

Parameters:
pctxt A 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.
numocts The number of bits n the string to be encoded.
data Pointer to the bit string data to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_BMPString ( OSCTXT *  pctxt,
ASN1BMPString  value,
Asn116BitCharSet *  permCharSet 
)

This function will encode a variable of the ASN.1 BMP character string. This differs from the encode routines for the character strings previously described in that the BMP string type is based on 16-bit characters. A 16-bit character string is modeled using an array of unsigned short integers.

Parameters:
pctxt A 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.
value Character string to be encoded. This structure includes a count field containing the number of characters to encode and an array of unsigned short integers to hold the 16-bit characters to be encoded.
permCharSet Pointer to the constraining character set. This contains an array containing all valid characters in the set as well as the aligned and unaligned bit counts required to encode the characters.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_byte_align ( OSCTXT *  pctxt  ) 

This function will position the encode bit cursor on the next byte boundry.

Parameters:
pctxt A 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.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

Referenced by ASN1PEREncodeBuffer::byteAlign().

int pe_ChoiceTypeExt ( OSCTXT *  pctxt,
OSUINT32  numocts,
const OSOCTET *  data 
)
Parameters:
pctxt A 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.
numocts Number of octets in the string to be encoded.
data Pointer to octet string data to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_ConsInt64 ( OSCTXT *  pctxt,
OSINT64  value,
OSINT64  lower,
OSINT64  upper 
)

This function encodes a 64-bit integer constrained either by a value or value range constraint.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded, represented as 64-bit integer.
lower Lower range value, represented as 64-bit integer.
upper Upper range value, represented as 64-bit integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_ConsInteger ( OSCTXT *  pctxt,
OSINT32  value,
OSINT32  lower,
OSINT32  upper 
)

This function encodes an integer constrained either by a value or value range constraint.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_ConstrainedString ( OSCTXT *  pctxt,
const char *  string,
Asn1CharSet *  pCharSet 
)

This function encodes a constrained string value. This is a deprecated version of the function provided for backward compatibility.

Parameters:
pctxt Pointer to context block structure.
string Pointer to string to be encoded.
pCharSet Pointer to a character set descriptor structure.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_ConstrainedStringEx ( OSCTXT *  pctxt,
const char *  string,
const char *  charSet,
OSUINT32  abits,
OSUINT32  ubits,
OSUINT32  canSetBits 
)

This function encodes a constrained string value. This version of the function allows all of the required permitted alphabet constraint parameters to be passed in as arguments.

Parameters:
pctxt Pointer to context block structure.
string Pointer to string to be encoded.
charSet String containing permitted alphabet character set. Can be null if no character set was specified.
abits Number of bits in a character set character (aligned).
ubits Number of bits in a character set character (unaligned).
canSetBits Number of bits in a character from the canonical set representing this string.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_ConsUInt64 ( OSCTXT *  pctxt,
OSUINT64  value,
OSUINT64  lower,
OSUINT64  upper 
)

This function encodes an unsigned 64-bit integer constrained either by a value or value range constraint. The constrained unsigned integer option is used if:

1. The lower value of the range is >= 0, and 2. The upper value of the range is >= MAXINT

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded, represented as unsigned 64-bit integer.
lower Lower range value, represented as unsigned 64-bit integer.
upper Upper range value, represented as unsigned 64-bit integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_ConsUnsigned ( OSCTXT *  pctxt,
OSUINT32  value,
OSUINT32  lower,
OSUINT32  upper 
)

This function encodes an unsigned integer constrained either by a value or value range constraint. The constrained unsigned integer option is used if:

1. The lower value of the range is >= 0, and 2. The upper value of the range is >= MAXINT

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_ConsWholeNumber ( OSCTXT *  pctxt,
OSUINT32  adjusted_value,
OSUINT32  range_value 
)

This function encodes a constrained whole number as specified in Section 10.5 of the X.691 standard.

Parameters:
pctxt Pointer to context block structure.
adjusted_value Unsigned adjusted integer value to be encoded. The adjustment is done by subtracting the lower value of the range from the value to be encoded.
range_value Unsigned integer value specifying the total size of the range. This is obtained by subtracting the lower range value from the upper range value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_ConsWholeNumber64 ( OSCTXT *  pctxt,
OSUINT64  adjusted_value,
OSUINT64  range_value 
)

This function encodes a constrained whole number as specified in Section 10.5 of the X.691 standard, represented as 64-bit integer.

Parameters:
pctxt Pointer to context block structure.
adjusted_value Unsigned adjusted integer value to be encoded. The adjustment is done by subtracting the lower value of the range from the value to be encoded.
range_value Unsigned integer value specifying the total size of the range. This is obtained by subtracting the lower range value from the upper range value.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_DateStr ( OSCTXT *  pctxt,
const char *  string,
OSUINT32  flags 
)

This function will encode an ISO 8601 DATE types.

Parameters:
pctxt Pointer to context block structure.
string Character string variable containing value to be encoded in string form (YYYY:MM:DD) and ect.
flags Set of flags: OSANY|OSCENTURY|OSYEAR|OSMONTH|OSWEEK|OSDAY.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_DateTimeStr ( OSCTXT *  pctxt,
const char *  string,
OSUINT32  flags 
)

This function will encode an ISO 8601 DATE-TIME types.

Parameters:
pctxt Pointer to context block structure.
string Character string variable containing value to be encoded in string form (YYYY-MM-DDTHH:MM:SS) and ect.
flags Set of flags: OSANY|OSCENTURY|OSYEAR|OSMONTH|OSWEEK|OSDAY| OSHOURS|OSMINUTES|OSSECONDS|OSUTC|OSDIFF|n. n - set digit number of fraction part.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_Duration ( OSCTXT *  pctxt,
const char *  string,
OSBOOL  rec 
)

This function will encode an ISO 8601 DURATION types.

Parameters:
pctxt Pointer to context block structure.
string Character string variable containing value to be encoded in string form (PnYnMnDTnHnMnS).
rec Encode recursive interval (Rn/).
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
OSUINT32 pe_GetIntLen ( OSUINT32  value  ) 
Parameters:
value Length value to be encoded.
size_t pe_GetMsgBitCnt ( OSCTXT *  pctxt  ) 
Parameters:
pctxt 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.

Referenced by ASN1PEREncodeBuffer::getMsgBitCnt().

OSOCTET* pe_GetMsgPtr ( OSCTXT *  pctxt,
OSINT32 *  pLength 
)

This function will return the message pointer and length of an encoded message. This function is called after a complier generated encode function to get the pointer and length of the message. It is normally used when dynamic encoding is specified because the message pointer is not known until encoding is complete. If static encoding is used, the message starts at the beginning of the specified buffer adn the pe_GetMsgLen function can be used to obtain the lenght of the message.

Parameters:
pctxt 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.
pLength Pointer to variable to receive length of the encoded message.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
OSOCTET* pe_GetMsgPtrU ( OSCTXT *  pctxt,
OSUINT32 *  pLength 
)
Parameters:
pctxt 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.
pLength Pointer to variable to receive length of the encoded message.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_Interval ( OSCTXT *  pctxt,
const char *  string,
OSBOOL  rec,
OSUINT32  startFlags,
OSUINT32  endFlags 
)

This function will encode an ISO 8601 INTERVAL type.

Parameters:
pctxt Pointer to context block structure.
string Character string variable containing value to be encoded in string form (start/end).
rec Encode recursive interval (Rn/).
startFlags Set format flags of interval start: OSANY|OSCENTURY|OSYEAR|OSMONTH|OSWEEK|OSDAY| OSHOURS|OSMINUTES|OSSECONDS|OSUTC|OSDIFF|n or OSDURATION. n - set digit number of fraction part.
endFlags Set format flags of interval end.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_Length ( OSCTXT *  pctxt,
OSUINT32  value 
)

This function will encode a length determinant value.

Parameters:
pctxt 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.
value Length value to be encoded.
Returns:
If successful, the encoded number of bytes is returned; otherwise, a negative error status code.
int pe_NonNegBinInt ( OSCTXT *  pctxt,
OSUINT32  value 
)

This function encodes a non-negative binary integer as specified in Section 10.3 of the X.691 standard.

Parameters:
pctxt Pointer to context block structure.
value Unsigned integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_NonNegBinInt64 ( OSCTXT *  pctxt,
OSUINT64  value 
)

This function encodes a non-negative binary 64-bit integer as specified in Section 10.3 of the X.691 standard.

Parameters:
pctxt Pointer to context block structure.
value Unsigned 64-bit integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_ObjectIdentifier ( OSCTXT *  pctxt,
ASN1OBJID *  pvalue 
)

This function encodes a value of the ASN.1 object identifier type.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to value to be encoded. The ASN1OBJID structure contains a numids fields to hold the number of subidentifiers and an array to hold the subidentifier values.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_OctetString ( OSCTXT *  pctxt,
OSUINT32  numocts,
const OSOCTET *  data 
)

This function will encode a value of the ASN.1 octet string type.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
numocts Number of octets in the string to be encoded.
data Pointer to octet string data to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_oid64 ( OSCTXT *  pctxt,
ASN1OID64 *  pvalue 
)

This function encodes a value of the ASN.1 object identifier type, using 64-bit subidentifiers.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to value to be encoded. The ASN1OID64 structure contains a numids fields to hold the number of subidentifiers and an array of unsigned 64-bit integers to hold the subidentifier values.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_OpenType ( OSCTXT *  pctxt,
OSUINT32  numocts,
const OSOCTET *  data 
)

This function will encode an ASN.1 open type. This used to be the ANY type, but now is used in a variety of applications requiring an encoding that can be interpreted by a decoder without a prior knowledge of the type of the variable.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
numocts Number of octets in the string to be encoded.
data Pointer to octet string data to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_OpenTypeEnd ( OSCTXT *  pctxt,
OSUINT32  pos,
void *  pPerField 
)

This function will finish encoding extension in ASN.1 open type. It will write open type length to saved position. If required function do fragmentation of open type data.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
pos Position that was saved in pe_OpenTypeStart function.
pPerField A pointer to bit field that was saved in pe_OpenTypeStart function.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_OpenTypeExt ( OSCTXT *  pctxt,
OSRTDList *  pElemList 
)

This function will encode an ASN.1 open type extension. An open type extension field is the data that potentially resides after the ... marker in a version-1 message. The open type structure contains a complete encoded bit set including option element bits or choice index, length, and data. Typically, this data is populated when a version-1 system decodes a version-2 message. The extension fields are retained and can then be re-encoded if a new message is to be sent out (for example, in a store and forward system).

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
pElemList A pointer to the open type to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_OpenTypeExtBits ( OSCTXT *  pctxt,
OSRTDList *  pElemList 
)
Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
pElemList A pointer to the open type to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_OpenTypeStart ( OSCTXT *  pctxt,
OSUINT32 *  pPos,
void **  ppPerField 
)

This function will start encoding extension in ASN.1 open type. It will reserve place to open type length and return current buffer position.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
pPos A pointer to return current buffer position.
ppPerField A pointer to to return current bit field record.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_Real ( OSCTXT *  pctxt,
OSREAL  value 
)

This function will encode a value of the ASN.1 real type. This function provides support for the plus-infinity and minus-infinity special real values. Use the rtxGetPlusInfinity or rtxGetMinusInfinity functions to get these special values.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
value Value to be encoded. Special real values plus and minus infinity are encoded by using the rtxGetPlusInfinity and the rtxGetMinusInfinity functions to se the real value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_Real10 ( OSCTXT *  pctxt,
const char *  pvalue 
)

This function will encode a number from character string to ASN.1 real type using decimal encoding. Number may be represented in integer, decimal, and exponent formats.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
pvalue Value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_RelativeOID ( OSCTXT *  pctxt,
ASN1OBJID *  pvalue 
)

This function encodes a value of the ASN.1 RELATIVE-OID type.

Parameters:
pctxt Pointer to context block structure.
pvalue Pointer to value to be encoded. The ASN1OBJID structure contains a numids fields to hold the number of subidentifiers and an array to hold the subidentifier values.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_SemiConsInt64 ( OSCTXT *  pctxt,
OSINT64  value,
OSINT64  lower 
)

This function encodes an semi-constrained 64-bit integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded, represented as 64-bit integer.
lower Lower range value, represented as signed 64-bit integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_SemiConsInteger ( OSCTXT *  pctxt,
OSINT32  value,
OSINT32  lower 
)

This function encodes an semi-constrained integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
lower Lower range value, represented as signed integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_SemiConsUInt64 ( OSCTXT *  pctxt,
OSUINT64  value,
OSUINT64  lower 
)

This function encodes an semi-constrained unsigned 64-bit integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded, represented as unsigned 64-bit integer.
lower Lower range value, represented as unsigned 64-bit integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_SemiConsUnsigned ( OSCTXT *  pctxt,
OSUINT32  value,
OSUINT32  lower 
)

This function encodes an semi-constrained unsigned integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
lower Lower range value, represented as unsigned integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_SmallNonNegWholeNumber ( OSCTXT *  pctxt,
OSUINT32  value 
)

This function will endcode a small, non-negative whole number as specified in Section 10.6 of teh X.691 standard. This is a number that is expected to be small, but whose size is potentially unlimited due to the presence of an extension marker.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
value An unsigned integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_TimeStr ( OSCTXT *  pctxt,
const char *  string,
OSUINT32  flags 
)

This function will encode an ISO 8601 TIME types.

Parameters:
pctxt Pointer to context block structure.
string Character string variable containing value to be encoded in string form (HH:MM:SS) and ect.
flags Set of flags: OSHOURS|OSMINUTES|OSSECONDS|OSUTC|OSDIFF|n. n - set digit number of fraction part.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_UnconsInt64 ( OSCTXT *  pctxt,
OSINT64  value 
)

This function encodes an unconstrained 64-bit integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded, represented as 64-bit integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_UnconsInteger ( OSCTXT *  pctxt,
OSINT32  value 
)

This function encodes an unconstrained integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_UnconsLength ( OSCTXT *  pctxt,
OSUINT32  value 
)
Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
value Value to be encoded.
Returns:
If successful, the encoded number of bytes is returned; otherwise, a negative error status code.
int pe_UnconsUInt64 ( OSCTXT *  pctxt,
OSUINT64  value 
)

This function encodes an unconstrained unsigned 64-bit integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded, represented as unsigned 64-bit integer.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_UnconsUnsigned ( OSCTXT *  pctxt,
OSUINT32  value 
)

This function encodes an unconstrained unsigned integer.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_UniversalString ( OSCTXT *  pctxt,
ASN1UniversalString  value,
Asn132BitCharSet *  permCharSet 
)

This function will encode a variable of the ASN.1 Universal character string. This differs from the encode routines for the character strings previously described in that the Universal string type is based on 32-bit characters. A 32-bit character string is modeled using an array of unsigned integers.

Parameters:
pctxt A 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.
value Character string to be encoded. The structure includes a count field containing all valid characters in the set as well as the aligned and unaligned bit counts required to encode the characters.
permCharSet A pointer to the constraining character set. This contains an array containing all valid characters in the set as well as the aligned and the unaligned bit counts required to encode the characters.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_VarWidthCharString ( OSCTXT *  pctxt,
const char *  value 
)

This function will encode a ASN.1 character string.

Parameters:
pctxt A pointer to a context structure. The provides a storage area for the function to store all working variables that must be maintained between function calls.
value A pointer to a character string containing the value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int pe_YearInt ( OSCTXT *  pctxt,
OSINT32  value 
)

This function will encode an ISO 8601 YEAR type.

Parameters:
pctxt Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.
int uperEncConstrString ( OSCTXT *  pctxt,
const char *  string,
const char *  charSet,
OSUINT32  nbits,
OSUINT32  canSetBits 
)

This function encodes a constrained string value. This version supports unaligned PER only. It allows all of the required permitted alphabet constraint parameters to be passed in as arguments.

Parameters:
pctxt Pointer to context block structure.
string Pointer to string to be encoded.
charSet String containing permitted alphabet character set. Can be null if no character set was specified.
nbits Number of bits in a character set character (unaligned).
canSetBits Number of bits in a character from the canonical set representing this string.
Returns:
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.