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

#ifndef __RPCC_REX_PROT_H_INCLUDED__
#define __RPCC_REX_PROT_H_INCLUDED__ 1

#include "xdrmisc.h"
#include "sfs_prot.h"
#include "dns.h"
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif

typedef rpc_str<63> ttypath;
void *ttypath_alloc ();
bool_t xdr_ttypath (XDR *, void *);
RPC_TYPEDEF_DECL (ttypath)

typedef rpc_str<MAXHOSTNAMELEN> utmphost;
void *utmphost_alloc ();
bool_t xdr_utmphost (XDR *, void *);
RPC_TYPEDEF_DECL (utmphost)


struct pty_alloc_res {
  const int32_t err;
  union {
    union_entry_base _base;
    union_entry<ttypath> path;
  };

#define rpcunion_tag_pty_alloc_res err
#define rpcunion_switch_pty_alloc_res(swarg, action, voidaction, defaction) \
  switch (swarg) { \
  case 0: \
    action (ttypath, path); \
    break; \
  default: \
    voidaction; \
    break; \
  }

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

  void set_err (int32_t _tag) {
    const_cast<int32_t &> (err) = _tag;
    rpcunion_switch_pty_alloc_res
      (_tag, RPCUNION_SET, _base.destroy (), _base.destroy ());
  }
};

template<class T> bool
rpc_traverse (T &t, pty_alloc_res &obj)
{
  int32_t tag = obj.err;
  if (!rpc_traverse (t, tag))
    return false;
  if (tag != obj.err)
    obj.set_err (tag);

  rpcunion_switch_pty_alloc_res
    (obj.err, RPCUNION_TRAVERSE, return true, return false);
}
inline bool
rpc_traverse (const stompcast_t &s, pty_alloc_res &obj)
{
  rpcunion_switch_pty_alloc_res
    (obj.err, RPCUNION_REC_STOMPCAST,
     obj._base.destroy (); return true, obj._base.destroy (); return true;);
}
void *pty_alloc_res_alloc ();
bool_t xdr_pty_alloc_res (XDR *, void *);
RPC_UNION_DECL (pty_alloc_res)


#ifndef PTYD_PROG
#define PTYD_PROG 344431
#endif /* !PTYD_PROG */
extern const rpc_program ptyd_prog_1;
enum { PTYD_VERS = 1 };
enum {
  PTYD_NULL = 0,
  PTYD_PTY_ALLOC = 1,
  PTYD_PTY_FREE = 2,
};
#define PTYD_PROG_1_APPLY_NOVOID(macro, void) \
  macro (PTYD_NULL, void, void) \
  macro (PTYD_PTY_ALLOC, utmphost, pty_alloc_res) \
  macro (PTYD_PTY_FREE, ttypath, int32_t)
#define PTYD_PROG_1_APPLY(macro) \
  PTYD_PROG_1_APPLY_NOVOID(macro, void)


typedef rpc_str<RPC_INFINITY> rex_progarg;
void *rex_progarg_alloc ();
bool_t xdr_rex_progarg (XDR *, void *);
RPC_TYPEDEF_DECL (rex_progarg)

typedef rpc_vec<rex_progarg, RPC_INFINITY> rex_cmd;
void *rex_cmd_alloc ();
bool_t xdr_rex_cmd (XDR *, void *);
RPC_TYPEDEF_DECL (rex_cmd)

typedef rpc_str<RPC_INFINITY> rex_envvar;
void *rex_envvar_alloc ();
bool_t xdr_rex_envvar (XDR *, void *);
RPC_TYPEDEF_DECL (rex_envvar)

typedef rpc_vec<rex_envvar, RPC_INFINITY> rex_env;
void *rex_env_alloc ();
bool_t xdr_rex_env (XDR *, void *);
RPC_TYPEDEF_DECL (rex_env)


struct rexd_spawn_arg {
  sfs_kmsg kmsg;
  rex_cmd command;
};
void *rexd_spawn_arg_alloc ();
bool_t xdr_rexd_spawn_arg (XDR *, void *);
RPC_STRUCT_DECL (rexd_spawn_arg)

template<class T> bool
rpc_traverse (T &t, rexd_spawn_arg &obj)
{
  return rpc_traverse (t, obj.kmsg)
    && rpc_traverse (t, obj.command);
}



