home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.sbin / amd / rpcx / nfs_prot.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-12  |  8.0 KB  |  390 lines

  1. /*
  2.  * Copyright (c) 1990 Jan-Simon Pendry
  3.  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
  4.  * Copyright (c) 1990 The Regents of the University of California.
  5.  * All rights reserved.
  6.  *
  7.  * This code is derived from software contributed to Berkeley by
  8.  * Jan-Simon Pendry at Imperial College, London.
  9.  *
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *    This product includes software developed by the University of
  21.  *    California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  *
  38.  *    @(#)nfs_prot.h    5.3 (Berkeley) 5/12/91
  39.  *
  40.  * $Id: nfs_prot.h,v 5.2.1.2 91/05/07 22:18:56 jsp Alpha $
  41.  *
  42.  */
  43.  
  44. #define    xdr_nfsstat xdr_enum
  45. #define    xdr_ftype xdr_enum
  46.  
  47. #define NFS_PORT 2049
  48. #define NFS_MAXDATA 8192
  49. #define NFS_MAXPATHLEN 1024
  50. #define NFS_MAXNAMLEN 255
  51. #define NFS_FHSIZE 32
  52. #define NFS_COOKIESIZE 4
  53. #define NFS_FIFO_DEV -1
  54. #define NFSMODE_FMT 0170000
  55. #define NFSMODE_DIR 0040000
  56. #define NFSMODE_CHR 0020000
  57. #define NFSMODE_BLK 0060000
  58. #define NFSMODE_REG 0100000
  59. #define NFSMODE_LNK 0120000
  60. #define NFSMODE_SOCK 0140000
  61. #define NFSMODE_FIFO 0010000
  62.  
  63. enum nfsstat {
  64.     NFS_OK = 0,
  65.     NFSERR_PERM = 1,
  66.     NFSERR_NOENT = 2,
  67.     NFSERR_IO = 5,
  68.     NFSERR_NXIO = 6,
  69.     NFSERR_ACCES = 13,
  70.     NFSERR_EXIST = 17,
  71.     NFSERR_NODEV = 19,
  72.     NFSERR_NOTDIR = 20,
  73.     NFSERR_ISDIR = 21,
  74.     NFSERR_FBIG = 27,
  75.     NFSERR_NOSPC = 28,
  76.     NFSERR_ROFS = 30,
  77.     NFSERR_NAMETOOLONG = 63,
  78.     NFSERR_NOTEMPTY = 66,
  79.     NFSERR_DQUOT = 69,
  80.     NFSERR_STALE = 70,
  81.     NFSERR_WFLUSH = 99
  82. };
  83. typedef enum nfsstat nfsstat;
  84. bool_t xdr_nfsstat();
  85.  
  86.  
  87. enum ftype {
  88.     NFNON = 0,
  89.     NFREG = 1,
  90.     NFDIR = 2,
  91.     NFBLK = 3,
  92.     NFCHR = 4,
  93.     NFLNK = 5,
  94.     NFSOCK = 6,
  95.     NFBAD = 7,
  96.     NFFIFO = 8
  97. };
  98. typedef enum ftype ftype;
  99. /* static bool_t xdr_ftype(); */
  100.  
  101.  
  102. struct nfs_fh {
  103.     char data[NFS_FHSIZE];
  104. };
  105. typedef struct nfs_fh nfs_fh;
  106. bool_t xdr_nfs_fh();
  107.  
  108.  
  109. struct nfstime {
  110.     u_int seconds;
  111.     u_int useconds;
  112. };
  113. typedef struct nfstime nfstime;
  114. /* static bool_t xdr_nfstime(); */
  115.  
  116.  
  117. struct fattr {
  118.     ftype type;
  119.     u_int mode;
  120.     u_int nlink;
  121.     u_int uid;
  122.     u_int gid;
  123.     u_int size;
  124.     u_int blocksize;
  125.     u_int rdev;
  126.     u_int blocks;
  127.     u_int fsid;
  128.     u_int fileid;
  129.     nfstime atime;
  130.     nfstime mtime;
  131.     nfstime ctime;
  132. };
  133. typedef struct fattr fattr;
  134. /* static bool_t xdr_fattr(); */
  135.  
  136.  
  137. struct sattr {
  138.     u_int mode;
  139.     u_int uid;
  140.     u_int gid;
  141.     u_int size;
  142.     nfstime atime;
  143.     nfstime mtime;
  144. };
  145. typedef struct sattr sattr;
  146. /* static bool_t xdr_sattr(); */
  147.  
  148.  
  149. typedef char *filename;
  150. /* static bool_t xdr_filename(); */
  151.  
  152.  
  153. typedef char *nfspath;
  154. bool_t xdr_nfspath();
  155.  
  156.  
  157. struct attrstat {
  158.     nfsstat status;
  159.     union {
  160.         fattr attributes;
  161.     } attrstat_u;
  162. };
  163. typedef struct attrstat attrstat;
  164. bool_t xdr_attrstat();
  165.  
  166.  
  167. struct sattrargs {
  168.     nfs_fh file;
  169.     sattr attributes;
  170. };
  171. typedef struct sattrargs sattrargs;
  172. bool_t xdr_sattrargs();
  173.  
  174.  
  175. struct diropargs {
  176.     nfs_fh dir;
  177.     filename name;
  178. };
  179. typedef struct diropargs diropargs;
  180. bool_t xdr_diropargs();
  181.  
  182.  
  183. struct diropokres {
  184.     nfs_fh file;
  185.     fattr attributes;
  186. };
  187. typedef struct diropokres diropokres;
  188. bool_t xdr_diropokres();
  189.  
  190.  
  191. struct diropres {
  192.     nfsstat status;
  193.     union {
  194.         diropokres diropres;
  195.     } diropres_u;
  196. };
  197. typedef struct diropres diropres;
  198. bool_t xdr_diropres();
  199.  
  200.  
  201. struct readlinkres {
  202.     nfsstat status;
  203.     union {
  204.         nfspath data;
  205.     } readlinkres_u;
  206. };
  207. typedef struct readlinkres readlinkres;
  208. bool_t xdr_readlinkres();
  209.  
  210.  
  211. struct readargs {
  212.     nfs_fh file;
  213.     u_int offset;
  214.     u_int count;
  215.     u_int totalcount;
  216. };
  217. typedef struct readargs readargs;
  218. bool_t xdr_readargs();
  219.  
  220.  
  221. struct readokres {
  222.     fattr attributes;
  223.     struct {
  224.         u_int data_len;
  225.         char *data_val;
  226.     } data;
  227. };
  228. typedef struct readokres readokres;
  229. bool_t xdr_readokres();
  230.  
  231.  
  232. struct readres {
  233.     nfsstat status;
  234.     union {
  235.         readokres reply;
  236.     } readres_u;
  237. };
  238. typedef struct readres readres;
  239. bool_t xdr_readres();
  240.  
  241.  
  242. struct writeargs {
  243.     nfs_fh file;
  244.     u_int beginoffset;
  245.     u_int offset;
  246.     u_int totalcount;
  247.     struct {
  248.         u_int data_len;
  249.         char *data_val;
  250.     } data;
  251. };
  252. typedef struct writeargs writeargs;
  253. bool_t xdr_writeargs();
  254.  
  255.  
  256. struct createargs {
  257.     diropargs where;
  258.     sattr attributes;
  259. };
  260. typedef struct createargs createargs;
  261. bool_t xdr_createargs();
  262.  
  263.  
  264. struct renameargs {
  265.     diropargs from;
  266.     diropargs to;
  267. };
  268. typedef struct renameargs renameargs;
  269. bool_t xdr_renameargs();
  270.  
  271.  
  272. struct linkargs {
  273.     nfs_fh from;
  274.     diropargs to;
  275. };
  276. typedef struct linkargs linkargs;
  277. bool_t xdr_linkargs();
  278.  
  279.  
  280. struct symlinkargs {
  281.     diropargs from;
  282.     nfspath to;
  283.     sattr attributes;
  284. };
  285. typedef struct symlinkargs symlinkargs;
  286. bool_t xdr_symlinkargs();
  287.  
  288.  
  289. typedef char nfscookie[NFS_COOKIESIZE];
  290. /* static bool_t xdr_nfscookie(); */
  291.  
  292.  
  293. struct readdirargs {
  294.     nfs_fh dir;
  295.     nfscookie cookie;
  296.     u_int count;
  297. };
  298. typedef struct readdirargs readdirargs;
  299. bool_t xdr_readdirargs();
  300.  
  301.  
  302. struct entry {
  303.     u_int fileid;
  304.     filename name;
  305.     nfscookie cookie;
  306.     struct entry *nextentry;
  307. };
  308. typedef struct entry entry;
  309. /* static bool_t xdr_entry(); */
  310.  
  311.  
  312. struct dirlist {
  313.     entry *entries;
  314.     bool_t eof;
  315. };
  316. typedef struct dirlist dirlist;
  317. /* static bool_t xdr_dirlist(); */
  318.  
  319.  
  320. struct readdirres {
  321.     nfsstat status;
  322.     union {
  323.         dirlist reply;
  324.     } readdirres_u;
  325. };
  326. typedef struct readdirres readdirres;
  327. bool_t xdr_readdirres();
  328.  
  329.  
  330. struct statfsokres {
  331.     u_int tsize;
  332.     u_int bsize;
  333.     u_int blocks;
  334.     u_int bfree;
  335.     u_int bavail;
  336. };
  337. typedef struct statfsokres statfsokres;
  338. bool_t xdr_statfsokres();
  339.  
  340.  
  341. struct statfsres {
  342.     nfsstat status;
  343.     union {
  344.         statfsokres reply;
  345.     } statfsres_u;
  346. };
  347. typedef struct statfsres statfsres;
  348. bool_t xdr_statfsres();
  349.  
  350.  
  351. #define NFS_PROGRAM ((u_long)100003)
  352. #define NFS_VERSION ((u_long)2)
  353. #define NFSPROC_NULL ((u_long)0)
  354. extern voidp nfsproc_null_2();
  355. #define NFSPROC_GETATTR ((u_long)1)
  356. extern attrstat *nfsproc_getattr_2();
  357. #define NFSPROC_SETATTR ((u_long)2)
  358. extern attrstat *nfsproc_setattr_2();
  359. #define NFSPROC_ROOT ((u_long)3)
  360. extern voidp nfsproc_root_2();
  361. #define NFSPROC_LOOKUP ((u_long)4)
  362. extern diropres *nfsproc_lookup_2();
  363. #define NFSPROC_READLINK ((u_long)5)
  364. extern readlinkres *nfsproc_readlink_2();
  365. #define NFSPROC_READ ((u_long)6)
  366. extern readres *nfsproc_read_2();
  367. #define NFSPROC_WRITECACHE ((u_long)7)
  368. extern voidp nfsproc_writecache_2();
  369. #define NFSPROC_WRITE ((u_long)8)
  370. extern attrstat *nfsproc_write_2();
  371. #define NFSPROC_CREATE ((u_long)9)
  372. extern diropres *nfsproc_create_2();
  373. #define NFSPROC_REMOVE ((u_long)10)
  374. extern nfsstat *nfsproc_remove_2();
  375. #define NFSPROC_RENAME ((u_long)11)
  376. extern nfsstat *nfsproc_rename_2();
  377. #define NFSPROC_LINK ((u_long)12)
  378. extern nfsstat *nfsproc_link_2();
  379. #define NFSPROC_SYMLINK ((u_long)13)
  380. extern nfsstat *nfsproc_symlink_2();
  381. #define NFSPROC_MKDIR ((u_long)14)
  382. extern diropres *nfsproc_mkdir_2();
  383. #define NFSPROC_RMDIR ((u_long)15)
  384. extern nfsstat *nfsproc_rmdir_2();
  385. #define NFSPROC_READDIR ((u_long)16)
  386. extern readdirres *nfsproc_readdir_2();
  387. #define NFSPROC_STATFS ((u_long)17)
  388. extern statfsres *nfsproc_statfs_2();
  389.  
  390.