/*
 * Copyright 2000, International Business Machines Corporation and others.
 * All Rights Reserved.
 * 
 * This software has been released under the terms of the IBM Public
 * License.  For details, see the LICENSE file in the top-level source
 * directory or online at http://www.openafs.org/dl/license10.html
 */

/*
 *                      Transarc does not currently use opcodes past 520, but
 *                      they *could* decide at any time to use more opcodes.
 *                      If they did, then one part of our local mods,
 *                      ListSupergroups, would break.  I've therefore
 *                      renumbered it to 530, and put logic in to enable the
 *                      old opcode to work (for now).
 *
 */


package PR_
prefix S
statindex 8

const PRSUCCESS=0;

const PR_MAXNAMELEN=64;
const PR_MAXGROUPS=5000;
const PR_MAXLIST=5000;
const PRSIZE=10;
const COSIZE=39;

struct prdebugentry {
	afs_int32 flags;
	afs_int32 id;
	afs_int32 cellid;
	afs_int32 next;
	afs_int32 reserved[5];
	afs_int32 entries[PRSIZE];
	afs_int32 nextID;
	afs_int32 nextname;
	afs_int32 owner;
	afs_int32 creator;
	afs_int32 ngroups;
	afs_int32 nusers;
	afs_int32 count;
	afs_int32 instance;
	afs_int32 owned;
	afs_int32 nextOwned;
	afs_int32 parent;
	afs_int32 sibling;
	afs_int32 child;
	char name[PR_MAXNAMELEN];
};

struct prcheckentry {
        afs_int32 flags;
	afs_int32 id;
	afs_int32 owner;
	afs_int32 creator;
	afs_int32 ngroups;
	afs_int32 nusers;
	afs_int32 count;
	afs_int32 reserved[5];
	char name[PR_MAXNAMELEN];
};	

struct prlistentries {
        afs_int32 flags;
	afs_int32 id;
	afs_int32 owner;
	afs_int32 creator;
	afs_int32 ngroups;
	afs_int32 nusers;
	afs_int32 count;
	afs_int32 reserved[5];
	char name[PR_MAXNAMELEN];
};	

struct PrUpdateEntry {
	afs_uint32 Mask;
        afs_int32 flags;
	afs_int32 id;
	afs_int32 owner;
	afs_int32 creator;
	afs_int32 ngroups;
	afs_int32 nusers;
	afs_int32 count;
	afs_int32 reserved[5];
	char name[PR_MAXNAMELEN];
};	

/* struct VldbUpdateEntry Mask bit values */
const	PRUPDATE_NAME	=	0x0001;
const	PRUPDATE_ID	=	0x0002;
const	PRUPDATE_FLAGS	=	0x0004;
const	PRUPDATE_NAMEHASH=	0x0008;
const	PRUPDATE_IDHASH =	0x0010;

/* These bits are used when calling SetFieldsEntry. */
%#define PR_SF_ALLBITS   0xff		/* set all access bits */
%#define PR_SF_NGROUPS (1<<31)		/* set field limiting group creation */
%#define PR_SF_NUSERS  (1<<30)		/*  "  "  foreign users  "  */

typedef char prname[PR_MAXNAMELEN];
typedef prname namelist<>;
typedef afs_int32 idlist<>;
typedef afs_int32 prlist<>;
typedef prlistentries prentries<>;

INewEntry(
  IN string name<PR_MAXNAMELEN>,
  IN afs_int32 id,
  IN afs_int32 oid
) = 500;

WhereIsIt(
  IN afs_int32 id,
  OUT afs_int32 *ps
) = 501;

DumpEntry(
  IN afs_int32 pos,
  OUT struct prdebugentry *entry
) = 502;

AddToGroup(
  IN afs_int32 uid,
  IN afs_int32 gid
) = 503;

NameToID(
  IN namelist *nlist,
  OUT idlist *ilist
) = 504;

IDToName(
  IN idlist *ilist,
  OUT namelist *nlist
) = 505;

Delete(
  IN afs_int32 id
) = 506;

RemoveFromGroup(
  IN afs_int32 id,
  IN afs_int32 gid
) = 507;

GetCPS(
  IN afs_int32 id,
  OUT prlist *elist,
  OUT afs_int32 *over
) = 508;

NewEntry(
  IN string name<PR_MAXNAMELEN>,
  afs_int32 flag,
  afs_int32 oid,
  OUT afs_int32 *id
) = 509;

ListMax(
  OUT afs_int32 *uid,
  afs_int32 *gid
) = 510;

SetMax(
  IN afs_int32 id,
  afs_int32 gflag
) = 511;

ListEntry(
  IN afs_int32 id,
  OUT struct prcheckentry *entry
) = 512;

ChangeEntry(
  IN afs_int32 id,
  IN string name<PR_MAXNAMELEN>,
  IN afs_int32 oid,
  IN afs_int32 newid
) = 513;

ListElements(
  IN afs_int32 id,
  OUT prlist *elist,
  OUT afs_int32 *over
) = 514;

IsAMemberOf(
  IN afs_int32 uid,
  IN afs_int32 gid,
  OUT afs_int32 *flag
) = 515;

SetFieldsEntry(
  IN afs_int32 id,
  IN afs_int32 mask,
  IN afs_int32 flags,
  IN afs_int32 ngroups,
  IN afs_int32 nusers,
  IN afs_int32 spare1,
  IN afs_int32 spare2
) = 516;

ListOwned(
  IN afs_int32 id,
  OUT prlist *elist,
  INOUT afs_int32 *lastp
) = 517;

GetCPS2(
  IN afs_int32 id,
  IN afs_int32 host,
  OUT prlist *elist,
  OUT afs_int32 *over
) = 518;

GetHostCPS(
  IN afs_int32 host,
  OUT prlist *elist,
  OUT afs_int32 *over
) = 519;

UpdateEntry(
  IN afs_int32 id,
  IN string name<PR_MAXNAMELEN>,
  IN PrUpdateEntry *uentry
) = 520;

ListEntries(
  IN afs_int32      flags,
  IN afs_int32      startindex,
  OUT prentries *bulkentries,
  OUT afs_int32     *nextstartindex
) = 521;

/* #if defined(SUPERGROUPS) */
ListSuperGroups(
  IN afs_int32 id,
  OUT prlist *elist,
  OUT afs_int32 *over
) = 530;
/* #endif */
