export function
[PxpRpc.git] / c / pxprpc / server.h
bloba4f59a0df9c6b58729c7e9c90557c7f5c7325479
2 #ifndef _PXPRPC_SERVER_H
3 #define _PXPRPC_SERVER_H
5 #include <stdint.h>
7 #include "def.h"
9 #include "config.h"
11 #pragma pack(1)
13 typedef void *pxprpc_server_context;
15 struct pxprpc_object{
16 void *object1;
17 uint16_t size_of_struct;
18 uint16_t count;
19 uint32_t (*addRef)(struct pxprpc_object *ref);
20 uint32_t (*release)(struct pxprpc_object *ref);
23 struct pxprpc_request{
24 struct pxprpc_abstract_io *io1;
25 struct pxprpc_object **ref_slots;
26 uint32_t dest_addr;
27 uint32_t session;
28 struct pxprpc_callable *callable;
29 void *callable_data;
30 void *server_context_data;
31 struct pxprpc_object *result;
35 struct pxprpc_callable{
36 void (*readParameter)(struct pxprpc_callable *self,struct pxprpc_request *r,void (*doneCallback)(struct pxprpc_request *r));
37 void (*call)(struct pxprpc_callable *self,struct pxprpc_request *r,void (*onResult)(struct pxprpc_request *r,struct pxprpc_object *result));
38 void (*writeResult)(struct pxprpc_callable *self,struct pxprpc_request *r);
41 struct pxprpc_namedfunc{
42 char *name;
43 struct pxprpc_callable *callable;
46 extern void pxprpc_close(pxprpc_server_context server_context);
47 extern struct pxprpc_object *pxprpc_new_object(void *obj);
48 extern struct pxprpc_object *pxprpc_new_bytes_object(uint32_t size);
49 extern int pxprpc_new_server_context(pxprpc_server_context *server_context,struct pxprpc_abstract_io *io1,
50 struct pxprpc_namedfunc *namedfuncs,int len_namedfuncs);
51 extern int pxprpc_start_serve(pxprpc_server_context server_context);
52 extern int pxprpc_free_context(pxprpc_server_context *server_context);
54 #endif