version 1.23.2.5, 2015/01/21 20:28:41
|
version 1.24.2.2, 2015/01/28 00:06:22
|
Line 161 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
Line 161 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
rpc_cli_t *cli = NULL; |
rpc_cli_t *cli = NULL; |
sockaddr_t sa = E_SOCKADDR_INIT; |
sockaddr_t sa = E_SOCKADDR_INIT; |
|
|
|
if (proto < 0 || proto > SOCK_RAW) { |
|
rpc_SetErr(EINVAL, "Invalid parameters can`t open RPC client"); |
|
return NULL; |
|
} |
|
|
if (!e_gethostbyname(csHost, Port, &sa)) |
if (!e_gethostbyname(csHost, Port, &sa)) |
return NULL; |
return NULL; |
if (!Port) |
if (!Port) |
Line 195 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
Line 200 rpc_cli_openClient(u_char InstID, int netBuf, const ch
|
AIT_SET_BUFSIZ(&cli->cli_buf, 0, netBuf); |
AIT_SET_BUFSIZ(&cli->cli_buf, 0, netBuf); |
|
|
/* connect to RPC server */ |
/* connect to RPC server */ |
cli->cli_sock = socket(cli->cli_sa.sa.sa_family, cli->cli_id, 0); | cli->cli_sock = socket(cli->cli_sa.sa.sa_family, cli->cli_id, |
| cli->cli_id == SOCK_RAW ? IPPROTO_ERPC : 0); |
if (cli->cli_sock == -1) { |
if (cli->cli_sock == -1) { |
LOGERR; |
LOGERR; |
goto err; |
goto err; |
Line 351 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
Line 357 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
if (type == SOCK_STREAM) |
if (type == SOCK_STREAM) |
ret = rpc_Read(sock, type, !estlen ? MSG_PEEK : 0, NULL, buf, blen); |
ret = rpc_Read(sock, type, !estlen ? MSG_PEEK : 0, NULL, buf, blen); |
else if (type == SOCK_EXT) { |
else if (type == SOCK_EXT) { |
ret = rpc_Read(sock, type, 0, NULL, AIT_GET_BUF(pkt), AIT_LEN(pkt)); | ret = rpc_Read(sock, type, 0, NULL, buf, blen); |
if (ret > 0) | if (estlen) /* hack for skip sanity checks */ |
estlen = ret; | ret += sizeof(struct tagRPCCall); |
} else if (type == SOCK_BPF) { |
} else if (type == SOCK_BPF) { |
ret = rpc_Read(sock, type, 0, sa, AIT_GET_BUF(pkt), AIT_LEN(pkt)); |
ret = rpc_Read(sock, type, 0, sa, AIT_GET_BUF(pkt), AIT_LEN(pkt)); |
if (ret > 0) |
if (ret > 0) |
Line 370 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
Line 376 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
} |
} |
|
|
/* check for loop request */ |
/* check for loop request */ |
if (!(rpc->call_io & RPC_ACK)) | if (!estlen && !(rpc->call_io & RPC_ACK)) |
continue; |
continue; |
|
|
/* check for response from known address */ |
/* check for response from known address */ |
Line 379 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
Line 385 rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
|
estlen = ntohl(rpc->call_len); |
estlen = ntohl(rpc->call_len); |
if (estlen > AIT_LEN(pkt)) |
if (estlen > AIT_LEN(pkt)) |
AIT_RE_BUF(pkt, estlen); |
AIT_RE_BUF(pkt, estlen); |
|
blen = estlen; |
buf = AIT_GET_BUF(pkt); |
buf = AIT_GET_BUF(pkt); |
|
|
|
if (type == SOCK_EXT) { |
|
blen -= sizeof(struct tagRPCCall); |
|
buf += sizeof(struct tagRPCCall); |
|
} |
|
|
rpc = (struct tagRPCCall*) buf; |
rpc = (struct tagRPCCall*) buf; |
blen = estlen; |
|
continue; |
continue; |
} |
} |
|
|
Line 468 rpc_pkt_Request(ait_val_t * __restrict pkt, rpc_sess_t
|
Line 480 rpc_pkt_Request(ait_val_t * __restrict pkt, rpc_sess_t
|
* |
* |
* @pkt = Packet buffer |
* @pkt = Packet buffer |
* @sess = RPC session info, if =NULL don't check session |
* @sess = RPC session info, if =NULL don't check session |
* @tag = Function tag | * @tag = Function tag, if =CALL_TAG_MAX don't check tag |
* @vars = Function argument array of values, may be NULL |
* @vars = Function argument array of values, may be NULL |
* @nocrc = Without CRC calculation |
* @nocrc = Without CRC calculation |
* return: -1 error or != -1 return value from function |
* return: -1 error or != -1 return value from function |
Line 504 rpc_pkt_Replay(ait_val_t * __restrict pkt, rpc_sess_t
|
Line 516 rpc_pkt_Replay(ait_val_t * __restrict pkt, rpc_sess_t
|
rpc_SetErr(ERPCMISMATCH, "Get invalid RPC session"); |
rpc_SetErr(ERPCMISMATCH, "Get invalid RPC session"); |
return -1; |
return -1; |
} |
} |
if (ntohs(rpc->call_tag) != tag) { | if (tag != CALL_TAG_MAX && ntohs(rpc->call_tag) != tag) { |
rpc_SetErr(ERPCMISMATCH, "Get wrong RPC reply"); |
rpc_SetErr(ERPCMISMATCH, "Get wrong RPC reply"); |
return -1; |
return -1; |
} |
} |