当前位置: 首页>>代码示例>>C++>>正文


C++ xdr_long函数代码示例

本文整理汇总了C++中xdr_long函数的典型用法代码示例。如果您正苦于以下问题:C++ xdr_long函数的具体用法?C++ xdr_long怎么用?C++ xdr_long使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xdr_long函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: xdr_enum

/*
 * 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
}
开发者ID:PADL,项目名称:krb5,代码行数:33,代码来源:xdr.c

示例2: xdr_fhs

/*
 * Xdr routine to generate file handle reply
 */
int
xdr_fhs(XDR *xdrsp, caddr_t cp)
{
	struct fhreturn *fhrp = (struct fhreturn *)cp;
	long ok = 0, len, auth;

	if (!xdr_long(xdrsp, &ok))
		return (0);
	switch (fhrp->fhr_vers) {
	case 1:
		return (xdr_opaque(xdrsp, (caddr_t)&fhrp->fhr_fh, NFSX_V2FH));
	case 3:
		len = NFSX_V3FH;
		if (!xdr_long(xdrsp, &len))
			return (0);
		if (!xdr_opaque(xdrsp, (caddr_t)&fhrp->fhr_fh, len))
			return (0);
		auth = RPCAUTH_UNIX;
		len = 1;
		if (!xdr_long(xdrsp, &len))
			return (0);
		return (xdr_long(xdrsp, &auth));
	}
	return (0);
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:28,代码来源:mountd.c

示例3: strcpy

long *kdReadLongArray(char *filename, int bAscii, char *arrayName)
// Reads a tipsy array file
{
  XDR xdrs;
  FILE *fp;
  long np;
  long *arr, temp;
  int i;
  char arrFile[256];

  strcpy(arrFile, filename);
  strcat(arrFile, ".");
  strcat(arrFile, arrayName);

  fprintf(stderr, "array = %s\n", arrFile);

  if (!bAscii) {
    assert(sizeof(Real)==sizeof(float)); /* Otherwise, this XDR stuff
					    ain't gonna work */
    
    fp = fopen(arrFile, "r");
    xdrstdio_create(&xdrs, fp, XDR_DECODE);
    xdr_long(&xdrs, &np);
    arr = malloc(sizeof(float)*np);
    for(i=0;i<np;i++) xdr_long(&xdrs,&temp);
  }
  fclose(fp);
  
  return arr; 
}
开发者ID:rokroskar,项目名称:sph_resample,代码行数:30,代码来源:kd.c

示例4: xdr_enum

/*
 * 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
}
开发者ID:FullMentalPanic,项目名称:RTEMS_NEW_TOOL_CHAIN,代码行数:29,代码来源:xdr.c

示例5: xdr_Create_LinkParms

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;
}
开发者ID:epicsdeb,项目名称:sdds,代码行数:56,代码来源:agilentcomm.cpp

示例6: xdr_longint

bool_t
xdr_longint (XDR *xdrs, longint *objp)
{
	register int32_t *buf;

	 if (!xdr_long (xdrs, &objp->a))
		 return FALSE;
	 if (!xdr_long (xdrs, &objp->b))
		 return FALSE;
	return TRUE;
}
开发者ID:laxmidevi,项目名称:networks-assignmnt,代码行数:11,代码来源:add_xdr.c

示例7: xdr_send_data

int xdr_send_data(XDR * xdrs, struct data *buffer)
{
	int i, rc;
	char *p;

	rc = xdr_long(xdrs, &buffer->address);
	rc = rc && xdr_long(xdrs, &buffer->request_id);
	rc = rc && xdr_long(xdrs, &buffer->data_length);
	for (i = 0, p = buffer->data; rc && i < buffer->data_length; i++, p++)
		rc = xdr_char(xdrs, p);
	return (rc);
}
开发者ID:Altiscale,项目名称:sig-core-t_ltp,代码行数:12,代码来源:rpc_server.c

示例8: xdr_receive_data

int xdr_receive_data(XDR * xdrs, struct data **buffer)
{
	struct data *bp;
	int i, rc;
	char *p;

	bp = *buffer = (struct data *)malloc(sizeof(struct data));
	rc = xdr_long(xdrs, &(bp->address));
	rc = rc && xdr_long(xdrs, &bp->request_id);
	rc = rc && xdr_long(xdrs, &bp->data_length);
	p = (*buffer)->data = (char *)malloc(bp->data_length);
	for (i = 0; rc && i < bp->data_length; p++, i++)
		rc = xdr_char(xdrs, p);
	return (rc);
}
开发者ID:Altiscale,项目名称:sig-core-t_ltp,代码行数:15,代码来源:rpc_server.c

示例9: xdr_int

/*
 * 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
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:18,代码来源:spans_kxdr.c

示例10: ltspfs_getattr

void
ltspfs_getattr (int sockfd, XDR *in)
{
  XDR         out;
  char        path[PATH_MAX];
  char 	      output[LTSP_MAXBUF];
  int         i;
  struct stat stbuf;

  if (get_fn(sockfd, in, path)) {
    if (debug)
      info ("get_fn failed\n");
    eacces(sockfd);
    return;
  }

  if (lstat (path, &stbuf) == -1) {
    status_return(sockfd, FAIL);
    return;
  }

  xdrmem_create(&out, output, LTSP_MAXBUF, XDR_ENCODE);
  i = 0;
  xdr_int(&out, &i);	 			/* First, the dummy length */
  xdr_int(&out, &i);				/* Then the 0 status return */
  xdr_u_longlong_t(&out, &(stbuf.st_dev));	/* device */
  xdr_u_longlong_t(&out, &(stbuf.st_ino));	/* inode */
  xdr_u_int(&out, &(stbuf.st_mode));		/* protection */
  xdr_u_int(&out, &(stbuf.st_nlink));		/* number of hard links */
  xdr_u_int(&out, &(stbuf.st_uid));		/* user ID of owner */
  xdr_u_int(&out, &(stbuf.st_gid));		/* group ID of owner */
  xdr_u_longlong_t(&out, &(stbuf.st_rdev));	/* device type */
  xdr_longlong_t(&out, &(stbuf.st_size));	/* total size, in bytes */
  xdr_long(&out, &(stbuf.st_blksize));		/* blocksize for fs I/O */
  xdr_longlong_t(&out, &(stbuf.st_blocks));	/* number of blocks allocated */
  xdr_long(&out, &(stbuf.st_atime));		/* time of last access */
  xdr_long(&out, &(stbuf.st_mtime));		/* time of last modification */
  xdr_long(&out, &(stbuf.st_ctime));		/* time of last status change */
  i = xdr_getpos(&out);				/* Get our position */
  xdr_setpos(&out, 0);				/* Rewind to the beginning */
  xdr_int(&out, &i);				/* Rewrite with proper length */
  xdr_destroy(&out);

  if (debug)
    info("returning OK");

  writen(sockfd, output, i);
}
开发者ID:Pardus-Linux,项目名称:ptsp,代码行数:48,代码来源:ltspfsd_functions.c

