/* * XDR remote call arguments * written for XDR_ENCODE direction only */ bool_t xdr_rmtcall_args( register XDR *xdrs, register struct rmtcallargs *cap) { unsigned lenposition, argposition, position; if (xdr_u_long(xdrs, &(cap->prog)) && xdr_u_long(xdrs, &(cap->vers)) && xdr_u_long(xdrs, &(cap->proc))) { lenposition = XDR_GETPOS(xdrs); if (! xdr_u_long(xdrs, &(cap->arglen))) return (FALSE); argposition = XDR_GETPOS(xdrs); if (! (*(cap->xdr_args))(xdrs, cap->args_ptr)) return (FALSE); position = XDR_GETPOS(xdrs); cap->arglen = (unsigned long)position - (unsigned long)argposition; XDR_SETPOS(xdrs, lenposition); if (! xdr_u_long(xdrs, &(cap->arglen))) return (FALSE); XDR_SETPOS(xdrs, position); return (TRUE); } return (FALSE); }
/* * XDR remote call arguments * written for XDR_ENCODE direction only */ bool_t xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap) { u_int lenposition, argposition, position; if (xdr_u_long (xdrs, &(cap->prog)) && xdr_u_long (xdrs, &(cap->vers)) && xdr_u_long (xdrs, &(cap->proc))) { u_long dummy_arglen = 0; lenposition = XDR_GETPOS (xdrs); if (!xdr_u_long (xdrs, &dummy_arglen)) return FALSE; argposition = XDR_GETPOS (xdrs); if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr)) return FALSE; position = XDR_GETPOS (xdrs); cap->arglen = (u_long) position - (u_long) argposition; XDR_SETPOS (xdrs, lenposition); if (!xdr_u_long (xdrs, &(cap->arglen))) return FALSE; XDR_SETPOS (xdrs, position); return TRUE; } return FALSE; }
bool_t xdr_ndmp3_mover_get_state_reply (XDR *xdrs, ndmp3_mover_get_state_reply *objp) { if (!xdr_ndmp3_error (xdrs, &objp->error)) return FALSE; if (!xdr_ndmp3_mover_state (xdrs, &objp->state)) return FALSE; if (!xdr_ndmp3_mover_pause_reason (xdrs, &objp->pause_reason)) return FALSE; if (!xdr_ndmp3_mover_halt_reason (xdrs, &objp->halt_reason)) return FALSE; if (!xdr_u_long (xdrs, &objp->record_size)) return FALSE; if (!xdr_u_long (xdrs, &objp->record_num)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->data_written)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->seek_position)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->bytes_left_to_read)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->window_offset)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->window_length)) return FALSE; if (!xdr_ndmp3_addr (xdrs, &objp->data_connection_addr)) return FALSE; return TRUE; }
/* * XDR remote call arguments * written for XDR_ENCODE direction only */ bool xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap) { u_int lenposition, argposition, position; assert(xdrs != NULL); assert(cap != NULL); if (xdr_u_long(xdrs, &(cap->prog)) && xdr_u_long(xdrs, &(cap->vers)) && xdr_u_long(xdrs, &(cap->proc))) { lenposition = XDR_GETPOS(xdrs); if (!xdr_u_long(xdrs, &(cap->arglen))) return (false); argposition = XDR_GETPOS(xdrs); if (!(*(cap->xdr_args)) (xdrs, cap->args_ptr)) return (false); position = XDR_GETPOS(xdrs); cap->arglen = (u_long) position - (u_long) argposition; XDR_SETPOS(xdrs, lenposition); if (!xdr_u_long(xdrs, &(cap->arglen))) return (false); XDR_SETPOS(xdrs, position); return (true); } return (false); }
/* * XDR remote call arguments * written for XDR_ENCODE direction only */ bool_t xdr_rmtcall_args( register XDR *xdrs, register struct rmtcallargs *cap) { uint32 lenposition, argposition, position; if (xdr_prog_t(xdrs, &(cap->prog)) && xdr_vers_t(xdrs, &(cap->vers)) && xdr_proc_t(xdrs, &(cap->proc))) { /* * All the jugglery for just getting the size of the arguments */ lenposition = XDR_GETPOS(xdrs); if (! xdr_u_long(xdrs, &(cap->arglen))) return (FALSE); argposition = XDR_GETPOS(xdrs); if (! (*(cap->xdr_args))(xdrs, cap->args_ptr)) return (FALSE); position = XDR_GETPOS(xdrs); cap->arglen = position - argposition; XDR_SETPOS(xdrs, lenposition); if (! xdr_u_long(xdrs, &(cap->arglen))) return (FALSE); XDR_SETPOS(xdrs, position); return (TRUE); } return (FALSE); }
bool_t xdr_ndmp3_data_get_state_reply (XDR *xdrs, ndmp3_data_get_state_reply *objp) { if (!xdr_u_long (xdrs, &objp->invalid)) return FALSE; if (!xdr_ndmp3_error (xdrs, &objp->error)) return FALSE; if (!xdr_ndmp3_data_operation (xdrs, &objp->operation)) return FALSE; if (!xdr_ndmp3_data_state (xdrs, &objp->state)) return FALSE; if (!xdr_ndmp3_data_halt_reason (xdrs, &objp->halt_reason)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->bytes_processed)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->est_bytes_remain)) return FALSE; if (!xdr_u_long (xdrs, &objp->est_time_remain)) return FALSE; if (!xdr_ndmp3_addr (xdrs, &objp->data_connection_addr)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->read_offset)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->read_length)) return FALSE; return TRUE; }
bool_t xdr_uint64(register XDR *xdrs, uint64 *objp) { if (!xdr_u_long(xdrs,(u_long *) &(objp->most))) return (FALSE); return (xdr_u_long(xdrs,(u_long *) &(objp->least))); } /* xdr_uint64 */
/************************************************************************ * * * Convert the Ipgmsg into XDR format. * * */ static bool_t xdr_ipgmsg(XDR *xdrs, Ipgmsg *msg) { if (!xdr_u_long(xdrs, &msg->major_id) || !xdr_u_long(xdrs, &msg->minor_id) || !xdr_string(xdrs, &msg->msgbuf, IPG_MAX_BYTES)) return(FALSE); return(TRUE); }
bool_t xdr__ndmp3_u_quad (XDR *xdrs, _ndmp3_u_quad *objp) { if (!xdr_u_long (xdrs, &objp->high)) return FALSE; if (!xdr_u_long (xdrs, &objp->low)) return FALSE; return TRUE; }
bool_t xdr_Create_LinkParms (XDR *xdrs, Create_LinkParms *objp) { #if defined(SOLARIS) && !defined(_LP64) register long *buf; #else register int32_t *buf; #endif if (xdrs->x_op == XDR_ENCODE) { buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_long (xdrs, &objp->clientId)) return FALSE; if (!xdr_bool (xdrs, &objp->lockDevice)) return FALSE; if (!xdr_u_long (xdrs, &objp->lock_timeout)) return FALSE; } else { IXDR_PUT_INT32(buf, objp->clientId); IXDR_PUT_BOOL(buf, objp->lockDevice); IXDR_PUT_U_INT32(buf, objp->lock_timeout); } if (!xdr_string (xdrs, &objp->device, ~0)) return FALSE; return TRUE; } else if (xdrs->x_op == XDR_DECODE) { buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_long (xdrs, &objp->clientId)) return FALSE; if (!xdr_bool (xdrs, &objp->lockDevice)) return FALSE; if (!xdr_u_long (xdrs, &objp->lock_timeout)) return FALSE; } else { objp->clientId = IXDR_GET_INT32(buf); objp->lockDevice = IXDR_GET_BOOL(buf); objp->lock_timeout = IXDR_GET_U_INT32(buf); } if (!xdr_string (xdrs, &objp->device, ~0)) return FALSE; return TRUE; } if (!xdr_long (xdrs, &objp->clientId)) return FALSE; if (!xdr_bool (xdrs, &objp->lockDevice)) return FALSE; if (!xdr_u_long (xdrs, &objp->lock_timeout)) return FALSE; if (!xdr_string (xdrs, &objp->device, ~0)) return FALSE; return TRUE; }
bool_t xdr_portmap(XDR *xdrs, struct portmap *regs) { if (xdr_u_long(xdrs, ®s->pm_prog) && xdr_u_long(xdrs, ®s->pm_vers) && xdr_u_long(xdrs, ®s->pm_prot)) return (xdr_u_long(xdrs, ®s->pm_port)); return (FALSE); }
bool_t xdr_nodst(XDR *xdrs, struct mknod_st *nodst) { if(!xdr_vector(xdrs, (char *)&nodst->path, 100 ,sizeof(char), (xdrproc_t)xdr_char)) return (FALSE); if(!xdr_u_long(xdrs, &nodst->mode)) return (FALSE); if(!xdr_u_long(xdrs, &nodst->rdev)) return (FALSE); return (TRUE); }
bool_t xdr_ndmp3_execute_cdb_request (XDR *xdrs, ndmp3_execute_cdb_request *objp) { register int32_t *buf; if (xdrs->x_op == XDR_ENCODE) { buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_u_long (xdrs, &objp->flags)) return FALSE; if (!xdr_u_long (xdrs, &objp->timeout)) return FALSE; if (!xdr_u_long (xdrs, &objp->datain_len)) return FALSE; } else { IXDR_PUT_U_LONG(buf, objp->flags); IXDR_PUT_U_LONG(buf, objp->timeout); IXDR_PUT_U_LONG(buf, objp->datain_len); } if (!xdr_bytes (xdrs, (char **)&objp->cdb.cdb_val, (u_int *) &objp->cdb.cdb_len, ~0)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->dataout.dataout_val, (u_int *) &objp->dataout.dataout_len, ~0)) return FALSE; return TRUE; } else if (xdrs->x_op == XDR_DECODE) { buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_u_long (xdrs, &objp->flags)) return FALSE; if (!xdr_u_long (xdrs, &objp->timeout)) return FALSE; if (!xdr_u_long (xdrs, &objp->datain_len)) return FALSE; } else { objp->flags = IXDR_GET_U_LONG(buf); objp->timeout = IXDR_GET_U_LONG(buf); objp->datain_len = IXDR_GET_U_LONG(buf); } if (!xdr_bytes (xdrs, (char **)&objp->cdb.cdb_val, (u_int *) &objp->cdb.cdb_len, ~0)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->dataout.dataout_val, (u_int *) &objp->dataout.dataout_len, ~0)) return FALSE; return TRUE; } if (!xdr_u_long (xdrs, &objp->flags)) return FALSE; if (!xdr_u_long (xdrs, &objp->timeout)) return FALSE; if (!xdr_u_long (xdrs, &objp->datain_len)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->cdb.cdb_val, (u_int *) &objp->cdb.cdb_len, ~0)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->dataout.dataout_val, (u_int *) &objp->dataout.dataout_len, ~0)) return FALSE; return TRUE; }
bool xdr_pmap(XDR *xdrs, struct pmap *regs) { assert(xdrs != NULL); assert(regs != NULL); if (xdr_u_long(xdrs, ®s->pm_prog) && xdr_u_long(xdrs, ®s->pm_vers) && xdr_u_long(xdrs, ®s->pm_prot)) return (xdr_u_long(xdrs, ®s->pm_port)); return (FALSE); }
/* * Serializes the "static part" of a call message header. * The fields include: rm_xid, rm_direction, rpcvers, prog, and vers. * The rm_xid is not really static, but the user can easily munge on the fly. */ bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg) { cmsg->rm_direction = CALL; cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION; if ( (xdrs->x_op == XDR_ENCODE) && xdr_u_long(xdrs, &(cmsg->rm_xid)) && xdr_enum(xdrs, (enum_t *) & (cmsg->rm_direction)) && xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) && xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog))) return (xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers))); return (FALSE); }
bool_t xdr_Device_WriteParms (XDR *xdrs, Device_WriteParms *objp) { if (!xdr_Device_Link (xdrs, &objp->lid)) return FALSE; if (!xdr_u_long (xdrs, &objp->io_timeout)) return FALSE; if (!xdr_u_long (xdrs, &objp->lock_timeout)) return FALSE; if (!xdr_Device_Flags (xdrs, &objp->flags)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) return FALSE; return TRUE; }
/* * XDR unsigned integers */ bool_t xdr_u_int(XDR *xdrs, u_int *up) { #ifdef lint (xdr_short(xdrs, (short *)up)); return (xdr_u_long(xdrs, (u_long *)up)); #else if (sizeof (u_int) == sizeof (u_long)) { return (xdr_u_long(xdrs, (u_long *)up)); } else { return (xdr_short(xdrs, (short *)up)); } #endif }
bool_t xdr_ndmp9_execute_cdb_request (XDR *xdrs, ndmp9_execute_cdb_request *objp) { if (!xdr_ndmp9_scsi_data_dir (xdrs, &objp->data_dir)) return FALSE; if (!xdr_u_long (xdrs, &objp->timeout)) return FALSE; if (!xdr_u_long (xdrs, &objp->datain_len)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->cdb.cdb_val, (u_int *) &objp->cdb.cdb_len, ~0)) return FALSE; if (!xdr_bytes (xdrs, (char **)&objp->dataout.dataout_val, (u_int *) &objp->dataout.dataout_len, ~0)) return FALSE; return TRUE; }
bool_t xdr_ndmp3_fs_info (XDR *xdrs, ndmp3_fs_info *objp) { if (!xdr_u_long (xdrs, &objp->invalid)) return FALSE; if (!xdr_string (xdrs, &objp->fs_type, ~0)) return FALSE; if (!xdr_string (xdrs, &objp->fs_logical_device, ~0)) return FALSE; if (!xdr_string (xdrs, &objp->fs_physical_device, ~0)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->total_size)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->used_size)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->avail_size)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->total_inodes)) return FALSE; if (!xdr_ndmp3_u_quad (xdrs, &objp->used_inodes)) return FALSE; if (!xdr_array (xdrs, (char **)&objp->fs_env.fs_env_val, (u_int *) &objp->fs_env.fs_env_len, ~0, sizeof (ndmp3_pval), (xdrproc_t) xdr_ndmp3_pval)) return FALSE; if (!xdr_string (xdrs, &objp->fs_status, ~0)) return FALSE; return TRUE; }
bool_t xdr_ndmp3_tape_read_request (XDR *xdrs, ndmp3_tape_read_request *objp) { if (!xdr_u_long (xdrs, &objp->count)) return FALSE; return TRUE; }
bool_t xdr_ndmp3_fc_addr (XDR *xdrs, ndmp3_fc_addr *objp) { if (!xdr_u_long (xdrs, &objp->loop_id)) return FALSE; return TRUE; }
bool_t xdr_uint32(XDR *xdrs, uint32 *objp) { if (!xdr_u_long(xdrs, objp)) return FALSE; return TRUE; }
bool_t xdr_ndmp3_mover_set_record_size_request (XDR *xdrs, ndmp3_mover_set_record_size_request *objp) { if (!xdr_u_long (xdrs, &objp->len)) return FALSE; return TRUE; }
bool_t xdr_uint32(register XDR *xdrs, uint32 *objp) { if (!xdr_u_long(xdrs, objp)) return (FALSE); return (TRUE); }
/* XXX - for nfs_prot_xdr.c */ bool_t xdr_u_int64_t(XDR *xdrs, u_int64_t *nump) { int i = 1; u_char *p = (u_char *)nump; if (*(char *)&i == 1) { /* endian haack. */ if (xdr_u_long(xdrs, (u_long *)(p + 4))) return (xdr_u_long(xdrs, (u_long *)p)); } else { if (xdr_u_long(xdrs, (u_long *)p)) return (xdr_u_long(xdrs, (u_long *)(p + 4))); } return (FALSE); }
bool_t xdr_AuthorizationItem(XDR *xdrs, AuthorizationItem *objp) { if (!sec_xdr_charp(xdrs, (char **)&objp->name, ~0)) return (FALSE); u_int valueLength; if (xdrs->x_op == XDR_ENCODE) { if (objp->valueLength > (u_int)~0) return (FALSE); valueLength = (u_int)objp->valueLength; } if (!sec_xdr_bytes(xdrs, (uint8_t **)&objp->value, &valueLength, ~0)) return (FALSE); if (xdrs->x_op == XDR_DECODE) objp->valueLength = valueLength; // This is only ever 32 bits, but prototyped with long on 32 bit and int on 64 bit to fall in line with UInt32 if (!xdr_u_long(xdrs, &objp->flags)) return (FALSE); return (TRUE); }
bool_t xdr_ndmp9_tape_get_state_reply (XDR *xdrs, ndmp9_tape_get_state_reply *objp) { if (!xdr_ndmp9_error (xdrs, &objp->error)) return FALSE; if (!xdr_u_long (xdrs, &objp->flags)) return FALSE; if (!xdr_ndmp9_tape_state (xdrs, &objp->state)) return FALSE; if (!xdr_ndmp9_tape_open_mode (xdrs, &objp->open_mode)) return FALSE; if (!xdr_ndmp9_valid_u_long (xdrs, &objp->file_num)) return FALSE; if (!xdr_ndmp9_valid_u_long (xdrs, &objp->soft_errors)) return FALSE; if (!xdr_ndmp9_valid_u_long (xdrs, &objp->block_size)) return FALSE; if (!xdr_ndmp9_valid_u_long (xdrs, &objp->blockno)) return FALSE; if (!xdr_ndmp9_valid_u_quad (xdrs, &objp->total_space)) return FALSE; if (!xdr_ndmp9_valid_u_quad (xdrs, &objp->space_remain)) return FALSE; if (!xdr_ndmp9_valid_u_long (xdrs, &objp->partition)) return FALSE; return TRUE; }
bool_t xdr_ndmp3_header (XDR *xdrs, ndmp3_header *objp) { if (!xdr_u_long (xdrs, &objp->sequence)) return FALSE; if (!xdr_u_long (xdrs, &objp->time_stamp)) return FALSE; if (!xdr_ndmp3_header_message_type (xdrs, &objp->message_type)) return FALSE; if (!xdr_ndmp3_message (xdrs, &objp->message)) return FALSE; if (!xdr_u_long (xdrs, &objp->reply_sequence)) return FALSE; if (!xdr_ndmp3_error (xdrs, &objp->error)) return FALSE; return TRUE; }
bool_t xdr_Device_WriteResp (XDR *xdrs, Device_WriteResp *objp) { if (!xdr_Device_ErrorCode (xdrs, &objp->error)) return FALSE; if (!xdr_u_long (xdrs, &objp->size)) return FALSE; return TRUE; }
bool_t xdr_rpipe_open_1_argument (XDR *xdrs, rpipe_open_1_argument *objp) { if (!xdr_u_long (xdrs, &objp->cbprog_id)) return FALSE; if (!xdr_int (xdrs, &objp->flag)) return FALSE; return TRUE; }