Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

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


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.


Defines

#define pe_UnconsInteger(ctxt_p, value)   pe_SemiConsInteger(ctxt_p,value,ASN1INT_MIN)
#define pe_UnconsInt64(ctxt_p, value)   pe_SemiConsInt64(ctxt_p,value,ASN1INT64MIN)
#define pe_UnconsUnsigned(ctxt_p, value)   pe_SemiConsUnsigned(ctxt_p,value,0)
#define pe_UnconsUInt64(ctxt_p, value)   pe_SemiConsUInt64(ctxt_p,value,0)

Functions

int pe_16BitConstrainedString (ASN1CTXT *ctxt_p, Asn116BitCharString value, Asn116BitCharSet *pCharSet)
int pe_32BitConstrainedString (ASN1CTXT *ctxt_p, Asn132BitCharString value, Asn132BitCharSet *pCharSet)
int pe_2sCompBinInt (ASN1CTXT *ctxt_p, ASN1INT value)
int pe_2sCompBinInt64 (ASN1CTXT *ctxt_p, ASN1INT64 value)
int pe_aligned_octets (ASN1CTXT *ctxt_p, ASN1OCTET *pvalue, ASN1UINT nocts)
int pe_BigInteger (ASN1CTXT *ctxt_p, ASN1ConstCharPtr pvalue)
int pe_bit (ASN1CTXT *ctxt_p, ASN1BOOL value)
int pe_bits (ASN1CTXT *ctxt_p, ASN1UINT value, ASN1UINT nbits)
int pe_bits64 (ASN1CTXT *ctxt_p, ASN1UINT64 value, ASN1UINT nbits)
int pe_BitString (ASN1CTXT *ctxt_p, ASN1UINT numocts, ASN1ConstOctetPtr data)
int pe_BMPString (ASN1CTXT *ctxt_p, ASN1BMPString value, Asn116BitCharSet *permCharSet)
int pe_UniversalString (ASN1CTXT *ctxt_p, ASN1UniversalString value, Asn132BitCharSet *permCharSet)
int pe_byte_align (ASN1CTXT *ctxt_p)
int pe_CheckBuffer (ASN1CTXT *ctxt_p, size_t nbytes)
int pe_ChoiceTypeExt (ASN1CTXT *ctxt_p, ASN1UINT numocts, ASN1ConstOctetPtr data)
int pe_ConsInteger (ASN1CTXT *ctxt_p, ASN1INT value, ASN1INT lower, ASN1INT upper)
int pe_ConsInt64 (ASN1CTXT *ctxt_p, ASN1INT64 value, ASN1INT64 lower, ASN1INT64 upper)
int pe_ConstrainedString (ASN1CTXT *ctxt_p, ASN1ConstCharPtr string, Asn1CharSet *pCharSet)
int pe_ConstrainedStringEx (ASN1CTXT *ctxt_p, ASN1ConstCharPtr string, ASN1ConstCharPtr charSet, ASN1UINT abits, ASN1UINT ubits, ASN1UINT canSetBits)
int pe_ConsUnsigned (ASN1CTXT *ctxt_p, ASN1UINT value, ASN1UINT lower, ASN1UINT upper)
int pe_ConsUInt64 (ASN1CTXT *ctxt_p, ASN1UINT64 value, ASN1UINT64 lower, ASN1UINT64 upper)
int pe_ConsWholeNumber (ASN1CTXT *ctxt_p, ASN1UINT adjusted_value, ASN1UINT range_value)
int pe_ConsWholeNumber64 (ASN1CTXT *ctxt_p, ASN1UINT64 adjusted_value, ASN1UINT64 range_value)
int pe_ExpandBuffer (ASN1CTXT *ctxt_p, size_t nbytes)
ASN1UINT pe_GetIntLen (ASN1UINT value)
size_t pe_GetMsgBitCnt (ASN1CTXT *ctxt_p)
ASN1OCTET * pe_GetMsgPtr (ASN1CTXT *ctxt_p, int *pLength)
ASN1OCTET * pe_GetMsgPtrU (ASN1CTXT *ctxt_p, ASN1UINT *pLength)
int pe_Length (ASN1CTXT *ctxt_p, ASN1UINT value)
int pe_NonNegBinInt (ASN1CTXT *ctxt_p, ASN1UINT value)
int pe_NonNegBinInt64 (ASN1CTXT *ctxt_p, ASN1UINT64 value)
int pe_ObjectIdentifier (ASN1CTXT *ctxt_p, ASN1OBJID *pvalue)
int pe_oid64 (ASN1CTXT *ctxt_p, ASN1OID64 *pvalue)
int pe_RelativeOID (ASN1CTXT *ctxt_p, ASN1OBJID *pvalue)
int pe_octets (ASN1CTXT *ctxt_p, ASN1ConstOctetPtr pvalue, ASN1UINT nbits)
int pe_OctetString (ASN1CTXT *ctxt_p, ASN1UINT numocts, ASN1ConstOctetPtr data)
int pe_OpenType (ASN1CTXT *ctxt_p, ASN1UINT numocts, ASN1ConstOctetPtr data)
int pe_OpenTypeExt (ASN1CTXT *ctxt_p, Asn1RTDList *pElemList)
int pe_OpenTypeExtBits (ASN1CTXT *ctxt_p, Asn1RTDList *pElemList)
int pe_Real (ASN1CTXT *ctxt_p, ASN1REAL value)
int pe_SmallNonNegWholeNumber (ASN1CTXT *ctxt_p, ASN1UINT value)
int pe_SemiConsInteger (ASN1CTXT *ctxt_p, ASN1INT value, ASN1INT lower)
int pe_SemiConsInt64 (ASN1CTXT *ctxt_p, ASN1INT64 value, ASN1INT64 lower)
int pe_SemiConsUnsigned (ASN1CTXT *ctxt_p, ASN1UINT value, ASN1UINT lower)
int pe_SemiConsUInt64 (ASN1CTXT *ctxt_p, ASN1UINT64 value, ASN1UINT64 lower)
int pe_UnconsLength (ASN1CTXT *ctxt_p, ASN1UINT value)
int pe_VarWidthCharString (ASN1CTXT *pctxt, ASN1ConstCharPtr value)


