1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 /* 3 * Copyright 2015 - Collabora Ltd. 4 */ 5 6 #ifndef __SOUP_XMLRPC_H__ 7 #define __SOUP_XMLRPC_H__ 1 8 9 #include <libsoup/soup-types.h> 10 #include <libsoup/soup-xmlrpc-old.h> 11 12 G_BEGIN_DECLS 13 14 /* XML-RPC client */ 15 SOUP_AVAILABLE_IN_2_52 16 char *soup_xmlrpc_build_request (const char *method_name, 17 GVariant *params, 18 GError **error); 19 SOUP_AVAILABLE_IN_2_52 20 SoupMessage *soup_xmlrpc_message_new (const char *uri, 21 const char *method_name, 22 GVariant *params, 23 GError **error); 24 SOUP_AVAILABLE_IN_2_52 25 GVariant *soup_xmlrpc_parse_response (const char *method_response, 26 int length, 27 const char *signature, 28 GError **error); 29 30 /* XML-RPC server */ 31 typedef struct _SoupXMLRPCParams SoupXMLRPCParams; 32 SOUP_AVAILABLE_IN_2_52 33 void soup_xmlrpc_params_free (SoupXMLRPCParams *self); 34 SOUP_AVAILABLE_IN_2_52 35 GVariant *soup_xmlrpc_params_parse (SoupXMLRPCParams *self, 36 const char *signature, 37 GError **error); 38 SOUP_AVAILABLE_IN_2_52 39 char *soup_xmlrpc_parse_request (const char *method_call, 40 int length, 41 SoupXMLRPCParams **params, 42 GError **error); 43 SOUP_AVAILABLE_IN_2_52 44 char *soup_xmlrpc_build_response (GVariant *value, 45 GError **error); 46 SOUP_AVAILABLE_IN_2_4 47 char *soup_xmlrpc_build_fault (int fault_code, 48 const char *fault_format, 49 ...) G_GNUC_PRINTF (2, 3); 50 SOUP_AVAILABLE_IN_2_52 51 gboolean soup_xmlrpc_message_set_response (SoupMessage *msg, 52 GVariant *value, 53 GError **error); 54 SOUP_AVAILABLE_IN_2_52 55 void soup_xmlrpc_message_set_fault (SoupMessage *msg, 56 int fault_code, 57 const char *fault_format, 58 ...) G_GNUC_PRINTF (3, 4); 59 60 /* Utils */ 61 SOUP_AVAILABLE_IN_2_52 62 GVariant *soup_xmlrpc_variant_new_datetime (SoupDate *date); 63 64 SOUP_AVAILABLE_IN_2_52 65 SoupDate *soup_xmlrpc_variant_get_datetime (GVariant *variant, 66 GError **error); 67 68 /* Errors */ 69 #define SOUP_XMLRPC_ERROR soup_xmlrpc_error_quark() 70 SOUP_AVAILABLE_IN_2_4 71 GQuark soup_xmlrpc_error_quark (void); 72 73 typedef enum { 74 SOUP_XMLRPC_ERROR_ARGUMENTS, 75 SOUP_XMLRPC_ERROR_RETVAL 76 } SoupXMLRPCError; 77 78 #define SOUP_XMLRPC_FAULT soup_xmlrpc_fault_quark() 79 SOUP_AVAILABLE_IN_2_4 80 GQuark soup_xmlrpc_fault_quark (void); 81 82 typedef enum { 83 SOUP_XMLRPC_FAULT_PARSE_ERROR_NOT_WELL_FORMED = -32700, 84 SOUP_XMLRPC_FAULT_PARSE_ERROR_UNSUPPORTED_ENCODING = -32701, 85 SOUP_XMLRPC_FAULT_PARSE_ERROR_INVALID_CHARACTER_FOR_ENCODING = -32702, 86 SOUP_XMLRPC_FAULT_SERVER_ERROR_INVALID_XML_RPC = -32600, 87 SOUP_XMLRPC_FAULT_SERVER_ERROR_REQUESTED_METHOD_NOT_FOUND = -32601, 88 SOUP_XMLRPC_FAULT_SERVER_ERROR_INVALID_METHOD_PARAMETERS = -32602, 89 SOUP_XMLRPC_FAULT_SERVER_ERROR_INTERNAL_XML_RPC_ERROR = -32603, 90 SOUP_XMLRPC_FAULT_APPLICATION_ERROR = -32500, 91 SOUP_XMLRPC_FAULT_SYSTEM_ERROR = -32400, 92 SOUP_XMLRPC_FAULT_TRANSPORT_ERROR = -32300 93 } SoupXMLRPCFault; 94 95 G_END_DECLS 96 97 #endif /* __SOUP_XMLRPC_H__ */ 98