
Generated BER Stream-Oriented Encode Functions
BER messages can be encoded directly to an output stream such as a file, network or memory stream. The ASN1C compiler has the -stream option to generate encode functions of this type. For each ASN.1 production defined in the ASN.1 source file, a C stream encode function is generated. This function will encode a populated C variable of the given type into an encoded ASN.1 message and write it to a stream.
If the return status indicates success (ASN_OK), the message will have been encoded to the given stream. Stream-oriented BER encoding starts from the beginning of the message until the message is complete. This is sometimes referred to as "forward encoding". This differs from regular BER where encoding is done from back-to-front. Indefinite lengths are used for all constructed elements in the message. Also, there is no permanent buffer for stream-oriented encoding, all octets are written to the stream. The buffer in the context structure is used only as a cache.
Objective Systems, Inc.102 Pickering Way, Suite #506Exton, Pennsylvania 19341 http://www.obj-sys.com Phone: (484) 875-9841 Toll-free: (877) 307-6855 (US only) Fax: (484) 875-9830 info@obj-sys.com |