hjl / source-git / glibc

Forked from source-git/glibc 3 years ago
Clone

Blame sunrpc/rpcsvc/nlm_prot.x

Packit 6c4009
/* @(#)nlm_prot.x	2.1 88/08/01 4.0 RPCSRC */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Network lock manager protocol definition
Packit 6c4009
 * Copyright (c) 2010, Oracle America, Inc.
Packit 6c4009
 * Redistribution and use in source and binary forms, with or without
Packit 6c4009
 * modification, are permitted provided that the following conditions are
Packit 6c4009
 * met:
Packit 6c4009
 *
Packit 6c4009
 *     * Redistributions of source code must retain the above copyright
Packit 6c4009
 *       notice, this list of conditions and the following disclaimer.
Packit 6c4009
 *     * Redistributions in binary form must reproduce the above
Packit 6c4009
 *       copyright notice, this list of conditions and the following
Packit 6c4009
 *       disclaimer in the documentation and/or other materials
Packit 6c4009
 *       provided with the distribution.
Packit 6c4009
 *     * Neither the name of the "Oracle America, Inc." nor the names of its
Packit 6c4009
 *       contributors may be used to endorse or promote products derived
Packit 6c4009
 *       from this software without specific prior written permission.
Packit 6c4009
 *
Packit 6c4009
 *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 6c4009
 *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 6c4009
 *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
Packit 6c4009
 *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
Packit 6c4009
 *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
Packit 6c4009
 *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 6c4009
 *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
Packit 6c4009
 *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit 6c4009
 *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
Packit 6c4009
 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Packit 6c4009
 *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 6c4009
 *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 6c4009
 *
Packit 6c4009
 * protocol used between local lock manager and remote lock manager
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifdef RPC_HDR
Packit 6c4009
%#define LM_MAXSTRLEN	1024
Packit 6c4009
%#define MAXNAMELEN	LM_MAXSTRLEN+1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * status of a call to the lock manager
Packit 6c4009
 */
