use XXX_SOURCE_DIR
[PxpRpc.git] / c / pxprpc / def.h
blobe129b67e9e6728e9a57c224d3fa9f3298129bad3
2 #ifndef _PXPRPC_DEF_H
3 #define _PXPRPC_DEF_H
5 #include <stdint.h>
7 struct pxprpc_abstract_io{
8 //onCompleted is called when expected length data is read or error occured.
9 void (*read)(struct pxprpc_abstract_io *self,uint32_t length,uint8_t *buf,void (*onCompleted)(void *args),void *p);
10 //onCompleted is called when buf is processed and can be free or error occured.
11 //Write request should be processed in order.
12 void (*write)(struct pxprpc_abstract_io *self,uint32_t length,const uint8_t *buf,void (*onCompleted)(void *args),void *p);
13 //get last error. For example, to get error caused by read, call "io->get_error(io,io->read)". return NULL if no error
14 const char *(*get_error)(struct pxprpc_abstract_io *self,void *fn);
15 void *userData;
18 struct pxprpc_bytes{
19 uint32_t length;
20 //variable length array
21 uint8_t data[1];
24 #endif