version 1.5.2.5, 2011/10/31 14:58:33
|
version 1.5.2.6, 2011/11/03 13:35:39
|
Line 65 rpc_cli_openBLOBClient(rpc_cli_t * __restrict rpccli,
|
Line 65 rpc_cli_openBLOBClient(rpc_cli_t * __restrict rpccli,
|
rpc_SetErr(EINVAL, "Error:: Invalid parameters can`t connect to BLOB server ...\n"); |
rpc_SetErr(EINVAL, "Error:: Invalid parameters can`t connect to BLOB server ...\n"); |
return NULL; |
return NULL; |
} |
} |
if (!Port) |
|
Port = RPC_DEFPORT + 1; |
|
|
|
cli = malloc(sizeof(rpc_cli_t)); |
cli = malloc(sizeof(rpc_cli_t)); |
if (!cli) { |
if (!cli) { |
Line 76 rpc_cli_openBLOBClient(rpc_cli_t * __restrict rpccli,
|
Line 74 rpc_cli_openBLOBClient(rpc_cli_t * __restrict rpccli,
|
memcpy(cli, rpccli, sizeof(rpc_cli_t)); |
memcpy(cli, rpccli, sizeof(rpc_cli_t)); |
|
|
memcpy(&sa, &rpccli->cli_sa, sizeof sa); |
memcpy(&sa, &rpccli->cli_sa, sizeof sa); |
switch (rpccli->cli_sa.sa.sa_family) { | switch (sa.sa.sa_family) { |
case AF_INET: |
case AF_INET: |
sa.sin.sin_port = htons(Port); | sa.sin.sin_port = htons(Port ? Port : ntohs(sa.sin.sin_port) + 1); |
break; |
break; |
case AF_INET6: |
case AF_INET6: |
sa.sin6.sin6_port = htons(Port); | sa.sin6.sin6_port = htons(Port ? Port : ntohs(sa.sin6.sin6_port) + 1); |
break; |
break; |
case AF_LOCAL: |
case AF_LOCAL: |
strlcat(sa.sun.sun_path, ".blob", sizeof sa.sun.sun_path); |
strlcat(sa.sun.sun_path, ".blob", sizeof sa.sun.sun_path); |
Line 323 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
Line 321 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
/* prepare RPC call */ |
/* prepare RPC call */ |
rpc = (struct tagRPCCall*) buf; |
rpc = (struct tagRPCCall*) buf; |
rpc_addPktSession(&rpc->call_session, cli->cli_parent); |
rpc_addPktSession(&rpc->call_session, cli->cli_parent); |
rpc->call_argc = htons(in_vars ? io_arraySize(in_vars) : 0); | rpc->call_argc = htons(io_arraySize(in_vars)); |
rpc->call_tag = tag = htons(crcFletcher16((u_short*) str, sizeof str / 2)); |
rpc->call_tag = tag = htons(crcFletcher16((u_short*) str, sizeof str / 2)); |
rpc->call_hash = hash = htonl(hash_fnv((char*) str, sizeof str)); |
rpc->call_hash = hash = htonl(hash_fnv((char*) str, sizeof str)); |
Limit = sizeof(struct tagRPCCall); |
Limit = sizeof(struct tagRPCCall); |
|
|
if (in_vars && io_arraySize(in_vars)) { | if (io_arraySize(in_vars)) { |
/* marshaling variables */ |
/* marshaling variables */ |
ret = io_vals2buffer(buf + Limit, cli->cli_netbuf - Limit, in_vars); |
ret = io_vals2buffer(buf + Limit, cli->cli_netbuf - Limit, in_vars); |
if (ret == -1) { |
if (ret == -1) { |
Line 387 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
Line 385 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
} else |
} else |
Limit = sizeof(struct tagRPCRet); |
Limit = sizeof(struct tagRPCRet); |
if (rrpc->ret_tag != tag || rrpc->ret_hash != hash) { |
if (rrpc->ret_tag != tag || rrpc->ret_hash != hash) { |
printf("tag=%x/%x hash=%x/%x\n", rrpc->ret_tag, tag, rrpc->ret_hash, hash); |
|
rpc_SetErr(ERPCMISMATCH, "Error:: get wrong RPC reply ...\n"); |
rpc_SetErr(ERPCMISMATCH, "Error:: get wrong RPC reply ...\n"); |
free(buf); |
free(buf); |
return -5; |
return -5; |
Line 421 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
Line 418 rpc_cli_execCall(rpc_cli_t *cli, const char *csModule,
|
} |
} |
|
|
/* |
/* |
* rpc_cli_freeVals() Free ait_val_t array returned from RPC call | * rpc_cli_freeVars() Free ait_val_t array returned from RPC call |
* @vars = Variable array |
* @vars = Variable array |
* return: none |
* return: none |
*/ |
*/ |
inline void |
inline void |
rpc_cli_freeVals(array_t ** __restrict vars) | rpc_cli_freeVars(array_t ** __restrict vars) |
{ |
{ |
register int i; |
register int i; |
|
|
Line 442 rpc_cli_freeVals(array_t ** __restrict vars)
|
Line 439 rpc_cli_freeVals(array_t ** __restrict vars)
|
} |
} |
|
|
/* |
/* |
* rpc_cli_allocVals() Allocate ait_val_t array for RPC call | * rpc_cli_allocVars() Allocate ait_val_t array for RPC call |
* @args = Number of arguments |
* @args = Number of arguments |
* return: =NULL error or !=NULL allocated array |
* return: =NULL error or !=NULL allocated array |
*/ |
*/ |
inline array_t * |
inline array_t * |
rpc_cli_allocVals(u_short args) | rpc_cli_allocVars(u_short args) |
{ |
{ |
array_t *arr; |
array_t *arr; |
register int i; |
register int i; |
Line 463 rpc_cli_allocVals(u_short args)
|
Line 460 rpc_cli_allocVals(u_short args)
|
v = malloc(sizeof(ait_val_t)); |
v = malloc(sizeof(ait_val_t)); |
if (!v) { |
if (!v) { |
LOGERR; |
LOGERR; |
rpc_cli_freeVals(&arr); | rpc_cli_freeVars(&arr); |
return NULL; |
return NULL; |
} else { |
} else { |
memset(v, 0, sizeof(ait_val_t)); |
memset(v, 0, sizeof(ait_val_t)); |