Packit 6c4009
enum nlm_stats {
Packit 6c4009
	nlm_granted = 0,
Packit 6c4009
	nlm_denied = 1,
Packit 6c4009
	nlm_denied_nolocks = 2,
Packit 6c4009
	nlm_blocked = 3,
Packit 6c4009
	nlm_denied_grace_period = 4
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct nlm_holder {
Packit 6c4009
	bool exclusive;
Packit 6c4009
	int svid;
Packit 6c4009
	netobj oh;
Packit 6c4009
	unsigned l_offset;
Packit 6c4009
	unsigned l_len;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
union nlm_testrply switch (nlm_stats stat) {
Packit 6c4009
	case nlm_denied:
Packit 6c4009
		struct nlm_holder holder;
Packit 6c4009
	default:
Packit 6c4009
		void;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct nlm_stat {
Packit 6c4009
	nlm_stats stat;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct nlm_res {
Packit 6c4009
	netobj cookie;
Packit 6c4009
	nlm_stat stat;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct nlm_testres {
Packit 6c4009
	netobj cookie;
Packit 6c4009
	nlm_testrply stat;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct nlm_lock {
Packit 6c4009
	string caller_name<LM_MAXSTRLEN>;
Packit 6c4009
	netobj fh;		/* identify a file */
Packit 6c4009
	netobj oh;		/* identify owner of a lock */
Packit 6c4009
	int svid;		/* generated from pid for svid */
Packit 6c4009
	unsigned l_offset;
Packit 6c4009
	unsigned l_len;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct nlm_lockargs {
Packit 6c4009
	netobj cookie;
Packit 6c4009
	bool block;
Packit 6c4009
	bool exclusive;
Packit 6c4009
	struct nlm_lock alock;
Packit 6c4009
	bool reclaim;		/* used for recovering locks */
Packit 6c4009
	int state;		/* specify local status monitor state */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct nlm_cancargs {
Packit 6c4009
	netobj cookie;
Packit 6c4009
	bool block;
Packit 6c4009
	bool exclusive;
Packit 6c4009
	struct nlm_lock alock;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct nlm_testargs {
Packit 6c4009
	netobj cookie;
Packit 6c4009
	bool exclusive;
Packit 6c4009
	struct nlm_lock alock;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct nlm_unlockargs {
Packit 6c4009
	netobj cookie;
Packit 6c4009
	struct nlm_lock alock;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
#ifdef RPC_HDR
Packit 6c4009
%/*
Packit 6c4009
% * The following enums are actually bit encoded for efficient
Packit 6c4009
% * boolean algebra.... DON'T change them.....
Packit 6c4009
% */
Packit 6c4009
#endif
Packit 6c4009
enum	fsh_mode {
Packit 6c4009
	fsm_DN  = 0,	/* deny none */
Packit 6c4009
	fsm_DR  = 1,	/* deny read */
Packit 6c4009
	fsm_DW  = 2,	/* deny write */
Packit 6c4009
	fsm_DRW = 3	/* deny read/write */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
enum	fsh_access {
Packit 6c4009
	fsa_NONE = 0,	/* for completeness */
Packit 6c4009
	fsa_R    = 1,	/* read only */
Packit 6c4009
	fsa_W    = 2,	/* write only */
Packit 6c4009
	fsa_RW   = 3	/* read/write */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct	nlm_share {
Packit 6c4009
	string caller_name<LM_MAXSTRLEN>;
Packit 6c4009
	netobj	fh;
Packit 6c4009
	netobj	oh;
Packit 6c4009
	fsh_mode	mode;
Packit 6c4009
	fsh_access	access;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct	nlm_shareargs {
Packit 6c4009
	netobj	cookie;
Packit 6c4009
	nlm_share	share;
Packit 6c4009
	bool	reclaim;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct	nlm_shareres {
Packit 6c4009
	netobj	cookie;
Packit 6c4009
	nlm_stats	stat;
Packit 6c4009
	int	sequence;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct	nlm_notify {
Packit 6c4009
	string name<MAXNAMELEN>;
Packit 6c4009
	long state;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Over-the-wire protocol used between the network lock managers
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
program NLM_PROG {
Packit 6c4009
	version NLM_VERS {
Packit 6c4009
Packit 6c4009
		nlm_testres	NLM_TEST(struct nlm_testargs) =	1;
Packit 6c4009
Packit 6c4009
		nlm_res		NLM_LOCK(struct nlm_lockargs) =	2;
Packit 6c4009
Packit 6c4009
		nlm_res		NLM_CANCEL(struct nlm_cancargs) = 3;
Packit 6c4009
		nlm_res		NLM_UNLOCK(struct nlm_unlockargs) =	4;
Packit 6c4009
Packit 6c4009
		/*
Packit 6c4009
		 * remote lock manager call-back to grant lock
Packit 6c4009
		 */
Packit 6c4009
		nlm_res		NLM_GRANTED(struct nlm_testargs)= 5;
Packit 6c4009
		/*
Packit 6c4009
		 * message passing style of requesting lock
Packit 6c4009
		 */
Packit 6c4009
		void		NLM_TEST_MSG(struct nlm_testargs) = 6;
Packit 6c4009
		void		NLM_LOCK_MSG(struct nlm_lockargs) = 7;
Packit 6c4009
		void		NLM_CANCEL_MSG(struct nlm_cancargs) =8;
Packit 6c4009
		void		NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
Packit 6c4009
		void		NLM_GRANTED_MSG(struct nlm_testargs) = 10;
Packit 6c4009
		void		NLM_TEST_RES(nlm_testres) = 11;
Packit 6c4009
		void		NLM_LOCK_RES(nlm_res) = 12;
Packit 6c4009
		void		NLM_CANCEL_RES(nlm_res) = 13;
Packit 6c4009
		void		NLM_UNLOCK_RES(nlm_res) = 14;
Packit 6c4009
		void		NLM_GRANTED_RES(nlm_res) = 15;
Packit 6c4009
	} = 1;
Packit 6c4009
Packit 6c4009
	version NLM_VERSX {
Packit 6c4009
		nlm_shareres	NLM_SHARE(nlm_shareargs) = 20;
Packit 6c4009
		nlm_shareres	NLM_UNSHARE(nlm_shareargs) = 21;
Packit 6c4009
		nlm_res		NLM_NM_LOCK(nlm_lockargs) = 22;
Packit 6c4009
		void		NLM_FREE_ALL(nlm_notify) = 23;
Packit 6c4009
	} = 3;
Packit 6c4009
Packit 6c4009
} = 100021;