Home | History | Annotate | Download | only in rpcsvc
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 /*
     22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     23  * Use is subject to license terms.
     24  */
     25 
     26 %#ifdef _KERNEL
     27 %#include <nfs/nfs4_kprot.h>
     28 %#else
     29 %#include <rpc/types.h>
     30 %#include <rpc/xdr.h>
     31 %#include <rpcsvc/nfs4_prot.h>
     32 %#endif
     33 
     34 %#include <nfs/spe_prot.h>
     35 
     36 /*
     37 %#ifndef _KERNEL
     38 typedef opaque		utf8string<>;
     39 typedef uint32_t	count4;
     40 %#endif
     41 */
     42 
     43 struct spe_stringlist {
     44 	utf8string		ss_name;
     45 	struct spe_stringlist	*next;
     46 };
     47 
     48 struct  spe_npool {
     49 	utf8string		sn_name;
     50 	spe_stringlist		*sn_dses;
     51 	struct spe_npool	*next;
     52 };
     53 
     54 enum spe_attributes {
     55 	SPE_ATTR_BASE,
     56 	SPE_ATTR_DAY,
     57 	SPE_ATTR_DOMAIN,
     58 	SPE_ATTR_EXTENSION,
     59 	SPE_ATTR_FILE,
     60 	SPE_ATTR_FQDN,
     61 	SPE_ATTR_GID,
     62 	SPE_ATTR_GROUP,
     63 	SPE_ATTR_HOST,
     64 	SPE_ATTR_HOUR,
     65 	SPE_ATTR_IP,
     66 	SPE_ATTR_PATH,
     67 	SPE_ATTR_SUBNET,
     68 	SPE_ATTR_UID,
     69 	SPE_ATTR_USER,
     70 	SPE_ATTR_WEEKDAY
     71 };
     72 
     73 enum spe_operators {
     74 	SPE_OP_AND,
     75 	SPE_OP_OR,
     76 	SPE_OP_NOT,
     77 	SPE_OP_EQUAL,
     78 	SPE_OP_NOT_EQUAL
     79 };
     80 
     81 enum spe_type {
     82 	SPE_DATA_ADDR,
     83 	SPE_DATA_GID,
     84 	SPE_DATA_INT,
     85 	SPE_DATA_NETNAME,
     86 	SPE_DATA_NETWORK,
     87 	SPE_DATA_STRING,
     88 	SPE_DATA_UID
     89 };
     90 
     91 /*
     92  * If NETNAME, then we use spe_netname.
     93  * Else, we use spe_network.
     94  */
     95 struct spe_network {
     96 	char		*sn_name;
     97 	uint32_t	sn_addr;
     98 	uint32_t	sn_mask;
     99 };
    100 
    101 union spe_data switch (spe_type sd_type) {
    102 	case SPE_DATA_UID:
    103 		uid_t			uid;
    104 	case SPE_DATA_GID:
    105 		gid_t			gid;
    106 	case SPE_DATA_INT:
    107 		int			i;
    108 	case SPE_DATA_NETNAME:
    109 	case SPE_DATA_STRING:
    110 		string			sz<MAXPATHLEN>;
    111 	case SPE_DATA_ADDR:
    112 	case SPE_DATA_NETWORK:
    113 		spe_network	net;
    114 };
    115 
    116 union spe_thunk switch (bool st_is_interior) {
    117 	case FALSE:
    118 		struct spe_leaf		*leaf;
    119 	case TRUE:
    120 		struct spe_interior	*interior;
    121 };
    122 
    123 struct spe_leaf {
    124 	bool		sl_is_attr;
    125 	spe_attributes	sl_attr;
    126 	spe_data	sl_data;
    127 };
    128 
    129 struct spe_interior {
    130 	spe_operators	si_op;
    131 	bool		si_parens;
    132 	spe_thunk	si_branches<>;
    133 };
    134 
    135 struct spe_policy {
    136 	uint32_t		sp_id;
    137 	count4			sp_stripe_count;
    138 	uint32_t		sp_interlace;
    139 	spe_interior		*sp_attr_expr;
    140 	char			*sp_name;
    141 	spe_npool		*sp_npools;
    142 	struct spe_policy	*next;
    143 };
    144 
    145 /*
    146  * Program number is in the transient range since it never
    147  * goes across the wire...
    148  */
    149 program NFS4_SPE {
    150 	version	NFS4_SPE_V1 {
    151 		void
    152 		SPETRANSFER(void) = 0;
    153 	} = 1;
    154 } = 0x40000010;
    155