GSK Reference Manual | ||||
---|---|---|---|---|
GskXmlrpcStreamClass; GskXmlrpcStream; #define GSK_XMLRPC_STREAM_REQUEST_HOOK (stream) GskXmlrpcRequest* gsk_xmlrpc_stream_get_request (GskXmlrpcStream *stream); void gsk_xmlrpc_stream_respond (GskXmlrpcStream *stream, GskXmlrpcRequest *request, GskXmlrpcResponse *response); void (*GskXmlrpcResponseNotify) (GskXmlrpcRequest *request, GskXmlrpcResponse *response, gpointer data); void gsk_xmlrpc_stream_make_request (GskXmlrpcStream *stream, GskXmlrpcRequest *request, GskXmlrpcResponseNotify notify, gpointer data, GDestroyNotify destroy);
This class provides an easy way to handle XMLRPC; you may wish to attach this to an HTTP post_data or content_stream.
Or, you may use XMLRPC with the raw TCP/IP transport layer if you please.
typedef struct { GskStreamClass stream_class; void (*set_poll_requestable) (GskXmlrpcStream *, gboolean polling); void (*shutdown_requestable) (GskXmlrpcStream *); } GskXmlrpcStreamClass;
typedef struct { GskStream stream; GskXmlrpcParser *parser; /* handle incoming requests */ GskXmlrpcIncoming *first_unhandled_request; GskXmlrpcIncoming *next_to_dequeue; GskXmlrpcIncoming *last_request; GskHook incoming_request_hook; /* handle outgoing requests */ GskXmlrpcOutgoing *first_unresponded_request; GskXmlrpcOutgoing *last_unresponded_request; /* queue outgoing response and request data here */ GskBuffer outgoing; } GskXmlrpcStream;
#define GSK_XMLRPC_STREAM_REQUEST_HOOK(stream) (&(GSK_XMLRPC_STREAM (stream)->incoming_request_hook))
Get the GskHook for the request-available end of the stream.
stream : |
GskXmlrpcStream from which to obtain the hook. |
GskXmlrpcRequest* gsk_xmlrpc_stream_get_request (GskXmlrpcStream *stream);
Grab a new request from the stream.
The caller should eventually respond to it with
gsk_xmlrpc_stream_respond()
.
stream : |
the stream to dequeue an incomiung request from. |
Returns : | a reference to a remote request which the caller
must call gsk_xmlrpc_request_unref() on eventually,
or NULL if no unhandled requests are available.
|
void gsk_xmlrpc_stream_respond (GskXmlrpcStream *stream, GskXmlrpcRequest *request, GskXmlrpcResponse *response);
Give the RPC result to the other side of this connection.
stream : |
the stream where the incoming request came in. |
request : |
the request initiated by the other side. |
response : |
local response to the request. |
void (*GskXmlrpcResponseNotify) (GskXmlrpcRequest *request, GskXmlrpcResponse *response, gpointer data);
request : |
|
response : |
|
data : |
void gsk_xmlrpc_stream_make_request (GskXmlrpcStream *stream, GskXmlrpcRequest *request, GskXmlrpcResponseNotify notify, gpointer data, GDestroyNotify destroy);
Make a request (a method call) to the other side of this
GskXmlrpcStream. When a response is received,
notify
will be called, then destroy will be called.
If the stream shuts down before a notify is obtained,
then just destroy
is run.
stream : |
the stream to make the request on. |
request : |
the request to issue. |
notify : |
callback to eventaully invoke with the remote response, if we get it. |
data : |
opaque user data to pass to the notify function eventually.
|
destroy : |
callback to invoke after the handler is run, or if the stream shuts down before a response is obtained. |