1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-06-23 04:07:05 +00:00
libsearpc/lib/searpc-server.h

73 lines
1.7 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>
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-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.
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 (void* func,
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:
* @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.
*
* Returns the serialized representatio of the returned value.
*/
gchar *searpc_server_call_function (gchar *func, gsize len, gsize *ret_len);
/**
* 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