/*
 * Please do not edit this file.
 * It was generated using rpcgen.
 */

#ifndef _METAMED_H_RPCGEN
#define	_METAMED_H_RPCGEN

#include <rpc/rpc.h>
#ifndef _KERNEL
#ifdef _REENTRANT
#include <synch.h>
#endif	/* _REENTRANT */
#ifdef _REENTRANT
#include <thread.h>
#endif	/* _REENTRANT */
#endif /* !_KERNEL */

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#pragma ident	"@(#)metamed.x	2.6	04/03/12 SMI"

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/utsname.h>

#include <sys/lvm/md_basic.h>

/*
 * mediator (med) errors, definition of MDE_MED_HOSTNOMED must be changed
 * when new errors are added, since MDE_MED_NOERROR has to come out to
 * be zero!
 */

enum md_med_errno_t {
	MDE_MED_HOSTNOMED = -16,
	MDE_MED_DBNOTINIT = -16 + 1,
	MDE_MED_DBSZBAD = -16 + 2,
	MDE_MED_DBKEYADDFAIL = -16 + 3,
	MDE_MED_DBKEYDELFAIL = -16 + 4,
	MDE_MED_DBHDRSZBAD = -16 + 5,
	MDE_MED_DBHDRMAGBAD = -16 + 6,
	MDE_MED_DBHDRREVBAD = -16 + 7,
	MDE_MED_DBHDRCKSBAD = -16 + 8,
	MDE_MED_DBRECSZBAD = -16 + 9,
	MDE_MED_DBRECMAGBAD = -16 + 10,
	MDE_MED_DBRECREVBAD = -16 + 11,
	MDE_MED_DBRECCKSBAD = -16 + 12,
	MDE_MED_DBRECOFFBAD = -16 + 13,
	MDE_MED_DBRECNOENT = -16 + 14,
	MDE_MED_DBARGSMISMATCH = -16 + 15,
	MDE_MED_NOERROR = -16 + 16
};
typedef enum md_med_errno_t md_med_errno_t;

struct med_err_t {
	int med_errno;
	char *med_node;
	char *med_misc;
};
typedef struct med_err_t med_err_t;

/*
 * Null error structure initializer.
 */
#define	MED_NULL_ERR	{ 0, NULL, NULL }
#define	MD_MED_DEF_TO	{2, 0}		/* 2 seconds */
#define	MD_MED_PMAP_TO	{5, 0}		/* 5 seconds */

/*
 * Mediator Magic Number and Data Revision String
 */
#define	MED_DATA_MAGIC	0x6d656461
#define	MED_DATA_REV	0x10000000

#define	MED_REC_MAGIC	0x6d657265
#define	MED_REC_REV	0x10000000

#define	MED_DB_MAGIC	0x6d656462
#define	MED_DB_REV	0x10000000

#define	METAETCDIR	"/etc/lvm/"
#define	MED_DB_FILE	METAETCDIR ## "meddb"

extern	char	*med_errnum_to_str(int errnum);
/* Mediator records in MN diskset have all callers set to multiowner */
#define	MED_MN_CALLER	"multiowner"


struct med_db_hdr_t {
	u_int med_dbh_mag;
	u_int med_dbh_rev;
	u_int med_dbh_cks;
	u_int med_dbh_nm;
};
typedef struct med_db_hdr_t med_db_hdr_t;

/*
 * Flags for the mediator data
 */

#define	MED_DFL_GOLDEN		0x0001
#define	MED_DFL_ERROR		0x0002



struct med_data_t {
	u_int med_dat_mag;
	u_int med_dat_rev;
	u_int med_dat_cks;
	u_int med_dat_fl;
	u_int med_dat_cc;
	set_t med_dat_sn;
	struct timeval med_dat_id;
	int med_dat_spare;
};
typedef struct med_data_t med_data_t;

/*
 * List of mediator data
 */


struct med_data_lst_t {
	struct med_data_lst_t *mdl_nx;
	med_data_t *mdl_med;
};
typedef struct med_data_lst_t med_data_lst_t;

/*
 * Flags for the mediator record
 */

#define	MED_RFL_DEL		0x0001



struct med_med_t {
	set_t med_setno;
	char *med_setname;
	char *med_caller;
};
typedef struct med_med_t med_med_t;

struct med_args_t {
	med_med_t med;
};
typedef struct med_args_t med_args_t;

struct med_res_t {
	med_err_t med_status;
	med_med_t med;
};
typedef struct med_res_t med_res_t;

struct med_get_data_res_t {
	med_err_t med_status;
	med_data_t med_data;
};
typedef struct med_get_data_res_t med_get_data_res_t;

