home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Utilities / vmount-0.6a-I / src / nfs / nfs_prot.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-14  |  7.3 KB  |  381 lines

  1. /*
  2.  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  3.  * unrestricted use provided that this legend is included on all tape
  4.  * media and as a part of the software program in whole or part.  Users
  5.  * may copy or modify Sun RPC without charge, but are not authorized
  6.  * to license or distribute it to anyone else except as part of a product or
  7.  * program developed by the user or with the express written consent of
  8.  * Sun Microsystems, Inc.
  9.  *
  10.  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  11.  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  12.  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  13.  *
  14.  * Sun RPC is provided with no support and without any obligation on the
  15.  * part of Sun Microsystems, Inc. to assist in its use, correction,
  16.  * modification or enhancement.
  17.  *
  18.  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  19.  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  20.  * OR ANY PART THEREOF.
  21.  *
  22.  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  23.  * or profits or other special, indirect and consequential damages, even if
  24.  * Sun has been advised of the possibility of such damages.
  25.  *
  26.  * Sun Microsystems, Inc.
  27.  * 2550 Garcia Avenue
  28.  * Mountain View, California  94043
  29.  */
  30. /*
  31.  * Copyright (c) 1987, 1990 by Sun Microsystems, Inc.
  32.  */
  33.  
  34. /* from @(#)nfs_prot.x    1.3 91/03/11 TIRPC 1.0 */
  35. #ifndef _rpcsvc_nfs_prot_h
  36. #define _rpcsvc_nfs_prot_h
  37. #define NFS_PORT 2049
  38. #define NFS_MAXDATA 8192
  39. #define NFS_MAXPATHLEN 1024
  40. #define NFS_MAXNAMLEN 255
  41. #define NFS_FHSIZE 32
  42. #define NFS_COOKIESIZE 4
  43. #define NFS_FIFO_DEV -1
  44. #define NFSMODE_FMT 0170000
  45. #define NFSMODE_DIR 0040000
  46. #define NFSMODE_CHR 0020000
  47. #define NFSMODE_BLK 0060000
  48. #define NFSMODE_REG 0100000
  49. #define NFSMODE_LNK 0120000
  50. #define NFSMODE_SOCK 0140000
  51. #define NFSMODE_FIFO 0010000
  52.  
  53. enum nfsstat {
  54.     NFS_OK = 0,
  55.     NFSERR_PERM = 1,
  56.     NFSERR_NOENT = 2,
  57.     NFSERR_IO = 5,
  58.     NFSERR_NXIO = 6,
  59.     NFSERR_ACCES = 13,
  60.     NFSERR_EXIST = 17,
  61.     NFSERR_NODEV = 19,
  62.     NFSERR_NOTDIR = 20,
  63.     NFSERR_ISDIR = 21,
  64.     NFSERR_FBIG = 27,
  65.     NFSERR_NOSPC = 28,
  66.     NFSERR_ROFS = 30,
  67.     NFSERR_NAMETOOLONG = 63,
  68.     NFSERR_NOTEMPTY = 66,
  69.     NFSERR_DQUOT = 69,
  70.     NFSERR_STALE = 70,
  71.     NFSERR_WFLUSH = 99,
  72. };
  73. typedef enum nfsstat nfsstat;
  74. bool_t xdr_nfsstat();
  75.  
  76.  
  77. enum ftype {
  78.     NFNON = 0,
  79.     NFREG = 1,
  80.     NFDIR = 2,
  81.     NFBLK = 3,
  82.     NFCHR = 4,
  83.     NFLNK = 5,
  84.     NFSOCK = 6,
  85.     NFBAD = 7,
  86.     NFFIFO = 8,
  87. };
  88. typedef enum ftype ftype;
  89. bool_t xdr_ftype();
  90.  
  91.  
  92. struct nfs_fh {
  93.     char data[NFS_FHSIZE];
  94. };
  95. typedef struct nfs_fh nfs_fh;
  96. bool_t xdr_nfs_fh();
  97.  
  98.  
  99. struct nfstime {
  100.     u_int seconds;
  101.     u_int useconds;
  102. };
  103. typedef struct nfstime nfstime;
  104. bool_t xdr_nfstime();
  105.  
  106.  
  107. struct fattr {
  108.     ftype type;
  109.     u_int mode;
  110.     u_int nlink;
  111.     u_int uid;
  112.     u_int gid;
  113.     u_int size;
  114.     u_int blocksize;
  115.     u_int rdev;
  116.     u_int blocks;
  117.     u_int fsid;
  118.     u_int fileid;
  119.     nfstime atime;
  120.     nfstime mtime;
  121.     nfstime ctime;
  122. };
  123. typedef struct fattr fattr;
  124. bool_t xdr_fattr();
  125.  
  126.  
  127. struct sattr {
  128.     u_int mode;
  129.     u_int uid;
  130.     u_int gid;
  131.     u_int size;
  132.     nfstime atime;
  133.     nfstime mtime;
  134. };
  135. typedef struct sattr sattr;
  136. bool_t xdr_sattr();
  137.  
  138.  
  139. typedef char *filename;
  140. bool_t xdr_filename();
  141.  
  142.  
  143. typedef char *nfspath;
  144. bool_t xdr_nfspath();
  145.  
  146.  
  147. struct attrstat {
  148.     nfsstat status;
  149.     union {
  150.         fattr attributes;
  151.     } attrstat_u;
  152. };
  153. typedef struct attrstat attrstat;
  154. bool_t xdr_attrstat();
  155.  
  156.  
  157. struct sattrargs {
  158.     nfs_fh file;
  159.     sattr attributes;
  160. };
  161. typedef struct sattrargs sattrargs;
  162. bool_t xdr_sattrargs();
  163.  
  164.  
  165. struct diropargs {
  166.     nfs_fh dir;
  167.     filename name;
  168. };
  169. typedef struct diropargs diropargs;
  170. bool_t xdr_diropargs();
  171.  
  172.  
  173. struct diropokres {
  174.     nfs_fh file;
  175.     fattr attributes;
  176. };
  177. typedef struct diropokres diropokres;
  178. bool_t xdr_diropokres();
  179.  
  180.  
  181. struct diropres {
  182.     nfsstat status;
  183.     union {
  184.         diropokres diropres;
  185.     } diropres_u;
  186. };
  187. typedef struct diropres diropres;
  188. bool_t xdr_diropres();
  189.  
  190.  
  191. struct readlinkres {
  192.     nfsstat status;
  193.     union {
  194.         nfspath data;
  195.     } readlinkres_u;
  196. };
  197. typedef struct readlinkres readlinkres;
  198. bool_t xdr_readlinkres();
  199.  
  200.  
  201. struct readargs {
  202.     nfs_fh file;
  203.     u_int offset;
  204.     u_int count;
  205.     u_int totalcount;
  206. };
  207. typedef struct readargs readargs;
  208. bool_t xdr_readargs();
  209.  
  210.  
  211. struct readokres {
  212.     fattr attributes;
  213.     struct {
  214.         u_int data_len;
  215.         char *data_val;
  216.     } data;
  217. };
  218. typedef struct readokres readokres;
  219. bool_t xdr_readokres();
  220.  
  221.  
  222. struct readres {
  223.     nfsstat status;
  224.     union {
  225.         readokres reply;
  226.     } readres_u;
  227. };
  228. typedef struct readres readres;
  229. bool_t xdr_readres();
  230.  
  231.  
  232. struct writeargs {
  233.     nfs_fh file;
  234.     u_int beginoffset;
  235.     u_int offset;
  236.     u_int totalcount;
  237.     struct {
  238.         u_int data_len;
  239.         char *data_val;
  240.     } data;
  241. };
  242. typedef struct writeargs writeargs;
  243. bool_t xdr_writeargs();
  244.  
  245.  
  246. struct createargs {
  247.     diropargs where;
  248.     sattr attributes;
  249. };
  250. typedef struct createargs createargs;
  251. bool_t xdr_createargs();
  252.  
  253.  
  254. struct renameargs {
  255.     diropargs from;
  256.     diropargs to;
  257. };
  258. typedef struct renameargs renameargs;
  259. bool_t xdr_renameargs();
  260.  
  261.  
  262. struct linkargs {
  263.     nfs_fh from;
  264.     diropargs to;
  265. };
  266. typedef struct linkargs linkargs;
  267. bool_t xdr_linkargs();
  268.  
  269.  
  270. struct symlinkargs {
  271.     diropargs from;
  272.     nfspath to;
  273.     sattr attributes;
  274. };
  275. typedef struct symlinkargs symlinkargs;
  276. bool_t xdr_symlinkargs();
  277.  
  278.  
  279. typedef char nfscookie[NFS_COOKIESIZE];
  280. bool_t xdr_nfscookie();
  281.  
  282.  
  283. struct readdirargs {
  284.     nfs_fh dir;
  285.     nfscookie cookie;
  286.     u_int count;
  287. };
  288. typedef struct readdirargs readdirargs;
  289. bool_t xdr_readdirargs();
  290.  
  291.  
  292. struct entry {
  293.     u_int fileid;
  294.     filename name;
  295.     nfscookie cookie;
  296.     struct entry *nextentry;
  297. };
  298. typedef struct entry entry;
  299. bool_t xdr_entry();
  300.  
  301.  
  302. struct dirlist {
  303.     entry *entries;
  304.     bool_t eof;
  305. };
  306. typedef struct dirlist dirlist;
  307. bool_t xdr_dirlist();
  308.  
  309.  
  310. struct readdirres {
  311.     nfsstat status;
  312.     union {
  313.         dirlist reply;
  314.     } readdirres_u;
  315. };
  316. typedef struct readdirres readdirres;
  317. bool_t xdr_readdirres();
  318.  
  319.  
  320. struct statfsokres {
  321.     u_int tsize;
  322.     u_int bsize;
  323.     u_int blocks;
  324.     u_int bfree;
  325.     u_int bavail;
  326. };
  327. typedef struct statfsokres statfsokres;
  328. bool_t xdr_statfsokres();
  329.  
  330.  
  331. struct statfsres {
  332.     nfsstat status;
  333.     union {
  334.         statfsokres reply;
  335.     } statfsres_u;
  336. };
  337. typedef struct statfsres statfsres;
  338. bool_t xdr_statfsres();
  339.  
  340.  
  341. #define NFS_PROGRAM ((u_long)100003)
  342. #define NFS_VERSION ((u_long)2)
  343. #define NFSPROC_NULL ((u_long)0)
  344. extern void *nfsproc_null_2();
  345. #define NFSPROC_GETATTR ((u_long)1)
  346. extern attrstat *nfsproc_getattr_2();
  347. #define NFSPROC_SETATTR ((u_long)2)
  348. extern attrstat *nfsproc_setattr_2();
  349. #define NFSPROC_ROOT ((u_long)3)
  350. extern void *nfsproc_root_2();
  351. #define NFSPROC_LOOKUP ((u_long)4)
  352. extern diropres *nfsproc_lookup_2();
  353. #define NFSPROC_READLINK ((u_long)5)
  354. extern readlinkres *nfsproc_readlink_2();
  355. #define NFSPROC_READ ((u_long)6)
  356. extern readres *nfsproc_read_2();
  357. #define NFSPROC_WRITECACHE ((u_long)7)
  358. extern void *nfsproc_writecache_2();
  359. #define NFSPROC_WRITE ((u_long)8)
  360. extern attrstat *nfsproc_write_2();
  361. #define NFSPROC_CREATE ((u_long)9)
  362. extern diropres *nfsproc_create_2();
  363. #define NFSPROC_REMOVE ((u_long)10)
  364. extern nfsstat *nfsproc_remove_2();
  365. #define NFSPROC_RENAME ((u_long)11)
  366. extern nfsstat *nfsproc_rename_2();
  367. #define NFSPROC_LINK ((u_long)12)
  368. extern nfsstat *nfsproc_link_2();
  369. #define NFSPROC_SYMLINK ((u_long)13)
  370. extern nfsstat *nfsproc_symlink_2();
  371. #define NFSPROC_MKDIR ((u_long)14)
  372. extern diropres *nfsproc_mkdir_2();
  373. #define NFSPROC_RMDIR ((u_long)15)
  374. extern nfsstat *nfsproc_rmdir_2();
  375. #define NFSPROC_READDIR ((u_long)16)
  376. extern readdirres *nfsproc_readdir_2();
  377. #define NFSPROC_STATFS ((u_long)17)
  378. extern statfsres *nfsproc_statfs_2();
  379.  
  380. #endif /*!_rpcsvc_nfs_prot_h*/
  381.