c fix, cpp wrap
[PxpRpc.git] / c / pxprpc / server.h
blob35f6c2c2f1a5e5f92c32010b5123c236c1a0fcb7
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 count;
18 uint32_t (*addRef)(struct pxprpc_object *self);
19 uint32_t (*release)(struct pxprpc_object *self);
22 struct pxprpc_request{
23 struct pxprpc_abstract_io *io1;
24 struct pxprpc_object **ref_slots;
25 uint32_t dest_addr;
26 uint32_t session;
27 struct pxprpc_callable *callable;
28 void *callable_data;
29 void *server_context_data;
30 struct pxprpc_object *result;
34 struct pxprpc_callable{
35 void (*readParameter)(struct pxprpc_callable *self,struct pxprpc_request *r,void (*doneCallback)(struct pxprpc_request *r));
36 void (*call)(struct pxprpc_callable *self,struct pxprpc_request *r,void (*onResult)(struct pxprpc_request *r,struct pxprpc_object *result));
37 void (*writeResult)(struct pxprpc_callable *self,struct pxprpc_request *r);
38 void *userData;
41 struct pxprpc_namedfunc{
42 const char *name;
43 struct pxprpc_callable *callable;
46 typedef struct pxprpc_server_api{
47 int (*context_new)(pxprpc_server_context *server_context,struct pxprpc_abstract_io *io1,
48 struct pxprpc_namedfunc *namedfuncs,int len_namedfuncs);
49 int (*context_start)(pxprpc_server_context);
50 int (*context_closed)(pxprpc_server_context);
51 int (*context_close)(pxprpc_server_context);
52 int (*context_delete)(pxprpc_server_context *);
53 struct pxprpc_object *(*new_object)(void *obj);
54 struct pxprpc_object *(*new_bytes_object)(uint32_t size);
55 }pxprpc_server_api;
57 extern int pxprpc_server_query_interface(pxprpc_server_api **outapi);
59 #endif