Git init
[profile/ivi/libsoup2.4.git] / libsoup / soup-xmlrpc.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2007 Red Hat, Inc.
4  */
5
6 #ifndef SOUP_XMLRPC_H
7 #define SOUP_XMLRPC_H 1
8
9 #include <libsoup/soup-types.h>
10
11 G_BEGIN_DECLS
12
13 /* XML-RPC client */
14 char        *soup_xmlrpc_build_method_call       (const char   *method_name,
15                                                   GValue       *params,
16                                                   int           n_params);
17 SoupMessage *soup_xmlrpc_request_new             (const char   *uri,
18                                                   const char   *method_name,
19                                                   ...);
20 gboolean     soup_xmlrpc_parse_method_response   (const char   *method_response,
21                                                   int           length,
22                                                   GValue       *value,
23                                                   GError      **error);
24 gboolean     soup_xmlrpc_extract_method_response (const char   *method_response,
25                                                   int           length,
26                                                   GError      **error,
27                                                   GType         type,
28                                                   ...);
29
30 /* XML-RPC server */
31 gboolean     soup_xmlrpc_parse_method_call       (const char   *method_call,
32                                                   int           length,
33                                                   char        **method_name,
34                                                   GValueArray **params);
35 gboolean     soup_xmlrpc_extract_method_call     (const char   *method_call,
36                                                   int           length,
37                                                   char        **method_name,
38                                                   ...);
39 char        *soup_xmlrpc_build_method_response   (GValue       *value);
40 char        *soup_xmlrpc_build_fault             (int           fault_code,
41                                                   const char   *fault_format,
42                                                   ...) G_GNUC_PRINTF (2, 3);
43 void         soup_xmlrpc_set_response            (SoupMessage  *msg,
44                                                   GType         type,
45                                                   ...);
46 void         soup_xmlrpc_set_fault               (SoupMessage  *msg,
47                                                   int           fault_code,
48                                                   const char   *fault_format,
49                                                   ...) G_GNUC_PRINTF (3, 4);
50
51
52 /* Errors */
53 #define SOUP_XMLRPC_ERROR soup_xmlrpc_error_quark()
54 GQuark soup_xmlrpc_error_quark (void);
55
56 typedef enum {
57         SOUP_XMLRPC_ERROR_ARGUMENTS,
58         SOUP_XMLRPC_ERROR_RETVAL
59 } SoupXMLRPCError;
60
61 #define SOUP_XMLRPC_FAULT soup_xmlrpc_fault_quark()
62 GQuark soup_xmlrpc_fault_quark (void);
63
64 /* From http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php.
65  * These are an extension, not part of the XML-RPC spec; you can't
66  * assume servers will use them.
67  */
68 typedef enum {
69         SOUP_XMLRPC_FAULT_PARSE_ERROR_NOT_WELL_FORMED = -32700,
70         SOUP_XMLRPC_FAULT_PARSE_ERROR_UNSUPPORTED_ENCODING = -32701,
71         SOUP_XMLRPC_FAULT_PARSE_ERROR_INVALID_CHARACTER_FOR_ENCODING = -32702,
72         SOUP_XMLRPC_FAULT_SERVER_ERROR_INVALID_XML_RPC = -32600,
73         SOUP_XMLRPC_FAULT_SERVER_ERROR_REQUESTED_METHOD_NOT_FOUND = -32601,
74         SOUP_XMLRPC_FAULT_SERVER_ERROR_INVALID_METHOD_PARAMETERS = -32602,
75         SOUP_XMLRPC_FAULT_SERVER_ERROR_INTERNAL_XML_RPC_ERROR = -32603,
76         SOUP_XMLRPC_FAULT_APPLICATION_ERROR = -32500,
77         SOUP_XMLRPC_FAULT_SYSTEM_ERROR = -32400,
78         SOUP_XMLRPC_FAULT_TRANSPORT_ERROR = -32300
79 } SoupXMLRPCFault;
80
81 G_END_DECLS
82
83 #endif /* SOUP_XMLRPC_H */