version 1.8.2.6, 2012/05/16 07:24:08
|
version 1.8.2.10, 2012/05/16 09:02:47
|
Line 180 typedef struct tagRPCFunc {
|
Line 180 typedef struct tagRPCFunc {
|
} rpc_func_t; |
} rpc_func_t; |
|
|
|
|
|
/* BLOB register element */ |
|
typedef struct tagBLOB { |
|
uint32_t blob_var; /* BLOB id */ |
|
|
|
size_t blob_len; /* size of allocated BLOB data */ |
|
void *blob_data; /* mapped BLOB data */ |
|
|
|
TAILQ_ENTRY(tagBLOB) blob_node; |
|
} rpc_blob_t; |
|
|
|
|
typedef struct { |
typedef struct { |
int cli_id; /* slot id */ |
int cli_id; /* slot id */ |
int cli_sock; /* socket fd */ |
int cli_sock; /* socket fd */ |
Line 189 typedef struct {
|
Line 200 typedef struct {
|
void *cli_parent; /* pointer to parent rpc_srv_t for server or to rpc_sess_t for client */ |
void *cli_parent; /* pointer to parent rpc_srv_t for server or to rpc_sess_t for client */ |
} rpc_cli_t; |
} rpc_cli_t; |
|
|
|
|
/* BLOB registration element! */ |
|
typedef struct tagBLOB { |
|
uint32_t blob_var; |
|
|
|
size_t blob_len; // size of allocated BLOB data |
|
void *blob_data; // BLOB data |
|
|
|
struct tagBLOB *blob_next; |
|
} rpc_blob_t; |
|
|
|
typedef struct { |
typedef struct { |
rpc_sess_t srv_session; /* RPC session registration info */ |
rpc_sess_t srv_session; /* RPC session registration info */ |
int srv_netbuf; /* size of network buffer */ |
int srv_netbuf; /* size of network buffer */ |
Line 213 typedef struct {
|
Line 213 typedef struct {
|
TAILQ_HEAD(, tagRPCFunc) srv_funcs; /* RPC functions list */ |
TAILQ_HEAD(, tagRPCFunc) srv_funcs; /* RPC functions list */ |
|
|
struct { |
struct { |
cmd_type_t state; // BLOB server state: ==0 disable | !=0 enable | sched_root_task_t *root; /* BLOB server scheduler */ |
ait_val_t dir; | intptr_t kill; /* BLOB server state: ==0 disable | !=0 enable */ |
|
|
rpc_cli_t server; // BLOB server socket | ait_val_t dir; /* BLOB states directory */ |
rpc_cli_t *clients; // connected blob client sockets | |
|
|
rpc_blob_t *blobs; // registered blob variables list | rpc_cli_t server; /* BLOB server socket */ |
| array_t *clients; /* connected blob client sockets */ |
| |
| TAILQ_HEAD(, tagBLOB) blobs; /* registered blob variables list */ |
} srv_blob; |
} srv_blob; |
} rpc_srv_t; |
} rpc_srv_t; |
|
|
Line 308 void rpc_srv_endServer(rpc_srv_t ** __restrict psrv);
|
Line 310 void rpc_srv_endServer(rpc_srv_t ** __restrict psrv);
|
*/ |
*/ |
int rpc_srv_loopServer(rpc_srv_t * __restrict srv); |
int rpc_srv_loopServer(rpc_srv_t * __restrict srv); |
#define rpc_srv_execServer(_srv, _sync) do { assert((_srv)); pthread_t __tid; \ |
#define rpc_srv_execServer(_srv, _sync) do { assert((_srv)); pthread_t __tid; \ |
pthread_create(&__tid, NULL, (void*(*)(void*)) \ | if (!(_srv)->srv_kill) { \ |
rpc_srv_loopServer, (_srv)); \ | pthread_create(&__tid, NULL, (void*(*)(void*)) \ |
if ((_sync)) \ | rpc_srv_loopServer, (_srv)); \ |
pthread_join(__tid, (void**) (_sync)); \ | if ((_sync)) \ |
else \ | pthread_join(__tid, (void**) (_sync)); \ |
pthread_detach(__tid); \ | else \ |
} while (0) | pthread_detach(__tid); \ |
| } } while (0) |
|
|
/* |
/* |
* rpc_srv_initBLOBServer() - Init & create BLOB Server |
* rpc_srv_initBLOBServer() - Init & create BLOB Server |
Line 338 void rpc_srv_endBLOBServer(rpc_srv_t * __restrict srv)
|
Line 341 void rpc_srv_endBLOBServer(rpc_srv_t * __restrict srv)
|
* @srv = RPC Server instance |
* @srv = RPC Server instance |
* return: -1 error or 0 ok, infinite loop ... |
* return: -1 error or 0 ok, infinite loop ... |
*/ |
*/ |
int rpc_srv_loopBLOB(rpc_srv_t * __restrict srv); | int rpc_srv_loopBLOBServer(rpc_srv_t * __restrict srv); |
#define rpc_srv_execBLOBServer(_srv) do { assert((_srv)); pthread_t __tid; \ |
#define rpc_srv_execBLOBServer(_srv) do { assert((_srv)); pthread_t __tid; \ |
if ((_srv)->srv_blob.state == enable) { \ | if (!(_srv)->srv_kill && !(_srv)->srv_blob.kill) { \ |
pthread_create(&__tid, NULL, (void*(*)(void*)) \ |
pthread_create(&__tid, NULL, (void*(*)(void*)) \ |
rpc_srv_loopBLOB, (_srv)); \ | rpc_srv_loopBLOBServer, (_srv)); \ |
pthread_detach(__tid); \ |
pthread_detach(__tid); \ |
(_srv)->srv_blob.state = running; \ |
|
} \ |
} \ |
} while (0) |
} while (0) |
|
|
Line 388 int rpc_srv_execCall(rpc_func_t * __restrict call, str
|
Line 390 int rpc_srv_execCall(rpc_func_t * __restrict call, str
|
|
|
|
|
/* |
/* |
* rpc_srv_blobCreate() - Create map blob to memory region and return object | * rpc_srv_blobCreate() - Create and map blob to memory region and return object |
* |
* |
* @srv = RPC Server instance |
* @srv = RPC Server instance |
* @len = BLOB length object |
* @len = BLOB length object |