本文整理汇总了C++中rpc_queue_pdu函数的典型用法代码示例。如果您正苦于以下问题:C++ rpc_queue_pdu函数的具体用法?C++ rpc_queue_pdu怎么用?C++ rpc_queue_pdu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rpc_queue_pdu函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rpc_pmap_getport_async
int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
struct mapping m;
pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_GETPORT, cb, private_data, (xdrproc_t)xdr_int, sizeof(uint32_t));
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/getport call");
return -1;
}
m.prog = program;
m.vers = version;
m.prot = IPPROTO_TCP;
m.port = 0;
if (xdr_mapping(&pdu->xdr, &m) == 0) {
rpc_set_error(rpc, "XDR error: Failed to encode data for portmap/getport call");
rpc_free_pdu(rpc, pdu);
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Failed to queue portmap/getport pdu");
rpc_free_pdu(rpc, pdu);
return -1;
}
return 0;
}
示例2: rpc_pmap_callit_async
int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int procedure, const char *data, int datalen, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
struct pmap_call_args ca;
pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_CALLIT, cb, private_data, (xdrproc_t)xdr_pmap_call_result, sizeof(pmap_call_result));
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/callit call");
return -1;
}
ca.prog = program;
ca.vers = version;
ca.proc = procedure;
ca.args.args_len = datalen;
ca.args.args_val = data;
if (xdr_pmap_call_args(&pdu->xdr, &ca) == 0) {
rpc_set_error(rpc, "XDR error: Failed to encode data for portmap/callit call");
rpc_free_pdu(rpc, pdu);
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Failed to queue portmap/callit pdu: %s", rpc_get_error(rpc));
return -1;
}
return 0;
}
示例3: rpc_pmap_set_async
int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
struct pmap_mapping m;
pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_SET, cb, private_data, (zdrproc_t)zdr_int, sizeof(uint32_t));
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/set call");
return -1;
}
m.prog = program;
m.vers = version;
m.prot = protocol;
m.port = port;
if (zdr_pmap_mapping(&pdu->zdr, &m) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/set call");
rpc_free_pdu(rpc, pdu);
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Failed to queue portmap/set pdu");
rpc_free_pdu(rpc, pdu);
return -1;
}
return 0;
}
示例4: rpc_send_error_reply
static int rpc_send_error_reply(struct rpc_context *rpc,
struct rpc_msg *call,
enum accept_stat err,
int min_vers, int max_vers)
{
struct rpc_pdu *pdu;
struct rpc_msg res;
assert(rpc->magic == RPC_CONTEXT_MAGIC);
memset(&res, 0, sizeof(struct rpc_msg));
res.xid = call->xid;
res.direction = REPLY;
res.body.rbody.stat = MSG_ACCEPTED;
res.body.rbody.reply.areply.reply_data.mismatch_info.low = min_vers;
res.body.rbody.reply.areply.reply_data.mismatch_info.high = max_vers;
res.body.rbody.reply.areply.verf = _null_auth;
res.body.rbody.reply.areply.stat = err;
if (rpc->is_udp) {
/* send the reply back to the client */
memcpy(&rpc->udp_dest, &rpc->udp_src, sizeof(rpc->udp_dest));
}
pdu = rpc_allocate_reply_pdu(rpc, &res, 0);
if (pdu == NULL) {
rpc_set_error(rpc, "Failed to send error_reply: %s",
rpc_get_error(rpc));
return -1;
}
rpc_queue_pdu(rpc, pdu);
return 0;
}
示例5: rpc_mount3_null_async
int rpc_mount3_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, MOUNT_PROGRAM, MOUNT_V3, MOUNT3_NULL, cb, private_data, (zdrproc_t)zdr_void, 0);
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for mount/null call");
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for mount/null call");
return -1;
}
return 0;
}
示例6: rpc_rquota1_null_async
int rpc_rquota1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, RQUOTA_PROGRAM, RQUOTA_V1, RQUOTA1_NULL, cb, private_data, (xdrproc_t)xdr_void, 0);
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for rquota1/null call");
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for rquota1/null call");
rpc_free_pdu(rpc, pdu);
return -2;
}
return 0;
}
示例7: rpc_nfsacl_null_async
int rpc_nfsacl_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, NFSACL_PROGRAM, NFSACL_V3, NFSACL3_NULL, cb, private_data, (xdrproc_t)xdr_void, 0);
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfsacl/null call");
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfsacl/null call");
rpc_free_pdu(rpc, pdu);
return -2;
}
return 0;
}
示例8: rpc_pmap_null_async
int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_NULL, cb, private_data, (xdrproc_t)xdr_void, 0);
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/null call");
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for portmap/null call");
rpc_free_pdu(rpc, pdu);
return -1;
}
return 0;
}
示例9: rpc_nlm4_null_async
int rpc_nlm4_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_NULL, cb, private_data, (zdrproc_t)zdr_void, 0);
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nlm/null call");
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nlm/null call");
rpc_free_pdu(rpc, pdu);
return -1;
}
return 0;
}
示例10: rpc_nlm4_cancel_async
int rpc_nlm4_cancel_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_CANCargs *args, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_CANCEL, cb, private_data, (zdrproc_t)zdr_NLM4_CANCres, sizeof(NLM4_CANCres));
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nlm/cancel call");
return -1;
}
if (zdr_NLM4_CANCargs(&pdu->zdr, args) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode NLM4_CANCargs");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nlm/cancel call");
return -1;
}
return 0;
}
示例11: rpc_nfsacl_setacl_async
int rpc_nfsacl_setacl_async(struct rpc_context *rpc, rpc_cb cb, struct SETACL3args *args, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, NFSACL_PROGRAM, NFSACL_V3, NFSACL3_SETACL, cb, private_data, (xdrproc_t)xdr_SETACL3res, sizeof(SETACL3res));
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nfsacl/setacl call");
return -1;
}
if (xdr_SETACL3args(&pdu->xdr, args) == 0) {
rpc_set_error(rpc, "XDR error: Failed to encode SETACL3args");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nfsacl/setacl call");
rpc_free_pdu(rpc, pdu);
return -2;
}
return 0;
}
示例12: rpc_nlm4_unlock_async
int rpc_nlm4_unlock_async(struct rpc_context *rpc, rpc_cb cb, struct NLM4_UNLOCKargs *args, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, NLM_PROGRAM, NLM_V4, NLM4_UNLOCK, cb, private_data, (xdrproc_t)xdr_NLM4_UNLOCKres, sizeof(NLM4_UNLOCKres));
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nlm/unlock call");
return -1;
}
if (xdr_NLM4_UNLOCKargs(&pdu->xdr, args) == 0) {
rpc_set_error(rpc, "XDR error: Failed to encode NLM4_UNLOCKargs");
rpc_free_pdu(rpc, pdu);
return -2;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nlm/unlock call");
rpc_free_pdu(rpc, pdu);
return -1;
}
return 0;
}
示例13: rpc_send_reply
int rpc_send_reply(struct rpc_context *rpc,
struct rpc_msg *call,
void *reply,
zdrproc_t encode_fn,
int alloc_hint)
{
struct rpc_pdu *pdu;
struct rpc_msg res;
assert(rpc->magic == RPC_CONTEXT_MAGIC);
memset(&res, 0, sizeof(struct rpc_msg));
res.xid = call->xid;
res.direction = REPLY;
res.body.rbody.stat = MSG_ACCEPTED;
res.body.rbody.reply.areply.verf = _null_auth;
res.body.rbody.reply.areply.stat = SUCCESS;
res.body.rbody.reply.areply.reply_data.results.where = reply;
res.body.rbody.reply.areply.reply_data.results.proc = encode_fn;
if (rpc->is_udp) {
/* send the reply back to the client */
memcpy(&rpc->udp_dest, &rpc->udp_src, sizeof(rpc->udp_dest));
}
pdu = rpc_allocate_reply_pdu(rpc, &res, alloc_hint);
if (pdu == NULL) {
rpc_set_error(rpc, "Failed to send error_reply: %s",
rpc_get_error(rpc));
return -1;
}
rpc_queue_pdu(rpc, pdu);
return 0;
}