am_xdr_func.h revision 174294
138494Sobrien/* 2174294Sobrien * Copyright (c) 1997-2006 Erez Zadok 338494Sobrien * Copyright (c) 1990 Jan-Simon Pendry 438494Sobrien * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 538494Sobrien * Copyright (c) 1990 The Regents of the University of California. 638494Sobrien * All rights reserved. 738494Sobrien * 838494Sobrien * This code is derived from software contributed to Berkeley by 938494Sobrien * Jan-Simon Pendry at Imperial College, London. 1038494Sobrien * 1138494Sobrien * Redistribution and use in source and binary forms, with or without 1238494Sobrien * modification, are permitted provided that the following conditions 1338494Sobrien * are met: 1438494Sobrien * 1. Redistributions of source code must retain the above copyright 1538494Sobrien * notice, this list of conditions and the following disclaimer. 1638494Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1738494Sobrien * notice, this list of conditions and the following disclaimer in the 1838494Sobrien * documentation and/or other materials provided with the distribution. 1938494Sobrien * 3. All advertising materials mentioning features or use of this software 2042629Sobrien * must display the following acknowledgment: 2138494Sobrien * This product includes software developed by the University of 2238494Sobrien * California, Berkeley and its contributors. 2338494Sobrien * 4. Neither the name of the University nor the names of its contributors 2438494Sobrien * may be used to endorse or promote products derived from this software 2538494Sobrien * without specific prior written permission. 2638494Sobrien * 2738494Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2838494Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2938494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 3038494Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 3138494Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3238494Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3338494Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3438494Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3538494Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3638494Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3738494Sobrien * SUCH DAMAGE. 3838494Sobrien * 3938494Sobrien * 40174294Sobrien * File: am-utils/include/am_xdr_func.h 4138494Sobrien * 4238494Sobrien */ 4338494Sobrien 44174294Sobrien#ifdef HAVE_FS_NFS3 45174294Sobrien 46174294Sobrien#define AM_FHSIZE3 64 /* size in bytes of a file handle (v3) */ 47174294Sobrien#define AM_MOUNTVERS3 ((unsigned long)(3)) 48174294Sobrien 49174294Sobrien/* NFSv3 handle */ 50174294Sobrienstruct am_nfs_fh3 { 51174294Sobrien u_int am_fh3_length; 52174294Sobrien char am_fh3_data[AM_FHSIZE3]; 53174294Sobrien}; 54174294Sobrientypedef struct am_nfs_fh3 am_nfs_fh3; 55174294Sobrien 56174294Sobrien#define AM_NFSPROC3_LOOKUP ((u_long) 3) 57174294Sobrienenum am_nfsstat3 { 58174294Sobrien AM_NFS3_OK = 0, 59174294Sobrien AM_NFS3ERR_PERM = 1, 60174294Sobrien AM_NFS3ERR_NOENT = 2, 61174294Sobrien AM_NFS3ERR_IO = 5, 62174294Sobrien AM_NFS3ERR_NXIO = 6, 63174294Sobrien AM_NFS3ERR_ACCES = 13, 64174294Sobrien AM_NFS3ERR_EXIST = 17, 65174294Sobrien AM_NFS3ERR_XDEV = 18, 66174294Sobrien AM_NFS3ERR_NODEV = 19, 67174294Sobrien AM_NFS3ERR_NOTDIR = 20, 68174294Sobrien AM_NFS3ERR_ISDIR = 21, 69174294Sobrien AM_NFS3ERR_INVAL = 22, 70174294Sobrien AM_NFS3ERR_FBIG = 27, 71174294Sobrien AM_NFS3ERR_NOSPC = 28, 72174294Sobrien AM_NFS3ERR_ROFS = 30, 73174294Sobrien AM_NFS3ERR_MLINK = 31, 74174294Sobrien AM_NFS3ERR_NAMETOOLONG = 63, 75174294Sobrien AM_NFS3ERR_NOTEMPTY = 66, 76174294Sobrien AM_NFS3ERR_DQUOT = 69, 77174294Sobrien AM_NFS3ERR_STALE = 70, 78174294Sobrien AM_NFS3ERR_REMOTE = 71, 79174294Sobrien AM_NFS3ERR_BADHANDLE = 10001, 80174294Sobrien AM_NFS3ERR_NOT_SYNC = 10002, 81174294Sobrien AM_NFS3ERR_BAD_COOKIE = 10003, 82174294Sobrien AM_NFS3ERR_NOTSUPP = 10004, 83174294Sobrien AM_NFS3ERR_TOOSMALL = 10005, 84174294Sobrien AM_NFS3ERR_SERVERFAULT = 10006, 85174294Sobrien AM_NFS3ERR_BADTYPE = 10007, 86174294Sobrien AM_NFS3ERR_JUKEBOX = 10008 87174294Sobrien}; 88174294Sobrientypedef enum am_nfsstat3 am_nfsstat3; 89174294Sobrien 90174294Sobrientypedef struct { 91174294Sobrien u_int fhandle3_len; 92174294Sobrien char *fhandle3_val; 93174294Sobrien} am_fhandle3; 94174294Sobrien 95174294Sobrienenum am_mountstat3 { 96174294Sobrien AM_MNT3_OK = 0, 97174294Sobrien AM_MNT3ERR_PERM = 1, 98174294Sobrien AM_MNT3ERR_NOENT = 2, 99174294Sobrien AM_MNT3ERR_IO = 5, 100174294Sobrien AM_MNT3ERR_ACCES = 13, 101174294Sobrien AM_MNT3ERR_NOTDIR = 20, 102174294Sobrien AM_MNT3ERR_INVAL = 22, 103174294Sobrien AM_MNT3ERR_NAMETOOLONG = 63, 104174294Sobrien AM_MNT3ERR_NOTSUPP = 10004, 105174294Sobrien AM_MNT3ERR_SERVERFAULT = 10006 106174294Sobrien}; 107174294Sobrientypedef enum am_mountstat3 am_mountstat3; 108174294Sobrien 109174294Sobrienstruct am_mountres3_ok { 110174294Sobrien am_fhandle3 fhandle; 111174294Sobrien struct { 112174294Sobrien u_int auth_flavors_len; 113174294Sobrien int *auth_flavors_val; 114174294Sobrien } auth_flavors; 115174294Sobrien}; 116174294Sobrientypedef struct am_mountres3_ok am_mountres3_ok; 117174294Sobrien 118174294Sobrienstruct am_mountres3 { 119174294Sobrien am_mountstat3 fhs_status; 120174294Sobrien union { 121174294Sobrien am_mountres3_ok mountinfo; 122174294Sobrien } mountres3_u; 123174294Sobrien}; 124174294Sobrientypedef struct am_mountres3 am_mountres3; 125174294Sobrien 126174294Sobrientypedef char *am_filename3; 127174294Sobrien 128174294Sobrienstruct am_diropargs3 { 129174294Sobrien am_nfs_fh3 dir; 130174294Sobrien am_filename3 name; 131174294Sobrien}; 132174294Sobrientypedef struct am_diropargs3 am_diropargs3; 133174294Sobrien 134174294Sobrienstruct am_LOOKUP3args { 135174294Sobrien am_diropargs3 what; 136174294Sobrien}; 137174294Sobrientypedef struct am_LOOKUP3args am_LOOKUP3args; 138174294Sobrien 139174294Sobrienstruct am_LOOKUP3resok { 140174294Sobrien am_nfs_fh3 object; 141174294Sobrien#if 0 142174294Sobrien post_op_attr obj_attributes; 143174294Sobrien post_op_attr dir_attributes; 144174294Sobrien#endif 145174294Sobrien}; 146174294Sobrientypedef struct am_LOOKUP3resok am_LOOKUP3resok; 147174294Sobrien 148174294Sobrienstruct am_LOOKUP3resfail { 149174294Sobrien#if 0 150174294Sobrien post_op_attr dir_attributes; 151174294Sobrien#else 152174294Sobrien char dummy; /* cannot have an empty declaration */ 153174294Sobrien#endif 154174294Sobrien}; 155174294Sobrientypedef struct am_LOOKUP3resfail am_LOOKUP3resfail; 156174294Sobrien 157174294Sobrienstruct am_LOOKUP3res { 158174294Sobrien am_nfsstat3 status; 159174294Sobrien union { 160174294Sobrien am_LOOKUP3resok ok; 161174294Sobrien am_LOOKUP3resfail fail; 162174294Sobrien } res_u; 163174294Sobrien}; 164174294Sobrientypedef struct am_LOOKUP3res am_LOOKUP3res; 165174294Sobrien#endif /* HAVE_FS_NFS3 */ 166174294Sobrien 16738494Sobrien/* 168174294Sobrien * Multi-protocol NFS file handle 169174294Sobrien */ 170174294Sobrienunion am_nfs_handle { 171174294Sobrien /* placeholder for V4 file handle */ 172174294Sobrien#ifdef HAVE_FS_NFS3 173174294Sobrien am_nfs_fh3 v3; /* NFS version 3 handle */ 174174294Sobrien#endif /* HAVE_FS_NFS3 */ 175174294Sobrien am_nfs_fh v2; /* NFS version 2 handle */ 176174294Sobrien}; 177174294Sobrientypedef union am_nfs_handle am_nfs_handle_t; 178174294Sobrien 179174294Sobrien 180174294Sobrien/* 18138494Sobrien * Definitions of all possible xdr functions that are otherwise 18238494Sobrien * not defined elsewhere. 18338494Sobrien */ 18438494Sobrien 18538494Sobrien#ifndef _AM_XDR_FUNC_H 18638494Sobrien#define _AM_XDR_FUNC_H 18738494Sobrien 18838494Sobrien#ifndef HAVE_XDR_ATTRSTAT 18938494Sobrienbool_t xdr_attrstat(XDR *xdrs, nfsattrstat *objp); 19038494Sobrien#endif /* not HAVE_XDR_ATTRSTAT */ 19138494Sobrien#ifndef HAVE_XDR_CREATEARGS 19238494Sobrienbool_t xdr_createargs(XDR *xdrs, nfscreateargs *objp); 19338494Sobrien#endif /* not HAVE_XDR_CREATEARGS */ 19438494Sobrien#ifndef HAVE_XDR_DIRLIST 19538494Sobrienbool_t xdr_dirlist(XDR *xdrs, nfsdirlist *objp); 19638494Sobrien#endif /* not HAVE_XDR_DIRLIST */ 19738494Sobrien#ifndef HAVE_XDR_DIROPARGS 19838494Sobrienbool_t xdr_diropargs(XDR *xdrs, nfsdiropargs *objp); 19938494Sobrien#endif /* not HAVE_XDR_DIROPARGS */ 20038494Sobrien#ifndef HAVE_XDR_DIROPOKRES 20138494Sobrienbool_t xdr_diropokres(XDR *xdrs, nfsdiropokres *objp); 20238494Sobrien#endif /* not HAVE_XDR_DIROPOKRES */ 20338494Sobrien#ifndef HAVE_XDR_DIROPRES 20438494Sobrienbool_t xdr_diropres(XDR *xdrs, nfsdiropres *objp); 20538494Sobrien#endif /* not HAVE_XDR_DIROPRES */ 20638494Sobrien#ifndef HAVE_XDR_DIRPATH 20738494Sobrienbool_t xdr_dirpath(XDR *xdrs, dirpath *objp); 20838494Sobrien#endif /* not HAVE_XDR_DIRPATH */ 20938494Sobrien#ifndef HAVE_XDR_ENTRY 21038494Sobrienbool_t xdr_entry(XDR *xdrs, nfsentry *objp); 21138494Sobrien#endif /* not HAVE_XDR_ENTRY */ 21238494Sobrien#ifndef HAVE_XDR_EXPORTNODE 21338494Sobrienbool_t xdr_exportnode(XDR *xdrs, exportnode *objp); 21438494Sobrien#endif /* not HAVE_XDR_EXPORTNODE */ 21538494Sobrien#ifndef HAVE_XDR_EXPORTS 21638494Sobrienbool_t xdr_exports(XDR *xdrs, exports *objp); 21738494Sobrien#endif /* not HAVE_XDR_EXPORTS */ 21838494Sobrien#ifndef HAVE_XDR_FATTR 21938494Sobrienbool_t xdr_fattr(XDR *xdrs, nfsfattr *objp); 22038494Sobrien#endif /* not HAVE_XDR_FATTR */ 22138494Sobrien#ifndef HAVE_XDR_FHANDLE 22238494Sobrienbool_t xdr_fhandle(XDR *xdrs, fhandle objp); 22338494Sobrien#endif /* not HAVE_XDR_FHANDLE */ 22438494Sobrien#ifndef HAVE_XDR_FHSTATUS 22538494Sobrienbool_t xdr_fhstatus(XDR *xdrs, fhstatus *objp); 22638494Sobrien#endif /* not HAVE_XDR_FHSTATUS */ 22738494Sobrien#ifndef HAVE_XDR_FILENAME 22838494Sobrienbool_t xdr_filename(XDR *xdrs, filename *objp); 22938494Sobrien#endif /* not HAVE_XDR_FILENAME */ 23038494Sobrien#ifndef HAVE_XDR_FTYPE 23138494Sobrienbool_t xdr_ftype(XDR *xdrs, nfsftype *objp); 23238494Sobrien#endif /* not HAVE_XDR_FTYPE */ 23338494Sobrien#ifndef HAVE_XDR_GROUPNODE 23438494Sobrienbool_t xdr_groupnode(XDR *xdrs, groupnode *objp); 23538494Sobrien#endif /* not HAVE_XDR_GROUPNODE */ 23638494Sobrien#ifndef HAVE_XDR_GROUPS 23782794Sobrienbool_t xdr_groups(XDR *xdrs, groups *objp); 23838494Sobrien#endif /* not HAVE_XDR_GROUPS */ 23938494Sobrien#ifndef HAVE_XDR_LINKARGS 24038494Sobrienbool_t xdr_linkargs(XDR *xdrs, nfslinkargs *objp); 24138494Sobrien#endif /* not HAVE_XDR_LINKARGS */ 24238494Sobrien#ifndef HAVE_XDR_MOUNTBODY 24338494Sobrienbool_t xdr_mountbody(XDR *xdrs, mountbody *objp); 24438494Sobrien#endif /* not HAVE_XDR_MOUNTBODY */ 24538494Sobrien#ifndef HAVE_XDR_MOUNTLIST 24638494Sobrienbool_t xdr_mountlist(XDR *xdrs, mountlist *objp); 24738494Sobrien#endif /* not HAVE_XDR_MOUNTLIST */ 24838494Sobrien#ifndef HAVE_XDR_NAME 24938494Sobrienbool_t xdr_name(XDR *xdrs, name *objp); 25038494Sobrien#endif /* not HAVE_XDR_NAME */ 25138494Sobrien#ifndef HAVE_XDR_NFS_FH 25238494Sobrienbool_t xdr_nfs_fh(XDR *xdrs, am_nfs_fh *objp); 25338494Sobrien#endif /* not HAVE_XDR_NFS_FH */ 25438494Sobrien#ifndef HAVE_XDR_NFSCOOKIE 25538494Sobrienbool_t xdr_nfscookie(XDR *xdrs, nfscookie objp); 25638494Sobrien#endif /* not HAVE_XDR_NFSCOOKIE */ 25738494Sobrien#ifndef HAVE_XDR_NFSPATH 25838494Sobrienbool_t xdr_nfspath(XDR *xdrs, nfspath *objp); 25938494Sobrien#endif /* not HAVE_XDR_NFSPATH */ 26038494Sobrien#ifndef HAVE_XDR_NFSSTAT 26138494Sobrienbool_t xdr_nfsstat(XDR *xdrs, nfsstat *objp); 26238494Sobrien#endif /* not HAVE_XDR_NFSSTAT */ 26338494Sobrien#ifndef HAVE_XDR_NFSTIME 26438494Sobrienbool_t xdr_nfstime(XDR *xdrs, nfstime *objp); 26538494Sobrien#endif /* not HAVE_XDR_NFSTIME */ 26638494Sobrien#ifndef HAVE_XDR_POINTER 26738494Sobrienbool_t xdr_pointer(register XDR *xdrs, char **objpp, u_int obj_size, XDRPROC_T_TYPE xdr_obj); 26838494Sobrien#endif /* not HAVE_XDR_POINTER */ 26938494Sobrien#ifndef HAVE_XDR_READARGS 27038494Sobrienbool_t xdr_readargs(XDR *xdrs, nfsreadargs *objp); 27138494Sobrien#endif /* not HAVE_XDR_READARGS */ 27238494Sobrien#ifndef HAVE_XDR_READDIRARGS 27338494Sobrienbool_t xdr_readdirargs(XDR *xdrs, nfsreaddirargs *objp); 27438494Sobrien#endif /* not HAVE_XDR_READDIRARGS */ 27538494Sobrien#ifndef HAVE_XDR_READDIRRES 27638494Sobrienbool_t xdr_readdirres(XDR *xdrs, nfsreaddirres *objp); 27738494Sobrien#endif /* not HAVE_XDR_READDIRRES */ 27838494Sobrien#ifndef HAVE_XDR_READLINKRES 27938494Sobrienbool_t xdr_readlinkres(XDR *xdrs, nfsreadlinkres *objp); 28038494Sobrien#endif /* not HAVE_XDR_READLINKRES */ 28138494Sobrien#ifndef HAVE_XDR_READOKRES 28238494Sobrienbool_t xdr_readokres(XDR *xdrs, nfsreadokres *objp); 28338494Sobrien#endif /* not HAVE_XDR_READOKRES */ 28438494Sobrien#ifndef HAVE_XDR_READRES 28538494Sobrienbool_t xdr_readres(XDR *xdrs, nfsreadres *objp); 28638494Sobrien#endif /* not HAVE_XDR_READRES */ 28738494Sobrien#ifndef HAVE_XDR_RENAMEARGS 28838494Sobrienbool_t xdr_renameargs(XDR *xdrs, nfsrenameargs *objp); 28938494Sobrien#endif /* not HAVE_XDR_RENAMEARGS */ 29038494Sobrien#ifndef HAVE_XDR_SATTR 29138494Sobrienbool_t xdr_sattr(XDR *xdrs, nfssattr *objp); 29238494Sobrien#endif /* not HAVE_XDR_SATTR */ 29338494Sobrien#ifndef HAVE_XDR_SATTRARGS 29438494Sobrienbool_t xdr_sattrargs(XDR *xdrs, nfssattrargs *objp); 29538494Sobrien#endif /* not HAVE_XDR_SATTRARGS */ 29638494Sobrien#ifndef HAVE_XDR_STATFSOKRES 29738494Sobrienbool_t xdr_statfsokres(XDR *xdrs, nfsstatfsokres *objp); 29838494Sobrien#endif /* not HAVE_XDR_STATFSOKRES */ 29938494Sobrien#ifndef HAVE_XDR_STATFSRES 30038494Sobrienbool_t xdr_statfsres(XDR *xdrs, nfsstatfsres *objp); 30138494Sobrien#endif /* not HAVE_XDR_STATFSRES */ 30238494Sobrien#ifndef HAVE_XDR_SYMLINKARGS 30338494Sobrienbool_t xdr_symlinkargs(XDR *xdrs, nfssymlinkargs *objp); 30438494Sobrien#endif /* not HAVE_XDR_SYMLINKARGS */ 30538494Sobrien#ifndef HAVE_XDR_WRITEARGS 30638494Sobrienbool_t xdr_writeargs(XDR *xdrs, nfswriteargs *objp); 30738494Sobrien#endif /* not HAVE_XDR_WRITEARGS */ 30838494Sobrien 309174294Sobrien/* 310174294Sobrien * NFS3 XDR FUNCTIONS: 311174294Sobrien */ 312174294Sobrien#ifdef HAVE_FS_NFS3 313174294Sobrienbool_t xdr_am_fhandle3(XDR *xdrs, am_fhandle3 *objp); 314174294Sobrienbool_t xdr_am_mountstat3(XDR *xdrs, am_mountstat3 *objp); 315174294Sobrienbool_t xdr_am_mountres3_ok(XDR *xdrs, am_mountres3_ok *objp); 316174294Sobrienbool_t xdr_am_mountres3(XDR *xdrs, am_mountres3 *objp); 317174294Sobrienbool_t xdr_am_diropargs3(XDR *xdrs, am_diropargs3 *objp); 318174294Sobrienbool_t xdr_am_filename3(XDR *xdrs, am_filename3 *objp); 319174294Sobrienbool_t xdr_am_LOOKUP3args(XDR *xdrs, am_LOOKUP3args *objp); 320174294Sobrienbool_t xdr_am_LOOKUP3res(XDR *xdrs, am_LOOKUP3res *objp); 321174294Sobrienbool_t xdr_am_LOOKUP3resfail(XDR *xdrs, am_LOOKUP3resfail *objp); 322174294Sobrienbool_t xdr_am_LOOKUP3resok(XDR *xdrs, am_LOOKUP3resok *objp); 323174294Sobrienbool_t xdr_am_nfsstat3(XDR *xdrs, am_nfsstat3 *objp); 324174294Sobrienbool_t xdr_am_nfs_fh3(XDR *xdrs, am_nfs_fh3 *objp); 325174294Sobrien#endif /* HAVE_FS_NFS3 */ 326174294Sobrien 32738494Sobrien#endif /* not _AM_XDR_FUNC_H */ 328