1 /*
2  * libwbxml, the WBXML Library.
3  * Copyright (C) 2002-2008 Aymerick Jehanne <aymerick@jehanne.org>
4  * Copyright (C) 2011 Michael Bell <michael.bell@opensync.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * LGPL v2.1: http://www.gnu.org/copyleft/lesser.txt
21  *
22  * Contact: aymerick@jehanne.org
23  * Home: http://libwbxml.aymerick.com
24  */
25 
26 /**
27  * @file wbxml_errors.h
28  * @ingroup wbxml_errors
29  *
30  * @author Aymerick Jehanne <aymerick@jehanne.org>
31  * @date 02/11/18
32  *
33  * @brief WBXML Error Codes Handling
34  */
35 
36 #ifndef WBXML_ERRORS_H
37 #define WBXML_ERRORS_H
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif /* __cplusplus */
42 
43 #include "wbxml_config.h"
44 #include "wbxml_defines.h"
45 
46 /** @addtogroup wbxml_errors
47  *  @{
48  */
49 
50 /**
51  * @brief The WBXML Parser Errors enumeration
52  */
53 typedef enum WBXMLError_e {
54     /* Generic Errors */
55     WBXML_OK = 0,       /**< No Error */
56     WBXML_NOT_ENCODED = 1,  /**< Not an error; just a special internal return code */
57     WBXML_ERROR_ATTR_TABLE_UNDEFINED = 10,
58     WBXML_ERROR_BAD_DATETIME =         11,
59     WBXML_ERROR_BAD_PARAMETER =        12,
60     WBXML_ERROR_INTERNAL =             13,
61     WBXML_ERROR_LANG_TABLE_UNDEFINED = 14,
62     WBXML_ERROR_NOT_ENOUGH_MEMORY =    15,
63     WBXML_ERROR_NOT_IMPLEMENTED =      16,
64     WBXML_ERROR_TAG_TABLE_UNDEFINED =  17,
65     WBXML_ERROR_B64_ENC =              18,
66     WBXML_ERROR_B64_DEC =              19,
67 #if defined( WBXML_SUPPORT_WV )
68     WBXML_ERROR_WV_DATETIME_FORMAT = 20,
69 #endif /* WBXML_SUPPORT_WV */
70     WBXML_ERROR_NO_CHARSET_CONV =   30,
71     WBXML_ERROR_CHARSET_STR_LEN =   31,
72     WBXML_ERROR_CHARSET_UNKNOWN =   32,
73     WBXML_ERROR_CHARSET_CONV_INIT = 33,
74     WBXML_ERROR_CHARSET_CONV =      34,
75     WBXML_ERROR_CHARSET_NOT_FOUND = 35,
76     /* WBXML Parser Errors */
77     WBXML_ERROR_ATTR_VALUE_TABLE_UNDEFINED =                  40,
78     WBXML_ERROR_BAD_LITERAL_INDEX =                           41,
79     WBXML_ERROR_BAD_NULL_TERMINATED_STRING_IN_STRING_TABLE =  42,
80     WBXML_ERROR_BAD_OPAQUE_LENGTH =                           43,
81     WBXML_ERROR_EMPTY_WBXML =                                 44,
82     WBXML_ERROR_END_OF_BUFFER =                               45,
83     WBXML_ERROR_ENTITY_CODE_OVERFLOW =                        46,
84     WBXML_ERROR_EXT_VALUE_TABLE_UNDEFINED =                   47,
85     WBXML_ERROR_INVALID_STRTBL_INDEX =                        48,
86     WBXML_ERROR_LITERAL_NOT_NULL_TERMINATED_IN_STRING_TABLE = 49,
87     WBXML_ERROR_NOT_NULL_TERMINATED_INLINE_STRING =           50,
88     WBXML_ERROR_NULL_PARSER =                                 51,
89     WBXML_ERROR_NULL_STRING_TABLE =                           52,
90     WBXML_ERROR_STRING_EXPECTED =                             53,
91     WBXML_ERROR_STRTBL_LENGTH =                               54,
92     WBXML_ERROR_UNKNOWN_ATTR =            60,
93     WBXML_ERROR_UNKNOWN_ATTR_VALUE =      61,
94     WBXML_ERROR_UNKNOWN_EXTENSION_TOKEN = 62,
95     WBXML_ERROR_UNKNOWN_EXTENSION_VALUE = 63,
96     WBXML_ERROR_UNKNOWN_PUBLIC_ID =       64,
97     WBXML_ERROR_UNKNOWN_TAG =             65,
98     WBXML_ERROR_UNVALID_MBUINT32 = 70,
99 #if defined( WBXML_SUPPORT_WV )
100     WBXML_ERROR_WV_INTEGER_OVERFLOW = 80,
101 #endif /* WBXML_SUPPORT_WV */
102     /* WBXML Encoder Errors */
103     WBXML_ERROR_ENCODER_APPEND_DATA = 90,
104     WBXML_ERROR_STRTBL_DISABLED =      100,
105     WBXML_ERROR_UNKNOWN_XML_LANGUAGE = 101,
106     WBXML_ERROR_XML_NODE_NOT_ALLOWED = 102,
107     WBXML_ERROR_XML_NULL_ATTR_NAME =   103,
108     WBXML_ERROR_XML_PARSING_FAILED =   104,
109 #if defined( WBXML_SUPPORT_SYNCML )
110     WBXML_ERROR_XML_DEVINF_CONV_FAILED = 110,
111 #endif /* WBXML_SUPPORT_WV */
112     WBXML_ERROR_NO_XMLPARSER =           120,
113     WBXML_ERROR_XMLPARSER_OUTPUT_UTF16 = 121,
114 } WBXMLError;
115 
116 
117 /**
118  * @brief Return a String describing an Error Code
119  * @param error_code WBXML error code
120  * @return The error description
121  */
122 WBXML_DECLARE(const WB_UTINY *) wbxml_errors_string(WBXMLError error_code);
123 
124 /** @} */
125 
126 #ifdef __cplusplus
127 }
128 #endif /* __cplusplus */
129 
130 #endif /* WBXML_ERRORS_H */
131