Fix BlueSky build on modern Linux and libs3.
[bluesky.git] / libs3-1.4 / inc / error_parser.h
1 /** **************************************************************************
2  * error_parser.h
3  * 
4  * Copyright 2008 Bryan Ischo <bryan@ischo.com>
5  * 
6  * This file is part of libs3.
7  * 
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.
11  *
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.
15  *
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
19  * details.
20  *
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/>.
24  *
25  ************************************************************************** **/
26
27 #ifndef ERROR_PARSER_H
28 #define ERROR_PARSER_H
29
30 #include "libs3.h"
31 #include "simplexml.h"
32 #include "string_buffer.h"
33
34
35 #define EXTRA_DETAILS_SIZE 8
36
37 typedef struct ErrorParser
38 {
39     // This is the S3ErrorDetails that this ErrorParser fills in from the
40     // data that it parses
41     S3ErrorDetails s3ErrorDetails;
42
43     // This is the error XML parser
44     SimpleXml errorXmlParser;
45
46     // Set to 1 after the first call to add
47     int errorXmlParserInitialized;
48
49     // Used to buffer the S3 Error Code as it is read in
50     string_buffer(code, 1024);
51
52     // Used to buffer the S3 Error Message as it is read in
53     string_buffer(message, 1024);
54
55     // Used to buffer the S3 Error Resource as it is read in
56     string_buffer(resource, 1024);
57
58     // Used to buffer the S3 Error Further Details as it is read in
59     string_buffer(furtherDetails, 1024);
60     
61     // The extra details; we support up to EXTRA_DETAILS_SIZE of them
62     S3NameValue extraDetails[EXTRA_DETAILS_SIZE];
63
64     // This is the buffer from which the names and values used in extraDetails
65     // are allocated
66     string_multibuffer(extraDetailsNamesValues, EXTRA_DETAILS_SIZE * 1024);
67 } ErrorParser;
68
69
70 // Always call this
71 void error_parser_initialize(ErrorParser *errorParser);
72
73 S3Status error_parser_add(ErrorParser *errorParser, char *buffer,
74                           int bufferSize);
75
76 void error_parser_convert_status(ErrorParser *errorParser, S3Status *status);
77
78 // Always call this
79 void error_parser_deinitialize(ErrorParser *errorParser);
80
81
82 #endif /* ERROR_PARSER_H */