1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-05-05 21:56:20 +00:00
libsearpc/lib/searpc-server.h

97 lines
2.3 KiB
C
Raw Normal View History

2011-04-08 12:58:15 +00:00
#ifndef SEARPC_SERVER_H
#define SEARPC_SERVER_H
#include <glib.h>
#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 ();
/**
* 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:
*
* 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
*/
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:
* @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.
*
* Call a registered function @func of a service.
2011-04-08 12:58:15 +00:00
*
* Returns the serialized representatio of the returned value.
*/
gchar *searpc_server_call_function (const char *service,
gchar *func, gsize len, gsize *ret_len,
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 */
#include <searpc-signature.h>
2011-04-08 12:58:15 +00:00
#endif