Consider using a more generic function \api{sec:asn_decode}{asn_decode(ATS_BER)}.
\noindent\emph{Consider using a more generic function \api{sec:asn_decode}{asn_decode(ATS_BER)}.}
\subsection*{Return values}
\subsection*{Return values}
\input{asn_dec_rval.inc}
\input{asn_dec_rval.inc}
...
@@ -907,16 +1061,107 @@ the next buffer to contain the unprocessed part of the previous buffer.
...
@@ -907,16 +1061,107 @@ the next buffer to contain the unprocessed part of the previous buffer.
\subsection*{See also}
\subsection*{See also}
\seealso{sec:der_encode}{der_encode()}.
\seealso{sec:der_encode}{der_encode()}.
\section{\label{sec:der_encode}der\_encode}
\apisection{sec:der_encode}{der\_encode}
\subsection*{Synopsis}
\begin{signature}
asn_enc_rval_t der_encode(
const asn_TYPE_descriptor_t *type_descriptor,
const void *structure_to_encode,
asn_app_consume_bytes_f *callback,
void *callback_key
\end{signature}
\subsection*{Description}
The \code{der_encode()} function serializes the given \code{structure_to_encode} using the DER transfer syntax (a variant of BER, Basic Encoding Rules).
During serialization, a user-specified \code{callback} is invoked zero
or more times with bytes of data to add to the output stream (if any), and
the \code{callback_key}. The signature for the callback is as follows:
The \code{der_encode_to_buffer()} function serializes the given \code{structure_to_encode} using the DER transfer syntax (a variant of BER, Basic Encoding Rules).
The function places the serialized data into the given
\code{buffer} of size \code{buffer_size}.\newline
\noindent\emph{Consider using a more generic function \api{sec:asn_encode_to_buffer}{asn_encode_to_buffer(ATS_DER)}.}
\subsection*{Return values}
\input{asn_enc_rval.inc}
The serialized output size is returned in \textbf{bytes}.
The \code{.encoded} never exceeds the available buffer size.\footnote{This
behavior is different from \api{sec:asn_encode_to_buffer}{asn_encode_to_buffer()}.}
If the \code{buffer_size} is not sufficient, the \code{.encoded}
will be set to -1 and encoding would fail.
\subsection*{Example}
\begin{example}
Rectangle_t *rect = ...;
uint8_t buffer[128];
asn_enc_rval_t er;
er = der_encode_to_buffer(&asn_DEF_Rectangle, rect, buffer, sizeof(buffer));
if(er.encoded == -1) {
fprintf(stderr, "Serialization of %\%%s failed.\n", asn_DEF_Rectangle.name);
Decode the BASIC-OER and CANONICAL-OER (Octet Encoding Rules),
Decode the BASIC-OER and CANONICAL-OER (Octet Encoding Rules),
as defined by ITU-T~X.696.
as defined by ITU-T~X.696.\newline
Consider using a more generic function \api{sec:asn_decode}{asn_decode(ATS_BASIC_OER)}.
\noindent\emph{Consider using a more generic function \api{sec:asn_decode}{asn_decode(ATS_BASIC_OER)}.}
\subsection*{Return values}
\subsection*{Return values}
\input{asn_dec_rval.inc}
\input{asn_dec_rval.inc}
...
@@ -952,11 +1197,107 @@ Note that in the RC\_WMORE case the decoder may have processed less data than
...
@@ -952,11 +1197,107 @@ Note that in the RC\_WMORE case the decoder may have processed less data than
it is available in the buffer, which means that you must be able to arrange
it is available in the buffer, which means that you must be able to arrange
the next buffer to contain the unprocessed part of the previous buffer.
the next buffer to contain the unprocessed part of the previous buffer.
\section{\label{sec:oer_encode}oer\_encode}
\apisection{sec:oer_encode}{oer\_encode()}
\section{oer\_encode\_to\_buffer}
\clearpage{}
\subsection*{Synopsis}
\section{\label{sec:uper_decode}uper\_decode()}
\begin{signature}
asn_enc_rval_t oer_encode(
const asn_TYPE_descriptor_t *type_descriptor,
const void *structure_to_encode,
asn_app_consume_bytes_f *callback,
void *callback_key);
\end{signature}
\subsection*{Description}
The \code{oer_encode()} function serializes the given \code{structure_to_encode} using the CANONICAL-OER transfer syntax (Octet Encoding Rules, ITU-T~X.691).
During serialization, a user-specified \code{callback} is invoked zero
or more times with bytes of data to add to the output stream (if any), and
the \code{callback_key}. The signature for the callback is as follows:
The \code{oer_encode_to_buffer()} function serializes the given \code{structure_to_encode} using the CANONICAL-OER transfer syntax (Octet Encoding Rules, ITU-T~X.691).
The function places the serialized data into the given
\code{buffer} of size \code{buffer_size}.\newline
\noindent\emph{Consider using a more generic function \api{sec:asn_encode_to_buffer}{asn_encode_to_buffer(ATS_CANONICAL_OER)}.}
\subsection*{Return values}
\input{asn_enc_rval.inc}
The serialized output size is returned in \textbf{bytes}.
The \code{.encoded} never exceeds the available buffer size.\footnote{This
behavior is different from \api{sec:asn_encode_to_buffer}{asn_encode_to_buffer()}.}
If the \code{buffer_size} is not sufficient, the \code{.encoded}
will be set to -1 and encoding would fail.
\subsection*{Example}
\begin{example}
Rectangle_t *rect = ...;
uint8_t buffer[128];
asn_enc_rval_t er;
er = oer_encode_to_buffer(&asn_DEF_Rectangle, 0, rect, buffer, sizeof(buffer));
if(er.encoded == -1) {
fprintf(stderr, "Serialization of %\%%s failed.\n", asn_DEF_Rectangle.name);
The \code{xer_encode()} function serializes the given \code{structure_to_encode} using the BASIC-XER or CANONICAL-XER transfer syntax (XML Encoding Rules, ITU-T~X.693).
During serialization, a user-specified \code{callback} is invoked zero
or more times with bytes of data to add to the output stream (if any), and
the \code{callback_key}. The signature for the callback is as follows:
\noindent\emph{Consider using a more generic function \api{sec:asn_encode}{asn_encode()} with \texttt{ATS\_BASIC\_XER} or \texttt{ATS\_CANONICAL\_XER} transfer syntax option.}
\subsection*{Return values}
\input{asn_enc_rval.inc}
The serialized output size is returned in \textbf{bytes}.