~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Utilities/cmxmlrpc/xmlrpc_client.h

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*============================================================================
2
 
                         xmlrpc_client.h
3
 
==============================================================================
4
 
  This header file defines the interface between xmlrpc.c and its users,
5
 
  related to clients.
6
 
 
7
 
  Copyright information is at the end of the file.
8
 
============================================================================*/
9
 
 
10
 
#ifndef  _XMLRPC_CLIENT_H_
11
 
#define  _XMLRPC_CLIENT_H_ 1
12
 
 
13
 
#ifdef __cplusplus
14
 
extern "C" {
15
 
#endif /* __cplusplus */
16
 
 
17
 
 
18
 
/*=========================================================================
19
 
**  Initialization and Shutdown
20
 
**=========================================================================
21
 
**  These routines initialize and terminate the XML-RPC client. If you're
22
 
**  already using libwww on your own, you can pass
23
 
**  XMLRPC_CLIENT_SKIP_LIBWWW_INIT to avoid initializing it twice.
24
 
*/
25
 
 
26
 
#define XMLRPC_CLIENT_NO_FLAGS         (0)
27
 
#define XMLRPC_CLIENT_SKIP_LIBWWW_INIT (1)
28
 
 
29
 
extern void
30
 
xmlrpc_client_init(int          const flags,
31
 
                   const char * const appname,
32
 
                   const char * const appversion);
33
 
 
34
 
struct xmlrpc_clientparms {
35
 
    const char * transport;
36
 
};
37
 
 
38
 
#define XMLRPC_CP_MEMBER_OFFSET(mbrname) \
39
 
  ((unsigned long)(char*)&((struct xmlrpc_clientparms *)0)->mbrname)
40
 
#define XMLRPC_CP_MEMBER_SIZE(mbrname) \
41
 
  sizeof(((struct xmlrpc_clientparms *)0)->mbrname)
42
 
#define XMLRPC_CPSIZE(mbrname) \
43
 
  (XMLRPC_CP_MEMBER_OFFSET(mbrname) + XMLRPC_CP_MEMBER_SIZE(mbrname))
44
 
 
45
 
/* XMLRPC_CPSIZE(xyz) is the minimum size a struct xmlrpc_clientparms
46
 
   must be to include the 'xyz' member.  This is essential to forward and
47
 
   backward compatbility, as new members will be added to the end of the
48
 
   struct in future releases.  This is how the callee knows whether or
49
 
   not the caller is new enough to have supplied a certain parameter.
50
 
*/
51
 
 
52
 
void 
53
 
xmlrpc_client_init2(xmlrpc_env *                const env,
54
 
                    int                         const flags,
55
 
                    const char *                const appname,
56
 
                    const char *                const appversion,
57
 
                    struct xmlrpc_clientparms * const clientparms,
58
 
                    unsigned int                const parm_size);
59
 
 
60
 
extern void
61
 
xmlrpc_client_cleanup(void);
62
 
 
63
 
const char * 
64
 
xmlrpc_client_get_default_transport(xmlrpc_env * const env);
65
 
 
66
 
/*=========================================================================
67
 
** Required for both internal and external development.
68
 
**=========================================================================
69
 
*/
70
 
/* A callback function to handle the response to an asynchronous call.
71
 
** If 'fault->fault_occurred' is true, then response will be NULL. All
72
 
** arguments except 'user_data' will be deallocated internally; please do
73
 
** not free any of them yourself.
74
 
** WARNING: param_array may (or may not) be NULL if fault->fault_occurred
75
 
** is true, and you set up the call using xmlrpc_client_call_asynch.
76
 
** WARNING: If asynchronous calls are still pending when the library is
77
 
** shut down, your handler may (or may not) be called with a fault. */
78
 
typedef void (*xmlrpc_response_handler) (const char *server_url,
79
 
                                         const char *method_name,
80
 
                                         xmlrpc_value *param_array,
81
 
                                         void *user_data,
82
 
                                         xmlrpc_env *fault,
83
 
                                         xmlrpc_value *result);
84
 
 
85
 
 
86
 
/*=========================================================================
87
 
**  xmlrpc_server_info
88
 
**=========================================================================
89
 
**  We normally refer to servers by URL. But sometimes we need to do extra
90
 
**  setup for particular servers. In that case, we can create an
91
 
**  xmlrpc_server_info object, configure it in various ways, and call the
92
 
**  remote server.
93
 
**
94
 
**  (This interface is also designed to discourage further multiplication
95
 
**  of xmlrpc_client_call APIs. We have enough of those already. Please
96
 
**  add future options and flags using xmlrpc_server_info.)
97
 
*/
98
 
 
99
 
typedef struct _xmlrpc_server_info xmlrpc_server_info;
100
 
 
101
 
/* Create a new server info record, pointing to the specified server. */
102
 
xmlrpc_server_info *
103
 
xmlrpc_server_info_new(xmlrpc_env * const env,
104
 
                       const char * const server_url);
105
 
 
106
 
/* Create a new server info record, with a copy of the old server. */
107
 
extern xmlrpc_server_info * 
108
 
xmlrpc_server_info_copy(xmlrpc_env *env, xmlrpc_server_info *src_server);
109
 
 
110
 
/* Delete a server info record. */
111
 
extern void
112
 
xmlrpc_server_info_free (xmlrpc_server_info *server);
113
 
 
114
 
/* We support rudimentary basic authentication. This lets us talk to Zope
115
 
** servers and similar critters. When called, this routine makes a copy
116
 
** of all the authentication information and passes it to future requests.
117
 
** Only the most-recently-set authentication information is used.
118
 
** (In general, you shouldn't write XML-RPC servers which require this
119
 
** kind of authentication--it confuses many client implementations.)
120
 
** If we fail, leave the xmlrpc_server_info record unchanged. */
121
 
void 
122
 
xmlrpc_server_info_set_basic_auth(xmlrpc_env *         const envP,
123
 
                                  xmlrpc_server_info * const serverP,
124
 
                                  const char *         const username,
125
 
                                  const char *         const password);
126
 
 
127
 
 
128
 
/*=========================================================================
129
 
**  xmlrpc_client_call
130
 
**=========================================================================
131
 
**  A synchronous XML-RPC client. Do not attempt to call any of these
132
 
**  functions from inside an asynchronous callback!
133
 
*/
134
 
 
135
 
xmlrpc_value * 
136
 
xmlrpc_client_call(xmlrpc_env * const envP,
137
 
                   const char * const server_url,
138
 
                   const char * const method_name,
139
 
                   const char * const format,
140
 
                   ...);
141
 
 
142
 
xmlrpc_value * 
143
 
xmlrpc_client_call_params (xmlrpc_env *   const env,
144
 
                           const char *   const server_url,
145
 
                           const char *   const method_name,
146
 
                           xmlrpc_value * const param_array);
147
 
 
148
 
xmlrpc_value * 
149
 
xmlrpc_client_call_server(xmlrpc_env *         const envP,
150
 
                          xmlrpc_server_info * const server,
151
 
                          const char *         const method_name,
152
 
                          const char *         const format, 
153
 
                          ...);
154
 
 
155
 
extern xmlrpc_value *
156
 
xmlrpc_client_call_server_params (xmlrpc_env *env,
157
 
                                  xmlrpc_server_info *server,
158
 
                                  char *method_name,
159
 
                                  xmlrpc_value *param_array);
160
 
 
161
 
 
162
 
/*=========================================================================
163
 
**  xmlrpc_client_call_asynch
164
 
**=========================================================================
165
 
**  An asynchronous XML-RPC client.
166
 
*/
167
 
 
168
 
/* Make an asynchronous XML-RPC call. We make internal copies of all
169
 
** arguments except user_data, so you can deallocate them safely as soon
170
 
** as you return. Errors will be passed to the callback. You will need
171
 
** to run the event loop somehow; see below.
172
 
** WARNING: If an error occurs while building the argument, the
173
 
** response handler will be called with a NULL param_array. */
174
 
void 
175
 
xmlrpc_client_call_asynch(const char * const server_url,
176
 
                          const char * const method_name,
177
 
                          xmlrpc_response_handler callback,
178
 
                          void *       const user_data,
179
 
                          const char * const format,
180
 
                          ...);
181
 
 
182
 
/* As above, but use an xmlrpc_server_info object. The server object can be
183
 
** safely destroyed as soon as this function returns. */
184
 
void 
185
 
xmlrpc_client_call_server_asynch(xmlrpc_server_info * const server,
186
 
                                 const char *         const method_name,
187
 
                                 xmlrpc_response_handler callback,
188
 
                                 void *               const user_data,
189
 
                                 const char *         const format,
190
 
                                 ...);
191
 
 
192
 
/* As above, but the parameter list is supplied as an xmlrpc_value
193
 
** containing an array.
194
 
*/
195
 
void
196
 
xmlrpc_client_call_asynch_params(const char *   const server_url,
197
 
                                 const char *   const method_name,
198
 
                                 xmlrpc_response_handler callback,
199
 
                                 void *         const user_data,
200
 
                                 xmlrpc_value * const paramArrayP);
201
 
    
202
 
/* As above, but use an xmlrpc_server_info object. The server object can be
203
 
** safely destroyed as soon as this function returns. */
204
 
void 
205
 
xmlrpc_client_call_server_asynch_params(
206
 
    xmlrpc_server_info * const server,
207
 
    const char *         const method_name,
208
 
    xmlrpc_response_handler callback,
209
 
    void *               const user_data,
210
 
    xmlrpc_value *       const paramArrayP);
211
 
    
212
 
/*=========================================================================
213
 
**  Event Loop Interface
214
 
**=========================================================================
215
 
**  These functions can be used to run the XML-RPC event loop. If you
216
 
**  don't like these, you can also run the libwww event loop directly.
217
 
*/
218
 
 
219
 
/* Finish all outstanding asynchronous calls. Alternatively, the loop
220
 
** will exit if someone calls xmlrpc_client_event_loop_end. */
221
 
extern void
222
 
xmlrpc_client_event_loop_finish_asynch(void);
223
 
 
224
 
 
225
 
/* Finish all outstanding asynchronous calls. */
226
 
extern void
227
 
xmlrpc_client_event_loop_finish_asynch_timeout(timeout_t const milliseconds);
228
 
 
229
 
 
230
 
 
231
 
/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
232
 
**
233
 
** Redistribution and use in source and binary forms, with or without
234
 
** modification, are permitted provided that the following conditions
235
 
** are met:
236
 
** 1. Redistributions of source code must retain the above copyright
237
 
**    notice, this list of conditions and the following disclaimer.
238
 
** 2. Redistributions in binary form must reproduce the above copyright
239
 
**    notice, this list of conditions and the following disclaimer in the
240
 
**    documentation and/or other materials provided with the distribution.
241
 
** 3. The name of the author may not be used to endorse or promote products
242
 
**    derived from this software without specific prior written permission. 
243
 
**  
244
 
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
245
 
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
246
 
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
247
 
** ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
248
 
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
249
 
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
250
 
** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
251
 
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
252
 
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
253
 
** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
254
 
** SUCH DAMAGE. */
255
 
 
256
 
 
257
 
#ifdef __cplusplus
258
 
}
259
 
#endif /* __cplusplus */
260
 
 
261
 
#endif /* _XMLRPC_CLIENT_H_ */