1 /*	$OpenBSD: rquota.x,v 1.3 2004/01/17 12:32:11 deraadt Exp $	*/
2 
3 /*
4  * Remote quota protocol
5  * Requires unix authentication
6  */
7 
8 #ifndef RPC_HDR
9 %#ifndef lint
10 %/*static char sccsid[] = "from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/
11 %/*static char sccsid[] = "from: @(#)rquota.x	2.1 88/08/01 4.0 RPCSRC";*/
12 %static char rcsid[] = "$OpenBSD: rquota.x,v 1.3 2004/01/17 12:32:11 deraadt Exp $";
13 %#endif /* not lint */
14 #endif
15 
16 const RQ_PATHLEN = 1024;
17 
18 struct getquota_args {
19 	string gqa_pathp<RQ_PATHLEN>;	/* path to filesystem of interest */
20 	int gqa_uid;			/* inquire about quota for uid */
21 };
22 
23 /*
24  * remote quota structure
25  */
26 struct rquota {
27 	int rq_bsize;			/* block size for block counts */
28 	bool rq_active;			/* indicates whether quota is active */
29 	unsigned int rq_bhardlimit;	/* absolute limit on disk blks alloc */
30 	unsigned int rq_bsoftlimit;	/* preferred limit on disk blks */
31 	unsigned int rq_curblocks;	/* current block count */
32 	unsigned int rq_fhardlimit;	/* absolute limit on allocated files */
33 	unsigned int rq_fsoftlimit;	/* preferred file limit */
34 	unsigned int rq_curfiles;	/* current # allocated files */
35 	unsigned int rq_btimeleft;	/* time left for excessive disk use */
36 	unsigned int rq_ftimeleft;	/* time left for excessive files */
37 };
38 
39 enum gqr_status {
40 	Q_OK = 1,		/* quota returned */
41 	Q_NOQUOTA = 2,		/* noquota for uid */
42 	Q_EPERM = 3		/* no permission to access quota */
43 };
44 
45 union getquota_rslt switch (gqr_status status) {
46 case Q_OK:
47 	rquota gqr_rquota;	/* valid if status == Q_OK */
48 case Q_NOQUOTA:
49 	void;
50 case Q_EPERM:
51 	void;
52 };
53 
54 program RQUOTAPROG {
55 	version RQUOTAVERS {
56 		/*
57 		 * Get all quotas
58 		 */
59 		getquota_rslt
60 		RQUOTAPROC_GETQUOTA(getquota_args) = 1;
61 
62 		/*
63 		 * Get active quotas only
64 		 */
65 		getquota_rslt
66 		RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
67 	} = 1;
68 } = 100011;
69