Define Documentation

#define pe_UnconsInt64 ctxt_p,
value   )     pe_SemiConsInt64(ctxt_p,value,ASN1INT64MIN)
 

This function encodes an unconstrained 64-bit integer.

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

#define pe_UnconsInteger ctxt_p,
value   )     pe_SemiConsInteger(ctxt_p,value,ASN1INT_MIN)
 

This function encodes an unconstrained integer.

Parameters:
ctxt_p Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

#define pe_UnconsUInt64 ctxt_p,
value   )     pe_SemiConsUInt64(ctxt_p,value,0)
 

This function encodes an unconstrained unsigned 64-bit integer.

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

#define pe_UnconsUnsigned ctxt_p,
value   )     pe_SemiConsUnsigned(ctxt_p,value,0)
 

This function encodes an unconstrained unsigned integer.

Parameters:
ctxt_p Pointer to context block structure.
value Value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.


Function Documentation

int pe_16BitConstrainedString ASN1CTXT *  ctxt_p,
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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_2sCompBinInt ASN1CTXT *  ctxt_p,
ASN1INT  value
 

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

Parameters:
ctxt_p Pointer to context block structure.
value Signed integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int pe_2sCompBinInt64 ASN1CTXT *  ctxt_p,
ASN1INT64  value
 

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

Parameters:
ctxt_p Pointer to context block structure.
value Signed 64-bit integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int pe_32BitConstrainedString ASN1CTXT *  ctxt_p,
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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_aligned_octets ASN1CTXT *  ctxt_p,
ASN1OCTET *  pvalue,
ASN1UINT  nocts
 

Parameters:
ctxt_p 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 ASN1CTXT *  ctxt_p,
ASN1ConstCharPtr  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:
ctxt_p Pointer to context block structure.
pvalue A pointer to a character string containing the value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int pe_bit ASN1CTXT *  ctxt_p,
ASN1BOOL  value
 

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

Parameters:
ctxt_p 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.

int pe_bits ASN1CTXT *  ctxt_p,
ASN1UINT  value,
ASN1UINT  nbits
 

This function encodes multiple bits.

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_bits64 ASN1CTXT *  ctxt_p,
ASN1UINT64  value,
ASN1UINT  nbits
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_BitString ASN1CTXT *  ctxt_p,
ASN1UINT  numocts,
ASN1ConstOctetPtr  data
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_BMPString ASN1CTXT *  ctxt_p,
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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_byte_align ASN1CTXT *  ctxt_p  ) 
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_CheckBuffer ASN1CTXT *  ctxt_p,
size_t  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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_ChoiceTypeExt ASN1CTXT *  ctxt_p,
ASN1UINT  numocts,
ASN1ConstOctetPtr  data
 

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_ConsInt64 ASN1CTXT *  ctxt_p,
ASN1INT64  value,
ASN1INT64  lower,
ASN1INT64  upper
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_ConsInteger ASN1CTXT *  ctxt_p,
ASN1INT  value,
ASN1INT  lower,
ASN1INT  upper
 

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