struct med_upd_data_args_t {
	med_med_t med;
	med_data_t med_data;
};
typedef struct med_upd_data_args_t med_upd_data_args_t;

struct med_hnm_res_t {
	med_err_t med_status;
	char *med_hnm;
};
typedef struct med_hnm_res_t med_hnm_res_t;

/*
 * External reference to constant null error struct. (declared in med_xdr.c)
 */
extern	const	med_err_t		med_null_err;
extern	const	struct	timeval		md_med_def_timeout;
extern	const	struct	timeval		md_med_pmap_timeout;

/*
 * Some useful defines
 */
#define	MED_SERVNAME	"rpc.metamedd"
#define	MED_SVC		"metamed"

/*
 * authorization info
 */
#define	MED_GID 14

extern	int		upd_med_hosts(md_hi_arr_t *mp, char *setname,
			    med_data_t *meddp, char *caller);
extern	med_data_lst_t 	*get_med_host_data(md_hi_arr_t *mp, char *setname, 
			    set_t setno);

#define	MED_PROG	100242
#define	MED_VERS	1

#if defined(__STDC__) || defined(__cplusplus)
#define	MED_NULL	0
extern  enum clnt_stat med_null_1(void *, med_err_t *, CLIENT *);
extern  bool_t med_null_1_svc(void *, med_err_t *, struct svc_req *);
#define	MED_UPD_DATA	1
extern  enum clnt_stat med_upd_data_1(med_upd_data_args_t *, med_err_t *, CLIENT *);
extern  bool_t med_upd_data_1_svc(med_upd_data_args_t *, med_err_t *, struct svc_req *);
#define	MED_GET_DATA	2
extern  enum clnt_stat med_get_data_1(med_args_t *, med_get_data_res_t *, CLIENT *);
extern  bool_t med_get_data_1_svc(med_args_t *, med_get_data_res_t *, struct svc_req *);
#define	MED_HOSTNAME	5
extern  enum clnt_stat med_hostname_1(void *, med_hnm_res_t *, CLIENT *);
extern  bool_t med_hostname_1_svc(void *, med_hnm_res_t *, struct svc_req *);
extern int med_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);

#else /* K&R C */
#define	MED_NULL	0
extern  enum clnt_stat med_null_1();
extern  bool_t med_null_1_svc();
#define	MED_UPD_DATA	1
extern  enum clnt_stat med_upd_data_1();
extern  bool_t med_upd_data_1_svc();
#define	MED_GET_DATA	2
extern  enum clnt_stat med_get_data_1();
extern  bool_t med_get_data_1_svc();
#define	MED_HOSTNAME	5
extern  enum clnt_stat med_hostname_1();
extern  bool_t med_hostname_1_svc();
extern int med_prog_1_freeresult();
#endif /* K&R C */

/* the xdr functions */

#if defined(__STDC__) || defined(__cplusplus)
extern  bool_t xdr_md_med_errno_t(XDR *, md_med_errno_t*);
extern  bool_t xdr_med_err_t(XDR *, med_err_t*);
extern  bool_t xdr_med_db_hdr_t(XDR *, med_db_hdr_t*);
extern  bool_t xdr_med_data_t(XDR *, med_data_t*);
extern  bool_t xdr_med_data_lst_t(XDR *, med_data_lst_t*);
extern  bool_t xdr_med_med_t(XDR *, med_med_t*);
extern  bool_t xdr_med_args_t(XDR *, med_args_t*);
extern  bool_t xdr_med_res_t(XDR *, med_res_t*);
extern  bool_t xdr_med_get_data_res_t(XDR *, med_get_data_res_t*);
extern  bool_t xdr_med_upd_data_args_t(XDR *, med_upd_data_args_t*);
extern  bool_t xdr_med_hnm_res_t(XDR *, med_hnm_res_t*);

#else /* K&R C */
extern bool_t xdr_md_med_errno_t();
extern bool_t xdr_med_err_t();
extern bool_t xdr_med_db_hdr_t();
extern bool_t xdr_med_data_t();
extern bool_t xdr_med_data_lst_t();
extern bool_t xdr_med_med_t();
extern bool_t xdr_med_args_t();
extern bool_t xdr_med_res_t();
extern bool_t xdr_med_get_data_res_t();
extern bool_t xdr_med_upd_data_args_t();
extern bool_t xdr_med_hnm_res_t();

#endif /* K&R C */

#ifdef __cplusplus
}
#endif

#endif /* !_METAMED_H_RPCGEN */
