File: asn1rt.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (150 lines) | stat: -rw-r--r-- 3,878 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
.TH asn1rt 3 "asn1  1.5.2" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
asn1rt \- ASN\&.1 runtime support functions
.SH DESCRIPTION
.LP
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\&.

.SH EXPORTS
.LP
.B
encode(Module,Type,Value)-> {ok,BinOrList} | {error,Reason}
.br
.RS
.TP
Types
Module = Type = atom()
.br
Value = term()
.br
BinOrList = Bytes | binary()
.br
Bytes = [Int|binary|Bytes] when integer(Int), Int >= 0, Int =< 255
.br
Reason = term()
.br
.RE
.RS
.LP
Encodes \fIValue\fR of \fIType\fR defined in the ASN\&.1 module \fIModule\fR\&. Returns a possibly nested list of bytes and or binaries if successful\&. If \fIModule\fR was compiled with the options \fIper_bin\fR and \fIoptimize\fR the result is a binary\&. To get as fast execution as possible the encode function only performs rudimentary tests that the input \fIValue\fR is a correct instance of \fIType\fR\&. The length of strings is for example not always checked\&. 
.RE
.LP
.B
decode(Module,Type,Bytes) -> {ok,Value}|{error,Reason}
.br
.RS
.TP
Types
Module = Type = atom()
.br
Value = Reason = term()
.br
Bytes = binary | [Int] when integer(Int), Int >= 0, Int =< 255 | binary
.br
.RE
.RS
.LP
Decodes \fIType\fR from \fIModule\fR from the list of bytes or binary \fIBytes\fR\&. If the module is compiled with \fIber_bin\fR or \fIper_bin\fR option \fIBytes\fR must be a binary\&. Returns \fI{ok, Value}\fR if successful\&.
.RE
.LP
.B
validate(Module,Type,Value) -> ok | {error,Reason}
.br
.RS
.TP
Types
Module = Type = atom()
.br
Value = term()
.br
.RE
.RS
.LP
Validates that \fIValue\fR conforms to \fIType\fR from \fIModule\fR\&. \fINot implemented in this version of the ASN\&.1 application\&.\fR
.RE
.LP
.B
load_driver() -> ok | {error,Reason}
.br
.RS
.TP
Types
Reason = term()
.br
.RE
.RS
.LP
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\&.
.LP
The driver is only used when encoding/decoding ASN\&.1 files that were compiled with the options \fIper_bin\fR and \fIoptimize\fR\&.
.RE
.LP
.B
unload_driver() -> ok | {error,Reason}
.br
.RS
.TP
Types
Reason = term()
.br
.RE
.RS
.LP
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\&. 
.LP
The driver is only used when ASN\&.1 modules have been compiled with the flags \fIper_bin\fR and \fIoptimize\fR\&.
.RE
.LP
.B
info(Module) -> {ok,Info} | {error,Reason}
.br
.RS
.TP
Types
Module = atom()
.br
Info = list()
.br
Reason = term()
.br
.RE
.RS
.LP
\fIinfo/1\fR returns the version of the asn1 compiler that was used to comile the module\&. It also returns the compiler options that was used\&.
.RE
.LP
.B
utf8_binary_to_list(UTF8Binary) -> {ok,UnicodeList} | {error,Reason}
.br
.RS
.TP
Types
UTF8Binary = binary()
.br
UnicodeList = [integer()]
.br
Reason = term()
.br
.RE
.RS
.LP
\fIutf8_binary_to_list/1\fR 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\&.
.RE
.LP
.B
utf8_list_to_binary(UnicodeList) -> {ok,UTF8Binary} | {error,Reason}
.br
.RS
.TP
Types
UnicodeList = [integer()]
.br
UTF8Binary = binary()
.br
Reason = term()
.br
.RE
.RS
.LP
\fIutf8_list_to_binary/1\fR Transforms a list of integers, where each integer represents one character as its unicode value, to a UTF8 encoded binary\&.
.RE