@jsonjoy.com/json-pack 1.17.0 → 1.19.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.
Files changed (63) hide show
  1. package/lib/nfs/v3/Nfsv3Decoder.js +10 -10
  2. package/lib/nfs/v3/Nfsv3Decoder.js.map +1 -1
  3. package/lib/nfs/v3/Nfsv3Encoder.js +10 -20
  4. package/lib/nfs/v3/Nfsv3Encoder.js.map +1 -1
  5. package/lib/nfs/v3/locks/NlmDecoder.d.ts +33 -0
  6. package/lib/nfs/v3/locks/NlmDecoder.js +209 -0
  7. package/lib/nfs/v3/locks/NlmDecoder.js.map +1 -0
  8. package/lib/nfs/v3/locks/NlmEncoder.d.ts +35 -0
  9. package/lib/nfs/v3/locks/NlmEncoder.js +182 -0
  10. package/lib/nfs/v3/locks/NlmEncoder.js.map +1 -0
  11. package/lib/nfs/v3/locks/constants.d.ts +39 -0
  12. package/lib/nfs/v3/locks/constants.js +3 -0
  13. package/lib/nfs/v3/locks/constants.js.map +1 -0
  14. package/lib/nfs/v3/locks/messages.d.ts +96 -0
  15. package/lib/nfs/v3/locks/messages.js +130 -0
  16. package/lib/nfs/v3/locks/messages.js.map +1 -0
  17. package/lib/nfs/v3/locks/structs.d.ts +31 -0
  18. package/lib/nfs/v3/locks/structs.js +42 -0
  19. package/lib/nfs/v3/locks/structs.js.map +1 -0
  20. package/lib/nfs/v3/messages.d.ts +16 -17
  21. package/lib/nfs/v3/messages.js.map +1 -1
  22. package/lib/nfs/v3/mount/MountDecoder.d.ts +21 -0
  23. package/lib/nfs/v3/mount/MountDecoder.js +135 -0
  24. package/lib/nfs/v3/mount/MountDecoder.js.map +1 -0
  25. package/lib/nfs/v3/mount/MountEncoder.d.ts +23 -0
  26. package/lib/nfs/v3/mount/MountEncoder.js +125 -0
  27. package/lib/nfs/v3/mount/MountEncoder.js.map +1 -0
  28. package/lib/nfs/v3/mount/constants.d.ts +27 -0
  29. package/lib/nfs/v3/mount/constants.js +3 -0
  30. package/lib/nfs/v3/mount/constants.js.map +1 -0
  31. package/lib/nfs/v3/mount/messages.d.ts +37 -0
  32. package/lib/nfs/v3/mount/messages.js +51 -0
  33. package/lib/nfs/v3/mount/messages.js.map +1 -0
  34. package/lib/nfs/v3/mount/structs.d.ts +22 -0
  35. package/lib/nfs/v3/mount/structs.js +33 -0
  36. package/lib/nfs/v3/mount/structs.js.map +1 -0
  37. package/lib/nfs/v3/structs.d.ts +4 -5
  38. package/lib/nfs/v3/structs.js.map +1 -1
  39. package/lib/nfs/v4/FullNfsv4Encoder.d.ts +28 -0
  40. package/lib/nfs/v4/FullNfsv4Encoder.js +73 -0
  41. package/lib/nfs/v4/FullNfsv4Encoder.js.map +1 -0
  42. package/lib/nfs/v4/Nfsv4Decoder.d.ts +106 -0
  43. package/lib/nfs/v4/Nfsv4Decoder.js +884 -0
  44. package/lib/nfs/v4/Nfsv4Decoder.js.map +1 -0
  45. package/lib/nfs/v4/Nfsv4Encoder.d.ts +99 -0
  46. package/lib/nfs/v4/Nfsv4Encoder.js +843 -0
  47. package/lib/nfs/v4/Nfsv4Encoder.js.map +1 -0
  48. package/lib/nfs/v4/constants.d.ts +313 -0
  49. package/lib/nfs/v4/constants.js +3 -0
  50. package/lib/nfs/v4/constants.js.map +1 -0
  51. package/lib/nfs/v4/errors.d.ts +6 -0
  52. package/lib/nfs/v4/errors.js +16 -0
  53. package/lib/nfs/v4/errors.js.map +1 -0
  54. package/lib/nfs/v4/index.d.ts +6 -0
  55. package/lib/nfs/v4/index.js +10 -0
  56. package/lib/nfs/v4/index.js.map +1 -0
  57. package/lib/nfs/v4/messages.d.ts +522 -0
  58. package/lib/nfs/v4/messages.js +731 -0
  59. package/lib/nfs/v4/messages.js.map +1 -0
  60. package/lib/nfs/v4/structs.d.ts +207 -0
  61. package/lib/nfs/v4/structs.js +285 -0
  62. package/lib/nfs/v4/structs.js.map +1 -0
  63. package/package.json +1 -1
