2011-04-08 12:58:15 +00:00
|
|
|
#ifndef SEARPC_SERVER_H
|
|
|
|
#define SEARPC_SERVER_H
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
2012-05-04 07:04:43 +00:00
|
|
|
#ifndef DFT_DOMAIN
|
|
|
|
#define DFT_DOMAIN g_quark_from_string(G_LOG_DOMAIN)
|
|
|
|
#endif
|
2011-04-08 12:58:15 +00:00
|
|
|
|
|
|
|
struct _JsonArray;
|
|
|
|
typedef gchar* (*SearpcMarshalFunc) (void *func, struct _JsonArray *param_array,
|
|
|
|
gsize *ret_len);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* searpc_server_init:
|
|
|
|
*
|
|
|
|
* Inititalize searpc server.
|
|
|
|
*/
|
|
|
|
void searpc_server_init ();
|
|
|
|
|
2011-11-13 06:09:58 +00:00
|
|
|
/**
|
|
|
|
* searpc_server_final:
|
|
|
|
*
|
|
|
|
* Free the server structure.
|
|
|
|
*/
|
|
|
|
void searpc_server_final ();
|
|
|
|
|
2011-12-25 03:07:36 +00:00
|
|
|
/**
|
|
|
|
* searpc_create_service:
|
|
|
|
*
|
|
|
|
* Create a new service. Service is a set of functions.
|
|
|
|
* The new service will be registered to the server.
|
|
|
|
*
|
|
|
|
* @svc_name: Service name.
|
|
|
|
*/
|
|
|
|
int searpc_create_service (const char *svc_name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* searpc_remove_service:
|
|
|
|
*
|
|
|
|
* Remove the service from the server.
|
|
|
|
*/
|
|
|
|
void searpc_remove_service (const char *svc_name);
|
|
|
|
|
2011-04-08 12:58:15 +00:00
|
|
|
/**
|
|
|
|
* searpc_server_register_marshal:
|
|
|
|
*
|
|
|
|
* For user to extend marshal functions.
|
2011-11-13 06:09:58 +00:00
|
|
|
*
|
|
|
|
* @signature: the signature of the marshal, register_marshal() will take
|
|
|
|
* owner of this string.
|
2011-04-08 12:58:15 +00:00
|
|
|
*/
|
2011-11-13 06:09:58 +00:00
|
|
|
gboolean searpc_server_register_marshal (gchar *signature,
|
2011-04-08 12:58:15 +00:00
|
|
|
SearpcMarshalFunc marshal);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* searpc_server_register_function:
|
|
|
|
*
|
2011-12-25 03:07:36 +00:00
|
|
|
* Register a rpc function with given signature to a service.
|
|
|
|
*
|
2011-11-13 06:09:58 +00:00
|
|
|
* @signature: the signature of the function, register_function() will take
|
|
|
|
* owner of this string.
|
2011-04-08 12:58:15 +00:00
|
|
|
*/
|
2011-12-25 03:07:36 +00:00
|
|
|
gboolean searpc_server_register_function (const char *service,
|
|
|
|
void* func,
|
2011-04-08 12:58:15 +00:00
|
|
|
const gchar *fname,
|
2011-11-13 06:09:58 +00:00
|
|
|
gchar *signature);
|
2011-04-08 12:58:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* searpc_server_call_function:
|
2011-12-25 03:07:36 +00:00
|
|
|
* @service: service name.
|
2011-04-08 12:58:15 +00:00
|
|
|
* @func: the serialized representation of the function to call.
|
|
|
|
* @len: length of @func.
|
|
|
|
* @ret_len: the length of the returned string.
|
|
|
|
*
|
2011-12-25 03:07:36 +00:00
|
|
|
* Call a registered function @func of a service.
|
2011-04-08 12:58:15 +00:00
|
|
|
*
|
|
|
|
* Returns the serialized representatio of the returned value.
|
|
|
|
*/
|
2011-12-25 03:07:36 +00:00
|
|
|
gchar *searpc_server_call_function (const char *service,
|
|
|
|
gchar *func, gsize len, gsize *ret_len,
|
2011-11-20 04:43:22 +00:00
|
|
|
GError **error);
|
2011-04-08 12:58:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* searpc_compute_signature:
|
|
|
|
* @ret_type: the return type of the function.
|
|
|
|
* @pnum: number of parameters of the function.
|
|
|
|
*
|
|
|
|
* Compute function signature.
|
|
|
|
*/
|
|
|
|
char* searpc_compute_signature (gchar *ret_type, int pnum, ...);
|
|
|
|
|
|
|
|
/* Signatures */
|
2011-05-18 09:24:34 +00:00
|
|
|
#include <searpc-signature.h>
|
2011-04-08 12:58:15 +00:00
|
|
|
|
|
|
|
#endif
|