示例11: xdr_cprinc3_arg

bool_t
xdr_cprinc3_arg(XDR *xdrs, cprinc3_arg *objp)
{
	if (!xdr_ui_4(xdrs, &objp->api_version)) {
		return (FALSE);
	}
	if (objp->api_version == KADM5_API_VERSION_1) {
		if (!xdr_kadm5_principal_ent_rec_v1(xdrs, &objp->rec)) {
			return (FALSE);
		}
	} else {
		if (!xdr_kadm5_principal_ent_rec(xdrs, &objp->rec)) {
			return (FALSE);
		}
	}
	if (!xdr_long(xdrs, &objp->mask)) {
		return (FALSE);
	}
	if (!xdr_array(xdrs, (caddr_t *)&objp->ks_tuple,
		       (unsigned int *)&objp->n_ks_tuple, ~0,
		       sizeof(krb5_key_salt_tuple),
		       xdr_krb5_key_salt_tuple)) {
		return (FALSE);
	}
	if (!xdr_nullstring(xdrs, &objp->passwd)) {
		return (FALSE);
	}
	return (TRUE);
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:29,代码来源:kadm_rpc_xdr.c

示例12: xdr_counted_string

static bool_t xdr_counted_string( XDR *xdrs, char **p)
{
  int mode;
  long int length;

  mode = (xdrs->x_op == XDR_DECODE);

  /* If writing, obtain the length */
  if( !mode)
    length = strlen(*p);

  /* Transfer the string length */
  if( !xdr_long(xdrs, &length))
    return 0;

  //  printf("length = %ld\n", length);

  /* If reading, obtain room for the string */
  if (mode)
    {
      *p = (char *) malloc( (length + 1) * sizeof(char) );
      (*p)[length] = '\0'; /* Null termination */
    }

  /* If the string length is nonzero, transfer it */
  return(length ? xdr_string(xdrs, p, length) : 1);
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:27,代码来源:mda_dump.c

示例13: main

main ()
{
        FILE *fp;                  /*указатель файла */
        XDR xdrs;                  /*дескpиптоp XDR */
        long val1=10;              /*целое */
        float val2=4.456789;       /*с плавающей точкой */
        char val3s[] = "qwerty123456uvwxyz"; /* 18+1 bytes null terminated string */
        char *val3;
        int r;
        val3 = malloc(20);
        strcpy(val3,val3s);
/*откpытие файла на запись */
        fp = fopen(FIC, "w");
/*      создание потока XDR для кодиpования */
        xdrstdio_create(&xdrs, fp, XDR_ENCODE);
/*запись целого */
        xdr_long(&xdrs, &val1);
/*запись числа с плавающей точкой */
        xdr_float(&xdrs, &val2);
/* write string */
        r = xdr_string(&xdrs, &val3, strlen(val3));
        printf("r=%d\n",r);
        free(val3);
        fclose(fp);
        exit(0);
}
开发者ID:vleo,项目名称:vleo-notebook,代码行数:26,代码来源:write_xdr_to_file.c

示例14: xdr_int32

bool_t
xdr_int32(XDR *xdrs, int32 *objp)
{
	if (!xdr_long(xdrs, objp))
		return FALSE;
	return TRUE;
}
开发者ID:Abioy,项目名称:sheepdog,代码行数:7,代码来源:xdr.c

示例15: xdr_osa_princ_ent_rec

bool_t
xdr_osa_princ_ent_rec(XDR *xdrs, osa_princ_ent_t objp)
{
    switch (xdrs->x_op) {
    case XDR_ENCODE:
	 objp->version = OSA_ADB_PRINC_VERSION_1;
	 /* fall through */
    case XDR_FREE:
	 if (!xdr_int(xdrs, &objp->version))
	      return FALSE;
	 break;
    case XDR_DECODE:
	 if (!xdr_int(xdrs, &objp->version))
	      return FALSE;
	 if (objp->version != OSA_ADB_PRINC_VERSION_1)
	      return FALSE;
	 break;
    }

    if (!xdr_nullstring(xdrs, &objp->policy))
	return (FALSE);
    if (!xdr_long(xdrs, &objp->aux_attributes))
	return (FALSE);
    if (!xdr_u_int(xdrs, &objp->old_key_next))
	return (FALSE);
    if (!xdr_krb5_kvno(xdrs, &objp->admin_history_kvno))
	return (FALSE);
    if (!xdr_array(xdrs, (caddr_t *) &objp->old_keys,
		   (unsigned int *) &objp->old_key_len, ~0,
		   sizeof(osa_pw_hist_ent),
		   xdr_osa_pw_hist_ent))
	return (FALSE);
    return (TRUE);
}
开发者ID:Baalmart,项目名称:krb5,代码行数:34,代码来源:adb_xdr.c


注:本文中的xdr_long函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。