<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- asn1rt</title> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/asn1-1.6.13.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>ASN.1</strong><br><strong>Reference Manual</strong><br><small>Version 1.6.13</small></p> <br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p> <ul class="flipMenu"> <li id="no" title="asn1ct " expanded="false">asn1ct<ul> <li><a href="asn1ct.html"> Top of manual page </a></li> <li title="compile-1"><a href="asn1ct.html#compile-1">compile/1</a></li> <li title="compile-2"><a href="asn1ct.html#compile-2">compile/2</a></li> <li title="encode-3"><a href="asn1ct.html#encode-3">encode/3</a></li> <li title="decode-3"><a href="asn1ct.html#decode-3">decode/3</a></li> <li title="validate-3"><a href="asn1ct.html#validate-3">validate/3</a></li> <li title="value-2"><a href="asn1ct.html#value-2">value/2</a></li> <li title="test-1"><a href="asn1ct.html#test-1">test/1</a></li> <li title="test-2"><a href="asn1ct.html#test-2">test/2</a></li> <li title="test-3"><a href="asn1ct.html#test-3">test/3</a></li> </ul> </li> <li id="loadscrollpos" title="asn1rt " expanded="true">asn1rt<ul> <li><a href="asn1rt.html"> Top of manual page </a></li> <li title="start-0"><a href="asn1rt.html#start-0">start/0</a></li> <li title="stop-0"><a href="asn1rt.html#stop-0">stop/0</a></li> <li title="decode-3"><a href="asn1rt.html#decode-3">decode/3</a></li> <li title="encode-3"><a href="asn1rt.html#encode-3">encode/3</a></li> <li title="info-1"><a href="asn1rt.html#info-1">info/1</a></li> <li title="load_driver-0"><a href="asn1rt.html#load_driver-0">load_driver/0</a></li> <li title="unload_driver-0"><a href="asn1rt.html#unload_driver-0">unload_driver/0</a></li> <li title="utf8_binary_to_list-1"><a href="asn1rt.html#utf8_binary_to_list-1">utf8_binary_to_list/1</a></li> <li title="utf8_list_to_binary-1"><a href="asn1rt.html#utf8_list_to_binary-1">utf8_list_to_binary/1</a></li> <li title="validate-3"><a href="asn1rt.html#validate-3">validate/3</a></li> </ul> </li> </ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><h1>asn1rt</h1></center> <h3>MODULE</h3> <div class="REFBODY">asn1rt</div> <h3>MODULE SUMMARY</h3> <div class="REFBODY">ASN.1 runtime support functions</div> <h3>DESCRIPTION</h3> <div class="REFBODY"><p> <p>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.</p> </p></div> <h3>EXPORTS</h3> <p><a name="start-0"><span class="bold_code">start() -> ok |{error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Starts the asn1 server that loads the drivers.</p> <p>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 <span class="code">[per_bin, optimize]</span> or <span class="code">[ber_bin, optimize, driver]</span>. 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.</p> </p></div> <p><a name="stop-0"><span class="bold_code">stop() -> ok |{error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Stops the asn1 server and unloads the drivers.</p> </p></div> <p><a name="decode-3"><span class="bold_code">decode(Module,Type,Bytes) -> {ok,Value}|{error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Module = Type = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Value = Reason = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Bytes = binary | [Int] when integer(Int), Int >= 0, Int =< 255 | binary</span><br> </div> </div> <div class="REFBODY"><p> <p>Decodes <span class="code">Type</span> from <span class="code">Module</span> from the list of bytes or binary <span class="code">Bytes</span>. If the module is compiled with <span class="code">ber_bin</span> or <span class="code">per_bin</span> option <span class="code">Bytes</span> must be a binary. Returns <span class="code">{ok,Value}</span> if successful.</p> </p></div> <p><a name="encode-3"><span class="bold_code">encode(Module,Type,Value)-> {ok,BinOrList} | {error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Module = Type = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Value = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">BinOrList = Bytes | binary()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Bytes = [Int|binary|Bytes] when integer(Int), Int >= 0, Int =< 255</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Encodes <span class="code">Value</span> of <span class="code">Type</span> defined in the ASN.1 module <span class="code">Module</span>. Returns a possibly nested list of bytes and or binaries if successful. If <span class="code">Module</span> was compiled with the options <span class="code">per_bin</span> and <span class="code">optimize</span> the result is a binary. To get as fast execution as possible the encode function only performs rudimentary tests that the input <span class="code">Value</span> is a correct instance of <span class="code">Type</span>. The length of strings is for example not always checked. </p> </p></div> <p><a name="info-1"><span class="bold_code">info(Module) -> {ok,Info} | {error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Module = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Info = list()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p><span class="code">info/1</span> returns the version of the asn1 compiler that was used to compile the module. It also returns the compiler options that was used.</p> </p></div> <p><a name="load_driver-0"><span class="bold_code">load_driver() -> ok | {error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>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.</p> <p>The driver is only used when encoding/decoding ASN.1 files that were compiled with the options <span class="code">per_bin</span> and <span class="code">optimize</span>.</p> </p></div> <p><a name="unload_driver-0"><span class="bold_code">unload_driver() -> ok | {error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>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. </p> <p>The driver is only used when ASN.1 modules have been compiled with the flags <span class="code">per_bin</span> and <span class="code">optimize</span>.</p> </p></div> <p><a name="utf8_binary_to_list-1"><span class="bold_code">utf8_binary_to_list(UTF8Binary) -> {ok,UnicodeList} | {error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">UTF8Binary = binary()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">UnicodeList = [integer()]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p><span class="code">utf8_binary_to_list/1</span> 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.</p> </p></div> <p><a name="utf8_list_to_binary-1"><span class="bold_code">utf8_list_to_binary(UnicodeList) -> {ok,UTF8Binary} | {error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">UnicodeList = [integer()]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">UTF8Binary = binary()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p><span class="code">utf8_list_to_binary/1</span> Transforms a list of integers, where each integer represents one character as its unicode value, to a UTF8 encoded binary.</p> </p></div> <p><a name="validate-3"><span class="bold_code">validate(Module,Type,Value) -> ok | {error,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Module = Type = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Value = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Validates that <span class="code">Value</span> conforms to <span class="code">Type</span> from <span class="code">Module</span>. <strong>Not implemented in this version of the ASN.1 application.</strong></p> </p></div> </div> <div class="footer"> <hr> <p>Copyright © 1997-2010 Ericsson AB. All Rights Reserved.</p> </div> </div> </div></body> </html>