3 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.
5 Currently , This project is in early state and only implement server and test on Java(>=1.6) platform
7 the message format is defined like below.
16 //function:push (push bytes data to server and put the reference into slot addressed by dest_addr.)
17 //Explain in C, *dest_addr=&data
20 uint8_t opcode; // "opcode" identify the type of the request. for push_request,this value is 1
23 } session; /* "session" is an identifier established by the client.
24 The Server MUST reply "session" with the same value in the Response struct for ALL request types */
35 } session; // MUST be the same as the value of "session" in request
38 //function:pull (pull bytes data refered by the reference in slot addressed by src_addr.)
39 //Explain in C, return **src_addr
55 uint32_t length; // 0XFFFFFFFF(-1) if data can't be transfered,In this case, sizeof(data)==0
58 //function:assign (set slot value.)
59 //Explain in C, *dest_addr=*src_addr
60 struct assign_request{
69 struct assign_response{
77 //function:unlink (set slot to NULL.)
78 // Explain in C, *dest_addr=NULL
79 //server may decide if the resources can be free.
80 struct unlink_request{
88 struct unlink_response{
96 //function:call (invoke function stored in func_addr.)
97 //Explain in C, *dest_addr=(*func_addr)(param1,param2...)
98 //PxpRpc assume the client always know the definition of the function.
99 //So wrong parameter may BREAK the PxpRpc connection permanently.
113 struct call_response{
119 #if FUNCTION_RETURN_32BIT
120 //function return boolean,int8-int32,float32,object slot address
121 uint32_t returnValue;
122 #elif FUNCTION_RETURN_64BIT
123 //funcion return int64,float64
124 uint64_t returnValue;
128 //function:getFunc (get builtin function named by string refered by func_name_addr.)
129 //Explain in C,*dest_addr=getFunction(*func_name_addr)
130 //func_name_addr can be a slot where stored the reference to a utf8 encode string pushed previously.
131 struct getFunc_request{
138 uint32_t func_name_addr;
140 struct getFunc_response{
146 uint32_t dest_addr; // 0 if function not found
149 //function:close (free the resource and prepare to disconnect)
150 struct close_request{
157 //closed, No response.
159 //function:getInfo (get string encoded in utf8 indicate the information about the server.)
160 struct getInfo_request{
167 struct getInfo_response{
173 uint32_t length; // 0XFFFFFFFF(-1) if data can't be transfered,In this case, sizeof(data)==0
177 "data" stored the information about the server (as utf8). An example "data" show below
178 -----------------------------
179 server name:pxprpc for java
181 reference slots size:256
182 -------------------------------
183 "server name" indicate the server name.
184 "version" indicate the pxprpc protocol version. Currently only 1.0 is valid.
185 "reference slots capacity" indicate how many slots can client use. Client should ensure that the slot address is less than this value.
189 the server should take responsibility for the lifecycle manager of object refer by references slots.
190 When a object have no reference refer to, server should free it.
196 See java test file for detail usage.
198 Feel free to PR and issue