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

#ifndef __RPCC_NFSMOUNTER_H_INCLUDED__
#define __RPCC_NFSMOUNTER_H_INCLUDED__ 1

#include "xdrmisc.h"
#ifndef NMOPT_ONLY
#include "nfs_prot.h"
#include "nfs3_prot.h"
#else
#undef NFS3_FHSIZE

enum { NFS3_FHSIZE = 64 };

#endif

enum { NMOPT_RO = 0x1 };
enum { NMOPT_SOFT = 0x2 };
enum { NMOPT_NOAC = 0x4 };
enum { NMOPT_NFS3 = 0x8 };
enum { NMOPT_RDPLUS = 0x10 };
enum { NMOPT_SENDCLOSE = 0x20 };

typedef rpc_bytes<NFS3_FHSIZE> nfsmnt_handle;
void *nfsmnt_handle_alloc ();
bool_t xdr_nfsmnt_handle (XDR *, void *);
RPC_TYPEDEF_DECL (nfsmnt_handle)

#ifndef NMOPT_ONLY


struct mountarg {
  rpc_str<RPC_INFINITY> hostname;
  rpc_str<RPC_INFINITY> path;
  int32_t flags;
  nfsmnt_handle handle;
};
void *mountarg_alloc ();
bool_t xdr_mountarg (XDR *, void *);
RPC_STRUCT_DECL (mountarg)

template<class T> bool
rpc_traverse (T &t, mountarg &obj)
{
  return rpc_traverse (t, obj.hostname)
    && rpc_traverse (t, obj.path)
    && rpc_traverse (t, obj.flags)
    && rpc_traverse (t, obj.handle);
}



struct mountres {
  const int32_t status;
  union {
    union_entry_base _base;
    union_entry<uint64> fsid;
  };

#define rpcunion_tag_mountres status
#define rpcunion_switch_mountres(swarg, action, voidaction, defaction) \
  switch (swarg) { \
  case 0: \
    action (uint64, fsid); \
    break; \
  default: \
    voidaction; \
    break; \
  }

  mountres (int32_t _tag = (int32_t) 0) : status (_tag)
    { _base.init (); set_status (_tag); }
  mountres (const mountres &_s)
    : status (_s.status)
    { _base.init (_s._base); }
  ~mountres () { _base.destroy (); }
  mountres &operator= (const mountres &_s) {
    const_cast<int32_t &> (status) = _s.status;
    _base.assign (_s._base);
    return *this;
  }

  void set_status (int32_t _tag) {
    const_cast<int32_t &> (status) = _tag;
    rpcunion_switch_mountres
      (_tag, RPCUNION_SET, _base.destroy (), _base.destroy ());
  }
};

template<class T> bool
rpc_traverse (T &t, mountres &obj)
{
  int32_t tag = obj.status;
  if (!rpc_traverse (t, tag))
    return false;
  if (tag != obj.status)
    obj.set_status (tag);

  rpcunion_switch_mountres
    (obj.status, RPCUNION_TRAVERSE, return true, return false);
}
inline bool
rpc_traverse (const stompcast_t &s, mountres &obj)
{
  rpcunion_switch_mountres
    (obj.status, RPCUNION_REC_STOMPCAST,
     obj._base.destroy (); return true, obj._base.destroy (); return true;);
}
void *mountres_alloc ();
bool_t xdr_mountres (XDR *, void *);
RPC_UNION_DECL (mountres)



struct remountarg {
  rpc_str<RPC_INFINITY> path;
  int32_t flags;
};
void *remountarg_alloc ();
bool_t xdr_remountarg (XDR *, void *);
RPC_STRUCT_DECL (remountarg)

template<class T> bool
rpc_traverse (T &t, remountarg &obj)
{
  return rpc_traverse (t, obj.path)
    && rpc_traverse (t, obj.flags);
}


#endif

enum { NUOPT_FORCE = 0x1 };
enum { NUOPT_STALE = 0x2 };
enum { NUOPT_NOOP = 0x4 };
enum { NUOPT_NLOG = 0x8 };

#ifndef NMOPT_ONLY


struct umountarg {
  rpc_str<RPC_INFINITY> path;
  int32_t flags;
};
void *umountarg_alloc ();
bool_t xdr_umountarg (XDR *, void *);
RPC_STRUCT_DECL (umountarg)

template<class T> bool
rpc_traverse (T &t, umountarg &obj)
{
  return rpc_traverse (t, obj.path)
    && rpc_traverse (t, obj.flags);
}


#ifndef NFSMOUNTER_PROG
#define NFSMOUNTER_PROG 395544
#endif /* !NFSMOUNTER_PROG */
extern const rpc_program nfsmounter_prog_1;
enum { NFSMOUNTER_VERS = 1 };
enum {
  NFSMOUNTER_NULL = 0,
  NFSMOUNTER_MOUNT = 1,
  NFSMOUNTER_REMOUNT = 2,
  NFSMOUNTER_UMOUNT = 3,
  NFSMOUNTER_UMOUNTALL = 4,
};
#define NFSMOUNTER_PROG_1_APPLY_NOVOID(macro, void) \
  macro (NFSMOUNTER_NULL, void, void) \
  macro (NFSMOUNTER_MOUNT, mountarg, mountres) \
  macro (NFSMOUNTER_REMOUNT, remountarg, int32_t) \
  macro (NFSMOUNTER_UMOUNT, umountarg, int32_t) \
  macro (NFSMOUNTER_UMOUNTALL, int32_t, int32_t)
#define NFSMOUNTER_PROG_1_APPLY(macro) \
  NFSMOUNTER_PROG_1_APPLY_NOVOID(macro, void)


#endif
#endif /* !__RPCC_NFSMOUNTER_H_INCLUDED__ */
