// -*-c++-*-
/* This file was automatically generated by rpcc. */

#ifndef __RPCC_MOUNT_PROT_H_INCLUDED__
#define __RPCC_MOUNT_PROT_H_INCLUDED__ 1

#include "xdrmisc.h"

enum { MNTPATHLEN = 1024 };
enum { MNTNAMLEN = 255 };
enum { FHSIZE2 = 32 };
enum { FHSIZE3 = 64 };

typedef rpc_opaque<FHSIZE2> fhandle2;
void *fhandle2_alloc ();
bool_t xdr_fhandle2 (XDR *, void *);
RPC_TYPEDEF_DECL (fhandle2)

typedef rpc_bytes<FHSIZE3> fhandle3;
void *fhandle3_alloc ();
bool_t xdr_fhandle3 (XDR *, void *);
RPC_TYPEDEF_DECL (fhandle3)

typedef rpc_str<MNTPATHLEN> dirpath;
void *dirpath_alloc ();
bool_t xdr_dirpath (XDR *, void *);
RPC_TYPEDEF_DECL (dirpath)

typedef rpc_str<MNTNAMLEN> name;
void *name_alloc ();
bool_t xdr_name (XDR *, void *);
RPC_TYPEDEF_DECL (name)


struct fhstatus {
  const u_int32_t fhs_status;
  union {
    union_entry_base _base;
    union_entry<fhandle2> fhs_fhandle;
  };

#define rpcunion_tag_fhstatus fhs_status
#define rpcunion_switch_fhstatus(swarg, action, voidaction, defaction) \
  switch (swarg) { \
  case 0: \
    action (fhandle2, fhs_fhandle); \
    break; \
  default: \
    voidaction; \
    break; \
  }

  fhstatus (u_int32_t _tag = (u_int32_t) 0) : fhs_status (_tag)
    { _base.init (); set_fhs_status (_tag); }
  fhstatus (const fhstatus &_s)
    : fhs_status (_s.fhs_status)
    { _base.init (_s._base); }
  ~fhstatus () { _base.destroy (); }
  fhstatus &operator= (const fhstatus &_s) {
    const_cast<u_int32_t &> (fhs_status) = _s.fhs_status;
    _base.assign (_s._base);
    return *this;
  }

  void set_fhs_status (u_int32_t _tag) {
    const_cast<u_int32_t &> (fhs_status) = _tag;
    rpcunion_switch_fhstatus
      (_tag, RPCUNION_SET, _base.destroy (), _base.destroy ());
  }
};

template<class T> bool
rpc_traverse (T &t, fhstatus &obj)
{
  u_int32_t tag = obj.fhs_status;
  if (!rpc_traverse (t, tag))
    return false;
  if (tag != obj.fhs_status)
    obj.set_fhs_status (tag);

  rpcunion_switch_fhstatus
    (obj.fhs_status, RPCUNION_TRAVERSE, return true, return false);
}
inline bool
rpc_traverse (const stompcast_t &s, fhstatus &obj)
{
  rpcunion_switch_fhstatus
    (obj.fhs_status, RPCUNION_REC_STOMPCAST,
     obj._base.destroy (); return true, obj._base.destroy (); return true;);
}
void *fhstatus_alloc ();
bool_t xdr_fhstatus (XDR *, void *);
RPC_UNION_DECL (fhstatus)


enum mountstat3 {
  MNT3_OK = 0,
  MNT3ERR_PERM = 1,
  MNT3ERR_NOENT = 2,
  MNT3ERR_IO = 5,
  MNT3ERR_ACCES = 13,
  MNT3ERR_NOTDIR = 20,
  MNT3ERR_INVAL = 22,
  MNT3ERR_NAMETOOLONG = 63,
  MNT3ERR_NOTSUPP = 10004,
  MNT3ERR_SERVERFAULT = 10006,
};
void *mountstat3_alloc ();
bool_t xdr_mountstat3 (XDR *, void *);
RPC_ENUM_DECL (mountstat3)

template<class T> inline bool
rpc_traverse (T &t, mountstat3 &obj)
{
  u_int32_t val = obj;
  if (!rpc_traverse (t, val))
    return false;
  obj = mountstat3 (val);
  return true;
}


struct mountres3_ok {
  fhandle3 fhandle;
  rpc_vec<int32_t, RPC_INFINITY> auth_flavors;
};
void *mountres3_ok_alloc ();
bool_t xdr_mountres3_ok (XDR *, void *);
RPC_STRUCT_DECL (mountres3_ok)

template<class T> bool
rpc_traverse (T &t, mountres3_ok &obj)
{
  return rpc_traverse (t, obj.fhandle)
    && rpc_traverse (t, obj.auth_flavors);
}



struct mountres3 {
  const mountstat3 fhs_status;
  union {
    union_entry_base _base;
    union_entry<mountres3_ok> mountinfo;
  };

#define rpcunion_tag_mountres3 fhs_status
#define rpcunion_switch_mountres3(swarg, action, voidaction, defaction) \
  switch (swarg) { \
  case MNT3_OK: \
    action (mountres3_ok, mountinfo); \
    break; \
  default: \
    voidaction; \
    break; \
  }

  mountres3 (mountstat3 _tag = (mountstat3) 0) : fhs_status (_tag)
    { _base.init (); set_fhs_status (_tag); }
  mountres3 (const mountres3 &_s)
    : fhs_status (_s.fhs_status)
    { _base.init (_s._base); }
  ~mountres3 () { _base.destroy (); }
  mountres3 &operator= (const mountres3 &_s) {
    const_cast<mountstat3 &> (fhs_status) = _s.fhs_status;
    _base.assign (_s._base);
    return *this;
  }

