Annotation of libaitrpc/inc/aitrpc.h, revision 1.1.1.1.2.12
1.1 misho 1: /*************************************************************************
2: * (C) 2010 AITNET ltd - Sofia/Bulgaria - <misho@aitbg.com>
3: * by Michael Pounov <misho@openbsd-bg.org>
4: *
5: * $Author: misho $
1.1.1.1.2.12! misho 6: * $Id: aitrpc.h,v 1.1.1.1.2.11 2010/06/24 15:01:19 misho Exp $
1.1 misho 7: *
8: *************************************************************************/
9: #ifndef __AITRPC_H
10: #define __AITRPC_H
11:
12:
13: #include <assert.h>
14: #include <stdlib.h>
15: #include <string.h>
16: #include <sys/types.h>
17: #include <sys/param.h>
18: #include <sys/limits.h>
19: #include <sys/socket.h>
20:
21:
22: #define RPC_VERSION 1
23: #define RPC_DEFPORT 2611
24:
25:
26: /* RPC builtin registed calls */
27:
1.1.1.1.2.5 misho 28: #define CALL_BLOBSHUTDOWN "rpcBLOBServerShutdown"
29: #define CALL_BLOBCLIENTS "rpcBLOBServerClients"
30: #define CALL_BLOBVARS "rpcBLOBServerVars"
1.1.1.1.2.12! misho 31: #define CALL_BLOBSTATE "rpcBLOBServerState"
1.1.1.1.2.5 misho 32:
1.1.1.1.2.1 misho 33: #define CALL_SRVSHUTDOWN "rpcServerShutdown"
1.1 misho 34: #define CALL_SRVCLIENTS "rpcServerClients"
35: #define CALL_SRVCALLS "rpcServerCalls"
36: #define CALL_SRVSESSIONS "rpcServerSessions"
37:
38:
39: /* RPC types */
40:
41: typedef enum {
42: empty, // empty -> variable is not set
1.1.1.1.2.3 misho 43: buffer, string, blob, // buffer -> uint8_t*; string -> int8_t*; blob -> void*(+socket);
1.1 misho 44: size, offset, datetime, // size -> size_t; offset -> off_t; datetime -> time_t;
45: real, bigreal, // real -> float; bigreal -> double;
46: u8, u16, u32, u64, // unsigned integers ...
47: i8, i16, i32, i64 // integers ...
48: } rpc_type_t;
49:
1.1.1.1.2.6 misho 50: typedef enum {
1.1.1.1.2.8 misho 51: disable, enable, // for blob.state
52: ok, error, // for blob reply
53: get, set, unset // for blob request
1.1.1.1.2.6 misho 54: } cmd_type_t;
55:
1.1 misho 56: /* RPC value */
57:
58: typedef struct {
59: rpc_type_t val_type;
60: size_t val_len;
61: union {
62: uint8_t *buffer;
63: int8_t *string;
1.1.1.1.2.3 misho 64: void *blob;
1.1 misho 65: size_t size;
66: off_t offset;
67: time_t datetime;
68: float real;
69: double bigreal;
70: uint8_t u8;
71: uint16_t u16;
72: uint32_t u32;
73: uint64_t u64;
74: int8_t i8;
75: int16_t i16;
76: int32_t i32;
77: int64_t i64;
78: } val;
79: } __packed rpc_val_t;
80:
81: #define RPC_TYPE_VAL(vl) ((vl)->val_type)
82: #define RPC_LEN_VAL(vl) ((vl)->val_len)
1.1.1.1.2.3 misho 83: #define RPC_BLOB_CHUNKS(vl, n) ((vl)->val_len / (n) + ((vl)->val_len % (n)) ? 1 : 0)
1.1 misho 84: #define RPC_EMPTY_VAL(vl) ((vl)->val_type == empty)
85:
86: #define RPC_GET_BUF(vl) (assert((vl)->val_type == buffer), (vl)->val.buffer)
87: #define RPC_GET_STR(vl) (assert((vl)->val_type == string), (vl)->val.string)
1.1.1.1.2.3 misho 88: #define RPC_GET_BLOB(vl) (assert((vl)->val_type == blob), (vl)->val.blob)
1.1 misho 89: #define RPC_GET_SIZE(vl) (assert((vl)->val_type == size), (vl)->val.size)
90: #define RPC_GET_OFF(vl) (assert((vl)->val_type == offset), (vl)->val.offset)
91: #define RPC_GET_TIME(vl) (assert((vl)->val_type == datetime), (vl)->val.datetime)
92: #define RPC_GET_REAL(vl) (assert((vl)->val_type == real), (vl)->val.real)
93: #define RPC_GET_BREAL(vl) (assert((vl)->val_type == bigreal), (vl)->val.bigreal)
94: #define RPC_GET_U8(vl) (assert((vl)->val_type == u8), (vl)->val.u8)
95: #define RPC_GET_U16(vl) (assert((vl)->val_type == u16), (vl)->val.u16)
96: #define RPC_GET_U32(vl) (assert((vl)->val_type == u32), (vl)->val.u32)
97: #define RPC_GET_U64(vl) (assert((vl)->val_type == u64), (vl)->val.u64)
98: #define RPC_GET_I8(vl) (assert((vl)->val_type == i8), (vl)->val.i8)
99: #define RPC_GET_I16(vl) (assert((vl)->val_type == i16), (vl)->val.i16)
100: #define RPC_GET_I32(vl) (assert((vl)->val_type == i32), (vl)->val.i32)
101: #define RPC_GET_I64(vl) (assert((vl)->val_type == i64), (vl)->val.i64)
102:
103: #define RPC_SET_BUF(vl, v, l) do { rpc_val_t *val = (vl); assert(val); val->val.buffer = malloc(l); \
104: if (val->val.buffer) { \
105: val->val_type = buffer; val->val_len = l; \
106: memcpy(val->val.buffer, v, l); \
107: } } while (0)
108: #define RPC_SET_STR(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val.string = (int8_t*) strdup(v); \
109: if (val->val.string) { \
110: val->val_type = string; val->val_len = strlen(v) + 1; \
111: } } while (0)
1.1.1.1.2.10 misho 112: #define RPC_SET_BLOB(vl, v, l) do { rpc_val_t *val = (vl); assert(val); val->val_type = blob; \
113: val->val.blob = (void*) v; val->val_len = l; } while (0)
1.1 misho 114: #define RPC_SET_SIZE(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = size; val->val.size = v; \
115: val->val_len = sizeof(size_t); } while (0)
116: #define RPC_SET_OFF(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = offset; val->val.offset = v; \
117: val->val_len = sizeof(off_t); } while (0)
118: #define RPC_SET_TIME(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = datetime; val->val.datetime = v; \
119: val->val_len = sizeof(time_t); } while (0)
120: #define RPC_SET_REAL(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = real; val->val.real = v; \
121: val->val_len = sizeof(float); } while (0)
122: #define RPC_SET_BREAL(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = bigreal; val->val.bigreal = v; \
123: val->val_len = sizeof(double); } while (0)
124: #define RPC_SET_U8(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = u8; val->val.u8 = v; \
125: val->val_len = sizeof(uint8_t); } while (0)
126: #define RPC_SET_U16(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = u16; val->val.u16 = v; \
127: val->val_len = sizeof(uint16_t); } while (0)
128: #define RPC_SET_U32(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = u32; val->val.u32 = v; \
129: val->val_len = sizeof(uint32_t); } while (0)
130: #define RPC_SET_U64(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = u64; val->val.u64 = v; \
131: val->val_len = sizeof(uint64_t); } while (0)
132: #define RPC_SET_I8(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = i8; val->val.i8 = v; \
133: val->val_len = sizeof(int8_t); } while (0)
134: #define RPC_SET_I16(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = i16; val->val.i16 = v; \
135: val->val_len = sizeof(int16_t); } while (0)
136: #define RPC_SET_I32(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = i32; val->val.i32 = v; \
137: val->val_len = sizeof(int32_t); } while (0)
138: #define RPC_SET_I64(vl, v) do { rpc_val_t *val = (vl); assert(val); val->val_type = i64; val->val.i64 = v; \
139: val->val_len = sizeof(int64_t); } while (0)
140:
141: #define RPC_FREE_VAL(vl) do { rpc_val_t *val = (vl); assert(val); \
142: if (val->val_type == buffer && val->val.buffer) { \
143: free(val->val.buffer); \
144: val->val.buffer = NULL; \
145: } \
146: if (val->val_type == string && val->val.string) { \
147: free(val->val.string); \
148: val->val.string = NULL; \
149: } \
150: val->val_type = val->val_len = 0; \
151: } while (0)
152:
153:
1.1.1.1.2.2 misho 154: #define RPC_CALLBACK_CHK_NUM_ARGS(f, n) do { \
1.1 misho 155: if (f->func_args != n) { \
156: rpc_SetErr(22, "Error:: different number of arguments!\n"); \
157: return -1; \
158: } \
1.1.1.1.2.1 misho 159: } while (0)
1.1.1.1.2.11 misho 160: #define RPC_CALLBACK_CHECK_INPUT(f) do { \
161: if (!f) { \
1.1.1.1.2.1 misho 162: rpc_SetErr(22, "Error:: invalid callback parameters ...\n"); \
163: return -1; \
164: } \
165: } while (0)
1.1 misho 166:
167:
168: /* RPC session identification */
169:
170: typedef struct {
171: uint8_t sess_version;
172: uint32_t sess_program;
173: uint32_t sess_process;
174: } __packed rpc_sess_t;
175:
176:
177: /* Server managment RPC functions ... */
178:
179: // RPC function registration element!
180: typedef struct tagRPCFunc {
181: uint16_t func_tag;
182: uint32_t func_hash;
183: int8_t func_file[MAXPATHLEN];
184: int8_t func_name[UCHAR_MAX + 1];
185:
186: int8_t func_args;
187: rpc_val_t *func_vals;
188:
1.1.1.1.2.11 misho 189: void *func_parent;
1.1 misho 190: struct tagRPCFunc *func_next;
191: } rpc_func_t;
192:
193:
194: /* Network RPC packet - Client request */
195:
196: struct tagRPCCall {
197: rpc_sess_t call_session;
198: uint16_t call_tag;
199: uint32_t call_hash;
200: uint8_t call_argc;
201: } __packed;
202:
203: /* Network RPC packet - Server response */
204:
205: struct tagRPCRet {
206: rpc_sess_t ret_session;
207: uint16_t ret_tag;
208: uint32_t ret_hash;
209: int32_t ret_retcode;
210: int32_t ret_errno;
211: uint8_t ret_argc;
212: } __packed;
213:
1.1.1.1.2.6 misho 214: /* Network BLOB packet - Header */
215:
216: struct tagBLOBHdr {
217: rpc_sess_t hdr_session;
218: uint8_t hdr_cmd;
219: uint32_t hdr_var;
220: uint32_t hdr_seq;
221: uint32_t hdr_len;
222: } __packed;
223:
1.1 misho 224: /* Network RPC client & server elements */
225:
226: typedef struct {
227: struct sockaddr cli_sa; // host info
228: int cli_sock; // socket
229: pthread_t cli_tid; // TID of thread
230:
231: void *cli_parent; // pointer to parent rpc_srv_t for server or to rpc_sess_t for client
232: } rpc_cli_t;
233:
234:
1.1.1.1.2.5 misho 235: // BLOB registration element!
236: typedef struct tagBLOB {
1.1.1.1.2.6 misho 237: uint32_t blob_var;
238:
1.1.1.1.2.5 misho 239: size_t blob_len; // size of allocated BLOB data
240: void *blob_data; // BLOB data
241:
242: struct tagBLOB *blob_next;
243: } rpc_blob_t;
244:
245: typedef struct {
1.1 misho 246: rpc_sess_t srv_session; // RPC session registration info
1.1.1.1.2.5 misho 247: int srv_numcli; // maximum concurent client connections
1.1 misho 248:
1.1.1.1.2.5 misho 249: rpc_cli_t srv_server; // RPC server socket
250: rpc_cli_t *srv_clients; // connected rpc client sockets
1.1 misho 251:
252: rpc_func_t *srv_funcs; // registered functions list
1.1.1.1.2.5 misho 253:
254: pthread_mutex_t srv_mtx;
255:
256: struct {
257: int state; // BLOB server state: ==0 disable | !=0 enable
1.1.1.1.2.6 misho 258: char dir[UCHAR_MAX + 1];
1.1.1.1.2.5 misho 259:
260: rpc_cli_t server; // BLOB server socket
261: rpc_cli_t *clients; // connected blob client sockets
262:
263: rpc_blob_t *blobs; // registered blob variables list
264:
265: pthread_mutex_t mtx;
266: } srv_blob;
1.1 misho 267: } rpc_srv_t;
268:
269:
1.1.1.1.2.11 misho 270: /*
271: * (*rpc_callback_t)() Callback type definition for RPC call in server process
272: * @arg1 = current execution RPC call function
273: * @arg2 = number of items in input array from call request
274: * @arg3 = input array with values from RPC call execution request
275: * return: -1 error or >-1 success execution
276: */
277: typedef int (*rpc_callback_t)(rpc_func_t *, int, rpc_val_t *);
1.1 misho 278:
279:
280: // -----------------------------------------------------------------------
281:
282: /* Error support functions */
283:
284: // cli_GetErrno() Get error code of last operation
285: inline int cli_GetErrno();
286: // cli_GetError() Get error text of last operation
287: inline const char *cli_GetError();
288:
289:
290: /* RPC Server side functions */
291:
292: /*
293: * rpc_srv_initServer() Init & create RPC Server
294: * @regProgID = ProgramID for authentication & recognition
295: * @regProcID = ProcessID for authentication & recognition
296: * @concurentClients = Concurent clients at same time to this server
297: * @family = Family socket type, AF_INET or AF_INET6
298: * @csHost = Host name or IP address for bind server, if NULL any address
299: * @Port = Port for bind server, if Port == 0 default port is selected
300: * return: NULL == error or !=NULL bind and created RPC server instance
301: */
302: rpc_srv_t *rpc_srv_initServer(u_int regProgID, u_int regProcID, int concurentClients,
303: u_short family, const char *csHost, u_short Port);
304: /*
305: * rpc_srv_endServer() Destroy RPC server, close all opened sockets and free resources
306: * @srv = RPC Server instance
307: * return: none
308: */
309: void rpc_srv_endServer(rpc_srv_t * __restrict srv);
310: /*
311: * rpc_srv_execServer() Execute Main server loop and wait for clients requests
312: * @srv = RPC Server instance
313: * return: -1 error or 0 ok, infinite loop ...
314: */
315: int rpc_srv_execServer(rpc_srv_t * __restrict srv);
316:
317: /*
1.1.1.1.2.5 misho 318: * rpc_srv_initBLOBServer() Init & create BLOB Server
319: * @Port = Port for bind server, if Port == 0 default port is selected
1.1.1.1.2.6 misho 320: * @diskDir = Disk place for BLOB file objects
1.1.1.1.2.5 misho 321: * return: -1 == error or 0 bind and created BLOB server instance
322: */
1.1.1.1.2.6 misho 323: int rpc_srv_initBLOBServer(rpc_srv_t * __restrict srv, u_short Port, const char *diskDir);
1.1.1.1.2.5 misho 324: /*
325: * rpc_srv_endBLOBServer() Destroy BLOB server, close all opened sockets and free resources
326: * @srv = RPC Server instance
327: * return: none
328: */
329: void rpc_srv_endBLOBServer(rpc_srv_t * __restrict srv);
330: /*
331: * rpc_srv_execBLOBServer() Execute Main BLOB server loop and wait for clients requests
332: * @srv = RPC Server instance
333: * return: -1 error or 0 ok, infinite loop ...
334: */
335: int rpc_srv_execBLOBServer(rpc_srv_t * __restrict srv);
336:
337: /*
1.1.1.1.2.6 misho 338: * rpc_srv_getBLOB() Get registered BLOB
339: * @srv = RPC Server instance
340: * @var = hash for variable
341: * return: NULL not found, !=NULL return blob var
342: */
343: inline rpc_blob_t *rpc_srv_getBLOB(rpc_srv_t * __restrict srv, uint32_t var);
344:
345: /*
1.1 misho 346: * rpc_srv_registerCall() Register call to RPC server
347: * @srv = RPC Server instance
348: * @csModule = Module name, if NULL self binary
349: * @csFunc = Function name
350: * @args = Number of function arguments
351: * return: -1 error or 0 register ok
352: */
353: int rpc_srv_registerCall(rpc_srv_t * __restrict srv, const char *csModule, const char *csFunc,
354: unsigned char args);
355: /*
356: * rpc_srv_unregisterCall() Unregister call from RPC server
357: * @srv = RPC Server instance
358: * @csModule = Module name, if NULL self binary
359: * @csFunc = Function name
360: * return: -1 error, 0 not found call, 1 unregister ok
361: */
362: int rpc_srv_unregisterCall(rpc_srv_t * __restrict srv, const char *csModule, const char *csFunc);
363: /*
364: * rpc_srv_getFunc() Get registered call from RPC server by Name
365: * @srv = RPC Server instance
366: * @csModule = Module name, if NULL self binary
367: * @csFunc = Function name
368: * return: NULL not found call, !=NULL return call
369: */
370: rpc_func_t *rpc_srv_getFunc(rpc_srv_t * __restrict srv, const char *csModule, const char *csFunc);
371: /*
372: * rpc_srv_getCall() Get registered call from RPC server
373: * @srv = RPC Server instance
374: * @tag = tag for function
375: * @hash = hash for function
376: * return: NULL not found call, !=NULL return call
377: */
378: inline rpc_func_t *rpc_srv_getCall(rpc_srv_t * __restrict srv, uint16_t tag, uint32_t hash);
379: /*
380: * rpc_srv_execCall() Execute registered call from RPC server
381: * @call = Register RPC call
382: * @rpc = IN RPC call structure
383: * @args = IN RPC call array of rpc values
384: * return: -1 error, !=-1 ok
385: */
1.1.1.1.2.11 misho 386: int rpc_srv_execCall(rpc_func_t * __restrict call, struct tagRPCCall * __restrict rpc,
387: rpc_val_t * __restrict args);
1.1 misho 388:
389:
390: /*
1.1.1.1.2.11 misho 391: * rpc_srv_retValsCall() Declare return variables for RPC call and zeroed values
392: (for safe handling return values, use this!)
393: * @call = RPC function call
394: * @return_vals = Number of return variables
395: * return: NULL error, !=NULL array with return values for RPC call with return_vals items
396: */
397: inline rpc_val_t *rpc_srv_retValsCall(rpc_func_t * __restrict call, int return_vals);
398: /*
399: * rpc_srv_declValsCall() Declare return variables for RPC call,
400: if already allocated memory for RPC call return values
401: function reallocate used space with return_vals count elements
1.1 misho 402: * @call = RPC function call
403: * @return_vals = Number of return variables
404: * return: -1 error, !=-1 ok
405: */
406: inline int rpc_srv_declValsCall(rpc_func_t * __restrict call, int return_vals);
407: /*
408: * rpc_srv_freeValsCall() Free return variables for RPC call
409: * @call = RPC function call
410: * return: none
411: */
412: inline void rpc_srv_freeValsCall(rpc_func_t * __restrict call);
413: /*
414: * rpc_srv_copyValsCall() Copy return variables for RPC call to new variable
415: * @call = RPC function call
416: * @newvals = New allocated variables array, must be free after use
417: * return: -1 error, !=-1 Returned number of copied RPC variables
418: */
419: inline int rpc_srv_copyValsCall(rpc_func_t * __restrict call, rpc_val_t ** __restrict newvals);
420: /*
1.1.1.1.2.11 misho 421: * rpc_srv_zeroValsCall() Clean values from return variables of RPC call
1.1 misho 422: * @call = RPC function call
423: * return: -1 error, !=-1 Returned number of cleaned RPC variables
424: */
1.1.1.1.2.11 misho 425: inline int rpc_srv_zeroValsCall(rpc_func_t * __restrict call);
1.1 misho 426: /*
427: * rpc_srv_getValsCall() Get return variables for RPC call
428: * @call = RPC function call
429: * @vals = Returned variables, may be NULL
430: * return: -1 error, !=-1 Number of returned variables
431: */
432: inline int rpc_srv_getValsCall(rpc_func_t * __restrict call, rpc_val_t ** __restrict vals);
433:
434:
1.1.1.1.2.7 misho 435: /*
1.1.1.1.2.10 misho 436: * rpc_srv_blobCreate() Create map blob to memory region and return object
437: * @srv = RPC Server instance
438: * @len = BLOB length object
439: * return: NULL error or !=NULL allocated BLOB object
440: */
441: inline rpc_blob_t *rpc_srv_blobCreate(rpc_srv_t * __restrict srv, int len);
442: /*
1.1.1.1.2.7 misho 443: * rpc_srv_blobMap() Map blob to memory region
444: * @srv = RPC Server instance
445: * @blob = Map to this BLOB element
446: * return: -1 error or 0 ok
447: */
448: inline int rpc_srv_blobMap(rpc_srv_t * __restrict srv, rpc_blob_t * __restrict blob);
449: /*
450: * rpc_srv_blobUnmap() Unmap blob memory region
451: * @blob = Mapped BLOB element
452: * return: none
453: */
454: inline void rpc_srv_blobUnmap(rpc_blob_t * __restrict blob);
455: /*
456: * rpc_srv_blobFree() Free blob from disk & memory
457: * @srv = RPC Server instance
458: * @blob = Mapped BLOB element
459: * return: -1 error or 0 ok
460: */
461: inline int rpc_srv_blobFree(rpc_srv_t * __restrict srv, rpc_blob_t * __restrict blob);
462:
1.1.1.1.2.9 misho 463: /*
1.1.1.1.2.10 misho 464: * rpc_srv_registerBLOB() Register new BLOB to server
465: * @srv = RPC Server instance
466: * @len = BLOB length
467: * return: -1 error or 0 register ok
468: */
469: rpc_blob_t *rpc_srv_registerBLOB(rpc_srv_t * __restrict srv, size_t len);
470: /*
471: * rpc_srv_unregisterBLOB() Unregister BLOB from server
472: * @srv = RPC Server instance
473: * @var = BLOB Variable for unregister
474: * return: -1 error, 0 not found call, 1 unregister ok
475: */
476: int rpc_srv_unregisterBLOB(rpc_srv_t * __restrict srv, uint32_t var);
477:
478: /*
1.1.1.1.2.9 misho 479: * rpc_srv_sendBLOB() Send mapped BLOB to client
480: * @cli = Client instance
481: * @blob = Mapped BLOB element
482: * return: -1 error, 0 ok
483: */
484: int rpc_srv_sendBLOB(rpc_cli_t * __restrict cli, rpc_blob_t * __restrict blob);
485: /*
486: * rpc_srv_recvBLOB() Receive BLOB from client
487: * @cli = Client instance
1.1.1.1.2.10 misho 488: * @blob = Mapped BLOB element
489: * return: -1 error, 0 ok, >0 unreceived data from client, may be error?
1.1.1.1.2.9 misho 490: */
1.1.1.1.2.10 misho 491: int rpc_srv_recvBLOB(rpc_cli_t * __restrict cli, rpc_blob_t * __restrict blob);
1.1.1.1.2.9 misho 492:
1.1.1.1.2.7 misho 493:
1.1 misho 494: /* RPC Client side functions */
495:
496: /*
497: * rpc_cli_openClient() Connect to RPC Server
498: * @ProgID = ProgramID for RPC session request
499: * @ProcID = ProcessID for RPC session request
500: * @family = Family socket type, AF_INET or AF_INET6
501: * @csHost = Host name or IP address for bind server
502: * @Port = Port for bind server, if Port == 0 default port is selected
503: * return: NULL == error or !=NULL connection to RPC server established
504: */
505: rpc_cli_t *rpc_cli_openClient(u_int ProgID, u_int ProcID, u_short family,
506: const char *csHost, u_short Port);
507: /*
508: * rpc_cli_closeClient() Close connection to RPC server and free resources
509: * @cli = RPC Client session
510: * return: none
511: */
512: void rpc_cli_closeClient(rpc_cli_t * __restrict cli);
513: /*
514: * rpc_cli_execCall() Execute RPC call
515: * @cli = RPC Client session
516: * @csModule = Module name, if NULL self binary
517: * @csFunc = Function name for execute
518: * @in_argc = IN count of arguments
519: * @in_vals = IN RPC call array of rpc values
520: * @out_argc = OUT returned count of arguments
521: * @out_vals = OUT returned array of rpc values, must be free after use (see rpc_cli_freeVals())
522: * return: -1 error or != -1 ok result
523: */
524: int rpc_cli_execCall(rpc_cli_t *cli, const char *csModule, const char *csFunc, int in_argc,
525: rpc_val_t * __restrict in_vals, int *out_argc, rpc_val_t ** __restrict out_vals);
526: /*
527: * rpc_cli_freeVals() Free rpc_val_t array returned from RPC call
528: * @args = Number of arguments in array
529: * @vals = Value elements
530: * return: none
531: */
532: inline void rpc_cli_freeVals(int args, rpc_val_t *vals);
533:
534:
535: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>