/usr/include/libxr/xr-call.h is in libxr1-dev 1.0-2.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | /*
* Copyright 2006-2008 Ondrej Jirman <ondrej.jirman@zonio.net>
*
* This file is part of libxr.
*
* Libxr is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 2 of the License, or (at your option) any
* later version.
*
* Libxr is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libxr. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file xr-call.h
*
* XML-RPC Call Handling API
*
* This code is used to prepare XML-RPC calls. It converts XML
* string representation of XML-RPC requests and responses into
* intermediate representation described in @ref xr-value.h that
* is further used for conversion into native data types.
*
*/
#ifndef __XR_CALL_H__
#define __XR_CALL_H__
#include "xr-value.h"
/** Transport type.
*/
typedef enum {
XR_CALL_XML_RPC = 0,
#ifdef XR_JSON_ENABLED
XR_CALL_JSON_RPC,
#endif
XR_CALL_TRANSPORT_COUNT /* must be last, not a real transport */
} xr_call_transport;
/** Opaque data structrure for storing intermediate representation
* of XML-RPC call.
*/
typedef struct _xr_call xr_call;
G_BEGIN_DECLS
/** Create new call obejct.
*
* @param method Method name. This may be NULL.
*
* @return Newly created call object.
*/
xr_call* xr_call_new(const char* method);
/** Free call object.
*
* @param call Call object.
*/
void xr_call_free(xr_call* call);
/** Set transport type (default is XR_CALL_XML_RPC).
*
* @param call Call object.
* @param transport Transport type.
*/
void xr_call_set_transport(xr_call* call, xr_call_transport transport);
/** Get method name (second part if in Servlet.Method format).
*
* @param call Call obejct.
*
* @return Method name or NULL if not set.
*
* @warning Returned value is still owned by the call object. Don't free it!
*/
const char* xr_call_get_method(xr_call* call);
/** Get method name (as passed in XML-RPC).
*
* @param call Call obejct.
*
* @return Method name or NULL if not set.
*
* @warning Returned value is still owned by the call object. Don't free it!
*/
const char* xr_call_get_method_full(xr_call* call);
/** Get servlet name (as passed in XML-RPC).
*
* @param call Call obejct.
* @param fallback Fallback value.
*
* @return Servlet name. Caller must free it.
*/
char* xr_call_get_servlet_name(xr_call* call, const char* fallback);
/** Add parameter to the call obejct.
*
* @param call Call obejct.
* @param val Parameter value. Call object takes ownership of this
* value and @ref xr_value_unref will be called from @ref xr_call_free.
*/
void xr_call_add_param(xr_call* call, xr_value* val);
/** Get parameter from specified position (counts from 0).
*
* @param call Call obejct.
* @param pos Parameter position (counts from 0).
*
* @return Value node or NULL if parameter does not exist.
*
* @warning Returned value is still owned by the call object. Don't free it!
*/
xr_value* xr_call_get_param(xr_call* call, unsigned int pos);
/** Set return value of the XML-RPC call.
*
* @param call Call obejct.
* @param val Retuirn value node. Call object takes ownership of this
* value and @ref xr_value_unref will be called from @ref xr_call_free.
*/
void xr_call_set_retval(xr_call* call, xr_value* val);
/** Get return value of the XML-RPC call.
*
* @param call Call obejct.
*
* @return Return value node or NULL if it is not set.
*
* @warning Returned value is still owned by the call object. Don't free it!
*/
xr_value* xr_call_get_retval(xr_call* call);
/** Set retval to be stadard XML-RPC error structure. If error is set
* and retval is set too, error gets preference on serialize response.
*
* @param call Call obejct.
* @param code Error code.
* @param msg Error message.
*/
void xr_call_set_error(xr_call* call, int code, const char* msg, ...);
/** Check whether the XML-RPC error structure is set
*
* @param call Call obejct.
*/
gboolean xr_call_error_set(xr_call* call);
/** Get error code that is set on the call object.
*
* @param call Call obejct.
*
* @return Error code.
*/
int xr_call_get_error_code(xr_call* call);
/** Get error message that is set on the call object.
*
* @param call Call obejct.
*
* @return Error message. String is owned by the call obejct.
*/
const char* xr_call_get_error_message(xr_call* call);
/** Serialize call object into XML-RPC request.
*
* @param call Call obejct.
* @param buf Pointer to the variable to store buffer pointer to.
* This buffer has to be freed using @ref xr_call_free_buffer.
* @param len Pointer to the variable to store buffer length to.
*/
void xr_call_serialize_request(xr_call* call, char** buf, int* len);
/** Serialize call object into XML-RPC response.
*
* @param call Call obejct.
* @param buf Pointer to the variable to store buffer pointer to.
* This buffer has to be freed using @ref xr_call_free_buffer.
* @param len Pointer to the variable to store buffer length to.
*/
void xr_call_serialize_response(xr_call* call, char** buf, int* len);
/** Unserialize XML-RPC request into call object.
*
* @param call Call obejct.
* @param buf Pointer to the buffer with XML-RPC request.
* @param len Length of the buffer.
*
* @return Returns TRUE on success and FALSE on failure. On failure
* @ref xr_call_set_error is used to set reason of the failure.
*/
gboolean xr_call_unserialize_request(xr_call* call, const char* buf, int len);
/** Unserialize XML-RPC response into call object.
*
* @param call Call obejct.
* @param buf Pointer to the buffer with XML-RPC response.
* @param len Length of the buffer.
*
* @return Returns TRUE on success and FALSE on failure. On failure
* @ref xr_call_set_error is used to set reason of the failure.
*/
gboolean xr_call_unserialize_response(xr_call* call, const char* buf, int len);
/** Free buffer allocated by serialize functions.
*
* @param call Call obejct.
* @param buf Buffer pointer.
*/
void xr_call_free_buffer(xr_call* call, char* buf);
/** Debugging function that dumps call object to the string.
*
* @param call Call obejct.
* @param indent Indent level, usually 0.
*
* @return String representing the call.
*/
char* xr_call_dump_string(xr_call* call, int indent);
/** Debugging function that prints call object using g_print().
*
* @param call Call obejct.
* @param indent Indent level, usually 0.
*/
void xr_call_dump(xr_call* call, int indent);
G_END_DECLS
#endif
|