ReactOS 0.4.15-dev-8145-ga541a46
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.

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}
bool_t xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p)
Definition: xdr.c:239
bool_t xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
Definition: xdr.c:536
void eprintf(LPCSTR format,...)
Definition: daemon_debug.c:86
const char * nfs_opnum_to_string(int opnum)
Definition: daemon_debug.c:305
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT32 uint32_t
Definition: types.h:75
GLuint res
Definition: glext.h:9613
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint32_t entry
Definition: isohybrid.c:63
static int expected_count(int *sink)
@ NFS4_OK
Definition: nfs41_const.h:87
#define NFS4_OPAQUE_LIMIT
Definition: nfs41_const.h:31
static const op_table_entry * op_table_find(uint32_t op)
Definition: nfs41_xdr.c:3582
Definition: nfs41_xdr.c:3509
Definition: ecma_167.h:138

Referenced by nfs41_send_compound().

◆ nfs_encode_compound()

bool_t nfs_encode_compound ( XDR xdr,
caddr_t args 
)

Definition at line 3591 of file nfs41_xdr.c.

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}
Definition: match.c:390

Referenced by nfs41_send_compound().

◆ nfsacl41_free()

void nfsacl41_free ( nfsacl41 acl)

Definition at line 335 of file nfs41_xdr.c.

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

Referenced by handle_getacl().