|
NAMEhttp_servlet_xmlrpc —
HTTP servlet for XML-RPC requests
LIBRARYPDEL Library (libpdel, -lpdel)SYNOPSIS#include <sys/types.h>
#include <stdio.h>
#include <netinet/in.h>
#include <openssl/ssl.h>
#include <pdel/http/http_defs.h>
#include
<pdel/http/http_server.h>
#include
<pdel/http/servlet/xmlrpc.h>
struct http_servlet *
DESCRIPTIONhttp_servlet_xmlrpc_create () creates a new servlet that
handles XML-RPC HTTP requests. The request and response data are automatically
converted to and from native binary format using the
structs(3)
library.
The arg is an opaque user cookie. When the
servlet is destroyed, if destroy is not
struct http_servlet_xmlrpc_method { const char *name; /* method name */ http_servlet_xmlrpc_handler_t *handler; /* method handler */ const struct structs_type **ptypes; /* parameter types */ u_int min_params; /* min # params */ u_int max_params; /* max # params */ }; struct http_servlet_xmlrpc_info { const struct http_servlet_xmlrpc_method *methods; /* methods */ http_logger_t *logger; /* loggging function */ }; The methods field points to the method
descriptor array, which is terminated with an entry having a
The logger is a logging function whose type is defined in http_server(3). Each element in the methods array describes one supported XML-RPC method: name is the method name; min_params and max_params specify the minimum and maximum number of parameters allowed for the method (the servlet itself enforces these limits); and ptypes points to an array of structs(3) types that has length max_params, one for each possible parameter. The handler is a pointer to the user function that implements the XML-RPC method. The function must be of this type: typedef void *http_servlet_xmlrpc_handler_t(void *arg, const char *method, struct http_request *req, u_int nparams, const void **params, const char *mtype, const struct structs_type **rtypep, int *faulted) The arg is the opqaue cookie supplied to
If successful, Since it's running as a servlet, the thread executing
Returning FaultsIfhandler () wishes to return an XML-RPC fault, it
should set *faulted to one, return a pointer to a
struct xmlrpc_compact_fault structure, and set
*rtypep to
&structs_type_xmlrpc_compact_fault.
Working With Raw XML-RPCIn some cases, the types of the XML-RPC parameters are not known ahead of time, or it may be inconvenient to have to provide a structs(3) type for the returned value. In these situations,handler () can operate with the XML-RPC parameters
and/or response values in their raw, “exploded” forms.
If ptypes is If Finally, if the method names themselves are not known ahead of time, a name equal to the empty string will match all method names. Such an entry acts as a “catch all” and must be last in the methods list. RETURN VALUESOn failure,http_servlet_xmlrpc_create () returns
NULL and sets errno to an
appropriate value.
SEE ALSOhttp_request(3), http_response(3), http_server(3), http_servlet(3), http_servlet_xml(3), http_xml(3), libpdel(3), structs(3), structs_xmlrpc(3), typed_mem(3)XML-RPC Home Page, http://www.xmlrpc.org/. HISTORYThe PDEL library was developed at Packet Design, LLC.http://www.packetdesign.com/
AUTHORSArchie Cobbs ⟨archie@freebsd.org⟩BUGShttp_servlet_xmlrpc_create () copies all information in
info except each method's parameter
structs(3)
types (pointed to by the elements of the ptypes array),
so these must remain valid for the lifetime of the servlet. Typically
structs(3)
types are stored in static variables, so this is not usually a problem.
Visit the GSP FreeBSD Man Page Interface. |