struct rexd_spawn_resok {
  sfs_kmsg kmsg;
};
void *rexd_spawn_resok_alloc ();
bool_t xdr_rexd_spawn_resok (XDR *, void *);
RPC_STRUCT_DECL (rexd_spawn_resok)

template<class T> inline bool
rpc_traverse (T &t, rexd_spawn_resok &obj)
{
  return rpc_traverse (t, obj.kmsg);
}



struct rexd_spawn_res {
  const sfsstat err;
  union {
    union_entry_base _base;
    union_entry<rexd_spawn_resok> resok;
  };

#define rpcunion_tag_rexd_spawn_res err
#define rpcunion_switch_rexd_spawn_res(swarg, action, voidaction, defaction) \
  switch (swarg) { \
  case SFS_OK: \
    action (rexd_spawn_resok, resok); \
    break; \
  default: \
    voidaction; \
    break; \
  }

  rexd_spawn_res (sfsstat _tag = (sfsstat) 0) : err (_tag)
    { _base.init (); set_err (_tag); }
  rexd_spawn_res (const rexd_spawn_res &_s)
    : err (_s.err)
    { _base.init (_s._base); }
  ~rexd_spawn_res () { _base.destroy (); }
  rexd_spawn_res &operator= (const rexd_spawn_res &_s) {
    const_cast<sfsstat &> (err) = _s.err;
    _base.assign (_s._base);
    return *this;
  }

  void set_err (sfsstat _tag) {
    const_cast<sfsstat &> (err) = _tag;
    rpcunion_switch_rexd_spawn_res
      (_tag, RPCUNION_SET, _base.destroy (), _base.destroy ());
  }
};

template<class T> bool
rpc_traverse (T &t, rexd_spawn_res &obj)
{
  sfsstat tag = obj.err;
  if (!rpc_traverse (t, tag))
    return false;
  if (tag != obj.err)
    obj.set_err (tag);

  rpcunion_switch_rexd_spawn_res
    (obj.err, RPCUNION_TRAVERSE, return true, return false);
}
inline bool
rpc_traverse (const stompcast_t &s, rexd_spawn_res &obj)
{
  rpcunion_switch_rexd_spawn_res
    (obj.err, RPCUNION_REC_STOMPCAST,
     obj._base.destroy (); return true, obj._base.destroy (); return true;);
}
void *rexd_spawn_res_alloc ();
bool_t xdr_rexd_spawn_res (XDR *, void *);
RPC_UNION_DECL (rexd_spawn_res)



struct rexd_attach_arg {
  sfs_hash sessid;
  sfs_seqno seqno;
  sfs_hash newsessid;
};
void *rexd_attach_arg_alloc ();
bool_t xdr_rexd_attach_arg (XDR *, void *);
RPC_STRUCT_DECL (rexd_attach_arg)

template<class T> bool
rpc_traverse (T &t, rexd_attach_arg &obj)
{
  return rpc_traverse (t, obj.sessid)
    && rpc_traverse (t, obj.seqno)
    && rpc_traverse (t, obj.newsessid);
}


typedef sfsstat rexd_attach_res;
void *rexd_attach_res_alloc ();
bool_t xdr_rexd_attach_res (XDR *, void *);
RPC_TYPEDEF_DECL (rexd_attach_res)


struct rex_sesskeydat {
  sfs_msgtype type;
  sfs_seqno seqno;
  sfs_secret sshare;
  sfs_secret cshare;
};
void *rex_sesskeydat_alloc ();
bool_t xdr_rex_sesskeydat (XDR *, void *);
RPC_STRUCT_DECL (rex_sesskeydat)

template<class T> bool
rpc_traverse (T &t, rex_sesskeydat &obj)
{
  return rpc_traverse (t, obj.type)
    && rpc_traverse (t, obj.seqno)
    && rpc_traverse (t, obj.sshare)
    && rpc_traverse (t, obj.cshare);
}


