libxrdeveloper's documentation
xr-call.h
Go to the documentation of this file.
00001 /* 
00002  * Copyright 2006-2008 Ondrej Jirman <ondrej.jirman@zonio.net>
00003  * 
00004  * This file is part of libxr.
00005  *
00006  * Libxr is free software: you can redistribute it and/or modify it under the
00007  * terms of the GNU Lesser General Public License as published by the Free
00008  * Software Foundation, either version 2 of the License, or (at your option) any
00009  * later version.
00010  *
00011  * Libxr is distributed in the hope that it will be useful, but WITHOUT ANY
00012  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00013  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00014  * details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with libxr.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00031 #ifndef __XR_CALL_H__
00032 #define __XR_CALL_H__
00033 
00034 #include "xr-value.h"
00035 
00038 typedef enum {
00039   XR_CALL_XML_RPC = 0,
00040 #ifdef XR_JSON_ENABLED
00041   XR_CALL_JSON_RPC,
00042 #endif
00043   XR_CALL_TRANSPORT_COUNT /* must be last, not a real transport */
00044 } xr_call_transport;
00045 
00049 typedef struct _xr_call xr_call;
00050 
00051 G_BEGIN_DECLS
00052 
00059 xr_call* xr_call_new(const char* method);
00060 
00065 void xr_call_free(xr_call* call);
00066 
00072 void xr_call_set_transport(xr_call* call, xr_call_transport transport);
00073 
00082 const char* xr_call_get_method(xr_call* call);
00083 
00092 const char* xr_call_get_method_full(xr_call* call);
00093 
00101 char* xr_call_get_servlet_name(xr_call* call, const char* fallback);
00102 
00109 void xr_call_add_param(xr_call* call, xr_value* val);
00110 
00120 xr_value* xr_call_get_param(xr_call* call, unsigned int pos);
00121 
00128 void xr_call_set_retval(xr_call* call, xr_value* val);
00129 
00138 xr_value* xr_call_get_retval(xr_call* call);
00139 
00147 void xr_call_set_error(xr_call* call, int code, const char* msg, ...);
00148 
00153 gboolean xr_call_error_set(xr_call* call);
00154 
00161 int xr_call_get_error_code(xr_call* call);
00162 
00169 const char* xr_call_get_error_message(xr_call* call);
00170 
00178 void xr_call_serialize_request(xr_call* call, char** buf, int* len);
00179 
00187 void xr_call_serialize_response(xr_call* call, char** buf, int* len);
00188 
00198 gboolean xr_call_unserialize_request(xr_call* call, const char* buf, int len);
00199 
00209 gboolean xr_call_unserialize_response(xr_call* call, const char* buf, int len);
00210 
00216 void xr_call_free_buffer(xr_call* call, char* buf);
00217 
00225 char* xr_call_dump_string(xr_call* call, int indent);
00226 
00232 void xr_call_dump(xr_call* call, int indent);
00233 
00234 G_END_DECLS
00235 
00236 #endif
Documentation for libxr, Thu Jun 9 2011 22:42:39.