5 PxpRpc(pursuer cross platform remote procedure call) is a very tiny rpc library aim to call and interchange data cross platform and language with high performance and little load.
7 Currently , This project is in early state, and implemented on below platform
9 rpc server on java (>=1.6)
13 rpc server over tcp on c with tbox
15 rpc server and client on python(>=3.8)
17 rpc client on typescript(websocket)
21 ### rpc message format
23 The rpc message format is defined like below.
32 //function:push (push bytes data to server and put the reference into slot addressed by dest_addr.)
33 //Explain in C, *dest_addr=&data
36 uint8_t opcode; // "opcode" identify the type of the request. for push_request,this value is 1
39 } session; /* "session" is an identifier established by the client.
40 The Server MUST reply "session" with the same value in the Response struct for ALL request types */
51 } session; // MUST be the same as the value of "session" in request
54 //function:pull (pull bytes data refered by the reference in slot addressed by src_addr.)
55 //Explain in C, return **src_addr
71 uint32_t length; // 0XFFFFFFFF(-1) if data can't be transfered,In this case, sizeof(data)==0
74 //function:assign (set slot value.)
75 //Explain in C, *dest_addr=*src_addr
76 struct assign_request{
85 struct assign_response{
93 //function:unlink (set slot to NULL.)
94 // Explain in C, *dest_addr=NULL
95 //server may decide if the resources can be free.
96 struct unlink_request{
104 struct unlink_response{
112 //function:call (invoke function stored in func_addr.)
113 //Explain in C, *dest_addr=(*func_addr)(param1,param2...)
114 //PxpRpc assume the client always know the definition of the function.
115 //So wrong parameter may BREAK the PxpRpc connection permanently.
129 struct call_response{
135 #if FUNCTION_RETURN_32BIT
136 //function return boolean,int8-int32,float32,object slot address
137 uint32_t returnValue;
138 #elif FUNCTION_RETURN_64BIT
139 //funcion return int64,float64
140 uint64_t returnValue;
144 //function:getFunc (get builtin function named by string refered by func_name_addr.)
145 //Explain in C,*dest_addr=getFunction(*func_name_addr)
146 //func_name_addr can be a slot where stored the reference to a utf8 encode string pushed previously.
147 struct getFunc_request{
154 uint32_t func_name_addr;
156 struct getFunc_response{
162 uint32_t dest_addr; // 0 if function not found
165 //function:close (free the resource and prepare to disconnect)
166 struct close_request{
173 //closed, No response.
175 //function:getInfo (get string encoded in utf8 indicate the information about the server.)
176 struct getInfo_request{
183 struct getInfo_response{
189 uint32_t length; // 0XFFFFFFFF(-1) if data can't be transfered,In this case, sizeof(data)==0
193 "data" stored the information about the server (as utf8). An example "data" show below
194 -----------------------------
195 server name:pxprpc for java
197 reference slots size:256
198 -------------------------------
199 "server name" indicate the server name.
200 "version" indicate the pxprpc protocol version. Currently only 1.0 is valid.
201 "reference slots capacity" indicate how many slots can client use. Client should ensure that the slot address is less than this value.
205 the server should take responsibility for the lifecycle manager of the objects referred by references slots.
206 When an object have no reference refer to, server should free it.
212 See java test file for detail usage.
214 Feel free to PR and issue