Parameters:
ctxt_p Pointer to context block structure.
value Value to be encoded.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int pe_ConstrainedString ASN1CTXT *  ctxt_p,
ASN1ConstCharPtr  string,
Asn1CharSet *  pCharSet
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_ConstrainedStringEx ASN1CTXT *  ctxt_p,
ASN1ConstCharPtr  string,
ASN1ConstCharPtr  charSet,
ASN1UINT  abits,
ASN1UINT  ubits,
ASN1UINT  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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_ConsUInt64 ASN1CTXT *  ctxt_p,
ASN1UINT64  value,
ASN1UINT64  lower,
ASN1UINT64  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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_ConsUnsigned ASN1CTXT *  ctxt_p,
ASN1UINT  value,
ASN1UINT  lower,
ASN1UINT  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:
ctxt_p Pointer to context block structure.
value Value to be encoded.
lower Lower range value.
upper Upper range value.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int pe_ConsWholeNumber ASN1CTXT *  ctxt_p,
ASN1UINT  adjusted_value,
ASN1UINT  range_value
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_ConsWholeNumber64 ASN1CTXT *  ctxt_p,
ASN1UINT64  adjusted_value,
ASN1UINT64  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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_ExpandBuffer ASN1CTXT *  ctxt_p,
size_t  nbytes
 

This function will expand the buffer to hold the given number of bytes.

Parameters:
ctxt_p 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 The number of bytes the buffer is to be expanded by. Note that the buffer will be expanded by ASN_K_ENCBIFXIZ or nbytes (whichever is larger.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

ASN1UINT pe_GetIntLen ASN1UINT  value  ) 
 

Parameters:
value Length value to be encoded.

size_t pe_GetMsgBitCnt ASN1CTXT *  ctxt_p  ) 
 

Parameters:
ctxt_p 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.

ASN1OCTET* pe_GetMsgPtr ASN1CTXT *  ctxt_p,
int *  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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

ASN1OCTET* pe_GetMsgPtrU ASN1CTXT *  ctxt_p,
ASN1UINT *  pLength
 

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_Length ASN1CTXT *  ctxt_p,
ASN1UINT  value
 

This function will encode a length determinant value.

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

int pe_NonNegBinInt ASN1CTXT *  ctxt_p,
ASN1UINT  value
 

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

Parameters:
ctxt_p Pointer to context block structure.
value Unsigned integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int pe_NonNegBinInt64 ASN1CTXT *  ctxt_p,
ASN1UINT64  value
 

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

Parameters:
ctxt_p Pointer to context block structure.
value Unsigned 64-bit integer value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int pe_ObjectIdentifier ASN1CTXT *  ctxt_p,
ASN1OBJID *  pvalue
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_octets ASN1CTXT *  ctxt_p,
ASN1ConstOctetPtr  pvalue,
ASN1UINT  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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_OctetString ASN1CTXT *  ctxt_p,
ASN1UINT  numocts,
ASN1ConstOctetPtr  data
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_oid64 ASN1CTXT *  ctxt_p,
ASN1OID64 *  pvalue
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_OpenType ASN1CTXT *  ctxt_p,
ASN1UINT  numocts,
ASN1ConstOctetPtr  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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_OpenTypeExt ASN1CTXT *  ctxt_p,
Asn1RTDList *  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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_OpenTypeExtBits ASN1CTXT *  ctxt_p,
Asn1RTDList *  pElemList
 

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_Real ASN1CTXT *  ctxt_p,
ASN1REAL  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 rtGetPlusInfinity or rtGetMinusInfinity functions to get these special values.

Parameters:
ctxt_p 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 rtGetPlusInfinity and the rtGetMinusInfinity functions to se the real value to be encoded.
Returns:
Completion status of operation:
  • 0 (ASN_OK) = success,
  • negative return value is error.

int pe_RelativeOID ASN1CTXT *  ctxt_p,
ASN1OBJID *  pvalue
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_SemiConsInt64 ASN1CTXT *  ctxt_p,
ASN1INT64  value,
ASN1INT64  lower
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_SemiConsInteger ASN1CTXT *  ctxt_p,
ASN1INT  value,
ASN1INT  lower
 

This function encodes an semi-constrained integer.

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

int pe_SemiConsUInt64 ASN1CTXT *  ctxt_p,
ASN1UINT64  value,
ASN1UINT64  lower
 

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

Parameters:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_SemiConsUnsigned ASN1CTXT *  ctxt_p,
ASN1UINT  value,
ASN1UINT  lower
 

This function encodes an semi-constrained unsigned integer.

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

int pe_SmallNonNegWholeNumber ASN1CTXT *  ctxt_p,
ASN1UINT  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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_UnconsLength ASN1CTXT *  ctxt_p,
ASN1UINT  value
 

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

int pe_UniversalString ASN1CTXT *  ctxt_p,
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:
ctxt_p 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 (ASN_OK) = success,
  • negative return value is error.

int pe_VarWidthCharString ASN1CTXT *  pctxt,
ASN1ConstCharPtr  value
 

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


Copyright © 1997-2004 Objective Systems,Inc.
All Rights Reserved.
This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.

This file was last modified on 1 Oct 2004.
ASN1C PER Runtime, ASN1C v5.7x