#ifndef REXD_PROG
#define REXD_PROG 344424
#endif /* !REXD_PROG */
extern const rpc_program rexd_prog_1;
enum { REXD_VERS = 1 };
enum {
  REXD_NULL = 0,
  REXD_SPAWN = 1,
  REXD_ATTACH = 2,
};
#define REXD_PROG_1_APPLY_NOVOID(macro, void) \
  macro (REXD_NULL, void, void) \
  macro (REXD_SPAWN, rexd_spawn_arg, rexd_spawn_res) \
  macro (REXD_ATTACH, rexd_attach_arg, rexd_attach_res)
#define REXD_PROG_1_APPLY(macro) \
  REXD_PROG_1_APPLY_NOVOID(macro, void)


#ifndef REXCTL_PROG
#define REXCTL_PROG 344426
#endif /* !REXCTL_PROG */
extern const rpc_program rexctl_prog_1;
enum { REXCTL_VERS = 1 };
enum {
  REXCTL_NULL = 0,
  REXCTL_CONNECT = 1,
};
#define REXCTL_PROG_1_APPLY_NOVOID(macro, void) \
  macro (REXCTL_NULL, void, void) \
  macro (REXCTL_CONNECT, sfs_sessinfo, void)
#define REXCTL_PROG_1_APPLY(macro) \
  REXCTL_PROG_1_APPLY_NOVOID(macro, void)



struct rex_payload {
  u_int32_t channel;
  int32_t fd;
  rpc_bytes<RPC_INFINITY> data;
};
void *rex_payload_alloc ();
bool_t xdr_rex_payload (XDR *, void *);
RPC_STRUCT_DECL (rex_payload)

template<class T> bool
rpc_traverse (T &t, rex_payload &obj)
{
  return rpc_traverse (t, obj.channel)
    && rpc_traverse (t, obj.fd)
    && rpc_traverse (t, obj.data);
}



struct rex_mkchannel_arg {
  int32_t nfds;
  rex_cmd av;
  rex_env env;
};
void *rex_mkchannel_arg_alloc ();
bool_t xdr_rex_mkchannel_arg (XDR *, void *);
RPC_STRUCT_DECL (rex_mkchannel_arg)

template<class T> bool
rpc_traverse (T &t, rex_mkchannel_arg &obj)
{
  return rpc_traverse (t, obj.nfds)
    && rpc_traverse (t, obj.av)
    && rpc_traverse (t, obj.env);
}



struct rex_mkchannel_resok {
  u_int32_t channel;
};
void *rex_mkchannel_resok_alloc ();
bool_t xdr_rex_mkchannel_resok (XDR *, void *);
RPC_STRUCT_DECL (rex_mkchannel_resok)

template<class T> inline bool
rpc_traverse (T &t, rex_mkchannel_resok &obj)
{
  return rpc_traverse (t, obj.channel);
}



struct rex_mkchannel_res {
  const sfsstat err;
  union {
    union_entry_base _base;
    union_entry<rex_mkchannel_resok> resok;
  };

#define rpcunion_tag_rex_mkchannel_res err
#define rpcunion_switch_rex_mkchannel_res(swarg, action, voidaction, defaction) \
  switch (swarg) { \
  case SFS_OK: \
    action (rex_mkchannel_resok, resok); \
    break; \
  default: \
    voidaction; \
    break; \
  }

  rex_mkchannel_res (sfsstat _tag = (sfsstat) 0) : err (_tag)
    { _base.init (); set_err (_tag); }
  rex_mkchannel_res (const rex_mkchannel_res &_s)
    : err (_s.err)
    { _base.init (_s._base); }
  ~rex_mkchannel_res () { _base.destroy (); }
  rex_mkchannel_res &operator= (const rex_mkchannel_res &_s) {
    const_cast<sfsstat &> (err) = _s.err;
    _base.assign (_s._base);
    return *this;
  }

  void set_err (sfsstat _tag) {
    const_cast<sfsstat &> (err) = _tag;
    rpcunion_switch_rex_mkchannel_res
      (_tag, RPCUNION_SET, _base.destroy (), _base.destroy ());
  }
};

