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