  void set_fhs_status (mountstat3 _tag) {
    const_cast<mountstat3 &> (fhs_status) = _tag;
    rpcunion_switch_mountres3
      (_tag, RPCUNION_SET, _base.destroy (), _base.destroy ());
  }
};

template<class T> bool
rpc_traverse (T &t, mountres3 &obj)
{
  mountstat3 tag = obj.fhs_status;
  if (!rpc_traverse (t, tag))
    return false;
  if (tag != obj.fhs_status)
    obj.set_fhs_status (tag);

  rpcunion_switch_mountres3
    (obj.fhs_status, RPCUNION_TRAVERSE, return true, return false);
}
inline bool
rpc_traverse (const stompcast_t &s, mountres3 &obj)
{
  rpcunion_switch_mountres3
    (obj.fhs_status, RPCUNION_REC_STOMPCAST,
     obj._base.destroy (); return true, obj._base.destroy (); return true;);
}
void *mountres3_alloc ();
bool_t xdr_mountres3 (XDR *, void *);
RPC_UNION_DECL (mountres3)


typedef rpc_ptr<struct mountbody> mountlist;
void *mountlist_alloc ();
bool_t xdr_mountlist (XDR *, void *);
RPC_TYPEDEF_DECL (mountlist)


struct mountbody {
  name ml_hostname;
  dirpath ml_directory;
  mountlist ml_next;
};
void *mountbody_alloc ();
bool_t xdr_mountbody (XDR *, void *);
RPC_STRUCT_DECL (mountbody)

template<class T> bool
rpc_traverse (T &t, mountbody &obj)
{
  return rpc_traverse (t, obj.ml_hostname)
    && rpc_traverse (t, obj.ml_directory)
    && rpc_traverse (t, obj.ml_next);
}


typedef rpc_ptr<struct groupnode> groups;
void *groups_alloc ();
bool_t xdr_groups (XDR *, void *);
RPC_TYPEDEF_DECL (groups)


struct groupnode {
  name gr_name;
  groups gr_next;
};
void *groupnode_alloc ();
bool_t xdr_groupnode (XDR *, void *);
RPC_STRUCT_DECL (groupnode)

template<class T> bool
rpc_traverse (T &t, groupnode &obj)
{
  return rpc_traverse (t, obj.gr_name)
    && rpc_traverse (t, obj.gr_next);
}


typedef rpc_ptr<struct exportnode> exports;
void *exports_alloc ();
bool_t xdr_exports (XDR *, void *);
RPC_TYPEDEF_DECL (exports)


struct exportnode {
  dirpath ex_dir;
  groups ex_groups;
  exports ex_next;
};
void *exportnode_alloc ();
bool_t xdr_exportnode (XDR *, void *);
RPC_STRUCT_DECL (exportnode)

template<class T> bool
rpc_traverse (T &t, exportnode &obj)
{
  return rpc_traverse (t, obj.ex_dir)
    && rpc_traverse (t, obj.ex_groups)
    && rpc_traverse (t, obj.ex_next);
}


#ifndef MOUNT_PROGRAM
#define MOUNT_PROGRAM 100005
#endif /* !MOUNT_PROGRAM */
extern const rpc_program mount_program_1;
enum { MOUNT_V1 = 1 };
enum {
  MOUNTPROC_NULL = 0,
  MOUNTPROC_MNT = 1,
  MOUNTPROC_DUMP = 2,
  MOUNTPROC_UMNT = 3,
  MOUNTPROC_UMNTALL = 4,
  MOUNTPROC_EXPORT = 5,
  MOUNTPROC_EXPORTALL = 6,
};
#define MOUNT_PROGRAM_1_APPLY_NOVOID(macro, void) \
  macro (MOUNTPROC_NULL, void, void) \
  macro (MOUNTPROC_MNT, dirpath, fhstatus) \
  macro (MOUNTPROC_DUMP, void, mountlist) \
  macro (MOUNTPROC_UMNT, dirpath, void) \
  macro (MOUNTPROC_UMNTALL, void, void) \
  macro (MOUNTPROC_EXPORT, void, exports) \
  macro (MOUNTPROC_EXPORTALL, void, exports)
#define MOUNT_PROGRAM_1_APPLY(macro) \
  MOUNT_PROGRAM_1_APPLY_NOVOID(macro, void)
extern const rpc_program mount_program_3;
enum { MOUNT_V3 = 3 };
enum {
  MOUNTPROC3_NULL = 0,
  MOUNTPROC3_MNT = 1,
  MOUNTPROC3_DUMP = 2,
  MOUNTPROC3_UMNT = 3,
  MOUNTPROC3_UMNTALL = 4,
  MOUNTPROC3_EXPORT = 5,
};
#define MOUNT_PROGRAM_3_APPLY_NOVOID(macro, void) \
  macro (MOUNTPROC3_NULL, void, void) \
  macro (MOUNTPROC3_MNT, dirpath, mountres3) \
  macro (MOUNTPROC3_DUMP, void, mountlist) \
  macro (MOUNTPROC3_UMNT, dirpath, void) \
  macro (MOUNTPROC3_UMNTALL, void, void) \
  macro (MOUNTPROC3_EXPORT, void, exports)
#define MOUNT_PROGRAM_3_APPLY(macro) \
  MOUNT_PROGRAM_3_APPLY_NOVOID(macro, void)

#endif /* !__RPCC_MOUNT_PROT_H_INCLUDED__ */
