Lev Walkin | 9ce64c1 | 2017-11-07 06:22:14 -0800 | [diff] [blame] | 1 | |
| 2 | Upon unsuccessful termination, the \code{*struct_ptr_ptr} |
| 3 | may contain partially decoded data. This data may be useful for debugging |
| 4 | (such as by using \code{asn_fprint()}). |
| 5 | Don't forget to discard the unused partially decoded data by calling |
| 6 | \code{ASN_STRUCT_FREE()} or \code{ASN_STRUCT_RESET()}. |
| 7 | |
Lev Walkin | 07f8c3e | 2017-11-15 00:21:51 -0800 | [diff] [blame^] | 8 | The function returns a compound structure: |
Lev Walkin | cf573ec | 2017-11-07 04:20:52 -0800 | [diff] [blame] | 9 | \begin{codesample} |
| 10 | typedef struct { |
| 11 | enum { |
| 12 | RC_OK, /* Decoded successfully */ |
| 13 | RC_WMORE, /* More data expected, call again */ |
| 14 | RC_FAIL /* Failure to decode data */ |
| 15 | } code; /* Result code */ |
| 16 | size_t consumed; /* Number of bytes consumed */ |
| 17 | } asn_dec_rval_t; |
| 18 | \end{codesample} |
| 19 | |
Lev Walkin | 07f8c3e | 2017-11-15 00:21:51 -0800 | [diff] [blame^] | 20 | \noindent{}The \code{.code} member specifies the decoding outcome. |
Lev Walkin | cf573ec | 2017-11-07 04:20:52 -0800 | [diff] [blame] | 21 | |
Lev Walkin | 9ce64c1 | 2017-11-07 06:22:14 -0800 | [diff] [blame] | 22 | \begin{tabular}[h!]{ll} |
| 23 | \texttt{RC\_OK} & Decoded successfully and completely \\ |
| 24 | \texttt{RC\_WMORE} & More data expected, call again \\ |
| 25 | \texttt{RC\_FAIL} & Failed for good |
| 26 | \end{tabular} |
Lev Walkin | cf573ec | 2017-11-07 04:20:52 -0800 | [diff] [blame] | 27 | |
Lev Walkin | 07f8c3e | 2017-11-15 00:21:51 -0800 | [diff] [blame^] | 28 | \noindent{}The \code{.consumed} member specifies the amount of \code{buffer} data |
Lev Walkin | cf573ec | 2017-11-07 04:20:52 -0800 | [diff] [blame] | 29 | that was used during parsing, irrespectively of the \code{.code}. |
| 30 | |