ReactOS  0.4.11-dev-946-g431643b
nfs41_xdr.h File Reference
#include "nfs41_types.h"
Include dependency graph for nfs41_xdr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool_t nfs_encode_compound (XDR *xdr, caddr_t *args)
 
bool_t nfs_decode_compound (XDR *xdr, caddr_t *res)
 
void nfsacl41_free (nfsacl41 *acl)
 

Function Documentation

◆ nfs_decode_compound()

bool_t nfs_decode_compound ( XDR xdr,
caddr_t res 
)

Definition at line 3625 of file nfs41_xdr.c.

Referenced by nfs41_send_compound().

3628 {
3630  uint32_t i, expected_count, expected_op;
3631  const op_table_entry *entry;
3632  unsigned char *tag = res->tag;
3633 
3634  if (!xdr_u_int32_t(xdr, &res->status))
3635  return FALSE;
3636 
3637  if (!xdr_bytes(xdr, (char **)&tag, &res->tag_len, NFS4_OPAQUE_LIMIT))
3638  return FALSE;
3639 
3640  expected_count = res->resarray_count;
3641  if (!xdr_u_int32_t(xdr, &res->resarray_count))
3642  return FALSE;
3643 
3644  /* validate the number of operations against what we sent */
3645  if (res->resarray_count > expected_count) {
3646  eprintf("reply with %u operations, only sent %u!\n",
3647  res->resarray_count, expected_count);
3648  return FALSE;
3649  } else if (res->resarray_count < expected_count &&
3650  res->status == NFS4_OK) {
3651  /* illegal for a server to reply with less operations,
3652  * unless one of them fails */
3653  eprintf("successful reply with only %u operations, sent %u!\n",
3654  res->resarray_count, expected_count);
3655  return FALSE;
3656  }
3657 
3658  for (i = 0; i < res->resarray_count; i++)
3659  {
3660  expected_op = res->resarray[i].op;
3661  if (!xdr_u_int32_t(xdr, &res->resarray[i].op))
3662  return FALSE;
3663 
3664  /* validate each operation number against what we sent */
3665  if (res->resarray[i].op != expected_op) {
3666  eprintf("reply with %s in operation %u, expected %s!\n",
3667  nfs_opnum_to_string(res->resarray[i].op), i+1,
3668  nfs_opnum_to_string(expected_op));
3669  return FALSE;
3670  }
3671 
3672  entry = op_table_find(res->resarray[i].op);
3673  if (entry == NULL || entry->decode == NULL)
3674  return FALSE;
3675  if (!entry->decode(xdr, &res->resarray[i]))
3676  return FALSE;
3677  }
3678  return TRUE;
3679 }
unsigned char tag[NFS4_OPAQUE_LIMIT]
#define TRUE
Definition: types.h:120
nfs_op_decode_proc decode
Definition: nfs41_xdr.c:3511
uint8_t entry
Definition: isohybrid.c:63
Definition: ecma_167.h:138
void eprintf(LPCSTR format,...)
Definition: daemon_debug.c:86
static const op_table_entry * op_table_find(uint32_t op)
Definition: nfs41_xdr.c:3582
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define NFS4_OPAQUE_LIMIT
Definition: nfs41_const.h:31
smooth NULL
Definition: ftsmooth.c:416
nfs_resop4 * resarray
bool_t xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p)
Definition: xdr.c:239
const char * nfs_opnum_to_string(int opnum)
Definition: daemon_debug.c:305
static int expected_count(int *sink)
UINT32 uint32_t
Definition: types.h:75
GLuint res
Definition: glext.h:9613
Definition: nfs41_xdr.c:3509
bool_t xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
Definition: xdr.c:536

◆ nfs_encode_compound()

bool_t nfs_encode_compound ( XDR xdr,
caddr_t args 
)

Definition at line 3591 of file nfs41_xdr.c.

Referenced by nfs41_send_compound().

3594 {
3595  unsigned char *tag;
3596 
3598  uint32_t i;
3599  const op_table_entry *entry;
3600 
3601  tag = args->tag;
3602  if (!xdr_bytes(xdr, (char **)&tag, &args->tag_len, NFS4_OPAQUE_LIMIT))
3603  return FALSE;
3604 
3605  if (!xdr_u_int32_t(xdr, &args->minorversion))
3606  return FALSE;
3607 
3608  if (!xdr_u_int32_t(xdr, &args->argarray_count))
3609  return FALSE;
3610 
3611  for (i = 0; i < args->argarray_count; i++)
3612  {
3613  entry = op_table_find(args->argarray[i].op);
3614  if (entry == NULL || entry->encode == NULL)
3615  return FALSE;
3616 
3617  if (!xdr_u_int32_t(xdr, &args->argarray[i].op))
3618  return FALSE;
3619  if (!entry->encode(xdr, &args->argarray[i]))
3620  return FALSE;
3621  }
3622  return TRUE;
3623 }
#define TRUE
Definition: types.h:120
uint8_t entry
Definition: isohybrid.c:63
unsigned char tag[NFS4_OPAQUE_LIMIT]
static const op_table_entry * op_table_find(uint32_t op)
Definition: nfs41_xdr.c:3582
Definition: match.c:390
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define NFS4_OPAQUE_LIMIT
Definition: nfs41_const.h:31
smooth NULL
Definition: ftsmooth.c:416
bool_t xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p)
Definition: xdr.c:239
UINT32 uint32_t
Definition: types.h:75
Definition: nfs41_xdr.c:3509
bool_t xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
Definition: xdr.c:536
nfs_op_encode_proc encode
Definition: nfs41_xdr.c:3510
char * tag
Definition: main.c:59

◆ nfsacl41_free()

void nfsacl41_free ( nfsacl41 acl)

Definition at line 335 of file nfs41_xdr.c.

Referenced by handle_getacl().

336 {
337  XDR xdr = { XDR_FREE };
338  xdr_nfsacl41(&xdr, acl);
339 }
Definition: xdr.h:103
static bool_t xdr_nfsacl41(XDR *xdr, nfsacl41 *acl)
Definition: nfs41_xdr.c:327
Definition: xdr.h:87