/* * XDR enumerations */ bool_t xdr_enum(XDR *xdrs, enum_t *ep) { #ifndef lint enum sizecheck { SIZEVAL }; /* used to find the size of an enum */ /* * enums are treated as ints */ switch (xdrs->x_op) { case XDR_ENCODE: VALGRIND_CHECK_DEFINED(*ep); break; default: break; } if (sizeof (enum sizecheck) == sizeof (long)) { return (xdr_long(xdrs, (long *)(void *)ep)); } else if (sizeof (enum sizecheck) == sizeof (int)) { return (xdr_int(xdrs, (int *)(void *)ep)); } else if (sizeof (enum sizecheck) == sizeof (short)) { return (xdr_short(xdrs, (short *)(void *)ep)); } else { return (FALSE); } #else (void) (xdr_short(xdrs, (short *)(void *)ep)); return (xdr_long(xdrs, (long *)(void *)ep)); #endif }
/* * XDR enumerations */ bool_t xdr_enum( XDR *xdrs, enum_t *ep) { #ifndef lint enum sizecheck { SIZEVAL }; /* used to find the size of an enum */ /* * enums are treated as ints */ if (sizeof (enum sizecheck) == sizeof (long)) { return (xdr_long(xdrs, (long *)ep)); } else if (sizeof (enum sizecheck) == sizeof (int)) { return (xdr_int(xdrs, (int *)ep)); } else if (sizeof (enum sizecheck) == sizeof (short)) { return (xdr_short(xdrs, (short *)ep)); } else { return (FALSE); } #else (void) (xdr_short(xdrs, (short *)ep)); (void) (xdr_int(xdrs, (int *)ep)); return (xdr_long(xdrs, (long *)ep)); #endif }
bool_t xdr_ndmp3_scsi_get_state_reply (XDR *xdrs, ndmp3_scsi_get_state_reply *objp) { if (!xdr_ndmp3_error (xdrs, &objp->error)) return FALSE; if (!xdr_short (xdrs, &objp->target_controller)) return FALSE; if (!xdr_short (xdrs, &objp->target_id)) return FALSE; if (!xdr_short (xdrs, &objp->target_lun)) return FALSE; return TRUE; }
/* * XDR group id types (gid_t) */ bool_t xdr_gid_t(XDR *xdrs, gid_t *ip) { #ifdef lint (void) (xdr_short(xdrs, (short *)ip)); return (xdr_int32(xdrs, (int32_t *)ip)); #else if (sizeof (gid_t) == sizeof (int32_t)) { return (xdr_int32(xdrs, (int32_t *)ip)); } else { return (xdr_short(xdrs, (short *)ip)); } #endif }
/* * XDR integers */ bool_t xdr_int(XDR *xdrs, int *ip) { #ifdef lint (xdr_short(xdrs, (short *)ip)); return (xdr_long(xdrs, (long *)ip)); #else if (sizeof (int) == sizeof (long)) { return (xdr_long(xdrs, (long *)ip)); } else { return (xdr_short(xdrs, (short *)ip)); } #endif }
/* * 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 }
void F77_FUNC(xdrfshort,XDRFSHORT)(int *xdrid, short *sp, int *ret) { xdr_fortran_lock(); *ret = xdr_short(xdridptr[*xdrid], sp); cnt += sizeof(sp); xdr_fortran_unlock(); }
static int xdr_RPGP_table_t (XDR *xdrs, RPGP_table_t *table) { int len; if (xdrs->x_op == XDR_DECODE) { table->comp_params = NULL; table->column_labels = NULL; table->row_labels = NULL; table->entries = NULL; } if (xdr_int (xdrs, &(table->comp_type)) == 0 || xdr_int (xdrs, &(table->numof_comp_params)) == 0 || (table->numof_comp_params > 0 && xdr_array (xdrs, (char **)&(table->comp_params), (unsigned int *)&(table->numof_comp_params), MAX_ARRAY_SIZE, sizeof (RPGP_parameter_t), (xdrproc_t)xdr_RPGP_parameter_t) == 0) || xdr_RPGP_string_t (xdrs, &(table->title)) == 0 || xdr_short (xdrs, &(table->n_columns)) == 0 || xdr_short (xdrs, &(table->n_rows)) == 0) return (0); len = table->n_columns; if (len > 0 && xdr_array (xdrs, (char **)&(table->column_labels), (unsigned int *)&len, MAX_ARRAY_SIZE, sizeof (RPGP_string_t), (xdrproc_t)xdr_RPGP_string_t) == 0) return (0); len = table->n_rows; if (len > 0 && xdr_array (xdrs, (char **)&(table->row_labels), (unsigned int *)&len, MAX_ARRAY_SIZE, sizeof (RPGP_string_t), (xdrproc_t)xdr_RPGP_string_t) == 0) return (0); len = table->n_rows * table->n_columns; if (len > 0 && xdr_array (xdrs, (char **)&(table->entries), (unsigned int *)&len, MAX_ARRAY_SIZE, sizeof (RPGP_string_t), (xdrproc_t)xdr_RPGP_string_t) == 0) return (0); return (1); }
static bool_t xdr_int16_t (XDR *xdrs, int16_t *objp) { int32_t *buf; if (!xdr_short (xdrs, objp)) return FALSE; return TRUE; }
bool_t xdr_enum(XDR *xdrs, enum_t *ep) { #ifndef lint /* * enums are treated as ints */ if (sizeof (sizecheckvar) == sizeof (int32_t)) { return (xdr_int(xdrs, (int32_t *)ep)); } else if (sizeof (sizecheckvar) == sizeof (short)) { return (xdr_short(xdrs, (short *)ep)); } else { return (FALSE); } #else (void) (xdr_short(xdrs, (short *)ep)); return (xdr_int(xdrs, (int32_t *)ep)); #endif }
short int si_print( XDR *xdrs, char *fmt ) { short int ss; if( !xdr_short(xdrs, &ss) ) { fflush( stdout); exit(1); } printf( fmt, ss); return ss; }
/* * XDR enumerations * * This function is a modified version of xdr_enum. It depends * on enum_t being defined as size long, short, or char. All * callers of xdr_enum_t must be sure that their enums are * type enum_t. BM */ bool_t xdr_enum_t(XDR *xdrs, enum_t *ep) { if (sizeof (enum_t) == sizeof (long)) { return (XDR_LONG(xdrs, (long *)ep)); } else if (sizeof (enum_t) == sizeof (short)) { return (xdr_short(xdrs, (short *)ep)); } else if (sizeof (enum_t) == sizeof (short)) { return (xdr_char(xdrs, (char *)ep)); } else { return (FALSE); } }
/* * XDR enumerations */ bool_t xdr_enum(XDR *xdrs, enum_t *ep) { enum sizecheck { SIZEVAL }; /* used to find the size of an enum */ /* * enums are treated as ints */ /* LINTED */ if (sizeof (enum sizecheck) == sizeof (long)) { return (xdr_long(xdrs, (long *)(void *)ep)); } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (int)) { return (xdr_int(xdrs, (int *)(void *)ep)); } else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (short)) { return (xdr_short(xdrs, (short *)(void *)ep)); } else { return (FALSE); } }
/* * XDR unsigned integers */ bool_t xdr_u_int(XDR* xdrs, unsigned int* up) { if (sizeof(unsigned int) == sizeof(unsigned long)) { return (xdr_u_long(xdrs, (unsigned long *) up)); } else if (sizeof(unsigned int) < sizeof(unsigned long)) { unsigned long l; switch (xdrs->x_op) { case XDR_ENCODE: l = (unsigned long) *up; return XDR_PUTLONG(xdrs, (long*)&l); case XDR_DECODE: if (!XDR_GETLONG(xdrs, (long*)&l)) return FALSE; *up = (unsigned int) l; case XDR_FREE: return TRUE; } return FALSE; } else { return (xdr_short(xdrs, (short *) up)); } }
/* * XDR integers */ bool_t xdr_int(XDR* xdrs, int* ip) { if (sizeof(int) == sizeof(long)) { return (xdr_long(xdrs, (long *) ip)); } else if (sizeof(int) < sizeof(long)) { long l; switch (xdrs->x_op) { case XDR_ENCODE: l = (long) *ip; return XDR_PUTLONG(xdrs, &l); case XDR_DECODE: if (!XDR_GETLONG(xdrs, &l)) return FALSE; *ip = (int) l; case XDR_FREE: return TRUE; } return FALSE; } else { return (xdr_short(xdrs, (short *) ip)); } }
bool_t xdr_ppathcnf (XDR *xdrs, ppathcnf *objp) { register int32_t *buf; int i; if (xdrs->x_op == XDR_ENCODE) { buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_int (xdrs, &objp->pc_link_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_canon)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_input)) return FALSE; if (!xdr_short (xdrs, &objp->pc_name_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_path_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_pipe_buf)) return FALSE; } else { IXDR_PUT_LONG(buf, objp->pc_link_max); IXDR_PUT_SHORT(buf, objp->pc_max_canon); IXDR_PUT_SHORT(buf, objp->pc_max_input); IXDR_PUT_SHORT(buf, objp->pc_name_max); IXDR_PUT_SHORT(buf, objp->pc_path_max); IXDR_PUT_SHORT(buf, objp->pc_pipe_buf); } if (!xdr_u_char (xdrs, &objp->pc_vdisable)) return FALSE; if (!xdr_char (xdrs, &objp->pc_xxx)) return FALSE; buf = XDR_INLINE (xdrs, ( 2 ) * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_vector (xdrs, (char *)objp->pc_mask, 2, sizeof (short), (xdrproc_t) xdr_short)) return FALSE; } else { { register short *genp; for (i = 0, genp = objp->pc_mask; i < 2; ++i) { IXDR_PUT_SHORT(buf, *genp++); } } } return TRUE; } else if (xdrs->x_op == XDR_DECODE) { buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_int (xdrs, &objp->pc_link_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_canon)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_input)) return FALSE; if (!xdr_short (xdrs, &objp->pc_name_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_path_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_pipe_buf)) return FALSE; } else { objp->pc_link_max = IXDR_GET_LONG(buf); objp->pc_max_canon = IXDR_GET_SHORT(buf); objp->pc_max_input = IXDR_GET_SHORT(buf); objp->pc_name_max = IXDR_GET_SHORT(buf); objp->pc_path_max = IXDR_GET_SHORT(buf); objp->pc_pipe_buf = IXDR_GET_SHORT(buf); } if (!xdr_u_char (xdrs, &objp->pc_vdisable)) return FALSE; if (!xdr_char (xdrs, &objp->pc_xxx)) return FALSE; buf = XDR_INLINE (xdrs, ( 2 ) * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (!xdr_vector (xdrs, (char *)objp->pc_mask, 2, sizeof (short), (xdrproc_t) xdr_short)) return FALSE; } else { { register short *genp; for (i = 0, genp = objp->pc_mask; i < 2; ++i) { *genp++ = IXDR_GET_SHORT(buf); } } } return TRUE; } if (!xdr_int (xdrs, &objp->pc_link_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_canon)) return FALSE; if (!xdr_short (xdrs, &objp->pc_max_input)) return FALSE; if (!xdr_short (xdrs, &objp->pc_name_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_path_max)) return FALSE; if (!xdr_short (xdrs, &objp->pc_pipe_buf)) return FALSE; if (!xdr_u_char (xdrs, &objp->pc_vdisable)) return FALSE; if (!xdr_char (xdrs, &objp->pc_xxx)) return FALSE; if (!xdr_vector (xdrs, (char *)objp->pc_mask, 2, sizeof (short), (xdrproc_t) xdr_short)) return FALSE; return TRUE; }
bool_t xdr_jobSpecs (XDR *xdrs, struct jobSpecs *jobSpecs, struct LSFHeader *hdr) { static char fname[] = "xdr_jobSpecs"; char *sp[15]; char *pTemp; int i, nLimits; int jobArrId, jobArrElemId; LS_LONG_INT tmpJobId; if (xdrs->x_op == XDR_DECODE) { jobSpecs->numToHosts = 0; jobSpecs->toHosts = NULL; jobSpecs->nxf = 0; jobSpecs->xf = NULL; jobSpecs->numEnv = 0; jobSpecs->env = NULL; jobSpecs->eexec.len = 0; jobSpecs->eexec.data = NULL; jobSpecs->loginShell = NULL; jobSpecs->schedHostType= NULL; jobSpecs->execHosts = NULL; } if (xdrs->x_op == XDR_FREE) { for(i=0; i < jobSpecs->numToHosts; i++) { FREEUP(jobSpecs->toHosts[i]); } FREEUP(jobSpecs->toHosts); for(i=0; i < jobSpecs->numEnv; i++) FREEUP(jobSpecs->env[i]); FREEUP(jobSpecs->env); FREEUP(jobSpecs->xf); FREEUP(jobSpecs->loginShell); FREEUP(jobSpecs->schedHostType); FREEUP(jobSpecs->execHosts); if (!xdr_thresholds(xdrs, jobSpecs) || !xdr_lenData(xdrs, &jobSpecs->eexec)) return(FALSE); return(TRUE); } if (xdrs->x_op == XDR_ENCODE) { jobId64To32(jobSpecs->jobId, &jobArrId, &jobArrElemId); } if (!xdr_int(xdrs, &jobArrId)) { ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname, "xdr_int", "jobId"); return(FALSE); } if (!(xdr_int(xdrs, &jobSpecs->userId) && xdr_int(xdrs, &jobSpecs->options) && xdr_short(xdrs, &jobSpecs->nice) && xdr_int(xdrs, &jobSpecs->priority) && xdr_int(xdrs, &jobSpecs->chkSig) && xdr_int(xdrs, &jobSpecs->actPid) && xdr_time_t(xdrs, &jobSpecs->chkPeriod) && xdr_time_t(xdrs, &jobSpecs->migThresh) && xdr_time_t(xdrs, &jobSpecs->lastSSuspTime) && xdr_float(xdrs, &jobSpecs->lastCpuTime))) { ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname, "xdr_int", "userId"); return(FALSE); } nLimits = LSF_RLIM_NLIMITS; tmpJobId = jobArrId; if (!xdr_int(xdrs, &nLimits)) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname, lsb_jobid2str(tmpJobId), "xdr_int", "nLimits"); return(FALSE); } for (i = 0; i < nLimits && i < LSF_RLIM_NLIMITS; i++) { if(!xdr_lsfLimit(xdrs, &jobSpecs->lsfLimits[i], hdr)) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S, fname, lsb_jobid2str(tmpJobId), "xdr_lsfLimit"); return(FALSE); } } if (nLimits > LSF_RLIM_NLIMITS) { for (i=LSF_RLIM_NLIMITS; i<nLimits; i++) { struct lsfLimit lsfLimit; if (!xdr_lsfLimit(xdrs, &lsfLimit, hdr)) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S, fname, lsb_jobid2str(tmpJobId), "xdr_lsfLimit"); return(FALSE); } } } if (!(xdr_int(xdrs, &jobSpecs->jStatus) && xdr_int(xdrs, &jobSpecs->reasons) && xdr_int(xdrs, &jobSpecs->subreasons) && xdr_time_t(xdrs, &jobSpecs->termTime) && xdr_time_t(xdrs, &jobSpecs->startTime) && xdr_int(xdrs, &jobSpecs->runTime) && xdr_time_t(xdrs, &jobSpecs->submitTime) && xdr_int(xdrs, &jobSpecs->jobPid) && xdr_int(xdrs, &jobSpecs->jobPGid) && xdr_int(xdrs, &jobSpecs->restartPid) && xdr_int(xdrs, &jobSpecs->sigValue) && xdr_int(xdrs, &jobSpecs->umask) && xdr_int(xdrs, &jobSpecs->jAttrib))) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname, lsb_jobid2str(tmpJobId), "xdr_int", "jStatus"); return(FALSE); } sp[0] = jobSpecs->jobFile; sp[1] = jobSpecs->inFile; sp[2] = jobSpecs->outFile; sp[3] = jobSpecs->errFile; sp[4] = jobSpecs->chkpntDir; sp[5] = jobSpecs->cwd; sp[6] = jobSpecs->subHomeDir; sp[7] = jobSpecs->command; sp[8] = jobSpecs->jobName; sp[9] = jobSpecs->preExecCmd; sp[10] = jobSpecs->fromHost; sp[11] = jobSpecs->resReq; if (xdrs->x_op == XDR_DECODE) for (i = 0; i < 11; i++) sp[i][0] = '\0'; if (!(xdr_string(xdrs, &sp[0], MAXFILENAMELEN) && xdr_string(xdrs, &sp[1], MAXFILENAMELEN) && xdr_string(xdrs, &sp[2], MAXFILENAMELEN) && xdr_string(xdrs, &sp[3], MAXFILENAMELEN) && xdr_string(xdrs, &sp[4], MAXFILENAMELEN) && xdr_string(xdrs, &sp[5], MAXFILENAMELEN) && xdr_string(xdrs, &sp[6], MAXFILENAMELEN) && xdr_string(xdrs, &sp[7], MAXLINELEN) && xdr_string(xdrs, &sp[8], MAXLINELEN) && xdr_string(xdrs, &sp[9], MAXLINELEN) && xdr_string(xdrs, &sp[10], MAXHOSTNAMELEN))) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname, lsb_jobid2str(tmpJobId), "xdr_int", "jobFile"); return(FALSE); } if (xdrs->x_op == XDR_DECODE) sp[11][0] = '\0'; if (!xdr_string(xdrs, &sp[11], MAXLINELEN)) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname, lsb_jobid2str(tmpJobId), "xdr_int", "jobFile"); return(FALSE); } sp[12] = jobSpecs->queue; sp[13] = jobSpecs->windows; sp[14] = jobSpecs->userName; if (xdrs->x_op == XDR_DECODE) for (i = 12; i < 15; i++) sp[i][0] = '\0'; if (!(xdr_string(xdrs, &sp[12], MAXFILENAMELEN) && xdr_string(xdrs, &sp[13], MAXLINELEN) && xdr_string(xdrs, &sp[14], MAX_LSB_NAME_LEN))) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname, lsb_jobid2str(tmpJobId), "xdr_int", "jobFile"); return(FALSE); } if (!xdr_int(xdrs, &jobSpecs->numToHosts)) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname, lsb_jobid2str(tmpJobId), "xdr_int", "numToHosts"); return(FALSE); } if (xdrs->x_op == XDR_DECODE && jobSpecs->numToHosts) { jobSpecs->toHosts = (char **) my_calloc(jobSpecs->numToHosts, sizeof (char *), fname); } for (i = 0; i < jobSpecs->numToHosts; i++) { if (!xdr_var_string(xdrs, &jobSpecs->toHosts[i])) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname, lsb_jobid2str(tmpJobId), "xdr_var_string", "toHosts"); return(FALSE); } } if (!xdr_thresholds(xdrs, jobSpecs)) ls_syslog(LOG_ERR, I18N_JOB_FAIL_S, fname, lsb_jobid2str(tmpJobId), "xdr_thresholds"); if (!xdr_int(xdrs, &jobSpecs->nxf)) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname, lsb_jobid2str(tmpJobId), "xdr_int", "nxf"); return(FALSE); } if (xdrs->x_op == XDR_DECODE && jobSpecs->nxf > 0) { jobSpecs->xf = (struct xFile *) my_calloc(jobSpecs->nxf, sizeof(struct xFile), fname); } for (i = 0; i < jobSpecs->nxf; i++) { if (!xdr_arrayElement(xdrs, (char *) &(jobSpecs->xf[i]), hdr, xdr_xFile)) { ls_syslog(LOG_ERR, I18N_JOB_FAIL_S_S, fname, lsb_jobid2str(tmpJobId), "xdr_arrayElement", "xf"); return(FALSE); } } sp[0] = jobSpecs->mailUser; sp[1] = jobSpecs->clusterName; sp[2] = jobSpecs->projectName; sp[3] = jobSpecs->preCmd; sp[4] = jobSpecs->postCmd; sp[5] = jobSpecs->execCwd; sp[6] = jobSpecs->execHome; sp[7] = jobSpecs->requeueEValues; if (xdrs->x_op == XDR_DECODE) { for(i=0; i < 8; i++) sp[i][0]= '\0'; } if (!(xdr_string(xdrs, &sp[0], MAXLINELEN) && xdr_string(xdrs, &sp[1], MAX_LSB_NAME_LEN) && xdr_string(xdrs, &sp[2], MAX_LSB_NAME_LEN) && xdr_string(xdrs, &sp[3], MAXLINELEN) && xdr_string(xdrs, &sp[4], MAXLINELEN) && xdr_string(xdrs, &sp[5], MAXFILENAMELEN) && xdr_string(xdrs, &sp[6], MAXFILENAMELEN) && xdr_string(xdrs, &sp[7], MAXLINELEN) && xdr_int(xdrs, &jobSpecs->execUid) && xdr_int(xdrs, &jobSpecs->maxNumProcessors) && xdr_int(xdrs, &jobSpecs->numEnv))) return(FALSE); if (xdrs->x_op == XDR_DECODE && jobSpecs->numEnv) { jobSpecs->env = (char **) my_calloc(jobSpecs->numEnv, sizeof (char *), fname); } for (i = 0; i < jobSpecs->numEnv; i++) { if (!xdr_var_string(xdrs, &jobSpecs->env[i])) return(FALSE); } if (!xdr_lenData(xdrs, &jobSpecs->eexec)) return (FALSE); if (!xdr_int(xdrs, &jobSpecs->niosPort)) return (FALSE); sp[0] = jobSpecs->resumeCond; sp[1] = jobSpecs->stopCond; sp[2] = jobSpecs->suspendActCmd; sp[3] = jobSpecs->resumeActCmd; sp[4] = jobSpecs->terminateActCmd; if (xdrs->x_op == XDR_DECODE) { sp[0][0] = '\0'; sp[1][0] = '\0'; } if (!(xdr_string(xdrs, &sp[0], MAXLINELEN)) || !(xdr_string(xdrs, &sp[1], MAXLINELEN))) return (FALSE); if (xdrs->x_op == XDR_DECODE) { for ( i = 2; i < 5; i++) sp[i][0] = '\0'; } for ( i = 2; i < 5; i++) if (!(xdr_string(xdrs, &sp[i], MAXLINELEN))) return(FALSE); for (i = 0; i <LSB_SIG_NUM; i++) if (!(xdr_int(xdrs, &jobSpecs->sigMap[i]))) return(FALSE); if (!(xdr_int(xdrs, &jobSpecs->actValue))) return (FALSE); if (!xdr_var_string(xdrs, &jobSpecs->loginShell)) return (FALSE); if (!xdr_var_string(xdrs, &jobSpecs->schedHostType)) return (FALSE); if (!xdr_var_string(xdrs, &jobSpecs->execHosts)) return (FALSE); if (!xdr_int(xdrs, &jobSpecs->options2)) { return(FALSE); } pTemp = jobSpecs->jobSpoolDir; if(!( xdr_string(xdrs, &pTemp, MAXPATHLEN))) { ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname, "xdr_string", "jobSpoolDir"); return(FALSE); } if (!(xdr_int(xdrs, &jobArrElemId))) { return (FALSE); } if (xdrs->x_op == XDR_DECODE) { jobId32To64(&jobSpecs->jobId,jobArrId,jobArrElemId); } sp[0] = jobSpecs->inFileSpool; sp[1] = jobSpecs->commandSpool; if (!(xdr_string(xdrs, &sp[0], MAXFILENAMELEN))) { ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname, "xdr_string", "inFileSpool"); return (FALSE); } if (!(xdr_string(xdrs, &sp[1], MAXFILENAMELEN))) { ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname, "xdr_string", "commandSpool"); return (FALSE); } if (!(xdr_int(xdrs, &jobSpecs->userPriority))) { ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname, "xdr_int", "userPriority"); return (FALSE); } sp[0] = jobSpecs->execUsername; if (!(xdr_string(xdrs, &sp[0], MAX_LSB_NAME_LEN))) { ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname, "xdr_string", "execUsername"); return (FALSE); } sp[0] = jobSpecs->prepostUsername; if (!(xdr_string(xdrs, &sp[0], MAX_LSB_NAME_LEN))) { ls_syslog(LOG_ERR, I18N_FUNC_S_FAIL, fname, "xdr_string", "prepostUsername"); return (FALSE); } return(TRUE); }
void mda_dump_extra( XDR *xdrs) { enum PV_TYPES { DBR_STRING=0, DBR_CTRL_CHAR=32, DBR_CTRL_SHORT=29, DBR_CTRL_LONG=33, DBR_CTRL_FLOAT=30, DBR_CTRL_DOUBLE=34 }; int i, j; short int pvs, type, count; count = 0; print( "\n\nExtra PV Offset = %li", xdr_getpos( xdrs) ); pvs = si_print( xdrs, "\n\nNumber of Extra PV's = %i.\n"); if( pvs < 0) { fflush(stdout); exit(1); } for( i = 0 ; i < pvs; i++) { print( "\nExtra PV #%i:\n", i+1); cs_print( xdrs, " Name = %s\n"); cs_print( xdrs, " Description = %s\n"); if( !xdr_short(xdrs, &type) ) return; if( (type != DBR_STRING) && (type != DBR_CTRL_CHAR) && (type != DBR_CTRL_SHORT) && (type != DBR_CTRL_LONG) && (type != DBR_CTRL_FLOAT) && (type != DBR_CTRL_DOUBLE)) { print( " Type = %i (UNKNOWN)\n", type); print( "\nExiting......\n"); exit(2); } if( type != DBR_STRING) { count = si_print( xdrs, " Count = %i\n"); cs_print( xdrs, " Unit = %s\n"); } switch(type) { case DBR_STRING: print( " Type = %i (DBR_STRING)\n", type); cs_print( xdrs, " Value = \"%s\"\n"); break; case DBR_CTRL_CHAR: { unsigned int size, maxsize; char *bytes; print( " Type = %i (DBR_CTRL_CHAR)\n", type); print( " Value%s = ", (count == 1) ? "" : "s"); maxsize = count; if( !xdr_bytes( xdrs, &(bytes), &size, maxsize ) ) return; count = size; for( j = 0; j < count; j++) { if( j) print( ", "); print( "%i", bytes[j]); } print( "\n"); } break; case DBR_CTRL_SHORT: { short int *shorts; print( " Type = %i (DBR_CTRL_SHORT\n", type); print( " Value%s = ", (count == 1) ? "" : "s"); shorts = (short int *) malloc( count * sizeof(short)); if( !xdr_vector( xdrs, (char *) shorts, count, sizeof( short), (xdrproc_t) xdr_short)) return; for( j = 0; j < count; j++) { if( j) print( ", "); print( "%i", shorts[j]); } print( "\n"); free (shorts); } break; case DBR_CTRL_LONG: { long int *longs; print( " Type = %i (DBR_CTRL_LONG)\n", type); print( " Value%s = ", (count == 1) ? "" : "s"); longs = (long int *) malloc( count * sizeof(long)); if( !xdr_vector( xdrs, (char *) longs, count, sizeof( long), (xdrproc_t) xdr_long)) return ; for( j = 0; j < count; j++) { if( j) print( ", "); print( "%li", longs[j]); } print( "\n"); free( longs); } break; case DBR_CTRL_FLOAT: { float *floats; print( " Type = %i (DBR_CTRL_FLOAT)\n", type); print( " Value%s = ", (count == 1) ? "" : "s"); floats = (float *) malloc( count * sizeof(float)); if( !xdr_vector( xdrs, (char *) floats, count, sizeof( float), (xdrproc_t) xdr_float)) return ; for( j = 0; j < count; j++) { if( j) print( ", "); print( "%.9g", floats[j]); } print( "\n"); free( floats); } break; case DBR_CTRL_DOUBLE: { double *doubles; print( " Type = %i (DBR_CTRL_DOUBLE)\n", type); print( " Value%s = ", (count == 1) ? "" : "s"); doubles = (double *) malloc( count * sizeof(double)); if( !xdr_vector( xdrs, (char *) doubles, count, sizeof( double), (xdrproc_t) xdr_double)) return; for( j = 0; j < count; j++) { if( j) print( ", "); print( "%.9lg", doubles[j]); } print( "\n"); free( doubles); } break; } } }
int xdr_RPGP_product_t (XDR *xdrs, RPGP_product_t *prod) { int *numof_prod_params_p; RPGP_parameter_t **prod_params_p; int *numof_components_p; void ***components_p; if (xdrs->x_op == XDR_DECODE) { prod->name = NULL; prod->description = NULL; } if (xdr_string (xdrs, &(prod->name), MAX_ARRAY_SIZE) == 0 || xdr_string (xdrs, &(prod->description), MAX_ARRAY_SIZE) == 0 || xdr_int (xdrs, &(prod->product_id)) == 0 || xdr_int (xdrs, &(prod->type)) == 0 || xdr_u_int (xdrs, &(prod->gen_time)) == 0) return (0); if (prod->type == RPGP_EXTERNAL) { RPGP_ext_data_t *eprod = (RPGP_ext_data_t *)prod; if (xdrs->x_op == XDR_DECODE) { eprod->prod_params = NULL; eprod->components = NULL; } if (xdr_short (xdrs, &(eprod->spare[0])) == 0 || xdr_short (xdrs, &(eprod->spare[1])) == 0 || xdr_short (xdrs, &(eprod->spare[2])) == 0 || xdr_short (xdrs, &(eprod->spare[3])) == 0 || xdr_short (xdrs, &(eprod->spare[4])) == 0 || xdr_short (xdrs, &(eprod->compress_type)) == 0 || xdr_int (xdrs, &(eprod->size_decompressed)) == 0) return (0); numof_prod_params_p = &(eprod->numof_prod_params); prod_params_p = &(eprod->prod_params); numof_components_p = &(eprod->numof_components); components_p = &(eprod->components); } else { if (xdrs->x_op == XDR_DECODE) { prod->radar_name = NULL; prod->prod_params = NULL; prod->components = NULL; } if (xdr_string (xdrs, &(prod->radar_name), MAX_ARRAY_SIZE) == 0 || xdr_float (xdrs, &(prod->radar_lat)) == 0 || xdr_float (xdrs, &(prod->radar_lon)) == 0 || xdr_float (xdrs, &(prod->radar_height)) == 0 || xdr_u_int (xdrs, &(prod->volume_time)) == 0 || xdr_u_int (xdrs, &(prod->elevation_time)) == 0 || xdr_float (xdrs, &(prod->elevation_angle)) == 0 || xdr_int (xdrs, &(prod->volume_number)) == 0 || xdr_short (xdrs, &(prod->operation_mode)) == 0 || xdr_short (xdrs, &(prod->vcp)) == 0 || xdr_short (xdrs, &(prod->elevation_number)) == 0 || xdr_short (xdrs, &(prod->compress_type)) == 0 || xdr_int (xdrs, &(prod->size_decompressed)) == 0) return (0); numof_prod_params_p = &(prod->numof_prod_params); prod_params_p = &(prod->prod_params); numof_components_p = &(prod->numof_components); components_p = &(prod->components); } if (xdr_int (xdrs, numof_prod_params_p) == 0 || (*numof_prod_params_p > 0 && xdr_array (xdrs, (char **)prod_params_p, (unsigned int *)numof_prod_params_p, MAX_ARRAY_SIZE, sizeof (RPGP_parameter_t), (xdrproc_t)xdr_RPGP_parameter_t) == 0)) return (0); if (xdr_int (xdrs, numof_components_p) == 0) return (0); /* process decompression */ if (*numof_components_p > 0 && xdr_array (xdrs, (char **)components_p, (unsigned int *)numof_components_p, MAX_ARRAY_SIZE, sizeof (char *), (xdrproc_t)xdr_RPGP_component_t) == 0) return (0); return (1); }
void F77_FUNC(xdrfshort,XDRFSHORT)(int *xdrid, short *sp, int *ret) { *ret = xdr_short(xdridptr[*xdrid], sp); cnt += sizeof(sp); }
ULONG CAN_encode_decode(burp_rel* relation, lstring* buffer, UCHAR* data, bool_t direction) { /************************************** * * C A N _ e n c o d e _ d e c o d e * ************************************** * * Functional description * encode and decode canonical backup. * **************************************/ const burp_fld* field; SSHORT n; XDR xdr; XDR* xdrs = &xdr; xdr_init(xdrs, buffer, direction ? XDR_ENCODE : XDR_DECODE); RCRD_OFFSET offset = 0; for (field = relation->rel_fields; field; field = field->fld_next) { if (field->fld_flags & FLD_computed) continue; UCHAR* p = data + field->fld_offset; const bool array_fld = ((field->fld_flags & FLD_array) != 0); const FLD_LENGTH length = array_fld ? 8 : field->fld_length; if (field->fld_offset >= offset) offset = field->fld_offset + length; if (field->fld_type == blr_varying && !array_fld) offset += sizeof(SSHORT); SSHORT dtype; if (field->fld_type == blr_blob || array_fld) dtype = dtype_blob; else dtype = (SSHORT) gds_cvt_blr_dtype[field->fld_type]; switch (dtype) { case dtype_text: if (!xdr_opaque(xdrs, reinterpret_cast<char*>(p), length)) { return FALSE; } break; case dtype_varying: { vary* pVary = reinterpret_cast<vary*>(p); if (!xdr_short(xdrs, reinterpret_cast<SSHORT*>(&pVary->vary_length))) { return FALSE; } if (!xdr_opaque(xdrs, reinterpret_cast<SCHAR*>(pVary->vary_string), MIN(pVary->vary_length, length))) { return FALSE; } } break; case dtype_cstring: if (xdrs->x_op == XDR_ENCODE) n = static_cast<SSHORT>(MIN(strlen(reinterpret_cast<const char*>(p)), length)); if (!xdr_short(xdrs, &n)) return FALSE; if (!xdr_opaque(xdrs, reinterpret_cast<SCHAR*>(p), n)) return FALSE; if (xdrs->x_op == XDR_DECODE) p[n] = 0; break; case dtype_short: if (!xdr_short(xdrs, (SSHORT *) p)) return FALSE; break; case dtype_long: case dtype_sql_time: case dtype_sql_date: if (!xdr_long(xdrs, (SLONG *) p)) return FALSE; break; case dtype_real: if (!xdr_float(xdrs, (float *) p)) return FALSE; break; case dtype_double: if (!xdr_double(xdrs, (double *) p)) return FALSE; break; case dtype_timestamp: if (!xdr_long(xdrs, &((SLONG*) p)[0])) return FALSE; if (!xdr_long(xdrs, &((SLONG*) p)[1])) return FALSE; break; case dtype_quad: case dtype_blob: if (!xdr_quad(xdrs, (SQUAD*) p)) return FALSE; break; case dtype_int64: if (!xdr_hyper(xdrs, (SINT64*) p)) return FALSE; break; case dtype_boolean: if (!xdr_opaque(xdrs, (SCHAR*) p, length)) return FALSE; break; default: fb_assert(FALSE); return FALSE; } } // Next, get null flags for (field = relation->rel_fields; field; field = field->fld_next) { if (field->fld_flags & FLD_computed) continue; offset = FB_ALIGN(offset, sizeof(SSHORT)); UCHAR* p = data + offset; if (!xdr_short(xdrs, (SSHORT*) p)) return FALSE; offset += sizeof(SSHORT); } return (xdrs->x_private - xdrs->x_base); }