asn1rt
MODULE
MODULE SUMMARY
DESCRIPTION
This module is the interface module for the ASN.1 runtime support functions. To encode and decode ASN.1 types in runtime the functions in this module should be used.
EXPORTS
Types:
Starts the asn1 server that loads the drivers.
The server schedules a driver that is not blocked by another caller. The driver is used by the asn1 application if specs are compiled with options [per_bin, optimize] or [ber_bin, optimize, driver]. The server will be started automatically at encode/decode if it isn't done explicitly. If encode/decode with driver is used in test or industrial code it is a performance gain to start it explicitly to avoid the one time load in run-time.
Types:
Stops the asn1 server and unloads the drivers.
decode(Module,Type,Bytes) -> {ok,Value}|{error,Reason}
Types:
Decodes Type from Module from the list of bytes or binary Bytes. If the module is compiled with ber_bin or per_bin option Bytes must be a binary. Returns {ok,Value} if successful.
encode(Module,Type,Value)-> {ok,BinOrList} | {error,Reason}
Types:
Encodes Value of Type defined in the ASN.1 module Module. Returns a possibly nested list of bytes and or binaries if successful. If Module was compiled with the options per_bin and optimize the result is a binary. To get as fast execution as possible the encode function only performs rudimentary tests that the input Value is a correct instance of Type. The length of strings is for example not always checked.
info(Module) -> {ok,Info} | {error,Reason}
Types:
info/1 returns the version of the asn1 compiler that was used to compile the module. It also returns the compiler options that was used.
load_driver() -> ok | {error,Reason}
Types:
This function loads the linked-in driver before the first call to encode. If this function is not called the driver will be loaded automatically at the first call to encode. If one doesn't want the performance cost of a driver load when the application is running, this function makes it possible to load the driver in an initialization.
The driver is only used when encoding/decoding ASN.1 files that were compiled with the options per_bin and optimize.
unload_driver() -> ok | {error,Reason}
Types:
This function unloads the linked-in driver. When the driver has been loaded it remains in the environment until it is unloaded. Normally the driver should remain loaded, it is crucial for the performance of ASN.1 encoding.
The driver is only used when ASN.1 modules have been compiled with the flags per_bin and optimize.
utf8_binary_to_list(UTF8Binary) -> {ok,UnicodeList} | {error,Reason}
Types:
utf8_binary_to_list/1 Transforms a UTF8 encoded binary to a list of integers, where each integer represents one character as its unicode value. The function fails if the binary is not a properly encoded UTF8 string.
utf8_list_to_binary(UnicodeList) -> {ok,UTF8Binary} | {error,Reason}
Types:
utf8_list_to_binary/1 Transforms a list of integers, where each integer represents one character as its unicode value, to a UTF8 encoded binary.
validate(Module,Type,Value) -> ok | {error,Reason}
Types:
Validates that Value conforms to Type from Module. Not implemented in this version of the ASN.1 application.