@jsonjoy.com/json-pack 1.16.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/nfs/v3/FullNfsv3Encoder.d.ts +28 -0
- package/lib/nfs/v3/FullNfsv3Encoder.js +73 -0
- package/lib/nfs/v3/FullNfsv3Encoder.js.map +1 -0
- package/lib/nfs/v3/Nfsv3Decoder.d.ts +78 -0
- package/lib/nfs/v3/Nfsv3Decoder.js +757 -0
- package/lib/nfs/v3/Nfsv3Decoder.js.map +1 -0
- package/lib/nfs/v3/Nfsv3Encoder.d.ts +80 -0
- package/lib/nfs/v3/Nfsv3Encoder.js +669 -0
- package/lib/nfs/v3/Nfsv3Encoder.js.map +1 -0
- package/lib/nfs/v3/constants.d.ts +115 -0
- package/lib/nfs/v3/constants.js +3 -0
- package/lib/nfs/v3/constants.js.map +1 -0
- package/lib/nfs/v3/errors.d.ts +6 -0
- package/lib/nfs/v3/errors.js +16 -0
- package/lib/nfs/v3/errors.js.map +1 -0
- package/lib/nfs/v3/index.d.ts +6 -0
- package/lib/nfs/v3/index.js +10 -0
- package/lib/nfs/v3/index.js.map +1 -0
- package/lib/nfs/v3/locks/NlmDecoder.d.ts +33 -0
- package/lib/nfs/v3/locks/NlmDecoder.js +209 -0
- package/lib/nfs/v3/locks/NlmDecoder.js.map +1 -0
- package/lib/nfs/v3/locks/NlmEncoder.d.ts +35 -0
- package/lib/nfs/v3/locks/NlmEncoder.js +182 -0
- package/lib/nfs/v3/locks/NlmEncoder.js.map +1 -0
- package/lib/nfs/v3/locks/constants.d.ts +39 -0
- package/lib/nfs/v3/locks/constants.js +3 -0
- package/lib/nfs/v3/locks/constants.js.map +1 -0
- package/lib/nfs/v3/locks/messages.d.ts +96 -0
- package/lib/nfs/v3/locks/messages.js +130 -0
- package/lib/nfs/v3/locks/messages.js.map +1 -0
- package/lib/nfs/v3/locks/structs.d.ts +31 -0
- package/lib/nfs/v3/locks/structs.js +42 -0
- package/lib/nfs/v3/locks/structs.js.map +1 -0
- package/lib/nfs/v3/messages.d.ts +460 -0
- package/lib/nfs/v3/messages.js +619 -0
- package/lib/nfs/v3/messages.js.map +1 -0
- package/lib/nfs/v3/mount/MountDecoder.d.ts +21 -0
- package/lib/nfs/v3/mount/MountDecoder.js +135 -0
- package/lib/nfs/v3/mount/MountDecoder.js.map +1 -0
- package/lib/nfs/v3/mount/MountEncoder.d.ts +23 -0
- package/lib/nfs/v3/mount/MountEncoder.js +125 -0
- package/lib/nfs/v3/mount/MountEncoder.js.map +1 -0
- package/lib/nfs/v3/mount/constants.d.ts +27 -0
- package/lib/nfs/v3/mount/constants.js +3 -0
- package/lib/nfs/v3/mount/constants.js.map +1 -0
- package/lib/nfs/v3/mount/messages.d.ts +37 -0
- package/lib/nfs/v3/mount/messages.js +51 -0
- package/lib/nfs/v3/mount/messages.js.map +1 -0
- package/lib/nfs/v3/mount/structs.d.ts +22 -0
- package/lib/nfs/v3/mount/structs.js +33 -0
- package/lib/nfs/v3/mount/structs.js.map +1 -0
- package/lib/nfs/v3/structs.d.ts +156 -0
- package/lib/nfs/v3/structs.js +210 -0
- package/lib/nfs/v3/structs.js.map +1 -0
- package/lib/rpc/errors.js +4 -4
- package/lib/rpc/errors.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Nfsv3Encoder = void 0;
|
|
4
|
+
const Writer_1 = require("@jsonjoy.com/util/lib/buffers/Writer");
|
|
5
|
+
const XdrEncoder_1 = require("../../xdr/XdrEncoder");
|
|
6
|
+
const errors_1 = require("./errors");
|
|
7
|
+
class Nfsv3Encoder {
|
|
8
|
+
constructor(writer = new Writer_1.Writer()) {
|
|
9
|
+
this.writer = writer;
|
|
10
|
+
this.xdr = new XdrEncoder_1.XdrEncoder(writer);
|
|
11
|
+
}
|
|
12
|
+
encodeMessage(message, proc, isRequest) {
|
|
13
|
+
if (isRequest)
|
|
14
|
+
this.writeRequest(message, proc);
|
|
15
|
+
else
|
|
16
|
+
this.writeResponse(message, proc);
|
|
17
|
+
return this.writer.flush();
|
|
18
|
+
}
|
|
19
|
+
writeMessage(message, proc, isRequest) {
|
|
20
|
+
if (isRequest)
|
|
21
|
+
this.writeRequest(message, proc);
|
|
22
|
+
else
|
|
23
|
+
this.writeResponse(message, proc);
|
|
24
|
+
}
|
|
25
|
+
writeRequest(request, proc) {
|
|
26
|
+
switch (proc) {
|
|
27
|
+
case 1:
|
|
28
|
+
return this.writeGetattrRequest(request);
|
|
29
|
+
case 2:
|
|
30
|
+
return this.writeSetattrRequest(request);
|
|
31
|
+
case 3:
|
|
32
|
+
return this.writeLookupRequest(request);
|
|
33
|
+
case 4:
|
|
34
|
+
return this.writeAccessRequest(request);
|
|
35
|
+
case 5:
|
|
36
|
+
return this.writeReadlinkRequest(request);
|
|
37
|
+
case 6:
|
|
38
|
+
return this.writeReadRequest(request);
|
|
39
|
+
case 7:
|
|
40
|
+
return this.writeWriteRequest(request);
|
|
41
|
+
case 8:
|
|
42
|
+
return this.writeCreateRequest(request);
|
|
43
|
+
case 9:
|
|
44
|
+
return this.writeMkdirRequest(request);
|
|
45
|
+
case 10:
|
|
46
|
+
return this.writeSymlinkRequest(request);
|
|
47
|
+
case 11:
|
|
48
|
+
return this.writeMknodRequest(request);
|
|
49
|
+
case 12:
|
|
50
|
+
return this.writeRemoveRequest(request);
|
|
51
|
+
case 13:
|
|
52
|
+
return this.writeRmdirRequest(request);
|
|
53
|
+
case 14:
|
|
54
|
+
return this.writeRenameRequest(request);
|
|
55
|
+
case 15:
|
|
56
|
+
return this.writeLinkRequest(request);
|
|
57
|
+
case 16:
|
|
58
|
+
return this.writeReaddirRequest(request);
|
|
59
|
+
case 17:
|
|
60
|
+
return this.writeReaddirplusRequest(request);
|
|
61
|
+
case 18:
|
|
62
|
+
return this.writeFsstatRequest(request);
|
|
63
|
+
case 19:
|
|
64
|
+
return this.writeFsinfoRequest(request);
|
|
65
|
+
case 20:
|
|
66
|
+
return this.writePathconfRequest(request);
|
|
67
|
+
case 21:
|
|
68
|
+
return this.writeCommitRequest(request);
|
|
69
|
+
default:
|
|
70
|
+
throw new errors_1.Nfsv3EncodingError(`Unknown procedure: ${proc}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
writeResponse(response, proc) {
|
|
74
|
+
switch (proc) {
|
|
75
|
+
case 1:
|
|
76
|
+
return this.writeGetattrResponse(response);
|
|
77
|
+
case 2:
|
|
78
|
+
return this.writeSetattrResponse(response);
|
|
79
|
+
case 3:
|
|
80
|
+
return this.writeLookupResponse(response);
|
|
81
|
+
case 4:
|
|
82
|
+
return this.writeAccessResponse(response);
|
|
83
|
+
case 5:
|
|
84
|
+
return this.writeReadlinkResponse(response);
|
|
85
|
+
case 6:
|
|
86
|
+
return this.writeReadResponse(response);
|
|
87
|
+
case 7:
|
|
88
|
+
return this.writeWriteResponse(response);
|
|
89
|
+
case 8:
|
|
90
|
+
return this.writeCreateResponse(response);
|
|
91
|
+
case 9:
|
|
92
|
+
return this.writeMkdirResponse(response);
|
|
93
|
+
case 10:
|
|
94
|
+
return this.writeSymlinkResponse(response);
|
|
95
|
+
case 11:
|
|
96
|
+
return this.writeMknodResponse(response);
|
|
97
|
+
case 12:
|
|
98
|
+
return this.writeRemoveResponse(response);
|
|
99
|
+
case 13:
|
|
100
|
+
return this.writeRmdirResponse(response);
|
|
101
|
+
case 14:
|
|
102
|
+
return this.writeRenameResponse(response);
|
|
103
|
+
case 15:
|
|
104
|
+
return this.writeLinkResponse(response);
|
|
105
|
+
case 16:
|
|
106
|
+
return this.writeReaddirResponse(response);
|
|
107
|
+
case 17:
|
|
108
|
+
return this.writeReaddirplusResponse(response);
|
|
109
|
+
case 18:
|
|
110
|
+
return this.writeFsstatResponse(response);
|
|
111
|
+
case 19:
|
|
112
|
+
return this.writeFsinfoResponse(response);
|
|
113
|
+
case 20:
|
|
114
|
+
return this.writePathconfResponse(response);
|
|
115
|
+
case 21:
|
|
116
|
+
return this.writeCommitResponse(response);
|
|
117
|
+
default:
|
|
118
|
+
throw new errors_1.Nfsv3EncodingError(`Unknown procedure: ${proc}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
writeFh(fh) {
|
|
122
|
+
const data = fh.data.uint8;
|
|
123
|
+
this.xdr.writeVarlenOpaque(data);
|
|
124
|
+
}
|
|
125
|
+
writeFilename(filename) {
|
|
126
|
+
this.xdr.writeStr(filename);
|
|
127
|
+
}
|
|
128
|
+
writeTime(time) {
|
|
129
|
+
const xdr = this.xdr;
|
|
130
|
+
xdr.writeUnsignedInt(time.seconds);
|
|
131
|
+
xdr.writeUnsignedInt(time.nseconds);
|
|
132
|
+
}
|
|
133
|
+
writeSpecData(spec) {
|
|
134
|
+
const xdr = this.xdr;
|
|
135
|
+
xdr.writeUnsignedInt(spec.specdata1);
|
|
136
|
+
xdr.writeUnsignedInt(spec.specdata2);
|
|
137
|
+
}
|
|
138
|
+
writeFattr(attr) {
|
|
139
|
+
const xdr = this.xdr;
|
|
140
|
+
xdr.writeUnsignedInt(attr.type);
|
|
141
|
+
xdr.writeUnsignedInt(attr.mode);
|
|
142
|
+
xdr.writeUnsignedInt(attr.nlink);
|
|
143
|
+
xdr.writeUnsignedInt(attr.uid);
|
|
144
|
+
xdr.writeUnsignedInt(attr.gid);
|
|
145
|
+
xdr.writeUnsignedHyper(attr.size);
|
|
146
|
+
xdr.writeUnsignedHyper(attr.used);
|
|
147
|
+
this.writeSpecData(attr.rdev);
|
|
148
|
+
xdr.writeUnsignedHyper(attr.fsid);
|
|
149
|
+
xdr.writeUnsignedHyper(attr.fileid);
|
|
150
|
+
this.writeTime(attr.atime);
|
|
151
|
+
this.writeTime(attr.mtime);
|
|
152
|
+
this.writeTime(attr.ctime);
|
|
153
|
+
}
|
|
154
|
+
writePostOpAttr(attr) {
|
|
155
|
+
this.xdr.writeBoolean(attr.attributesFollow);
|
|
156
|
+
if (attr.attributesFollow && attr.attributes) {
|
|
157
|
+
this.writeFattr(attr.attributes);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
writeWccAttr(attr) {
|
|
161
|
+
this.xdr.writeUnsignedHyper(attr.size);
|
|
162
|
+
this.writeTime(attr.mtime);
|
|
163
|
+
this.writeTime(attr.ctime);
|
|
164
|
+
}
|
|
165
|
+
writePreOpAttr(attr) {
|
|
166
|
+
this.xdr.writeBoolean(attr.attributesFollow);
|
|
167
|
+
if (attr.attributesFollow && attr.attributes) {
|
|
168
|
+
this.writeWccAttr(attr.attributes);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
writeWccData(wcc) {
|
|
172
|
+
this.writePreOpAttr(wcc.before);
|
|
173
|
+
this.writePostOpAttr(wcc.after);
|
|
174
|
+
}
|
|
175
|
+
writePostOpFh(fh) {
|
|
176
|
+
this.xdr.writeBoolean(fh.handleFollows);
|
|
177
|
+
if (fh.handleFollows && fh.handle) {
|
|
178
|
+
this.writeFh(fh.handle);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
writeSetMode(setMode) {
|
|
182
|
+
const xdr = this.xdr;
|
|
183
|
+
xdr.writeBoolean(setMode.set);
|
|
184
|
+
if (setMode.set && setMode.mode !== undefined) {
|
|
185
|
+
xdr.writeUnsignedInt(setMode.mode);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
writeSetUid(setUid) {
|
|
189
|
+
const xdr = this.xdr;
|
|
190
|
+
xdr.writeBoolean(setUid.set);
|
|
191
|
+
if (setUid.set && setUid.uid !== undefined) {
|
|
192
|
+
xdr.writeUnsignedInt(setUid.uid);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
writeSetGid(setGid) {
|
|
196
|
+
const xdr = this.xdr;
|
|
197
|
+
xdr.writeBoolean(setGid.set);
|
|
198
|
+
if (setGid.set && setGid.gid !== undefined) {
|
|
199
|
+
xdr.writeUnsignedInt(setGid.gid);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
writeSetSize(setSize) {
|
|
203
|
+
const xdr = this.xdr;
|
|
204
|
+
xdr.writeBoolean(setSize.set);
|
|
205
|
+
if (setSize.set && setSize.size !== undefined) {
|
|
206
|
+
xdr.writeUnsignedHyper(setSize.size);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
writeSetAtime(setAtime) {
|
|
210
|
+
this.xdr.writeUnsignedInt(setAtime.how);
|
|
211
|
+
if (setAtime.how === 2 && setAtime.atime) {
|
|
212
|
+
this.writeTime(setAtime.atime);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
writeSetMtime(setMtime) {
|
|
216
|
+
const xdr = this.xdr;
|
|
217
|
+
xdr.writeUnsignedInt(setMtime.how);
|
|
218
|
+
if (setMtime.how === 2 && setMtime.mtime) {
|
|
219
|
+
this.writeTime(setMtime.mtime);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
writeSattr(sattr) {
|
|
223
|
+
this.writeSetMode(sattr.mode);
|
|
224
|
+
this.writeSetUid(sattr.uid);
|
|
225
|
+
this.writeSetGid(sattr.gid);
|
|
226
|
+
this.writeSetSize(sattr.size);
|
|
227
|
+
this.writeSetAtime(sattr.atime);
|
|
228
|
+
this.writeSetMtime(sattr.mtime);
|
|
229
|
+
}
|
|
230
|
+
writeSattrGuard(guard) {
|
|
231
|
+
const xdr = this.xdr;
|
|
232
|
+
xdr.writeBoolean(guard.check);
|
|
233
|
+
if (guard.check && guard.objCtime) {
|
|
234
|
+
this.writeTime(guard.objCtime);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
writeDirOpArgs(args) {
|
|
238
|
+
this.writeFh(args.dir);
|
|
239
|
+
this.writeFilename(args.name);
|
|
240
|
+
}
|
|
241
|
+
writeCreateHow(how) {
|
|
242
|
+
const xdr = this.xdr;
|
|
243
|
+
xdr.writeUnsignedInt(how.mode);
|
|
244
|
+
switch (how.mode) {
|
|
245
|
+
case 0:
|
|
246
|
+
case 1:
|
|
247
|
+
if (how.objAttributes) {
|
|
248
|
+
this.writeSattr(how.objAttributes);
|
|
249
|
+
}
|
|
250
|
+
break;
|
|
251
|
+
case 2:
|
|
252
|
+
if (how.verf) {
|
|
253
|
+
const verfData = how.verf.uint8;
|
|
254
|
+
xdr.writeOpaque(verfData);
|
|
255
|
+
}
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
writeMknodData(data) {
|
|
260
|
+
this.xdr.writeUnsignedInt(data.type);
|
|
261
|
+
switch (data.type) {
|
|
262
|
+
case 4:
|
|
263
|
+
if (data.chr) {
|
|
264
|
+
this.writeSattr(data.chr.devAttributes);
|
|
265
|
+
this.writeSpecData(data.chr.spec);
|
|
266
|
+
}
|
|
267
|
+
break;
|
|
268
|
+
case 3:
|
|
269
|
+
if (data.blk) {
|
|
270
|
+
this.writeSattr(data.blk.devAttributes);
|
|
271
|
+
this.writeSpecData(data.blk.spec);
|
|
272
|
+
}
|
|
273
|
+
break;
|
|
274
|
+
case 6:
|
|
275
|
+
if (data.sock) {
|
|
276
|
+
this.writeSattr(data.sock);
|
|
277
|
+
}
|
|
278
|
+
break;
|
|
279
|
+
case 7:
|
|
280
|
+
if (data.pipe) {
|
|
281
|
+
this.writeSattr(data.pipe);
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
writeEntry(entry) {
|
|
287
|
+
const xdr = this.xdr;
|
|
288
|
+
if (!entry) {
|
|
289
|
+
xdr.writeBoolean(false);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
xdr.writeBoolean(true);
|
|
293
|
+
xdr.writeUnsignedHyper(entry.fileid);
|
|
294
|
+
this.writeFilename(entry.name);
|
|
295
|
+
xdr.writeUnsignedHyper(entry.cookie);
|
|
296
|
+
this.writeEntry(entry.nextentry);
|
|
297
|
+
}
|
|
298
|
+
writeEntryPlus(entry) {
|
|
299
|
+
const xdr = this.xdr;
|
|
300
|
+
if (!entry) {
|
|
301
|
+
xdr.writeBoolean(false);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
xdr.writeBoolean(true);
|
|
305
|
+
xdr.writeUnsignedHyper(entry.fileid);
|
|
306
|
+
this.writeFilename(entry.name);
|
|
307
|
+
xdr.writeUnsignedHyper(entry.cookie);
|
|
308
|
+
this.writePostOpAttr(entry.nameAttributes);
|
|
309
|
+
this.writePostOpFh(entry.nameHandle);
|
|
310
|
+
this.writeEntryPlus(entry.nextentry);
|
|
311
|
+
}
|
|
312
|
+
writeDirList(dirList) {
|
|
313
|
+
this.writeEntry(dirList.entries);
|
|
314
|
+
this.xdr.writeBoolean(dirList.eof);
|
|
315
|
+
}
|
|
316
|
+
writeDirListPlus(dirList) {
|
|
317
|
+
this.writeEntryPlus(dirList.entries);
|
|
318
|
+
this.xdr.writeBoolean(dirList.eof);
|
|
319
|
+
}
|
|
320
|
+
writeGetattrRequest(req) {
|
|
321
|
+
this.writeFh(req.object);
|
|
322
|
+
}
|
|
323
|
+
writeGetattrResponse(res) {
|
|
324
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
325
|
+
if (res.status === 0 && res.resok) {
|
|
326
|
+
this.writeFattr(res.resok.objAttributes);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
writeSetattrRequest(req) {
|
|
330
|
+
this.writeFh(req.object);
|
|
331
|
+
this.writeSattr(req.newAttributes);
|
|
332
|
+
this.writeSattrGuard(req.guard);
|
|
333
|
+
}
|
|
334
|
+
writeSetattrResponse(res) {
|
|
335
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
336
|
+
if (res.status === 0 && res.resok) {
|
|
337
|
+
this.writeWccData(res.resok.objWcc);
|
|
338
|
+
}
|
|
339
|
+
else if (res.resfail) {
|
|
340
|
+
this.writeWccData(res.resfail.objWcc);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
writeLookupRequest(req) {
|
|
344
|
+
this.writeDirOpArgs(req.what);
|
|
345
|
+
}
|
|
346
|
+
writeLookupResponse(res) {
|
|
347
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
348
|
+
if (res.status === 0 && res.resok) {
|
|
349
|
+
this.writeFh(res.resok.object);
|
|
350
|
+
this.writePostOpAttr(res.resok.objAttributes);
|
|
351
|
+
this.writePostOpAttr(res.resok.dirAttributes);
|
|
352
|
+
}
|
|
353
|
+
else if (res.resfail) {
|
|
354
|
+
this.writePostOpAttr(res.resfail.dirAttributes);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
writeAccessRequest(req) {
|
|
358
|
+
this.writeFh(req.object);
|
|
359
|
+
this.xdr.writeUnsignedInt(req.access);
|
|
360
|
+
}
|
|
361
|
+
writeAccessResponse(res) {
|
|
362
|
+
const xdr = this.xdr;
|
|
363
|
+
xdr.writeUnsignedInt(res.status);
|
|
364
|
+
if (res.status === 0 && res.resok) {
|
|
365
|
+
this.writePostOpAttr(res.resok.objAttributes);
|
|
366
|
+
xdr.writeUnsignedInt(res.resok.access);
|
|
367
|
+
}
|
|
368
|
+
else if (res.resfail) {
|
|
369
|
+
this.writePostOpAttr(res.resfail.objAttributes);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
writeReadlinkRequest(req) {
|
|
373
|
+
this.writeFh(req.symlink);
|
|
374
|
+
}
|
|
375
|
+
writeReadlinkResponse(res) {
|
|
376
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
377
|
+
if (res.status === 0 && res.resok) {
|
|
378
|
+
this.writePostOpAttr(res.resok.symlinkAttributes);
|
|
379
|
+
this.writeFilename(res.resok.data);
|
|
380
|
+
}
|
|
381
|
+
else if (res.resfail) {
|
|
382
|
+
this.writePostOpAttr(res.resfail.symlinkAttributes);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
writeReadRequest(req) {
|
|
386
|
+
this.writeFh(req.file);
|
|
387
|
+
const xdr = this.xdr;
|
|
388
|
+
xdr.writeUnsignedHyper(req.offset);
|
|
389
|
+
xdr.writeUnsignedInt(req.count);
|
|
390
|
+
}
|
|
391
|
+
writeReadResponse(res) {
|
|
392
|
+
const xdr = this.xdr;
|
|
393
|
+
xdr.writeUnsignedInt(res.status);
|
|
394
|
+
if (res.status === 0 && res.resok) {
|
|
395
|
+
this.writePostOpAttr(res.resok.fileAttributes);
|
|
396
|
+
xdr.writeUnsignedInt(res.resok.count);
|
|
397
|
+
xdr.writeBoolean(res.resok.eof);
|
|
398
|
+
const data = res.resok.data.uint8;
|
|
399
|
+
xdr.writeVarlenOpaque(data);
|
|
400
|
+
}
|
|
401
|
+
else if (res.resfail) {
|
|
402
|
+
this.writePostOpAttr(res.resfail.fileAttributes);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
writeWriteRequest(req) {
|
|
406
|
+
this.writeFh(req.file);
|
|
407
|
+
const xdr = this.xdr;
|
|
408
|
+
xdr.writeUnsignedHyper(req.offset);
|
|
409
|
+
xdr.writeUnsignedInt(req.count);
|
|
410
|
+
xdr.writeUnsignedInt(req.stable);
|
|
411
|
+
const data = req.data.uint8;
|
|
412
|
+
xdr.writeVarlenOpaque(data);
|
|
413
|
+
}
|
|
414
|
+
writeWriteResponse(res) {
|
|
415
|
+
const xdr = this.xdr;
|
|
416
|
+
xdr.writeUnsignedInt(res.status);
|
|
417
|
+
if (res.status === 0 && res.resok) {
|
|
418
|
+
this.writeWccData(res.resok.fileWcc);
|
|
419
|
+
xdr.writeUnsignedInt(res.resok.count);
|
|
420
|
+
xdr.writeUnsignedInt(res.resok.committed);
|
|
421
|
+
const verf = res.resok.verf.uint8;
|
|
422
|
+
xdr.writeOpaque(verf);
|
|
423
|
+
}
|
|
424
|
+
else if (res.resfail) {
|
|
425
|
+
this.writeWccData(res.resfail.fileWcc);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
writeCreateRequest(req) {
|
|
429
|
+
this.writeDirOpArgs(req.where);
|
|
430
|
+
this.writeCreateHow(req.how);
|
|
431
|
+
}
|
|
432
|
+
writeCreateResponse(res) {
|
|
433
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
434
|
+
if (res.status === 0 && res.resok) {
|
|
435
|
+
this.writePostOpFh(res.resok.obj);
|
|
436
|
+
this.writePostOpAttr(res.resok.objAttributes);
|
|
437
|
+
this.writeWccData(res.resok.dirWcc);
|
|
438
|
+
}
|
|
439
|
+
else if (res.resfail) {
|
|
440
|
+
this.writeWccData(res.resfail.dirWcc);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
writeMkdirRequest(req) {
|
|
444
|
+
this.writeDirOpArgs(req.where);
|
|
445
|
+
this.writeSattr(req.attributes);
|
|
446
|
+
}
|
|
447
|
+
writeMkdirResponse(res) {
|
|
448
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
449
|
+
if (res.status === 0 && res.resok) {
|
|
450
|
+
this.writePostOpFh(res.resok.obj);
|
|
451
|
+
this.writePostOpAttr(res.resok.objAttributes);
|
|
452
|
+
this.writeWccData(res.resok.dirWcc);
|
|
453
|
+
}
|
|
454
|
+
else if (res.resfail) {
|
|
455
|
+
this.writeWccData(res.resfail.dirWcc);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
writeSymlinkRequest(req) {
|
|
459
|
+
this.writeDirOpArgs(req.where);
|
|
460
|
+
this.writeSattr(req.symlinkAttributes);
|
|
461
|
+
this.writeFilename(req.symlinkData);
|
|
462
|
+
}
|
|
463
|
+
writeSymlinkResponse(res) {
|
|
464
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
465
|
+
if (res.status === 0 && res.resok) {
|
|
466
|
+
this.writePostOpFh(res.resok.obj);
|
|
467
|
+
this.writePostOpAttr(res.resok.objAttributes);
|
|
468
|
+
this.writeWccData(res.resok.dirWcc);
|
|
469
|
+
}
|
|
470
|
+
else if (res.resfail) {
|
|
471
|
+
this.writeWccData(res.resfail.dirWcc);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
writeMknodRequest(req) {
|
|
475
|
+
this.writeDirOpArgs(req.where);
|
|
476
|
+
this.writeMknodData(req.what);
|
|
477
|
+
}
|
|
478
|
+
writeMknodResponse(res) {
|
|
479
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
480
|
+
if (res.status === 0 && res.resok) {
|
|
481
|
+
this.writePostOpFh(res.resok.obj);
|
|
482
|
+
this.writePostOpAttr(res.resok.objAttributes);
|
|
483
|
+
this.writeWccData(res.resok.dirWcc);
|
|
484
|
+
}
|
|
485
|
+
else if (res.resfail) {
|
|
486
|
+
this.writeWccData(res.resfail.dirWcc);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
writeRemoveRequest(req) {
|
|
490
|
+
this.writeDirOpArgs(req.object);
|
|
491
|
+
}
|
|
492
|
+
writeRemoveResponse(res) {
|
|
493
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
494
|
+
if (res.status === 0 && res.resok) {
|
|
495
|
+
this.writeWccData(res.resok.dirWcc);
|
|
496
|
+
}
|
|
497
|
+
else if (res.resfail) {
|
|
498
|
+
this.writeWccData(res.resfail.dirWcc);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
writeRmdirRequest(req) {
|
|
502
|
+
this.writeDirOpArgs(req.object);
|
|
503
|
+
}
|
|
504
|
+
writeRmdirResponse(res) {
|
|
505
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
506
|
+
if (res.status === 0 && res.resok) {
|
|
507
|
+
this.writeWccData(res.resok.dirWcc);
|
|
508
|
+
}
|
|
509
|
+
else if (res.resfail) {
|
|
510
|
+
this.writeWccData(res.resfail.dirWcc);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
writeRenameRequest(req) {
|
|
514
|
+
this.writeDirOpArgs(req.from);
|
|
515
|
+
this.writeDirOpArgs(req.to);
|
|
516
|
+
}
|
|
517
|
+
writeRenameResponse(res) {
|
|
518
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
519
|
+
if (res.status === 0 && res.resok) {
|
|
520
|
+
this.writeWccData(res.resok.fromDirWcc);
|
|
521
|
+
this.writeWccData(res.resok.toDirWcc);
|
|
522
|
+
}
|
|
523
|
+
else if (res.resfail) {
|
|
524
|
+
this.writeWccData(res.resfail.fromDirWcc);
|
|
525
|
+
this.writeWccData(res.resfail.toDirWcc);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
writeLinkRequest(req) {
|
|
529
|
+
this.writeFh(req.file);
|
|
530
|
+
this.writeDirOpArgs(req.link);
|
|
531
|
+
}
|
|
532
|
+
writeLinkResponse(res) {
|
|
533
|
+
this.xdr.writeUnsignedInt(res.status);
|
|
534
|
+
if (res.status === 0 && res.resok) {
|
|
535
|
+
this.writePostOpAttr(res.resok.fileAttributes);
|
|
536
|
+
this.writeWccData(res.resok.linkDirWcc);
|
|
537
|
+
}
|
|
538
|
+
else if (res.resfail) {
|
|
539
|
+
this.writePostOpAttr(res.resfail.fileAttributes);
|
|
540
|
+
this.writeWccData(res.resfail.linkDirWcc);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
writeReaddirRequest(req) {
|
|
544
|
+
this.writeFh(req.dir);
|
|
545
|
+
const xdr = this.xdr;
|
|
546
|
+
xdr.writeUnsignedHyper(req.cookie);
|
|
547
|
+
const cookieverf = req.cookieverf.uint8;
|
|
548
|
+
xdr.writeOpaque(cookieverf);
|
|
549
|
+
xdr.writeUnsignedInt(req.count);
|
|
550
|
+
}
|
|
551
|
+
writeReaddirResponse(res) {
|
|
552
|
+
const xdr = this.xdr;
|
|
553
|
+
xdr.writeUnsignedInt(res.status);
|
|
554
|
+
if (res.status === 0 && res.resok) {
|
|
555
|
+
this.writePostOpAttr(res.resok.dirAttributes);
|
|
556
|
+
const cookieverf = res.resok.cookieverf.uint8;
|
|
557
|
+
xdr.writeOpaque(cookieverf);
|
|
558
|
+
this.writeDirList(res.resok.reply);
|
|
559
|
+
}
|
|
560
|
+
else if (res.resfail) {
|
|
561
|
+
this.writePostOpAttr(res.resfail.dirAttributes);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
writeReaddirplusRequest(req) {
|
|
565
|
+
this.writeFh(req.dir);
|
|
566
|
+
const xdr = this.xdr;
|
|
567
|
+
xdr.writeUnsignedHyper(req.cookie);
|
|
568
|
+
const cookieverf = req.cookieverf.uint8;
|
|
569
|
+
xdr.writeOpaque(cookieverf);
|
|
570
|
+
xdr.writeUnsignedInt(req.dircount);
|
|
571
|
+
xdr.writeUnsignedInt(req.maxcount);
|
|
572
|
+
}
|
|
573
|
+
writeReaddirplusResponse(res) {
|
|
574
|
+
const xdr = this.xdr;
|
|
575
|
+
xdr.writeUnsignedInt(res.status);
|
|
576
|
+
if (res.status === 0 && res.resok) {
|
|
577
|
+
this.writePostOpAttr(res.resok.dirAttributes);
|
|
578
|
+
const cookieverf = res.resok.cookieverf.uint8;
|
|
579
|
+
xdr.writeOpaque(cookieverf);
|
|
580
|
+
this.writeDirListPlus(res.resok.reply);
|
|
581
|
+
}
|
|
582
|
+
else if (res.resfail) {
|
|
583
|
+
this.writePostOpAttr(res.resfail.dirAttributes);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
writeFsstatRequest(req) {
|
|
587
|
+
this.writeFh(req.fsroot);
|
|
588
|
+
}
|
|
589
|
+
writeFsstatResponse(res) {
|
|
590
|
+
const xdr = this.xdr;
|
|
591
|
+
xdr.writeUnsignedInt(res.status);
|
|
592
|
+
if (res.status === 0 && res.resok) {
|
|
593
|
+
this.writePostOpAttr(res.resok.objAttributes);
|
|
594
|
+
xdr.writeUnsignedHyper(res.resok.tbytes);
|
|
595
|
+
xdr.writeUnsignedHyper(res.resok.fbytes);
|
|
596
|
+
xdr.writeUnsignedHyper(res.resok.abytes);
|
|
597
|
+
xdr.writeUnsignedHyper(res.resok.tfiles);
|
|
598
|
+
xdr.writeUnsignedHyper(res.resok.ffiles);
|
|
599
|
+
xdr.writeUnsignedHyper(res.resok.afiles);
|
|
600
|
+
xdr.writeUnsignedInt(res.resok.invarsec);
|
|
601
|
+
}
|
|
602
|
+
else if (res.resfail) {
|
|
603
|
+
this.writePostOpAttr(res.resfail.objAttributes);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
writeFsinfoRequest(req) {
|
|
607
|
+
this.writeFh(req.fsroot);
|
|
608
|
+
}
|
|
609
|
+
writeFsinfoResponse(res) {
|
|
610
|
+
const xdr = this.xdr;
|
|
611
|
+
xdr.writeUnsignedInt(res.status);
|
|
612
|
+
if (res.status === 0 && res.resok) {
|
|
613
|
+
this.writePostOpAttr(res.resok.objAttributes);
|
|
614
|
+
xdr.writeUnsignedInt(res.resok.rtmax);
|
|
615
|
+
xdr.writeUnsignedInt(res.resok.rtpref);
|
|
616
|
+
xdr.writeUnsignedInt(res.resok.rtmult);
|
|
617
|
+
xdr.writeUnsignedInt(res.resok.wtmax);
|
|
618
|
+
xdr.writeUnsignedInt(res.resok.wtpref);
|
|
619
|
+
xdr.writeUnsignedInt(res.resok.wtmult);
|
|
620
|
+
xdr.writeUnsignedInt(res.resok.dtpref);
|
|
621
|
+
xdr.writeUnsignedHyper(res.resok.maxfilesize);
|
|
622
|
+
xdr.writeUnsignedInt(res.resok.timeDelta.seconds);
|
|
623
|
+
xdr.writeUnsignedInt(res.resok.timeDelta.nseconds);
|
|
624
|
+
xdr.writeUnsignedInt(res.resok.properties);
|
|
625
|
+
}
|
|
626
|
+
else if (res.resfail) {
|
|
627
|
+
this.writePostOpAttr(res.resfail.objAttributes);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
writePathconfRequest(req) {
|
|
631
|
+
this.writeFh(req.object);
|
|
632
|
+
}
|
|
633
|
+
writePathconfResponse(res) {
|
|
634
|
+
const xdr = this.xdr;
|
|
635
|
+
xdr.writeUnsignedInt(res.status);
|
|
636
|
+
if (res.status === 0 && res.resok) {
|
|
637
|
+
this.writePostOpAttr(res.resok.objAttributes);
|
|
638
|
+
xdr.writeUnsignedInt(res.resok.linkmax);
|
|
639
|
+
xdr.writeUnsignedInt(res.resok.namemax);
|
|
640
|
+
xdr.writeBoolean(res.resok.noTrunc);
|
|
641
|
+
xdr.writeBoolean(res.resok.chownRestricted);
|
|
642
|
+
xdr.writeBoolean(res.resok.caseInsensitive);
|
|
643
|
+
xdr.writeBoolean(res.resok.casePreserving);
|
|
644
|
+
}
|
|
645
|
+
else if (res.resfail) {
|
|
646
|
+
this.writePostOpAttr(res.resfail.objAttributes);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
writeCommitRequest(req) {
|
|
650
|
+
this.writeFh(req.file);
|
|
651
|
+
const xdr = this.xdr;
|
|
652
|
+
xdr.writeUnsignedHyper(req.offset);
|
|
653
|
+
xdr.writeUnsignedInt(req.count);
|
|
654
|
+
}
|
|
655
|
+
writeCommitResponse(res) {
|
|
656
|
+
const xdr = this.xdr;
|
|
657
|
+
xdr.writeUnsignedInt(res.status);
|
|
658
|
+
if (res.status === 0 && res.resok) {
|
|
659
|
+
this.writeWccData(res.resok.fileWcc);
|
|
660
|
+
const verf = res.resok.verf.uint8;
|
|
661
|
+
xdr.writeOpaque(verf);
|
|
662
|
+
}
|
|
663
|
+
else if (res.resfail) {
|
|
664
|
+
this.writeWccData(res.resfail.fileWcc);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
exports.Nfsv3Encoder = Nfsv3Encoder;
|
|
669
|
+
//# sourceMappingURL=Nfsv3Encoder.js.map
|