/*= -*- c-file-style: "linux"; indent-tabs-mode: t; -*-
 *
 * n4: A fast userspace NFSv4 server.
 * $Id: nfs4.h,v 1.8 2001/07/20 07:41:32 mbp Exp $
 * 
 * Copyright (C) 2001 by Martin Pool <mbp@samba.org>
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

enum {
    NFSPROC4_NULL = 0,
    NFSPROC4_COMPOUND = 1
};

enum {
    NFS4_VERSION = 4
};

enum {
    NFS4_MINOR0 = 0
};

enum {
    NFS_PROGRAM = 100003
};

enum {
    NFS4_FHSIZE               = 128
};

enum {
	NFS4_SET_TO_SERVER_TIME = 0,
	NFS4_SET_TO_CLIENT_TIME = 1
};


typedef guint64        nfs_cookie4;
typedef guint64        nfs_verifier4;

typedef guint32        nfs_count4;
/**< Various count parameters (READ, WRITE, COMMIT) */

extern const nfs_verifier4 N4_NULL_VERIFIER4;
extern const nfs_cookie4 N4_NULL_COOKIE;
extern const guint32 N4_SUGGESTED_MAX;

typedef uint64_t                offset4_t;
typedef uint64_t                stateid4_t;
typedef uint32_t                count4_t;

/*
 * Values for fattr4_fh_expire_type
 */
#define FH4_PERSISTENT          0x00000000
#define FH4_NOEXPIRE_WITH_OPEN  0x00000001
#define FH4_VOLATILE_ANY        0x00000002
#define FH4_VOL_MIGRATION       0x00000004
#define FH4_VOL_RENAME          0x00000008

// All of the attribute bits can fit into a single uint64_t, since
// there's only 55 of them.
typedef uint64_t                fattrbits_t;

typedef uint64_t n4attrmask_t;

typedef enum n4ftype  n4ftype_t;

/** FSID structure for major/minor **/
typedef struct n4fsid {
	uint64_t        major;
	uint64_t        minor;
} n4fsid_t;

/**
 * NFS4 representation of time since the epoch.
 **/
struct n4nfstime {
	int64_t seconds;
	uint32_t nseconds;
};


/**
 * Used when setting the timestamp on a file.  If \p set_how is TRUE,
 * then \p time is ignored and the current server time is set.
 * Otherwise \p time is used.
 **/
struct n4settime {
	bool_t			set_how;
	struct n4nfstime	time;
};
