#ifndef _Qlib_h
#define _Qlib_h

#include <afs/prs_fs.h>
#include "libq_et.h"

/*
 * This is really, really gross.  But it's needed to allow these
 * programs to be compiled with a C compiler that has an ANSI C
 * preprocessor.  If the C compiler has an ANSI C preprocessor, then
 * ANSI_CPP should be set the Makefile.
 */

#ifdef ANSI_CPP
#undef _VICEIOCTL
#define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl))
#endif

/*
 * This resolves a difference in oppinions between <sys/dir.h> type
 * declarations onvarious platforms.
 */

#if defined(_AIX)
#define Q_DIR_ENTRY struct dirent
#else
#define Q_DIR_ENTRY struct direct
#endif

/* ACL specials */

#define AFS_ACL_READ (PRSFS_READ | PRSFS_LOOKUP)
#define AFS_ACL_WRITE (AFS_ACL_READ | PRSFS_WRITE \
		       | PRSFS_INSERT | PRSFS_LOCK | PRSFS_DELETE)
#define AFS_ACL_MAIL (PRSFS_INSERT | PRSFS_LOOKUP | PRSFS_LOCK)
#define AFS_ACL_ALL (AFS_ACL_WRITE | PRSFS_ADMINISTER)

#define AFSMAXSIZE 2048 /* maximum buffer size used in AFS */
#define AFSMAXNAME 100  /* maximum length of an AFS group name */
#define AFSMAXACL  20   /* maximum length of AFS acl rights string */

/* possible filesystems */

#define ON_UFS 0
#define ON_NFS 1
#define ON_AFS 2

typedef struct
{
  char name[AFSMAXNAME];  /* ckclark, system:anyuser, etc. */
  long bits;              /* rliwdka bits defined in <afs/prs_fs.h> */
} AFS_acl_entry;

typedef struct 
{
  int num_pos;  /* number of positive entries in acl */
  int num_neg;  /* number of negative entries in acl */
  AFS_acl_entry *pos_entries;
  AFS_acl_entry *neg_entries;
} AFS_acl;

typedef struct
{
  unsigned short type;     /* one of ON_AFS, ON_NFS, or ON_UFS */
  int num_members;         /* number of members in the group */
  char **members;          /* members */
} Group;

extern int q_initialized;

typedef char** Files;

#include "qproto.h"

#endif  /* _Qlib_h */
