nlm_prot.x revision 1.4 1 1.1 jtc /*
2 1.1 jtc * Network lock manager protocol definition
3 1.1 jtc * Copyright (C) 1986 Sun Microsystems, Inc.
4 1.1 jtc *
5 1.1 jtc * protocol used between local lock manager and remote lock manager
6 1.1 jtc */
7 1.1 jtc
8 1.1 jtc #ifdef RPC_HDR
9 1.1 jtc %#define LM_MAXSTRLEN 1024
10 1.1 jtc %#define MAXNAMELEN LM_MAXSTRLEN+1
11 1.1 jtc #else
12 1.3 lukem %#include <sys/cdefs.h>
13 1.1 jtc %#ifndef lint
14 1.1 jtc %/*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
15 1.1 jtc %/*static char sccsid[] = "from: * @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
16 1.4 simonb %__RCSID("$NetBSD: nlm_prot.x,v 1.4 1999/07/02 15:44:13 simonb Exp $");
17 1.1 jtc %#endif /* not lint */
18 1.1 jtc #endif
19 1.1 jtc
20 1.1 jtc /*
21 1.1 jtc * status of a call to the lock manager
22 1.1 jtc */
23 1.1 jtc enum nlm_stats {
24 1.1 jtc nlm_granted = 0,
25 1.1 jtc nlm_denied = 1,
26 1.1 jtc nlm_denied_nolocks = 2,
27 1.1 jtc nlm_blocked = 3,
28 1.1 jtc nlm_denied_grace_period = 4
29 1.1 jtc };
30 1.1 jtc
31 1.1 jtc struct nlm_holder {
32 1.1 jtc bool exclusive;
33 1.1 jtc int svid;
34 1.1 jtc netobj oh;
35 1.1 jtc unsigned l_offset;
36 1.1 jtc unsigned l_len;
37 1.1 jtc };
38 1.1 jtc
39 1.1 jtc union nlm_testrply switch (nlm_stats stat) {
40 1.1 jtc case nlm_denied:
41 1.1 jtc struct nlm_holder holder;
42 1.1 jtc default:
43 1.1 jtc void;
44 1.1 jtc };
45 1.1 jtc
46 1.1 jtc struct nlm_stat {
47 1.1 jtc nlm_stats stat;
48 1.1 jtc };
49 1.1 jtc
50 1.1 jtc struct nlm_res {
51 1.1 jtc netobj cookie;
52 1.1 jtc nlm_stat stat;
53 1.1 jtc };
54 1.1 jtc
55 1.1 jtc struct nlm_testres {
56 1.1 jtc netobj cookie;
57 1.1 jtc nlm_testrply stat;
58 1.1 jtc };
59 1.1 jtc
60 1.1 jtc struct nlm_lock {
61 1.1 jtc string caller_name<LM_MAXSTRLEN>;
62 1.1 jtc netobj fh; /* identify a file */
63 1.1 jtc netobj oh; /* identify owner of a lock */
64 1.1 jtc int svid; /* generated from pid for svid */
65 1.1 jtc unsigned l_offset;
66 1.1 jtc unsigned l_len;
67 1.1 jtc };
68 1.1 jtc
69 1.1 jtc struct nlm_lockargs {
70 1.1 jtc netobj cookie;
71 1.1 jtc bool block;
72 1.1 jtc bool exclusive;
73 1.1 jtc struct nlm_lock alock;
74 1.1 jtc bool reclaim; /* used for recovering locks */
75 1.1 jtc int state; /* specify local status monitor state */
76 1.1 jtc };
77 1.1 jtc
78 1.1 jtc struct nlm_cancargs {
79 1.4 simonb netobj cookie;
80 1.1 jtc bool block;
81 1.1 jtc bool exclusive;
82 1.1 jtc struct nlm_lock alock;
83 1.1 jtc };
84 1.1 jtc
85 1.1 jtc struct nlm_testargs {
86 1.4 simonb netobj cookie;
87 1.1 jtc bool exclusive;
88 1.1 jtc struct nlm_lock alock;
89 1.1 jtc };
90 1.1 jtc
91 1.1 jtc struct nlm_unlockargs {
92 1.4 simonb netobj cookie;
93 1.1 jtc struct nlm_lock alock;
94 1.1 jtc };
95 1.1 jtc
96 1.1 jtc
97 1.1 jtc #ifdef RPC_HDR
98 1.1 jtc %/*
99 1.1 jtc % * The following enums are actually bit encoded for efficient
100 1.1 jtc % * boolean algebra.... DON'T change them.....
101 1.1 jtc % */
102 1.1 jtc #endif
103 1.1 jtc enum fsh_mode {
104 1.1 jtc fsm_DN = 0, /* deny none */
105 1.1 jtc fsm_DR = 1, /* deny read */
106 1.1 jtc fsm_DW = 2, /* deny write */
107 1.1 jtc fsm_DRW = 3 /* deny read/write */
108 1.1 jtc };
109 1.1 jtc
110 1.1 jtc enum fsh_access {
111 1.1 jtc fsa_NONE = 0, /* for completeness */
112 1.1 jtc fsa_R = 1, /* read only */
113 1.1 jtc fsa_W = 2, /* write only */
114 1.1 jtc fsa_RW = 3 /* read/write */
115 1.1 jtc };
116 1.1 jtc
117 1.1 jtc struct nlm_share {
118 1.1 jtc string caller_name<LM_MAXSTRLEN>;
119 1.1 jtc netobj fh;
120 1.1 jtc netobj oh;
121 1.1 jtc fsh_mode mode;
122 1.1 jtc fsh_access access;
123 1.1 jtc };
124 1.1 jtc
125 1.1 jtc struct nlm_shareargs {
126 1.1 jtc netobj cookie;
127 1.1 jtc nlm_share share;
128 1.1 jtc bool reclaim;
129 1.1 jtc };
130 1.1 jtc
131 1.1 jtc struct nlm_shareres {
132 1.1 jtc netobj cookie;
133 1.1 jtc nlm_stats stat;
134 1.1 jtc int sequence;
135 1.1 jtc };
136 1.1 jtc
137 1.1 jtc struct nlm_notify {
138 1.1 jtc string name<MAXNAMELEN>;
139 1.1 jtc long state;
140 1.1 jtc };
141 1.1 jtc
142 1.1 jtc /*
143 1.1 jtc * Over-the-wire protocol used between the network lock managers
144 1.1 jtc */
145 1.1 jtc
146 1.1 jtc program NLM_PROG {
147 1.1 jtc version NLM_VERS {
148 1.1 jtc
149 1.1 jtc nlm_testres NLM_TEST(struct nlm_testargs) = 1;
150 1.1 jtc
151 1.1 jtc nlm_res NLM_LOCK(struct nlm_lockargs) = 2;
152 1.1 jtc
153 1.1 jtc nlm_res NLM_CANCEL(struct nlm_cancargs) = 3;
154 1.1 jtc nlm_res NLM_UNLOCK(struct nlm_unlockargs) = 4;
155 1.1 jtc
156 1.1 jtc /*
157 1.1 jtc * remote lock manager call-back to grant lock
158 1.1 jtc */
159 1.1 jtc nlm_res NLM_GRANTED(struct nlm_testargs)= 5;
160 1.1 jtc /*
161 1.1 jtc * message passing style of requesting lock
162 1.1 jtc */
163 1.1 jtc void NLM_TEST_MSG(struct nlm_testargs) = 6;
164 1.1 jtc void NLM_LOCK_MSG(struct nlm_lockargs) = 7;
165 1.1 jtc void NLM_CANCEL_MSG(struct nlm_cancargs) =8;
166 1.1 jtc void NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
167 1.1 jtc void NLM_GRANTED_MSG(struct nlm_testargs) = 10;
168 1.1 jtc void NLM_TEST_RES(nlm_testres) = 11;
169 1.1 jtc void NLM_LOCK_RES(nlm_res) = 12;
170 1.1 jtc void NLM_CANCEL_RES(nlm_res) = 13;
171 1.1 jtc void NLM_UNLOCK_RES(nlm_res) = 14;
172 1.1 jtc void NLM_GRANTED_RES(nlm_res) = 15;
173 1.1 jtc } = 1;
174 1.1 jtc
175 1.1 jtc version NLM_VERSX {
176 1.1 jtc nlm_shareres NLM_SHARE(nlm_shareargs) = 20;
177 1.1 jtc nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21;
178 1.1 jtc nlm_res NLM_NM_LOCK(nlm_lockargs) = 22;
179 1.1 jtc void NLM_FREE_ALL(nlm_notify) = 23;
180 1.1 jtc } = 3;
181 1.1 jtc
182 1.1 jtc } = 100021;
183 1.1 jtc
184