template<class T> bool
rpc_traverse (T &t, rex_mkchannel_res &obj)
{
  sfsstat tag = obj.err;
  if (!rpc_traverse (t, tag))
    return false;
  if (tag != obj.err)
    obj.set_err (tag);

  rpcunion_switch_rex_mkchannel_res
    (obj.err, RPCUNION_TRAVERSE, return true, return false);
}
inline bool
rpc_traverse (const stompcast_t &s, rex_mkchannel_res &obj)
{
  rpcunion_switch_rex_mkchannel_res
    (obj.err, RPCUNION_REC_STOMPCAST,
     obj._base.destroy (); return true, obj._base.destroy (); return true;);
}
void *rex_mkchannel_res_alloc ();
bool_t xdr_rex_mkchannel_res (XDR *, void *);
RPC_UNION_DECL (rex_mkchannel_res)



struct rex_int_arg {
  u_int32_t channel;
  int32_t val;
};
void *rex_int_arg_alloc ();
bool_t xdr_rex_int_arg (XDR *, void *);
RPC_STRUCT_DECL (rex_int_arg)

template<class T> bool
rpc_traverse (T &t, rex_int_arg &obj)
{
  return rpc_traverse (t, obj.channel)
    && rpc_traverse (t, obj.val);
}



struct rexcb_newfd_arg {
  u_int32_t channel;
  int32_t fd;
  int32_t newfd;
};
void *rexcb_newfd_arg_alloc ();
bool_t xdr_rexcb_newfd_arg (XDR *, void *);
RPC_STRUCT_DECL (rexcb_newfd_arg)

template<class T> bool
rpc_traverse (T &t, rexcb_newfd_arg &obj)
{
  return rpc_traverse (t, obj.channel)
    && rpc_traverse (t, obj.fd)
    && rpc_traverse (t, obj.newfd);
}



struct rex_setenv_arg {
  rpc_str<RPC_INFINITY> name;
  rpc_str<RPC_INFINITY> value;
};
void *rex_setenv_arg_alloc ();
bool_t xdr_rex_setenv_arg (XDR *, void *);
RPC_STRUCT_DECL (rex_setenv_arg)

template<class T> bool
rpc_traverse (T &t, rex_setenv_arg &obj)
{
  return rpc_traverse (t, obj.name)
    && rpc_traverse (t, obj.value);
}


typedef rpc_str<RPC_INFINITY> rex_unsetenv_arg;
void *rex_unsetenv_arg_alloc ();
bool_t xdr_rex_unsetenv_arg (XDR *, void *);
RPC_TYPEDEF_DECL (rex_unsetenv_arg)

#ifndef REX_PROG
#define REX_PROG 344428
#endif /* !REX_PROG */
extern const rpc_program rex_prog_1;
enum { REX_VERS = 1 };
enum {
  REX_NULL = 0,
  REX_DATA = 1,
  REX_CLOSE = 2,
  REX_KILL = 3,
  REX_MKCHANNEL = 4,
  REX_SETENV = 5,
  REX_UNSETENV = 6,
};
#define REX_PROG_1_APPLY_NOVOID(macro, void) \
  macro (REX_NULL, void, void) \
  macro (REX_DATA, rex_payload, bool) \
  macro (REX_CLOSE, rex_int_arg, bool) \
  macro (REX_KILL, rex_int_arg, bool) \
  macro (REX_MKCHANNEL, rex_mkchannel_arg, rex_mkchannel_res) \
  macro (REX_SETENV, rex_setenv_arg, bool) \
  macro (REX_UNSETENV, rex_unsetenv_arg, void)
#define REX_PROG_1_APPLY(macro) \
  REX_PROG_1_APPLY_NOVOID(macro, void)


#ifndef REXCB_PROG
#define REXCB_PROG 344429
#endif /* !REXCB_PROG */
extern const rpc_program rexcb_prog_1;
enum { REXCB_VERS = 1 };
enum {
  REXCB_NULL = 0,
  REXCB_DATA = 1,
  REXCB_NEWFD = 2,
  REXCB_EXIT = 3,
};
#define REXCB_PROG_1_APPLY_NOVOID(macro, void) \
  macro (REXCB_NULL, void, void) \
  macro (REXCB_DATA, rex_payload, bool) \
  macro (REXCB_NEWFD, rexcb_newfd_arg, bool) \
  macro (REXCB_EXIT, rex_int_arg, void)
#define REXCB_PROG_1_APPLY(macro) \
  REXCB_PROG_1_APPLY_NOVOID(macro, void)

#endif /* !__RPCC_REX_PROT_H_INCLUDED__ */
