1 /** **************************************************************************
4 * Copyright 2008 Bryan Ischo <bryan@ischo.com>
6 * This file is part of libs3.
8 * libs3 is free software: you can redistribute it and/or modify it under the
9 * terms of the GNU General Public License as published by the Free Software
10 * Foundation, version 3 of the License.
12 * In addition, as a special exception, the copyright holders give
13 * permission to link the code of this library and its programs with the
14 * OpenSSL library, and distribute linked combinations including the two.
16 * libs3 is distributed in the hope that it will be useful, but WITHOUT ANY
17 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 * You should have received a copy of the GNU General Public License version 3
22 * along with libs3, in a file named COPYING. If not, see
23 * <http://www.gnu.org/licenses/>.
25 ************************************************************************** **/
27 #ifndef ERROR_PARSER_H
28 #define ERROR_PARSER_H
31 #include "simplexml.h"
32 #include "string_buffer.h"
35 #define EXTRA_DETAILS_SIZE 8
37 typedef struct ErrorParser
39 // This is the S3ErrorDetails that this ErrorParser fills in from the
40 // data that it parses
41 S3ErrorDetails s3ErrorDetails;
43 // This is the error XML parser
44 SimpleXml errorXmlParser;
46 // Set to 1 after the first call to add
47 int errorXmlParserInitialized;
49 // Used to buffer the S3 Error Code as it is read in
50 string_buffer(code, 1024);
52 // Used to buffer the S3 Error Message as it is read in
53 string_buffer(message, 1024);
55 // Used to buffer the S3 Error Resource as it is read in
56 string_buffer(resource, 1024);
58 // Used to buffer the S3 Error Further Details as it is read in
59 string_buffer(furtherDetails, 1024);
61 // The extra details; we support up to EXTRA_DETAILS_SIZE of them
62 S3NameValue extraDetails[EXTRA_DETAILS_SIZE];
64 // This is the buffer from which the names and values used in extraDetails
66 string_multibuffer(extraDetailsNamesValues, EXTRA_DETAILS_SIZE * 1024);
71 void error_parser_initialize(ErrorParser *errorParser);
73 S3Status error_parser_add(ErrorParser *errorParser, char *buffer,
76 void error_parser_convert_status(ErrorParser *errorParser, S3Status *status);
79 void error_parser_deinitialize(ErrorParser *errorParser);
82 #endif /* ERROR_PARSER_H */