libsyncml 0.5.4

- Main Page
- Modules
- Data Structures
- Files

- File List

sml_error.h
1 /*
2 * libsyncml - A syncml protocol implementation
3 * Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org>
4 * Copyright (C) 2007-2008 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22 #ifndef _SML_ERROR_H_
23 #define _SML_ERROR_H_
24
25 typedef enum {
26 SML_ERRORCLASS_UNKNOWN = 0,
27 SML_ERRORCLASS_SUCCESS = 2,
28 SML_ERRORCLASS_RETRY = 3,
29 SML_ERRORCLASS_FATAL = 5
30 } SmlErrorClass;
31
35 typedef enum {
36 SML_ERROR_UNKNOWN = 0,
37
38 /* Informational */
39 SML_IN_PROGRESS = 101,
40
41 /* OK code */
43 SML_NO_ERROR = 200,
45 SML_ITEM_ADDED = 201,
47 SML_PROCESSING_ACCEPTED = 202,
49 SML_NON_AUTHORITATIVE = 203,
51 SML_NO_CONTENT = 204,
53 SML_RESET_CONTENT = 205,
55 SML_PARTIAL_CONTENT = 206,
57 SML_CONFLICT_MERGE = 207,
59 SML_CONFLICT_CLIENT_WIN = 208,
61 SML_CONFLICT_DUPLICATE = 209,
63 SML_DELETE_NO_ARCHIVE = 210,
65 SML_DELETE_NOT_FOUND = 211,
67 SML_AUTH_ACCEPTED = 212,
69 SML_CHUNK_ACCEPTED = 213,
71 SML_OPERATION_CANCELLED = 214,
73 SML_NOT_EXECUTED = 215,
75 SML_ATOMIC_ROLLBACK_OK = 216,
76
77 /* Retry error */
78 SML_ERROR_MULTIPLE_CHOICES = 300,
79 SML_ERROR_MOVED_PERMANENTLY = 301,
80 SML_ERROR_FOUND_RETRY = 302,
81 SML_ERROR_SEE_OTHER_RETRY = 303,
82 SML_ERROR_NOT_MODIFIED = 304,
83 SML_ERROR_USE_PROXY = 305,
84
85 /* Errors */
86 SML_ERROR_BAD_REQUEST = 400, // Bad Request
87 SML_ERROR_AUTH_REJECTED = 401, // Unauthorized, Invalid Credentials
88 SML_ERROR_PAYMENT_NEEDED =402, // Payment need
89 SML_ERROR_FORBIDDEN = 403, // Forbidden
90 SML_ERROR_NOT_FOUND = 404, // Not found
91 SML_ERROR_COMMAND_NOT_ALLOWED = 405, // Command not allowed
92 SML_ERROR_UNSUPPORTED_FEATURE = 406, // Optional feature unsupported
93 SML_ERROR_AUTH_REQUIRED = 407, // Authentication required, Missing Credentials
94 SML_ERROR_RETRY_LATER = 417, // Retry later
95 SML_ERROR_ALREADY_EXISTS = 418, // Put or Add failed because item already exists
96 SML_ERROR_SIZE_MISMATCH = 424, // Size mismatch
97
98 /* Standard errors */
99 SML_ERROR_GENERIC = 500,
100 SML_ERROR_NOT_IMPLEMENTED = 501,
101 SML_ERROR_SERVICE_UNAVAILABLE = 503,
102 SML_ERROR_REQUIRE_REFRESH = 508,
103 SML_ERROR_SERVER_FAILURE = 511,
104
105 /* Internal errors - never ever send this via SyncML */
106 SML_ERROR_INTERNAL_IO_ERROR = 1501,
107 SML_ERROR_INTERNAL_TIMEOUT = 1503,
108 SML_ERROR_INTERNAL_FILE_NOT_FOUND = 1505,
109 SML_ERROR_INTERNAL_MISCONFIGURATION = 1506,
110 SML_ERROR_INTERNAL_NO_MEMORY = 1512
111
112 } SmlErrorType;
113
114 SmlError **smlErrorRef(SmlError **error);
115 void smlErrorDeref(SmlError **error);
116 SmlBool smlErrorIsSet(SmlError **error);
117 void smlErrorSet(SmlError **error, SmlErrorType type, const char *format, ...);
118 void smlErrorUpdate(SmlError **error, const char *format, ...);
119 void smlErrorDuplicate(SmlError **target, SmlError **source);
120 const char *smlErrorPrint(SmlError **error);
121 SmlErrorType smlErrorGetType(SmlError **error);
122 void smlErrorSetType(SmlError **error, SmlErrorType type);
123 SmlErrorClass smlErrorGetClass(SmlError **error);
124
125 #endif //_SML_ERROR_H_