@@ -0,0 +1,884 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Nfsv4Decoder = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const Reader_1 = require("@jsonjoy.com/buffers/lib/Reader");
6
+ const XdrDecoder_1 = require("../../xdr/XdrDecoder");
7
+ const errors_1 = require("./errors");
8
+ const msg = tslib_1.__importStar(require("./messages"));
9
+ const structs = tslib_1.__importStar(require("./structs"));
10
+ class Nfsv4Decoder {
11
+ constructor(reader = new Reader_1.Reader()) {
12
+ this.xdr = new XdrDecoder_1.XdrDecoder(reader);
13
+ }
14
+ decodeCompound(reader, isRequest) {
15
+ this.xdr.reader = reader;
16
+ const startPos = reader.x;
17
+ try {
18
+ if (isRequest) {
19
+ return this.decodeCompoundRequest();
20
+ }
21
+ else {
22
+ return this.decodeCompoundResponse();
23
+ }
24
+ }
25
+ catch (err) {
26
+ if (err instanceof RangeError) {
27
+ reader.x = startPos;
28
+ return undefined;
29
+ }
30
+ throw err;
31
+ }
32
+ }
33
+ decodeCompoundRequest() {
34
+ const xdr = this.xdr;
35
+ const tag = xdr.readString();
36
+ const minorversion = xdr.readUnsignedInt();
37
+ const argarray = [];
38
+ const count = xdr.readUnsignedInt();
39
+ for (let i = 0; i < count; i++) {
40
+ const op = xdr.readUnsignedInt();
41
+ const request = this.decodeRequest(op);
42
+ if (request)
43
+ argarray.push(request);
44
+ }
45
+ return new msg.Nfsv4CompoundRequest(tag, minorversion, argarray);
46
+ }
47
+ decodeCompoundResponse() {
48
+ const xdr = this.xdr;
49
+ const status = xdr.readUnsignedInt();
50
+ const tag = xdr.readString();
51
+ const resarray = [];
52
+ const count = xdr.readUnsignedInt();
53
+ for (let i = 0; i < count; i++) {
54
+ const op = xdr.readUnsignedInt();
55
+ const response = this.decodeResponse(op);
56
+ if (response)
57
+ resarray.push(response);
58
+ }
59
+ return new msg.Nfsv4CompoundResponse(status, tag, resarray);
60
+ }
61
+ decodeRequest(op) {
62
+ switch (op) {
63
+ case 3:
64
+ return this.decodeAccessRequest();
65
+ case 4:
66
+ return this.decodeCloseRequest();
67
+ case 5:
68
+ return this.decodeCommitRequest();
69
+ case 6:
70
+ return this.decodeCreateRequest();
71
+ case 7:
72
+ return this.decodeDelegpurgeRequest();
73
+ case 8:
74
+ return this.decodeDelegreturnRequest();
75
+ case 9:
76
+ return this.decodeGetattrRequest();
77
+ case 10:
78
+ return this.decodeGetfhRequest();
79
+ case 11:
80
+ return this.decodeLinkRequest();
81
+ case 12:
82
+ return this.decodeLockRequest();
83
+ case 13:
84
+ return this.decodeLocktRequest();
85
+ case 14:
86
+ return this.decodeLockuRequest();
87
+ case 15:
88
+ return this.decodeLookupRequest();
89
+ case 16:
90
+ return this.decodeLookuppRequest();
91
+ case 17:
92
+ return this.decodeNverifyRequest();
93
+ case 18:
94
+ return this.decodeOpenRequest();
95
+ case 19:
96
+ return this.decodeOpenattrRequest();
97
+ case 20:
98
+ return this.decodeOpenConfirmRequest();
99
+ case 21:
100
+ return this.decodeOpenDowngradeRequest();
101
+ case 22:
102
+ return this.decodePutfhRequest();
103
+ case 23:
104
+ return this.decodePutpubfhRequest();
105
+ case 24:
106
+ return this.decodePutrootfhRequest();
107
+ case 25:
108
+ return this.decodeReadRequest();
109
+ case 26:
110
+ return this.decodeReaddirRequest();
111
+ case 27:
112
+ return this.decodeReadlinkRequest();
113
+ case 28:
114
+ return this.decodeRemoveRequest();
115
+ case 29:
116
+ return this.decodeRenameRequest();
117
+ case 30:
118
+ return this.decodeRenewRequest();
119
+ case 31:
120
+ return this.decodeRestorefhRequest();
121
+ case 32:
122
+ return this.decodeSavefhRequest();
123
+ case 33:
124
+ return this.decodeSecinfoRequest();
125
+ case 34:
126
+ return this.decodeSetattrRequest();
127
+ case 35:
128
+ return this.decodeSetclientidRequest();
129
+ case 36:
130
+ return this.decodeSetclientidConfirmRequest();
131
+ case 37:
132
+ return this.decodeVerifyRequest();
133
+ case 38:
134
+ return this.decodeWriteRequest();
135
+ case 39:
136
+ return this.decodeReleaseLockOwnerRequest();
137
+ case 10044:
138
+ return this.decodeIllegalRequest();
139
+ default:
140
+ throw new errors_1.Nfsv4DecodingError(`Unknown operation: ${op}`);
141
+ }
142
+ }
143
+ decodeResponse(op) {
144
+ switch (op) {
145
+ case 3:
146
+ return this.decodeAccessResponse();
147
+ case 4:
148
+ return this.decodeCloseResponse();
149
+ case 5:
150
+ return this.decodeCommitResponse();
151
+ case 6:
152
+ return this.decodeCreateResponse();
153
+ case 7:
154
+ return this.decodeDelegpurgeResponse();
155
+ case 8:
156
+ return this.decodeDelegreturnResponse();
157
+ case 9:
158
+ return this.decodeGetattrResponse();
159
+ case 10:
160
+ return this.decodeGetfhResponse();
161
+ case 11:
162
+ return this.decodeLinkResponse();
163
+ case 12:
164
+ return this.decodeLockResponse();
165
+ case 13:
166
+ return this.decodeLocktResponse();
167
+ case 14:
168
+ return this.decodeLockuResponse();
169
+ case 15:
170
+ return this.decodeLookupResponse();
171
+ case 16:
172
+ return this.decodeLookuppResponse();
173
+ case 17:
174
+ return this.decodeNverifyResponse();
175
+ case 18:
176
+ return this.decodeOpenResponse();
177
+ case 19:
178
+ return this.decodeOpenattrResponse();
179
+ case 20:
180
+ return this.decodeOpenConfirmResponse();
181
+ case 21:
182
+ return this.decodeOpenDowngradeResponse();
183
+ case 22:
184
+ return this.decodePutfhResponse();
185
+ case 23:
186
+ return this.decodePutpubfhResponse();
187
+ case 24:
188
+ return this.decodePutrootfhResponse();
189
+ case 25:
190
+ return this.decodeReadResponse();
191
+ case 26:
192
+ return this.decodeReaddirResponse();
193
+ case 27:
194
+ return this.decodeReadlinkResponse();
195
+ case 28:
196
+ return this.decodeRemoveResponse();
197
+ case 29:
198
+ return this.decodeRenameResponse();
199
+ case 30:
200
+ return this.decodeRenewResponse();
201
+ case 31:
202
+ return this.decodeRestorefhResponse();
203
+ case 32:
204
+ return this.decodeSavefhResponse();
205
+ case 33:
206
+ return this.decodeSecinfoResponse();
207
+ case 34:
208
+ return this.decodeSetattrResponse();
209
+ case 35:
210
+ return this.decodeSetclientidResponse();
211
+ case 36:
212
+ return this.decodeSetclientidConfirmResponse();
213
+ case 37:
214
+ return this.decodeVerifyResponse();
215
+ case 38:
216
+ return this.decodeWriteResponse();
217
+ case 39:
218
+ return this.decodeReleaseLockOwnerResponse();
219
+ case 10044:
220
+ return this.decodeIllegalResponse();
221
+ default:
222
+ throw new errors_1.Nfsv4DecodingError(`Unknown operation: ${op}`);
223
+ }
224
+ }
225
+ readFh() {
226
+ const data = this.xdr.readVarlenOpaque();
227
+ return new structs.Nfsv4Fh(data);
228
+ }
229
+ readVerifier() {
230
+ const data = this.xdr.readOpaque(8);
231
+ return new structs.Nfsv4Verifier(data);
232
+ }
233
+ readTime() {
234
+ const xdr = this.xdr;
235
+ const seconds = xdr.readHyper();
236
+ const nseconds = xdr.readUnsignedInt();
237
+ return new structs.Nfsv4Time(seconds, nseconds);
238
+ }
239
+ readStateid() {
240
+ const xdr = this.xdr;
241
+ const seqid = xdr.readUnsignedInt();
242
+ const other = xdr.readOpaque(12);
243
+ return new structs.Nfsv4Stateid(seqid, other);
244
+ }
245
+ readBitmap() {
246
+ const xdr = this.xdr;
247
+ const count = xdr.readUnsignedInt();
248
+ const mask = [];
249
+ for (let i = 0; i < count; i++)
250
+ mask.push(xdr.readUnsignedInt());
251
+ return new structs.Nfsv4Bitmap(mask);
252
+ }
253
+ readFattr() {
254
+ const attrmask = this.readBitmap();
255
+ const attrVals = this.xdr.readVarlenOpaque();
256
+ return new structs.Nfsv4Fattr(attrmask, attrVals);
257
+ }
258
+ readChangeInfo() {
259
+ const xdr = this.xdr;
260
+ const atomic = xdr.readBoolean();
261
+ const before = xdr.readUnsignedHyper();
262
+ const after = xdr.readUnsignedHyper();
263
+ return new structs.Nfsv4ChangeInfo(atomic, before, after);
264
+ }
265
+ readClientAddr() {
266
+ const xdr = this.xdr;
267
+ const rNetid = xdr.readString();
268
+ const rAddr = xdr.readString();
269
+ return new structs.Nfsv4ClientAddr(rNetid, rAddr);
270
+ }
271
+ readCbClient() {
272
+ const cbProgram = this.xdr.readUnsignedInt();
273
+ const cbLocation = this.readClientAddr();
274
+ return new structs.Nfsv4CbClient(cbProgram, cbLocation);
275
+ }
276
+ readClientId() {
277
+ const verifier = this.readVerifier();
278
+ const id = this.xdr.readVarlenOpaque();
279
+ return new structs.Nfsv4ClientId(verifier, id);
280
+ }
281
+ readOpenOwner() {
282
+ const xdr = this.xdr;
283
+ const clientid = xdr.readUnsignedHyper();
284
+ const owner = xdr.readVarlenOpaque();
285
+ return new structs.Nfsv4OpenOwner(clientid, owner);
286
+ }
287
+ readLockOwner() {
288
+ const xdr = this.xdr;
289
+ const clientid = xdr.readUnsignedHyper();
290
+ const owner = xdr.readVarlenOpaque();
291
+ return new structs.Nfsv4LockOwner(clientid, owner);
292
+ }
293
+ readOpenToLockOwner() {
294
+ const xdr = this.xdr;
295
+ const openSeqid = xdr.readUnsignedInt();
296
+ const openStateid = this.readStateid();
297
+ const lockSeqid = xdr.readUnsignedInt();
298
+ const lockOwner = this.readLockOwner();
299
+ return new structs.Nfsv4OpenToLockOwner(openSeqid, openStateid, lockSeqid, lockOwner);
300
+ }
301
+ readLockOwnerInfo() {
302
+ const xdr = this.xdr;
303
+ const newLockOwner = xdr.readBoolean();
304
+ if (newLockOwner) {
305
+ const openToLockOwner = this.readOpenToLockOwner();
306
+ return new structs.Nfsv4LockOwnerInfo(true, new structs.Nfsv4LockNewOwner(openToLockOwner));
307
+ }
308
+ else {
309
+ const lockStateid = this.readStateid();
310
+ const lockSeqid = xdr.readUnsignedInt();
311
+ return new structs.Nfsv4LockOwnerInfo(false, new structs.Nfsv4LockExistingOwner(lockStateid, lockSeqid));
312
+ }
313
+ }
314
+ readOpenClaim() {
315
+ const xdr = this.xdr;
316
+ const claimType = xdr.readUnsignedInt();
317
+ switch (claimType) {
318
+ case 0: {
319
+ const file = xdr.readString();
320
+ return new structs.Nfsv4OpenClaim(claimType, new structs.Nfsv4OpenClaimNull(file));
321
+ }
322
+ case 1: {
323
+ const delegateType = xdr.readUnsignedInt();
324
+ return new structs.Nfsv4OpenClaim(claimType, new structs.Nfsv4OpenClaimPrevious(delegateType));
325
+ }
326
+ case 2: {
327
+ const delegateStateid = this.readStateid();
328
+ const file = xdr.readString();
329
+ return new structs.Nfsv4OpenClaim(claimType, new structs.Nfsv4OpenClaimDelegateCur(delegateStateid, file));
330
+ }
331
+ case 3: {
332
+ const file = xdr.readString();
333
+ return new structs.Nfsv4OpenClaim(claimType, new structs.Nfsv4OpenClaimDelegatePrev(file));
334
+ }
335
+ default:
336
+ throw new errors_1.Nfsv4DecodingError(`Unknown open claim type: ${claimType}`);
337
+ }
338
+ }
339
+ readOpenDelegation() {
340
+ const xdr = this.xdr;
341
+ const delegationType = xdr.readUnsignedInt();
342
+ switch (delegationType) {
343
+ case 0:
344
+ return new structs.Nfsv4OpenDelegation(delegationType);
345
+ case 1: {
346
+ const stateid = this.readStateid();
347
+ const recall = xdr.readBoolean();
348
+ const aceCount = xdr.readUnsignedInt();
349
+ const permissions = [];
350
+ for (let i = 0; i < aceCount; i++) {
351
+ permissions.push(this.readAce());
352
+ }
353
+ return new structs.Nfsv4OpenDelegation(delegationType, new structs.Nfsv4OpenReadDelegation(stateid, recall, permissions));
354
+ }
355
+ case 2: {
356
+ const stateid = this.readStateid();
357
+ const recall = xdr.readBoolean();
358
+ const spaceLimit = xdr.readUnsignedHyper();
359
+ const aceCount = xdr.readUnsignedInt();
360
+ const permissions = [];
361
+ for (let i = 0; i < aceCount; i++) {
362
+ permissions.push(this.readAce());
363
+ }
364
+ return new structs.Nfsv4OpenDelegation(delegationType, new structs.Nfsv4OpenWriteDelegation(stateid, recall, spaceLimit, permissions));
365
+ }
366
+ default:
367
+ throw new errors_1.Nfsv4DecodingError(`Unknown delegation type: ${delegationType}`);
368
+ }
369
+ }
370
+ readAce() {
371
+ const xdr = this.xdr;
372
+ const type = xdr.readUnsignedInt();
373
+ const flag = xdr.readUnsignedInt();
374
+ const accessMask = xdr.readUnsignedInt();
375
+ const who = xdr.readString();
376
+ return new structs.Nfsv4Ace(type, flag, accessMask, who);
377
+ }
378
+ readSecInfoFlavor() {
379
+ const xdr = this.xdr;
380
+ const flavor = xdr.readUnsignedInt();
381
+ if (flavor === 6) {
382
+ const oid = xdr.readVarlenOpaque();
383
+ const qop = xdr.readUnsignedInt();
384
+ const service = xdr.readUnsignedInt();
385
+ const flavorInfo = new structs.Nfsv4RpcSecGssInfo(oid, qop, service);
386
+ return new structs.Nfsv4SecInfoFlavor(flavor, flavorInfo);
387
+ }
388
+ return new structs.Nfsv4SecInfoFlavor(flavor);
389
+ }
390
+ decodeAccessRequest() {
391
+ const access = this.xdr.readUnsignedInt();
392
+ return new msg.Nfsv4AccessRequest(access);
393
+ }
394
+ decodeAccessResponse() {
395
+ const xdr = this.xdr;
396
+ const status = xdr.readUnsignedInt();
397
+ if (status === 0) {
398
+ const supported = xdr.readUnsignedInt();
399
+ const access = xdr.readUnsignedInt();
400
+ return new msg.Nfsv4AccessResponse(status, new msg.Nfsv4AccessResOk(supported, access));
401
+ }
402
+ return new msg.Nfsv4AccessResponse(status);
403
+ }
404
+ decodeCloseRequest() {
405
+ const xdr = this.xdr;
406
+ const seqid = xdr.readUnsignedInt();
407
+ const openStateid = this.readStateid();
408
+ return new msg.Nfsv4CloseRequest(seqid, openStateid);
409
+ }
410
+ decodeCloseResponse() {
411
+ const status = this.xdr.readUnsignedInt();
412
+ if (status === 0) {
413
+ const openStateid = this.readStateid();
414
+ return new msg.Nfsv4CloseResponse(status, new msg.Nfsv4CloseResOk(openStateid));
415
+ }
416
+ return new msg.Nfsv4CloseResponse(status);
417
+ }
418
+ decodeCommitRequest() {
419
+ const xdr = this.xdr;
420
+ const offset = xdr.readUnsignedHyper();
421
+ const count = xdr.readUnsignedInt();
422
+ return new msg.Nfsv4CommitRequest(offset, count);
423
+ }
424
+ decodeCommitResponse() {
425
+ const status = this.xdr.readUnsignedInt();
426
+ if (status === 0) {
427
+ const writeverf = this.readVerifier();
428
+ return new msg.Nfsv4CommitResponse(status, new msg.Nfsv4CommitResOk(writeverf));
429
+ }
430
+ return new msg.Nfsv4CommitResponse(status);
431
+ }
432
+ decodeCreateRequest() {
433
+ const xdr = this.xdr;
434
+ const type = xdr.readUnsignedInt();
435
+ let objtype;
436
+ const objname = xdr.readString();
437
+ const createattrs = this.readFattr();
438
+ switch (type) {
439
+ case 5: {
440
+ const linkdata = xdr.readString();
441
+ objtype = new structs.Nfsv4CreateType(type, new structs.Nfsv4CreateTypeLink(linkdata, createattrs));
442
+ break;
443
+ }
444
+ case 3:
445
+ case 4: {
446
+ const specdata1 = xdr.readUnsignedInt();
447
+ const specdata2 = xdr.readUnsignedInt();
448
+ const devdata = new structs.Nfsv4SpecData(specdata1, specdata2);
449
+ objtype = new structs.Nfsv4CreateType(type, new structs.Nfsv4CreateTypeDevice(devdata, createattrs));
450
+ break;
451
+ }
452
+ default:
453
+ objtype = new structs.Nfsv4CreateType(type, new structs.Nfsv4CreateTypeOther(createattrs));
454
+ }
455
+ return new msg.Nfsv4CreateRequest(objtype, objname);
456
+ }
457
+ decodeCreateResponse() {
458
+ const status = this.xdr.readUnsignedInt();
459
+ if (status === 0) {
460
+ const cinfo = this.readChangeInfo();
461
+ const attrset = this.readBitmap();
462
+ return new msg.Nfsv4CreateResponse(status, new msg.Nfsv4CreateResOk(cinfo, attrset));
463
+ }
464
+ return new msg.Nfsv4CreateResponse(status);
465
+ }
466
+ decodeDelegpurgeRequest() {
467
+ const clientid = this.xdr.readUnsignedHyper();
468
+ return new msg.Nfsv4DelegpurgeRequest(clientid);
469
+ }
470
+ decodeDelegpurgeResponse() {
471
+ const status = this.xdr.readUnsignedInt();
472
+ return new msg.Nfsv4DelegpurgeResponse(status);
473
+ }
474
+ decodeDelegreturnRequest() {
475
+ const delegStateid = this.readStateid();
476
+ return new msg.Nfsv4DelegreturnRequest(delegStateid);
477
+ }
478
+ decodeDelegreturnResponse() {
479
+ const status = this.xdr.readUnsignedInt();
480
+ return new msg.Nfsv4DelegreturnResponse(status);
481
+ }
482
+ decodeGetattrRequest() {
483
+ const attrRequest = this.readBitmap();
484
+ return new msg.Nfsv4GetattrRequest(attrRequest);
485
+ }
486
+ decodeGetattrResponse() {
487
+ const status = this.xdr.readUnsignedInt();
488
+ if (status === 0) {
489
+ const objAttributes = this.readFattr();
490
+ return new msg.Nfsv4GetattrResponse(status, new msg.Nfsv4GetattrResOk(objAttributes));
491
+ }
492
+ return new msg.Nfsv4GetattrResponse(status);
493
+ }
494
+ decodeGetfhRequest() {
495
+ return new msg.Nfsv4GetfhRequest();
496
+ }
497
+ decodeGetfhResponse() {
498
+ const status = this.xdr.readUnsignedInt();
499
+ if (status === 0) {
500
+ const object = this.readFh();
501
+ return new msg.Nfsv4GetfhResponse(status, new msg.Nfsv4GetfhResOk(object));
502
+ }
503
+ return new msg.Nfsv4GetfhResponse(status);
504
+ }
505
+ decodeLinkRequest() {
506
+ const newname = this.xdr.readString();
507
+ return new msg.Nfsv4LinkRequest(newname);
508
+ }
509
+ decodeLinkResponse() {
510
+ const status = this.xdr.readUnsignedInt();
511
+ if (status === 0) {
512
+ const cinfo = this.readChangeInfo();
513
+ return new msg.Nfsv4LinkResponse(status, new msg.Nfsv4LinkResOk(cinfo));
514
+ }
515
+ return new msg.Nfsv4LinkResponse(status);
516
+ }
517
+ decodeLockRequest() {
518
+ const xdr = this.xdr;
519
+ const locktype = xdr.readUnsignedInt();
520
+ const reclaim = xdr.readBoolean();
521
+ const offset = xdr.readUnsignedHyper();
522
+ const length = xdr.readUnsignedHyper();
523
+ const locker = this.readLockOwnerInfo();
524
+ return new msg.Nfsv4LockRequest(locktype, reclaim, offset, length, locker);
525
+ }
526
+ decodeLockResponse() {
527
+ const xdr = this.xdr;
528
+ const status = xdr.readUnsignedInt();
529
+ if (status === 0) {
530
+ const lockStateid = this.readStateid();
531
+ return new msg.Nfsv4LockResponse(status, new msg.Nfsv4LockResOk(lockStateid));
532
+ }
533
+ else if (status === 10010) {
534
+ const offset = xdr.readUnsignedHyper();
535
+ const length = xdr.readUnsignedHyper();
536
+ const locktype = xdr.readUnsignedInt();
537
+ const owner = this.readLockOwner();
538
+ return new msg.Nfsv4LockResponse(status, undefined, new msg.Nfsv4LockResDenied(offset, length, locktype, owner));
539
+ }
540
+ return new msg.Nfsv4LockResponse(status);
541
+ }
542
+ decodeLocktRequest() {
543
+ const xdr = this.xdr;
544
+ const locktype = xdr.readUnsignedInt();
545
+ const offset = xdr.readUnsignedHyper();
546
+ const length = xdr.readUnsignedHyper();
547
+ const owner = this.readLockOwner();
548
+ return new msg.Nfsv4LocktRequest(locktype, offset, length, owner);
549
+ }
550
+ decodeLocktResponse() {
551
+ const xdr = this.xdr;
552
+ const status = xdr.readUnsignedInt();
553
+ if (status === 10010) {
554
+ const offset = xdr.readUnsignedHyper();
555
+ const length = xdr.readUnsignedHyper();
556
+ const locktype = xdr.readUnsignedInt();
557
+ const owner = this.readLockOwner();
558
+ return new msg.Nfsv4LocktResponse(status, new msg.Nfsv4LocktResDenied(offset, length, locktype, owner));
559
+ }
560
+ return new msg.Nfsv4LocktResponse(status);
561
+ }
562
+ decodeLockuRequest() {
563
+ const xdr = this.xdr;
564
+ const locktype = xdr.readUnsignedInt();
565
+ const seqid = xdr.readUnsignedInt();
566
+ const lockStateid = this.readStateid();
567
+ const offset = xdr.readUnsignedHyper();
568
+ const length = xdr.readUnsignedHyper();
569
+ return new msg.Nfsv4LockuRequest(locktype, seqid, lockStateid, offset, length);
570
+ }
571
+ decodeLockuResponse() {
572
+ const status = this.xdr.readUnsignedInt();
573
+ if (status === 0) {
574
+ const lockStateid = this.readStateid();
575
+ return new msg.Nfsv4LockuResponse(status, new msg.Nfsv4LockuResOk(lockStateid));
576
+ }
577
+ return new msg.Nfsv4LockuResponse(status);
578
+ }
579
+ decodeLookupRequest() {
580
+ const objname = this.xdr.readString();
581
+ return new msg.Nfsv4LookupRequest(objname);
582
+ }
583
+ decodeLookupResponse() {
584
+ const status = this.xdr.readUnsignedInt();
585
+ return new msg.Nfsv4LookupResponse(status);
586
+ }
587
+ decodeLookuppRequest() {
588
+ return new msg.Nfsv4LookuppRequest();
589
+ }
590
+ decodeLookuppResponse() {
591
+ const status = this.xdr.readUnsignedInt();
592
+ return new msg.Nfsv4LookuppResponse(status);
593
+ }
594
+ decodeNverifyRequest() {
595
+ const objAttributes = this.readFattr();
596
+ return new msg.Nfsv4NverifyRequest(objAttributes);
597
+ }
598
+ decodeNverifyResponse() {
599
+ const status = this.xdr.readUnsignedInt();
600
+ return new msg.Nfsv4NverifyResponse(status);
601
+ }
602
+ decodeOpenRequest() {
603
+ const xdr = this.xdr;
604
+ const seqid = xdr.readUnsignedInt();
605
+ const shareAccess = xdr.readUnsignedInt();
606
+ const shareDeny = xdr.readUnsignedInt();
607
+ const owner = this.readOpenOwner();
608
+ const openhow = xdr.readUnsignedInt();
609
+ const claim = this.readOpenClaim();
610
+ return new msg.Nfsv4OpenRequest(seqid, shareAccess, shareDeny, owner, openhow, claim);
611
+ }
612
+ decodeOpenResponse() {
613
+ const xdr = this.xdr;
614
+ const status = xdr.readUnsignedInt();
615
+ if (status === 0) {
616
+ const stateid = this.readStateid();
617
+ const cinfo = this.readChangeInfo();
618
+ const rflags = xdr.readUnsignedInt();
619
+ const attrset = this.readBitmap();
620
+ const delegation = this.readOpenDelegation();
621
+ return new msg.Nfsv4OpenResponse(status, new msg.Nfsv4OpenResOk(stateid, cinfo, rflags, attrset, delegation));
622
+ }
623
+ return new msg.Nfsv4OpenResponse(status);
624
+ }
625
+ decodeOpenattrRequest() {
626
+ const createdir = this.xdr.readBoolean();
627
+ return new msg.Nfsv4OpenattrRequest(createdir);
628
+ }
629
+ decodeOpenattrResponse() {
630
+ const status = this.xdr.readUnsignedInt();
631
+ return new msg.Nfsv4OpenattrResponse(status);
632
+ }
633
+ decodeOpenConfirmRequest() {
634
+ const openStateid = this.readStateid();
635
+ const seqid = this.xdr.readUnsignedInt();
636
+ return new msg.Nfsv4OpenConfirmRequest(openStateid, seqid);
637
+ }
638
+ decodeOpenConfirmResponse() {
639
+ const status = this.xdr.readUnsignedInt();
640
+ if (status === 0) {
641
+ const openStateid = this.readStateid();
642
+ return new msg.Nfsv4OpenConfirmResponse(status, new msg.Nfsv4OpenConfirmResOk(openStateid));
643
+ }
644
+ return new msg.Nfsv4OpenConfirmResponse(status);
645
+ }
646
+ decodeOpenDowngradeRequest() {
647
+ const xdr = this.xdr;
648
+ const openStateid = this.readStateid();
649
+ const seqid = xdr.readUnsignedInt();
650
+ const shareAccess = xdr.readUnsignedInt();
651
+ const shareDeny = xdr.readUnsignedInt();
652
+ return new msg.Nfsv4OpenDowngradeRequest(openStateid, seqid, shareAccess, shareDeny);
653
+ }
654
+ decodeOpenDowngradeResponse() {
655
+ const status = this.xdr.readUnsignedInt();
656
+ if (status === 0) {
657
+ const openStateid = this.readStateid();
658
+ return new msg.Nfsv4OpenDowngradeResponse(status, new msg.Nfsv4OpenDowngradeResOk(openStateid));
659
+ }
660
+ return new msg.Nfsv4OpenDowngradeResponse(status);
661
+ }
662
+ decodePutfhRequest() {
663
+ const object = this.readFh();
664
+ return new msg.Nfsv4PutfhRequest(object);
665
+ }
666
+ decodePutfhResponse() {
667
+ const status = this.xdr.readUnsignedInt();
668
+ return new msg.Nfsv4PutfhResponse(status);
669
+ }
670
+ decodePutpubfhRequest() {
671
+ return new msg.Nfsv4PutpubfhRequest();
672
+ }
673
+ decodePutpubfhResponse() {
674
+ const status = this.xdr.readUnsignedInt();
675
+ return new msg.Nfsv4PutpubfhResponse(status);
676
+ }
677
+ decodePutrootfhRequest() {
678
+ return new msg.Nfsv4PutrootfhRequest();
679
+ }
680
+ decodePutrootfhResponse() {
681
+ const status = this.xdr.readUnsignedInt();
682
+ return new msg.Nfsv4PutrootfhResponse(status);
683
+ }
684
+ decodeReadRequest() {
685
+ const xdr = this.xdr;
686
+ const stateid = this.readStateid();
687
+ const offset = xdr.readUnsignedHyper();
688
+ const count = xdr.readUnsignedInt();
689
+ return new msg.Nfsv4ReadRequest(stateid, offset, count);
690
+ }
691
+ decodeReadResponse() {
692
+ const xdr = this.xdr;
693
+ const status = xdr.readUnsignedInt();
694
+ if (status === 0) {
695
+ const eof = xdr.readBoolean();
696
+ const data = xdr.readVarlenOpaque();
697
+ return new msg.Nfsv4ReadResponse(status, new msg.Nfsv4ReadResOk(eof, data));
698
+ }
699
+ return new msg.Nfsv4ReadResponse(status);
700
+ }
701
+ decodeReaddirRequest() {
702
+ const xdr = this.xdr;
703
+ const cookie = xdr.readUnsignedHyper();
704
+ const cookieverf = this.readVerifier();
705
+ const dircount = xdr.readUnsignedInt();
706
+ const maxcount = xdr.readUnsignedInt();
707
+ const attrRequest = this.readBitmap();
708
+ return new msg.Nfsv4ReaddirRequest(cookie, cookieverf, dircount, maxcount, attrRequest);
709
+ }
710
+ decodeReaddirResponse() {
711
+ const xdr = this.xdr;
712
+ const status = xdr.readUnsignedInt();
713
+ if (status === 0) {
714
+ const cookieverf = this.readVerifier();
715
+ const entries = [];
716
+ while (xdr.readBoolean()) {
717
+ const cookie = xdr.readUnsignedHyper();
718
+ const name = xdr.readString();
719
+ const attrs = this.readFattr();
720
+ entries.push(new structs.Nfsv4Entry(cookie, name, attrs));
721
+ }
722
+ const eof = xdr.readBoolean();
723
+ return new msg.Nfsv4ReaddirResponse(status, new msg.Nfsv4ReaddirResOk(cookieverf, entries, eof));
724
+ }
725
+ return new msg.Nfsv4ReaddirResponse(status);
726
+ }
727
+ decodeReadlinkRequest() {
728
+ return new msg.Nfsv4ReadlinkRequest();
729
+ }
730
+ decodeReadlinkResponse() {
731
+ const xdr = this.xdr;
732
+ const status = xdr.readUnsignedInt();
733
+ if (status === 0) {
734
+ const link = xdr.readString();
735
+ return new msg.Nfsv4ReadlinkResponse(status, new msg.Nfsv4ReadlinkResOk(link));
736
+ }
737
+ return new msg.Nfsv4ReadlinkResponse(status);
738
+ }
739
+ decodeRemoveRequest() {
740
+ const target = this.xdr.readString();
741
+ return new msg.Nfsv4RemoveRequest(target);
742
+ }
743
+ decodeRemoveResponse() {
744
+ const status = this.xdr.readUnsignedInt();
745
+ if (status === 0) {
746
+ const cinfo = this.readChangeInfo();
747
+ return new msg.Nfsv4RemoveResponse(status, new msg.Nfsv4RemoveResOk(cinfo));
748
+ }
749
+ return new msg.Nfsv4RemoveResponse(status);
750
+ }
751
+ decodeRenameRequest() {
752
+ const xdr = this.xdr;
753
+ const oldname = xdr.readString();
754
+ const newname = xdr.readString();
755
+ return new msg.Nfsv4RenameRequest(oldname, newname);
756
+ }
757
+ decodeRenameResponse() {
758
+ const xdr = this.xdr;
759
+ const status = xdr.readUnsignedInt();
760
+ if (status === 0) {
761
+ const sourceCinfo = this.readChangeInfo();
762
+ const targetCinfo = this.readChangeInfo();
763
+ return new msg.Nfsv4RenameResponse(status, new msg.Nfsv4RenameResOk(sourceCinfo, targetCinfo));
764
+ }
765
+ return new msg.Nfsv4RenameResponse(status);
766
+ }
767
+ decodeRenewRequest() {
768
+ const clientid = this.xdr.readUnsignedHyper();
769
+ return new msg.Nfsv4RenewRequest(clientid);
770
+ }
771
+ decodeRenewResponse() {
772
+ const status = this.xdr.readUnsignedInt();
773
+ return new msg.Nfsv4RenewResponse(status);
774
+ }
775
+ decodeRestorefhRequest() {
776
+ return new msg.Nfsv4RestorefhRequest();
777
+ }
778
+ decodeRestorefhResponse() {
779
+ const status = this.xdr.readUnsignedInt();
780
+ return new msg.Nfsv4RestorefhResponse(status);
781
+ }
782
+ decodeSavefhRequest() {
783
+ return new msg.Nfsv4SavefhRequest();
784
+ }
785
+ decodeSavefhResponse() {
786
+ const status = this.xdr.readUnsignedInt();
787
+ return new msg.Nfsv4SavefhResponse(status);
788
+ }
789
+ decodeSecinfoRequest() {
790
+ const name = this.xdr.readString();
791
+ return new msg.Nfsv4SecinfoRequest(name);
792
+ }
793
+ decodeSecinfoResponse() {
794
+ const xdr = this.xdr;
795
+ const status = xdr.readUnsignedInt();
796
+ if (status === 0) {
797
+ const count = xdr.readUnsignedInt();
798
+ const flavors = [];
799
+ for (let i = 0; i < count; i++)
800
+ flavors.push(this.readSecInfoFlavor());
801
+ return new msg.Nfsv4SecinfoResponse(status, new msg.Nfsv4SecinfoResOk(flavors));
802
+ }
803
+ return new msg.Nfsv4SecinfoResponse(status);
804
+ }
805
+ decodeSetattrRequest() {
806
+ const stateid = this.readStateid();
807
+ const objAttributes = this.readFattr();
808
+ return new msg.Nfsv4SetattrRequest(stateid, objAttributes);
809
+ }
810
+ decodeSetattrResponse() {
811
+ const status = this.xdr.readUnsignedInt();
812
+ const attrset = this.readBitmap();
813
+ return new msg.Nfsv4SetattrResponse(status, new msg.Nfsv4SetattrResOk(attrset));
814
+ }
815
+ decodeSetclientidRequest() {
816
+ const client = this.readClientId();
817
+ const callback = this.readCbClient();
818
+ const callbackIdent = this.xdr.readUnsignedInt();
819
+ return new msg.Nfsv4SetclientidRequest(client, callback, callbackIdent);
820
+ }
821
+ decodeSetclientidResponse() {
822
+ const xdr = this.xdr;
823
+ const status = xdr.readUnsignedInt();
824
+ if (status === 0) {
825
+ const clientid = xdr.readUnsignedHyper();
826
+ const setclientidConfirm = this.readVerifier();
827
+ return new msg.Nfsv4SetclientidResponse(status, new msg.Nfsv4SetclientidResOk(clientid, setclientidConfirm));
828
+ }
829
+ return new msg.Nfsv4SetclientidResponse(status);
830
+ }
831
+ decodeSetclientidConfirmRequest() {
832
+ const clientid = this.xdr.readUnsignedHyper();
833
+ const setclientidConfirm = this.readVerifier();
834
+ return new msg.Nfsv4SetclientidConfirmRequest(clientid, setclientidConfirm);
835
+ }
836
+ decodeSetclientidConfirmResponse() {
837
+ const status = this.xdr.readUnsignedInt();
838
+ return new msg.Nfsv4SetclientidConfirmResponse(status);
839
+ }
840
+ decodeVerifyRequest() {
841
+ const objAttributes = this.readFattr();
842
+ return new msg.Nfsv4VerifyRequest(objAttributes);
843
+ }
844
+ decodeVerifyResponse() {
845
+ const status = this.xdr.readUnsignedInt();
846
+ return new msg.Nfsv4VerifyResponse(status);
847
+ }
848
+ decodeWriteRequest() {
849
+ const xdr = this.xdr;
850
+ const stateid = this.readStateid();
851
+ const offset = xdr.readUnsignedHyper();
852
+ const stable = xdr.readUnsignedInt();
853
+ const data = xdr.readVarlenOpaque();
854
+ return new msg.Nfsv4WriteRequest(stateid, offset, stable, data);
855
+ }
856
+ decodeWriteResponse() {
857
+ const xdr = this.xdr;
858
+ const status = xdr.readUnsignedInt();
859
+ if (status === 0) {
860
+ const count = xdr.readUnsignedInt();
861
+ const committed = xdr.readUnsignedInt();
862
+ const writeverf = this.readVerifier();
863
+ return new msg.Nfsv4WriteResponse(status, new msg.Nfsv4WriteResOk(count, committed, writeverf));
864
+ }
865
+ return new msg.Nfsv4WriteResponse(status);
866
+ }
867
+ decodeReleaseLockOwnerRequest() {
868
+ const lockOwner = this.readLockOwner();
869
+ return new msg.Nfsv4ReleaseLockOwnerRequest(lockOwner);
870
+ }
871
+ decodeReleaseLockOwnerResponse() {
872
+ const status = this.xdr.readUnsignedInt();
873
+ return new msg.Nfsv4ReleaseLockOwnerResponse(status);
874
+ }
875
+ decodeIllegalRequest() {
876
+ return new msg.Nfsv4IllegalRequest();
877
+ }
878
+ decodeIllegalResponse() {
879
+ const status = this.xdr.readUnsignedInt();
880
+ return new msg.Nfsv4IllegalResponse(status);
881
+ }
882
+ }
883
+ exports.Nfsv4Decoder = Nfsv4Decoder;
884
+ //# sourceMappingURL=Nfsv4Decoder.js.map