aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2005-01-31 10:18:53 +0000
committerLev Walkin <vlm@lionet.info>2005-01-31 10:18:53 +0000
commite94e3e511a6806e4c31a1b24de72d7844176f5be (patch)
tree0a3a876addf243899a2ef36bec9e5626f7d4f902
parentfecbd1e91ccc14b900854c49776db812943a2f74 (diff)
converted from tex
-rw-r--r--doc/asn1c-usage.html274
1 files changed, 210 insertions, 64 deletions
diff --git a/doc/asn1c-usage.html b/doc/asn1c-usage.html
index 3195b2ad..36250bb9 100644
--- a/doc/asn1c-usage.html
+++ b/doc/asn1c-usage.html
@@ -41,93 +41,103 @@ Contents</A>
<!--Table of Contents-->
<UL>
-<LI><A NAME="tex2html48"
+<LI><A NAME="tex2html50"
HREF="asn1c-usage.html#SECTION02000000000000000000">ASN.1 Basics</A>
<UL>
-<LI><A NAME="tex2html49"
+<LI><A NAME="tex2html51"
HREF="asn1c-usage.html#SECTION02100000000000000000">Abstract Syntax Notation: ASN.1</A>
<UL>
-<LI><A NAME="tex2html50"
+<LI><A NAME="tex2html52"
HREF="asn1c-usage.html#SECTION02110000000000000000">Some of the ASN.1 Basic Types</A>
<UL>
-<LI><A NAME="tex2html51"
+<LI><A NAME="tex2html53"
HREF="asn1c-usage.html#SECTION02111000000000000000">The BOOLEAN type</A>
-<LI><A NAME="tex2html52"
+<LI><A NAME="tex2html54"
HREF="asn1c-usage.html#SECTION02112000000000000000">The INTEGER type</A>
-<LI><A NAME="tex2html53"
+<LI><A NAME="tex2html55"
HREF="asn1c-usage.html#SECTION02113000000000000000">The ENUMERATED type</A>
-<LI><A NAME="tex2html54"
+<LI><A NAME="tex2html56"
HREF="asn1c-usage.html#SECTION02114000000000000000">The OCTET STRING type</A>
-<LI><A NAME="tex2html55"
+<LI><A NAME="tex2html57"
HREF="asn1c-usage.html#SECTION02115000000000000000">The OBJECT IDENTIFIER type</A>
-<LI><A NAME="tex2html56"
+<LI><A NAME="tex2html58"
HREF="asn1c-usage.html#SECTION02116000000000000000">The RELATIVE-OID type</A>
</UL>
-<LI><A NAME="tex2html57"
+<LI><A NAME="tex2html59"
HREF="asn1c-usage.html#SECTION02120000000000000000">Some of the ASN.1 String Types</A>
<UL>
-<LI><A NAME="tex2html58"
+<LI><A NAME="tex2html60"
HREF="asn1c-usage.html#SECTION02121000000000000000">The IA5String type</A>
-<LI><A NAME="tex2html59"
+<LI><A NAME="tex2html61"
HREF="asn1c-usage.html#SECTION02122000000000000000">The UTF8String type</A>
-<LI><A NAME="tex2html60"
+<LI><A NAME="tex2html62"
HREF="asn1c-usage.html#SECTION02123000000000000000">The NumericString type</A>
-<LI><A NAME="tex2html61"
+<LI><A NAME="tex2html63"
HREF="asn1c-usage.html#SECTION02124000000000000000">The PrintableString type</A>
-<LI><A NAME="tex2html62"
+<LI><A NAME="tex2html64"
HREF="asn1c-usage.html#SECTION02125000000000000000">The VisibleString type</A>
</UL>
-<LI><A NAME="tex2html63"
+<LI><A NAME="tex2html65"
HREF="asn1c-usage.html#SECTION02130000000000000000">ASN.1 Constructed Types</A>
<UL>
-<LI><A NAME="tex2html64"
+<LI><A NAME="tex2html66"
HREF="asn1c-usage.html#SECTION02131000000000000000">The SEQUENCE type</A>
-<LI><A NAME="tex2html65"
+<LI><A NAME="tex2html67"
HREF="asn1c-usage.html#SECTION02132000000000000000">The SET type</A>
-<LI><A NAME="tex2html66"
+<LI><A NAME="tex2html68"
HREF="asn1c-usage.html#SECTION02133000000000000000">The CHOICE type</A>
-<LI><A NAME="tex2html67"
+<LI><A NAME="tex2html69"
HREF="asn1c-usage.html#SECTION02134000000000000000">The SEQUENCE OF type</A>
-<LI><A NAME="tex2html68"
+<LI><A NAME="tex2html70"
HREF="asn1c-usage.html#SECTION02135000000000000000">The SET OF type</A>
</UL>
</UL>
</UL><BR>
-<LI><A NAME="tex2html69"
+<LI><A NAME="tex2html71"
HREF="asn1c-usage.html#SECTION03000000000000000000">Using the ASN.1 Compiler</A>
<UL>
-<LI><A NAME="tex2html70"
+<LI><A NAME="tex2html72"
HREF="asn1c-usage.html#SECTION03100000000000000000">Introduction to the ASN.1 Compiler</A>
-<LI><A NAME="tex2html71"
+<LI><A NAME="tex2html73"
HREF="asn1c-usage.html#SECTION03200000000000000000">Quick start</A>
-<LI><A NAME="tex2html72"
+<LI><A NAME="tex2html74"
HREF="asn1c-usage.html#SECTION03300000000000000000">Using the ASN.1 Compiler</A>
<UL>
-<LI><A NAME="tex2html73"
+<LI><A NAME="tex2html75"
HREF="asn1c-usage.html#SECTION03310000000000000000">Command-line options</A>
-<LI><A NAME="tex2html74"
+<LI><A NAME="tex2html76"
HREF="asn1c-usage.html#SECTION03320000000000000000">Recognizing compiler output</A>
-<LI><A NAME="tex2html75"
+<LI><A NAME="tex2html77"
HREF="asn1c-usage.html#SECTION03330000000000000000">Invoking the ASN.1 helper code from an application</A>
<UL>
-<LI><A NAME="tex2html76"
+<LI><A NAME="tex2html78"
HREF="asn1c-usage.html#SECTION03331000000000000000">Decoding BER</A>
-<LI><A NAME="tex2html77"
+<LI><A NAME="tex2html79"
HREF="asn1c-usage.html#SECTION03332000000000000000">Encoding DER</A>
-<LI><A NAME="tex2html78"
+<LI><A NAME="tex2html80"
HREF="asn1c-usage.html#SECTION03333000000000000000">Encoding XER</A>
-<LI><A NAME="tex2html79"
+<LI><A NAME="tex2html81"
HREF="asn1c-usage.html#SECTION03334000000000000000">Validating the target structure</A>
-<LI><A NAME="tex2html80"
+<LI><A NAME="tex2html82"
HREF="asn1c-usage.html#SECTION03335000000000000000">Printing the target structure</A>
-<LI><A NAME="tex2html81"
+<LI><A NAME="tex2html83"
HREF="asn1c-usage.html#SECTION03336000000000000000">Freeing the target structure</A>
</UL>
</UL>
</UL><BR>
-<LI><A NAME="tex2html82"
+<LI><A NAME="tex2html84"
HREF="asn1c-usage.html#SECTION04000000000000000000">Examples</A>
-<LI><A NAME="tex2html83"
+<UL>
+<LI><A NAME="tex2html85"
+ HREF="asn1c-usage.html#SECTION04100000000000000000">Step by step examples</A>
+<UL>
+<LI><A NAME="tex2html86"
+ HREF="asn1c-usage.html#SECTION04110000000000000000">A ''Rectangle'' Encoder</A>
+<LI><A NAME="tex2html87"
+ HREF="asn1c-usage.html#SECTION04120000000000000000">A ''Rectangle'' Decoder</A>
+</UL>
+</UL><BR>
+<LI><A NAME="tex2html88"
HREF="asn1c-usage.html#SECTION05000000000000000000">Bibliography</A>
</UL>
<!--End of Table of Contents-->
@@ -570,7 +580,7 @@ language structures and surrounding maintenance code. For example,
the C structure which may be created by compiler to represent the
simple <I>Rectangle</I> specification defined earlier in this document,
may look like this<A NAME="tex2html2"
- HREF="#foot574"><SUP>2.2</SUP></A>:
+ HREF="#foot739"><SUP>2.2</SUP></A>:
<P>
@@ -596,8 +606,8 @@ Quick start</A>
<P>
After building and installing the compiler, the <I>asn1c</I><A NAME="tex2html4"
- HREF="#foot575"><SUP>3.1</SUP></A> command may be used to compile the ASN.1 specification<A NAME="tex2html5"
- HREF="#foot576"><SUP>3.2</SUP></A>:
+ HREF="#foot740"><SUP>3.1</SUP></A> command may be used to compile the ASN.1 specification<A NAME="tex2html5"
+ HREF="#foot741"><SUP>3.2</SUP></A>:
<P>
@@ -663,7 +673,7 @@ the compiler's behavior.
<P>
<BR><P></P>
-<DIV ALIGN="CENTER"><A NAME="579"></A>
+<DIV ALIGN="CENTER"><A NAME="744"></A>
<TABLE>
<CAPTION><STRONG><A NAME=Table1>Table 1:</A></STRONG>
The list of asn1c command line options</CAPTION>
@@ -807,7 +817,7 @@ be possible to compile everything with the single instruction:
<BLOCKQUOTE><PRE>
cc&nbsp;-o&nbsp;rectangle&nbsp;*.c&nbsp;&nbsp;&nbsp;#&nbsp;It&nbsp;could&nbsp;be&nbsp;<I>that</I>&nbsp;simple<A NAME="tex2html7"
- HREF="#foot582"><SUP>4.1</SUP></A>
+ HREF="#foot747"><SUP>4.1</SUP></A>
</PRE>
</BLOCKQUOTE>
@@ -1059,19 +1069,6 @@ function, which is somewhat simpler:
<P>
<BLOCKQUOTE><PRE>
-/*
-&nbsp;*&nbsp;This&nbsp;is&nbsp;a&nbsp;custom&nbsp;function&nbsp;which&nbsp;writes&nbsp;the
-&nbsp;*&nbsp;encoded&nbsp;output&nbsp;into&nbsp;some&nbsp;FILE&nbsp;stream.
-&nbsp;*/
-static&nbsp;int
-write_stream(const&nbsp;void&nbsp;*buffer,&nbsp;size_t&nbsp;size,&nbsp;void&nbsp;*app_key)&nbsp;{
-&nbsp;&nbsp;&nbsp;&nbsp;FILE&nbsp;*ostream&nbsp;=&nbsp;app_key;
-&nbsp;&nbsp;&nbsp;&nbsp;size_t&nbsp;wrote;
-&nbsp;
-&nbsp;&nbsp;&nbsp;&nbsp;wrote&nbsp;=&nbsp;fwrite(buffer,&nbsp;1,&nbsp;size,&nbsp;ostream);
-&nbsp;
-&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(wrote&nbsp;==&nbsp;size)&nbsp;?&nbsp;0&nbsp;:&nbsp;-1;
-}
&nbsp;
/*
&nbsp;*&nbsp;This&nbsp;is&nbsp;the&nbsp;serializer&nbsp;itself,
@@ -1112,7 +1109,7 @@ DER encoder will essentially do the same thing (i.e., encode the data)
but no callbacks will be invoked (so the data goes nowhere). It may
prove useful to determine the size of the structure's encoding before
actually doing the encoding<A NAME="tex2html9"
- HREF="#foot329"><SUP>4.3</SUP></A>.
+ HREF="#foot322"><SUP>4.3</SUP></A>.
<P>
Please look into der_encoder.h for the precise definition of der_encode()
@@ -1299,11 +1296,159 @@ Examples</A>
<P>
<H1><A NAME="SECTION04100000000000000000">
-Step-by-step: A ''Rectangle'' Decoder</A>
+Step by step examples</A>
+</H1>
+
+<P>
+
+<H1><A NAME="SECTION04110000000000000000">
+A ''Rectangle'' Encoder</A>
+</H1>
+
+<P>
+This chapter will help you to create a simple BER and XER encoder
+of a ''Rectangle'' type used throughout this document.
+
+<P>
+
+<OL>
+<LI>Create a file named <B>rectangle.asn1</B> with the following contents:
+
+<P>
+
+<BLOCKQUOTE><PRE>
+RectangleModule1&nbsp;DEFINITIONS&nbsp;::=
+BEGIN
+&nbsp;
+Rectangle&nbsp;::=&nbsp;SEQUENCE&nbsp;{
+&nbsp;&nbsp;&nbsp;&nbsp;height&nbsp;&nbsp;INTEGER,
+&nbsp;&nbsp;&nbsp;&nbsp;width&nbsp;&nbsp;&nbsp;INTEGER
+}
+&nbsp;
+END
+</PRE>
+</BLOCKQUOTE>
+
+</LI>
+<LI>Compile it into the set of .c and .h files using asn1c compiler [<A
+ HREF="asn1c-usage.html#ASN1C">ASN1C</A>]:
+
+<P>
+
+<BLOCKQUOTE><PRE>
+<I>asn1c&nbsp;-fnative-types</I>&nbsp;<B>rectangle.asn1</B>
+</PRE>
+</BLOCKQUOTE>
+
+</LI>
+<LI>Alternatively, use the Online ASN.1 compiler [<A
+ HREF="asn1c-usage.html#AONL">AONL</A>] by uploading
+the <B>rectangle.asn1</B> file into the Web form and unpacking the
+produced archive on your computer.
+</LI>
+<LI>By this time, you should have gotten multiple files in the current
+directory, including the <B>Rectangle.c</B> and <B>Rectangle.h</B>.
+</LI>
+<LI>Create a main() routine which creates the Rectangle_t structure in
+memory and encodes it using BER and XER encoding rules. Let's name
+the file <B>main.c</B>:
+
+<P>
+
+<BLOCKQUOTE><PRE>
+<FONT SIZE="-1">#include&nbsp;&lt;stdio.h&gt;</FONT>
+<FONT SIZE="-1">#include&nbsp;&lt;sys/types.h&gt;</FONT>
+<FONT SIZE="-1">#include&nbsp;&lt;Rectangle.h&gt;&nbsp;&nbsp;&nbsp;/*&nbsp;Rectangle&nbsp;ASN.1&nbsp;type&nbsp;&nbsp;*/</FONT>
+&nbsp;
+<FONT SIZE="-1">/*</FONT>
+&nbsp;<FONT SIZE="-1">*&nbsp;This&nbsp;is&nbsp;a&nbsp;custom&nbsp;function&nbsp;which&nbsp;writes&nbsp;the</FONT>
+&nbsp;<FONT SIZE="-1">*&nbsp;encoded&nbsp;output&nbsp;into&nbsp;some&nbsp;FILE&nbsp;stream.</FONT>
+&nbsp;<FONT SIZE="-1">*/</FONT>
+<FONT SIZE="-1">static&nbsp;int</FONT>
+<FONT SIZE="-1">write_out(const&nbsp;void&nbsp;*buffer,&nbsp;size_t&nbsp;size,&nbsp;void&nbsp;*app_key)&nbsp;{</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;FILE&nbsp;*out_fp&nbsp;=&nbsp;app_key;</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;size_t&nbsp;wrote;</FONT>
+&nbsp;
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;wrote&nbsp;=&nbsp;fwrite(buffer,&nbsp;1,&nbsp;size,&nbsp;out_fp);</FONT>
+&nbsp;
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;return&nbsp;(wrote&nbsp;==&nbsp;size)&nbsp;?&nbsp;0&nbsp;:&nbsp;-1;</FONT>
+<FONT SIZE="-1">}</FONT>
+&nbsp;
+<FONT SIZE="-1">int&nbsp;main(int&nbsp;ac,&nbsp;char&nbsp;*av)&nbsp;{</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;Rectangle_t&nbsp;*rectangle;&nbsp;/*&nbsp;Type&nbsp;to&nbsp;encode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;asn_enc_rval_t&nbsp;ec;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Encoder&nbsp;return&nbsp;value&nbsp;&nbsp;*/</FONT>
+&nbsp;
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;/*&nbsp;Allocate&nbsp;the&nbsp;Rectangle_t&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;rectangle&nbsp;=&nbsp;calloc(1,&nbsp;sizeof(Rectangle_t);&nbsp;/*&nbsp;not&nbsp;malloc!&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;if(!rectangle)&nbsp;{</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;perror(''calloc()&nbsp;failed'');</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(71);&nbsp;/*&nbsp;better,&nbsp;EX_OSERR&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;}</FONT>
+&nbsp;
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;/*&nbsp;Initialize&nbsp;the&nbsp;Rectangle&nbsp;members&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;rectangle-&gt;height&nbsp;=&nbsp;42;&nbsp;&nbsp;/*&nbsp;any&nbsp;random&nbsp;value&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;rectangle-&gt;width&nbsp;&nbsp;=&nbsp;23;&nbsp;&nbsp;/*&nbsp;any&nbsp;random&nbsp;value&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;/*&nbsp;BER&nbsp;encode&nbsp;the&nbsp;data&nbsp;if&nbsp;filename&nbsp;is&nbsp;given&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;if(ac&nbsp;&lt;&nbsp;2)&nbsp;{</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&nbsp;''Specify&nbsp;filename&nbsp;for&nbsp;BER&nbsp;output&#92;n'');</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;char&nbsp;*filename&nbsp;=&nbsp;av[1];</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FILE&nbsp;*fp&nbsp;=&nbsp;fopen(filename,&nbsp;''w'');&nbsp;&nbsp;&nbsp;/*&nbsp;for&nbsp;BER&nbsp;output&nbsp;*/</FONT>
+&nbsp;
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!fp)&nbsp;{</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;perror(filename);</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(71);&nbsp;/*&nbsp;better,&nbsp;EX_OSERR&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Encode&nbsp;the&nbsp;Rectangle&nbsp;type&nbsp;as&nbsp;BER&nbsp;(DER)&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ec&nbsp;=&nbsp;der_encode(&amp;asn_DEF_Rectangle,</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rectangle,&nbsp;write_out,&nbsp;stream);</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fclose(fp);</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(ec.encoded&nbsp;==&nbsp;-1)&nbsp;{</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;''Could&nbsp;not&nbsp;encode&nbsp;Rectangle&nbsp;(at&nbsp;%s)&#92;n'',</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ec.failed_type&nbsp;?&nbsp;ec.failed_type-&gt;name&nbsp;:&nbsp;''unknown'');</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(65);&nbsp;/*&nbsp;better,&nbsp;EX_DATAERR&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&nbsp;''Created&nbsp;%s&nbsp;with&nbsp;BER&nbsp;encoded&nbsp;Rectangle&#92;n'',</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filename);</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;}</FONT>
+&nbsp;
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;/*&nbsp;Also&nbsp;print&nbsp;the&nbsp;constructed&nbsp;Rectangle&nbsp;XER&nbsp;encoded&nbsp;(XML)&nbsp;*/</FONT>
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;xer_fprint(stdout,&nbsp;&amp;asn_DEF_Rectangle,&nbsp;rectangle);</FONT>
+&nbsp;
+&nbsp;<FONT SIZE="-1">&nbsp;&nbsp;&nbsp;return&nbsp;0;&nbsp;/*&nbsp;Encoding&nbsp;finished&nbsp;successfully&nbsp;*/</FONT>
+<FONT SIZE="-1">}</FONT>
+</PRE>
+</BLOCKQUOTE>
+
+</LI>
+<LI>Compile all files together using C compiler (varies by platform):
+
+<P>
+
+<BLOCKQUOTE><PRE>
+<I>cc&nbsp;-I.&nbsp;-o</I>&nbsp;<B><I>rencode</I></B>&nbsp;<I>*.c</I>
+</PRE>
+</BLOCKQUOTE>
+
+</LI>
+<LI>Voila! You have just created the BER and XER encoder of a Rectangle
+type, named <B>rencode</B>!
+</LI>
+</OL>
+
+
+<P>
+
+<H1><A NAME="SECTION04120000000000000000">
+A ''Rectangle'' Decoder</A>
</H1>
<P>
-This chapter will help you to create a simple decoder of a simple
+This chapter will help you to create a simple BER decoder of a simple
''Rectangle'' type used throughout this document.
<P>
@@ -1417,7 +1562,8 @@ it as it were a BER-encoded Rectangle type, and prints out the text
</BLOCKQUOTE>
</LI>
-<LI>Voila! You have just created the Rectangle type decoder named <B>rdecode</B>!
+<LI>Voila! You have just created the BER decoder of a Rectangle type,
+named <B>rdecode</B>!
</LI>
</OL>
<H2><A NAME="SECTION05000000000000000000">
@@ -1442,7 +1588,7 @@ ISBN:0-12-6333361-0.
not a definitive factor.
</DD>
-<DT><A NAME="foot574">... this</A><A
+<DT><A NAME="foot739">... this</A><A
HREF="asn1c-usage.html#tex2html2"><SUP>2.2</SUP></A></DT>
<DD><I>-fnative-types</I> compiler option is used to produce basic C <I>int</I>
types instead of infinite width INTEGER_t structures. See <A HREF=#Table1>Table 1</A>.
@@ -1454,19 +1600,19 @@ types instead of infinite width INTEGER_t structures. See <A HREF=#Table1>Table
text (XML) based.
</DD>
-<DT><A NAME="foot575">...asn1c</A><A
+<DT><A NAME="foot740">...asn1c</A><A
HREF="asn1c-usage.html#tex2html4"><SUP>3.1</SUP></A></DT>
<DD>The 1 symbol in asn<B>1</B>c is a digit, not an ''ell'' letter.
</DD>
-<DT><A NAME="foot576">... specification</A><A
+<DT><A NAME="foot741">... specification</A><A
HREF="asn1c-usage.html#tex2html5"><SUP>3.2</SUP></A></DT>
<DD>This is probably <B>not</B> what you want to try out right now -
read through the rest of this chapter to find out about <B>-P</B>
and <B>-R</B> options.
</DD>
-<DT><A NAME="foot582">...that&nbsp;simple</A><A
+<DT><A NAME="foot747">...that&nbsp;simple</A><A
HREF="asn1c-usage.html#tex2html7"><SUP>4.1</SUP></A></DT>
<DD>Provided that you've also created a .c file with the <I>int main()</I>
routine.
@@ -1479,7 +1625,7 @@ it will fail, but may later be invoked again with the rest of the
buffer to continue decoding.
</DD>
-<DT><A NAME="foot329">... encoding</A><A
+<DT><A NAME="foot322">... encoding</A><A
HREF="asn1c-usage.html#tex2html9"><SUP>4.3</SUP></A></DT>
<DD>It is actually faster too: the encoder might skip over some computations
which aren't important for the size determination.
@@ -1488,7 +1634,7 @@ which aren't important for the size determination.
</DL><BR><HR>
<ADDRESS>
Lev Walkin
-2005-01-17
+2005-01-31
</ADDRESS>
</BODY>
</HTML>