|
NAMEstructs_xmlrpc —
structs support for XML-RPC
LIBRARYPDEL Library (libpdel, -lpdel)SYNOPSIS#include <sys/types.h>
#include
<pdel/structs/structs.h>
#include
<pdel/structs/type/array.h>
#include
<pdel/structs/type/union.h>
#include <pdel/structs/xmlrpc.h>
int
int
struct xmlrpc_request *
struct xmlrpc_response_union *
struct xmlrpc_response_union *
extern const struct structs_type
structs_type_xmlrpc_value;
DESCRIPTIONThese functions and structs(3) types provide support for XML-RPC, i.e., conversion between XML-RPC values and native C data types.Compact and Exploded TypesFor any XML-RPC data structure, there are two structs(3) types that describe it: a “compact” type and an “exploded” type. Applications usually work with compact (or native C) types, i.e., where XML-RPC i32's are represented by C int32_t's, XML-RPC struct's are represented by C structures, and so on. In order to convert between native data structures and XML-RPC, intermediate “exploded” types are used. This man page describes structs(3) types for the exploded XML-RPC data structures and functions to convert between the compact and exploded forms.That is, XML-RPC is just a special case of structs(3) types converted into XML with lots of extra nesting so that a fixed set of XML tags may be used. The exploded types are simply the structs(3) types that include the extra nesting so that when they are converted to XML in the normal fashion (see structs_xml_output(3)), the result is a well-formed XML-RPC request or response. The following types data structures are defined in the header file
structs_type_xmlrpc_value is a
structs(3)
type representing an exploded XML-RPC value, i.e., a structs_type_xmlrpc_array is a
structs(3)
type representing an exploded XML-RPC array, i.e., a structs_type_xmlrpc_member is a
structs(3)
type representing an exploded XML-RPC structure member, i.e., a
structs_type_xmlrpc_struct is a
structs(3)
type representing an exploded XML-RPC structure, i.e., a
structs_type_xmlrpc_request is a
structs(3)
type representing an exploded XML-RPC request, i.e., a
structs_type_xmlrpc_response is a
structs(3)
type representing an exploded XML-RPC response, i.e., a
structs_type_xmlrpc_fault is a
structs(3)
type representing an exploded XML-RPC fault, i.e., a structs_type_xmlrpc_compact_fault is a
structs(3)
type representing an XML-RPC fault in a compact form, i.e., a
struct xmlrpc_compact_fault { int32_t faultCode; /* XML-RPC fault code */ char *faultString; /* XML-RPC fault string */ }; Conversion Routinesstructs_struct2xmlrpc () converts an arbitrary compact
structs(3)
instance into an “exploded” XML-RPC value. The original instance
should be pointed to by data and have
structs(3)
type type, while the XML-RPC instance should be pointed
to by xdata and have
structs(3)
type xtype. sname and
xname may be non- NULL to name
specific sub-fields of data and
xdata, respectively, to convert. The
xdata instance must already be initialized, and the
sub-field of xdata specified by
xname must have type
structs_type_xmlrpc_value, i.e., it must be a
struct xmlrpc_value_union .
The following primitive
structs(3)
types are specially recognized by
All other primitive types are converted to XML-RPC <string>'s.
Scalar XML-RPC values are converted into primitive types by simply calling structs_set_string(3). There is no checking that the XML-RPC tag is consistent with the primitive structs type; i.e., if the primitive type successfully parses the string, then it's assumed to be OK. Array XML-RPC values are converted into array types. Structure XML-RPC values are converted into structure types or union types, depending on the destination type provided. In the union case, the last field specified in the XML-RPC structure is chosen for the union. Other fields specified must be valid for the union, but are otherwise ignored. XML-RPC Requests and Responsesstructs_xmlrpc_build_request () creates an XML-RPC
request instance from native, “compact” parameter data
structures. methodName is the XML-RPC request method
name. There will be nparams parameters in the request;
types must point to an array of
nparams
structs(3)
parameter types and params an array of
nparams parameter values having the corresponding types.
To build the request directly out of “exploded”
XML-RPC parameter values, set types to
If successful,
To directly send an “exploded” XML-RPC return value,
set type to If successful,
RETURN VALUESThe above functions indicate an error by returning either -1 orNULL and setting errno to an
appropriate value.
SEE ALSOhttp_servlet_xmlrpc(3), http_xml(3), libpdel(3), structs(3), structs_type(3), structs_xml_input(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⟩
Visit the GSP FreeBSD Man Page Interface. |