@jsonjoy.com/json-pack 1.15.0 → 1.17.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/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/structs.d.ts +156 -0
- package/lib/nfs/v3/structs.js +210 -0
- package/lib/nfs/v3/structs.js.map +1 -0
- package/lib/rm/RmRecordDecoder.d.ts +8 -0
- package/lib/rm/RmRecordDecoder.js +57 -0
- package/lib/rm/RmRecordDecoder.js.map +1 -0
- package/lib/rm/RmRecordEncoder.d.ts +10 -0
- package/lib/rm/RmRecordEncoder.js +43 -0
- package/lib/rm/RmRecordEncoder.js.map +1 -0
- package/lib/rm/index.d.ts +2 -0
- package/lib/rm/index.js +6 -0
- package/lib/rm/index.js.map +1 -0
- package/lib/rpc/RpcMessageDecoder.d.ts +6 -0
- package/lib/rpc/RpcMessageDecoder.js +107 -0
- package/lib/rpc/RpcMessageDecoder.js.map +1 -0
- package/lib/rpc/RpcMessageEncoder.d.ts +28 -0
- package/lib/rpc/RpcMessageEncoder.js +152 -0
- package/lib/rpc/RpcMessageEncoder.js.map +1 -0
- package/lib/rpc/constants.d.ts +50 -0
- package/lib/rpc/constants.js +5 -0
- package/lib/rpc/constants.js.map +1 -0
- package/lib/rpc/errors.d.ts +6 -0
- package/lib/rpc/errors.js +16 -0
- package/lib/rpc/errors.js.map +1 -0
- package/lib/rpc/index.d.ts +5 -0
- package/lib/rpc/index.js +9 -0
- package/lib/rpc/index.js.map +1 -0
- package/lib/rpc/messages.d.ts +40 -0
- package/lib/rpc/messages.js +50 -0
- package/lib/rpc/messages.js.map +1 -0
- package/lib/ws/WsFrameDecoder.d.ts +1 -1
- package/lib/ws/WsFrameDecoder.js +1 -1
- package/lib/ws/WsFrameDecoder.js.map +1 -1
- package/lib/ws/index.d.ts +1 -0
- package/lib/ws/index.js +1 -0
- package/lib/ws/index.js.map +1 -1
- package/lib/xdr/XdrDecoder.js +9 -18
- package/lib/xdr/XdrDecoder.js.map +1 -1
- package/lib/xdr/XdrEncoder.js +5 -10
- package/lib/xdr/XdrEncoder.js.map +1 -1
- package/lib/xdr/XdrSchemaDecoder.d.ts +1 -0
- package/lib/xdr/XdrSchemaDecoder.js +10 -0
- package/lib/xdr/XdrSchemaDecoder.js.map +1 -1
- package/lib/xdr/XdrSchemaEncoder.d.ts +2 -1
- package/lib/xdr/XdrSchemaEncoder.js +23 -2
- package/lib/xdr/XdrSchemaEncoder.js.map +1 -1
- package/lib/xdr/XdrSchemaValidator.d.ts +2 -0
- package/lib/xdr/XdrSchemaValidator.js +21 -0
- package/lib/xdr/XdrSchemaValidator.js.map +1 -1
- package/lib/xdr/index.js.map +1 -1
- package/lib/xdr/types.d.ts +8 -2
- package/package.json +3 -3
|
@@ -0,0 +1,757 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Nfsv3Decoder = 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 Nfsv3Decoder {
|
|
11
|
+
constructor(reader = new Reader_1.Reader()) {
|
|
12
|
+
this.xdr = new XdrDecoder_1.XdrDecoder(reader);
|
|
13
|
+
}
|
|
14
|
+
decodeMessage(reader, proc, isRequest) {
|
|
15
|
+
this.xdr.reader = reader;
|
|
16
|
+
const startPos = reader.x;
|
|
17
|
+
try {
|
|
18
|
+
if (isRequest) {
|
|
19
|
+
return this.decodeRequest(proc);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return this.decodeResponse(proc);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
if (err instanceof RangeError) {
|
|
27
|
+
reader.x = startPos;
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
decodeRequest(proc) {
|
|
34
|
+
switch (proc) {
|
|
35
|
+
case 1:
|
|
36
|
+
return this.decodeGetattrRequest();
|
|
37
|
+
case 2:
|
|
38
|
+
return this.decodeSetattrRequest();
|
|
39
|
+
case 3:
|
|
40
|
+
return this.decodeLookupRequest();
|
|
41
|
+
case 4:
|
|
42
|
+
return this.decodeAccessRequest();
|
|
43
|
+
case 5:
|
|
44
|
+
return this.decodeReadlinkRequest();
|
|
45
|
+
case 6:
|
|
46
|
+
return this.decodeReadRequest();
|
|
47
|
+
case 7:
|
|
48
|
+
return this.decodeWriteRequest();
|
|
49
|
+
case 8:
|
|
50
|
+
return this.decodeCreateRequest();
|
|
51
|
+
case 9:
|
|
52
|
+
return this.decodeMkdirRequest();
|
|
53
|
+
case 10:
|
|
54
|
+
return this.decodeSymlinkRequest();
|
|
55
|
+
case 11:
|
|
56
|
+
return this.decodeMknodRequest();
|
|
57
|
+
case 12:
|
|
58
|
+
return this.decodeRemoveRequest();
|
|
59
|
+
case 13:
|
|
60
|
+
return this.decodeRmdirRequest();
|
|
61
|
+
case 14:
|
|
62
|
+
return this.decodeRenameRequest();
|
|
63
|
+
case 15:
|
|
64
|
+
return this.decodeLinkRequest();
|
|
65
|
+
case 16:
|
|
66
|
+
return this.decodeReaddirRequest();
|
|
67
|
+
case 17:
|
|
68
|
+
return this.decodeReaddirplusRequest();
|
|
69
|
+
case 18:
|
|
70
|
+
return this.decodeFsstatRequest();
|
|
71
|
+
case 19:
|
|
72
|
+
return this.decodeFsinfoRequest();
|
|
73
|
+
case 20:
|
|
74
|
+
return this.decodePathconfRequest();
|
|
75
|
+
case 21:
|
|
76
|
+
return this.decodeCommitRequest();
|
|
77
|
+
default:
|
|
78
|
+
throw new errors_1.Nfsv3DecodingError(`Unknown procedure: \${proc}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
decodeResponse(proc) {
|
|
82
|
+
switch (proc) {
|
|
83
|
+
case 1:
|
|
84
|
+
return this.decodeGetattrResponse();
|
|
85
|
+
case 2:
|
|
86
|
+
return this.decodeSetattrResponse();
|
|
87
|
+
case 3:
|
|
88
|
+
return this.decodeLookupResponse();
|
|
89
|
+
case 4:
|
|
90
|
+
return this.decodeAccessResponse();
|
|
91
|
+
case 5:
|
|
92
|
+
return this.decodeReadlinkResponse();
|
|
93
|
+
case 6:
|
|
94
|
+
return this.decodeReadResponse();
|
|
95
|
+
case 7:
|
|
96
|
+
return this.decodeWriteResponse();
|
|
97
|
+
case 8:
|
|
98
|
+
return this.decodeCreateResponse();
|
|
99
|
+
case 9:
|
|
100
|
+
return this.decodeMkdirResponse();
|
|
101
|
+
case 10:
|
|
102
|
+
return this.decodeSymlinkResponse();
|
|
103
|
+
case 11:
|
|
104
|
+
return this.decodeMknodResponse();
|
|
105
|
+
case 12:
|
|
106
|
+
return this.decodeRemoveResponse();
|
|
107
|
+
case 13:
|
|
108
|
+
return this.decodeRmdirResponse();
|
|
109
|
+
case 14:
|
|
110
|
+
return this.decodeRenameResponse();
|
|
111
|
+
case 15:
|
|
112
|
+
return this.decodeLinkResponse();
|
|
113
|
+
case 16:
|
|
114
|
+
return this.decodeReaddirResponse();
|
|
115
|
+
case 17:
|
|
116
|
+
return this.decodeReaddirplusResponse();
|
|
117
|
+
case 18:
|
|
118
|
+
return this.decodeFsstatResponse();
|
|
119
|
+
case 19:
|
|
120
|
+
return this.decodeFsinfoResponse();
|
|
121
|
+
case 20:
|
|
122
|
+
return this.decodePathconfResponse();
|
|
123
|
+
case 21:
|
|
124
|
+
return this.decodeCommitResponse();
|
|
125
|
+
default:
|
|
126
|
+
throw new errors_1.Nfsv3DecodingError(`Unknown procedure: \${proc}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
readFh() {
|
|
130
|
+
const data = this.xdr.readVarlenOpaque();
|
|
131
|
+
return new structs.Nfsv3Fh(new Reader_1.Reader(data));
|
|
132
|
+
}
|
|
133
|
+
readFilename() {
|
|
134
|
+
return this.xdr.readString();
|
|
135
|
+
}
|
|
136
|
+
readTime() {
|
|
137
|
+
const xdr = this.xdr;
|
|
138
|
+
const seconds = xdr.readUnsignedInt();
|
|
139
|
+
const nseconds = xdr.readUnsignedInt();
|
|
140
|
+
return new structs.Nfsv3Time(seconds, nseconds);
|
|
141
|
+
}
|
|
142
|
+
readSpecData() {
|
|
143
|
+
const xdr = this.xdr;
|
|
144
|
+
const specdata1 = xdr.readUnsignedInt();
|
|
145
|
+
const specdata2 = xdr.readUnsignedInt();
|
|
146
|
+
return new structs.Nfsv3SpecData(specdata1, specdata2);
|
|
147
|
+
}
|
|
148
|
+
readFattr() {
|
|
149
|
+
const xdr = this.xdr;
|
|
150
|
+
const type = xdr.readUnsignedInt();
|
|
151
|
+
const mode = xdr.readUnsignedInt();
|
|
152
|
+
const nlink = xdr.readUnsignedInt();
|
|
153
|
+
const uid = xdr.readUnsignedInt();
|
|
154
|
+
const gid = xdr.readUnsignedInt();
|
|
155
|
+
const size = xdr.readUnsignedHyper();
|
|
156
|
+
const used = xdr.readUnsignedHyper();
|
|
157
|
+
const rdev = this.readSpecData();
|
|
158
|
+
const fsid = xdr.readUnsignedHyper();
|
|
159
|
+
const fileid = xdr.readUnsignedHyper();
|
|
160
|
+
const atime = this.readTime();
|
|
161
|
+
const mtime = this.readTime();
|
|
162
|
+
const ctime = this.readTime();
|
|
163
|
+
return new structs.Nfsv3Fattr(type, mode, nlink, uid, gid, size, used, rdev, fsid, fileid, atime, mtime, ctime);
|
|
164
|
+
}
|
|
165
|
+
readPostOpAttr() {
|
|
166
|
+
const attributesFollow = this.xdr.readBoolean();
|
|
167
|
+
const attributes = attributesFollow ? this.readFattr() : undefined;
|
|
168
|
+
return new structs.Nfsv3PostOpAttr(attributesFollow, attributes);
|
|
169
|
+
}
|
|
170
|
+
readWccAttr() {
|
|
171
|
+
const size = this.xdr.readUnsignedHyper();
|
|
172
|
+
const mtime = this.readTime();
|
|
173
|
+
const ctime = this.readTime();
|
|
174
|
+
return new structs.Nfsv3WccAttr(size, mtime, ctime);
|
|
175
|
+
}
|
|
176
|
+
readPreOpAttr() {
|
|
177
|
+
const attributesFollow = this.xdr.readBoolean();
|
|
178
|
+
const attributes = attributesFollow ? this.readWccAttr() : undefined;
|
|
179
|
+
return new structs.Nfsv3PreOpAttr(attributesFollow, attributes);
|
|
180
|
+
}
|
|
181
|
+
readWccData() {
|
|
182
|
+
const before = this.readPreOpAttr();
|
|
183
|
+
const after = this.readPostOpAttr();
|
|
184
|
+
return new structs.Nfsv3WccData(before, after);
|
|
185
|
+
}
|
|
186
|
+
readPostOpFh() {
|
|
187
|
+
const handleFollows = this.xdr.readBoolean();
|
|
188
|
+
const handle = handleFollows ? this.readFh() : undefined;
|
|
189
|
+
return new structs.Nfsv3PostOpFh(handleFollows, handle);
|
|
190
|
+
}
|
|
191
|
+
readSetMode() {
|
|
192
|
+
const set = this.xdr.readBoolean();
|
|
193
|
+
const mode = set ? this.xdr.readUnsignedInt() : undefined;
|
|
194
|
+
return new structs.Nfsv3SetMode(set, mode);
|
|
195
|
+
}
|
|
196
|
+
readSetUid() {
|
|
197
|
+
const set = this.xdr.readBoolean();
|
|
198
|
+
const uid = set ? this.xdr.readUnsignedInt() : undefined;
|
|
199
|
+
return new structs.Nfsv3SetUid(set, uid);
|
|
200
|
+
}
|
|
201
|
+
readSetGid() {
|
|
202
|
+
const set = this.xdr.readBoolean();
|
|
203
|
+
const gid = set ? this.xdr.readUnsignedInt() : undefined;
|
|
204
|
+
return new structs.Nfsv3SetGid(set, gid);
|
|
205
|
+
}
|
|
206
|
+
readSetSize() {
|
|
207
|
+
const set = this.xdr.readBoolean();
|
|
208
|
+
const size = set ? this.xdr.readUnsignedHyper() : undefined;
|
|
209
|
+
return new structs.Nfsv3SetSize(set, size);
|
|
210
|
+
}
|
|
211
|
+
readSetAtime() {
|
|
212
|
+
const how = this.xdr.readUnsignedInt();
|
|
213
|
+
const atime = how === 2 ? this.readTime() : undefined;
|
|
214
|
+
return new structs.Nfsv3SetAtime(how, atime);
|
|
215
|
+
}
|
|
216
|
+
readSetMtime() {
|
|
217
|
+
const how = this.xdr.readUnsignedInt();
|
|
218
|
+
const mtime = how === 2 ? this.readTime() : undefined;
|
|
219
|
+
return new structs.Nfsv3SetMtime(how, mtime);
|
|
220
|
+
}
|
|
221
|
+
readSattr() {
|
|
222
|
+
const mode = this.readSetMode();
|
|
223
|
+
const uid = this.readSetUid();
|
|
224
|
+
const gid = this.readSetGid();
|
|
225
|
+
const size = this.readSetSize();
|
|
226
|
+
const atime = this.readSetAtime();
|
|
227
|
+
const mtime = this.readSetMtime();
|
|
228
|
+
return new structs.Nfsv3Sattr(mode, uid, gid, size, atime, mtime);
|
|
229
|
+
}
|
|
230
|
+
readSattrGuard() {
|
|
231
|
+
const check = this.xdr.readBoolean();
|
|
232
|
+
const objCtime = check ? this.readTime() : undefined;
|
|
233
|
+
return new structs.Nfsv3SattrGuard(check, objCtime);
|
|
234
|
+
}
|
|
235
|
+
readDirOpArgs() {
|
|
236
|
+
const dir = this.readFh();
|
|
237
|
+
const name = this.readFilename();
|
|
238
|
+
return new structs.Nfsv3DirOpArgs(dir, name);
|
|
239
|
+
}
|
|
240
|
+
readCreateHow() {
|
|
241
|
+
const xdr = this.xdr;
|
|
242
|
+
const mode = xdr.readUnsignedInt();
|
|
243
|
+
let objAttributes;
|
|
244
|
+
let verf;
|
|
245
|
+
if (mode === 0 || mode === 1) {
|
|
246
|
+
objAttributes = this.readSattr();
|
|
247
|
+
}
|
|
248
|
+
else if (mode === 2) {
|
|
249
|
+
const verfData = xdr.readOpaque(8);
|
|
250
|
+
verf = new Reader_1.Reader(verfData);
|
|
251
|
+
}
|
|
252
|
+
return new structs.Nfsv3CreateHow(mode, objAttributes, verf);
|
|
253
|
+
}
|
|
254
|
+
readMknodData() {
|
|
255
|
+
const type = this.xdr.readUnsignedInt();
|
|
256
|
+
let chr;
|
|
257
|
+
let blk;
|
|
258
|
+
let sock;
|
|
259
|
+
let pipe;
|
|
260
|
+
switch (type) {
|
|
261
|
+
case 4:
|
|
262
|
+
chr = new structs.Nfsv3DeviceData(this.readSattr(), this.readSpecData());
|
|
263
|
+
break;
|
|
264
|
+
case 3:
|
|
265
|
+
blk = new structs.Nfsv3DeviceData(this.readSattr(), this.readSpecData());
|
|
266
|
+
break;
|
|
267
|
+
case 6:
|
|
268
|
+
sock = this.readSattr();
|
|
269
|
+
break;
|
|
270
|
+
case 7:
|
|
271
|
+
pipe = this.readSattr();
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
return new structs.Nfsv3MknodData(type, chr, blk, sock, pipe);
|
|
275
|
+
}
|
|
276
|
+
readEntry() {
|
|
277
|
+
const xdr = this.xdr;
|
|
278
|
+
const valueFollows = xdr.readBoolean();
|
|
279
|
+
if (!valueFollows)
|
|
280
|
+
return undefined;
|
|
281
|
+
const fileid = xdr.readUnsignedHyper();
|
|
282
|
+
const name = this.readFilename();
|
|
283
|
+
const cookie = xdr.readUnsignedHyper();
|
|
284
|
+
const nextentry = this.readEntry();
|
|
285
|
+
return new structs.Nfsv3Entry(fileid, name, cookie, nextentry);
|
|
286
|
+
}
|
|
287
|
+
readEntryPlus() {
|
|
288
|
+
const xdr = this.xdr;
|
|
289
|
+
const valueFollows = xdr.readBoolean();
|
|
290
|
+
if (!valueFollows)
|
|
291
|
+
return undefined;
|
|
292
|
+
const fileid = xdr.readUnsignedHyper();
|
|
293
|
+
const name = this.readFilename();
|
|
294
|
+
const cookie = xdr.readUnsignedHyper();
|
|
295
|
+
const nameAttributes = this.readPostOpAttr();
|
|
296
|
+
const nameHandle = this.readPostOpFh();
|
|
297
|
+
const nextentry = this.readEntryPlus();
|
|
298
|
+
return new structs.Nfsv3EntryPlus(fileid, name, cookie, nameAttributes, nameHandle, nextentry);
|
|
299
|
+
}
|
|
300
|
+
readDirList() {
|
|
301
|
+
const entries = this.readEntry();
|
|
302
|
+
const eof = this.xdr.readBoolean();
|
|
303
|
+
return new structs.Nfsv3DirList(eof, entries);
|
|
304
|
+
}
|
|
305
|
+
readDirListPlus() {
|
|
306
|
+
const entries = this.readEntryPlus();
|
|
307
|
+
const eof = this.xdr.readBoolean();
|
|
308
|
+
return new structs.Nfsv3DirListPlus(eof, entries);
|
|
309
|
+
}
|
|
310
|
+
decodeGetattrRequest() {
|
|
311
|
+
const object = this.readFh();
|
|
312
|
+
return new msg.Nfsv3GetattrRequest(object);
|
|
313
|
+
}
|
|
314
|
+
decodeGetattrResponse() {
|
|
315
|
+
const status = this.xdr.readUnsignedInt();
|
|
316
|
+
let resok;
|
|
317
|
+
if (status === 0) {
|
|
318
|
+
const objAttributes = this.readFattr();
|
|
319
|
+
resok = new msg.Nfsv3GetattrResOk(objAttributes);
|
|
320
|
+
}
|
|
321
|
+
return new msg.Nfsv3GetattrResponse(status, resok);
|
|
322
|
+
}
|
|
323
|
+
decodeSetattrRequest() {
|
|
324
|
+
const object = this.readFh();
|
|
325
|
+
const newAttributes = this.readSattr();
|
|
326
|
+
const guard = this.readSattrGuard();
|
|
327
|
+
return new msg.Nfsv3SetattrRequest(object, newAttributes, guard);
|
|
328
|
+
}
|
|
329
|
+
decodeSetattrResponse() {
|
|
330
|
+
const status = this.xdr.readUnsignedInt();
|
|
331
|
+
let resok;
|
|
332
|
+
let resfail;
|
|
333
|
+
const objWcc = this.readWccData();
|
|
334
|
+
if (status === 0) {
|
|
335
|
+
resok = new msg.Nfsv3SetattrResOk(objWcc);
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
resfail = new msg.Nfsv3SetattrResFail(objWcc);
|
|
339
|
+
}
|
|
340
|
+
return new msg.Nfsv3SetattrResponse(status, resok, resfail);
|
|
341
|
+
}
|
|
342
|
+
decodeLookupRequest() {
|
|
343
|
+
const what = this.readDirOpArgs();
|
|
344
|
+
return new msg.Nfsv3LookupRequest(what);
|
|
345
|
+
}
|
|
346
|
+
decodeLookupResponse() {
|
|
347
|
+
const status = this.xdr.readUnsignedInt();
|
|
348
|
+
let resok;
|
|
349
|
+
let resfail;
|
|
350
|
+
if (status === 0) {
|
|
351
|
+
const object = this.readFh();
|
|
352
|
+
const objAttributes = this.readPostOpAttr();
|
|
353
|
+
const dirAttributes = this.readPostOpAttr();
|
|
354
|
+
resok = new msg.Nfsv3LookupResOk(object, objAttributes, dirAttributes);
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
const dirAttributes = this.readPostOpAttr();
|
|
358
|
+
resfail = new msg.Nfsv3LookupResFail(dirAttributes);
|
|
359
|
+
}
|
|
360
|
+
return new msg.Nfsv3LookupResponse(status, resok, resfail);
|
|
361
|
+
}
|
|
362
|
+
decodeAccessRequest() {
|
|
363
|
+
const object = this.readFh();
|
|
364
|
+
const access = this.xdr.readUnsignedInt();
|
|
365
|
+
return new msg.Nfsv3AccessRequest(object, access);
|
|
366
|
+
}
|
|
367
|
+
decodeAccessResponse() {
|
|
368
|
+
const xdr = this.xdr;
|
|
369
|
+
const status = xdr.readUnsignedInt();
|
|
370
|
+
let resok;
|
|
371
|
+
let resfail;
|
|
372
|
+
const objAttributes = this.readPostOpAttr();
|
|
373
|
+
if (status === 0) {
|
|
374
|
+
const access = xdr.readUnsignedInt();
|
|
375
|
+
resok = new msg.Nfsv3AccessResOk(objAttributes, access);
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
resfail = new msg.Nfsv3AccessResFail(objAttributes);
|
|
379
|
+
}
|
|
380
|
+
return new msg.Nfsv3AccessResponse(status, resok, resfail);
|
|
381
|
+
}
|
|
382
|
+
decodeReadlinkRequest() {
|
|
383
|
+
const symlink = this.readFh();
|
|
384
|
+
return new msg.Nfsv3ReadlinkRequest(symlink);
|
|
385
|
+
}
|
|
386
|
+
decodeReadlinkResponse() {
|
|
387
|
+
const status = this.xdr.readUnsignedInt();
|
|
388
|
+
let resok;
|
|
389
|
+
let resfail;
|
|
390
|
+
const symlinkAttributes = this.readPostOpAttr();
|
|
391
|
+
if (status === 0) {
|
|
392
|
+
const data = this.readFilename();
|
|
393
|
+
resok = new msg.Nfsv3ReadlinkResOk(symlinkAttributes, data);
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
resfail = new msg.Nfsv3ReadlinkResFail(symlinkAttributes);
|
|
397
|
+
}
|
|
398
|
+
return new msg.Nfsv3ReadlinkResponse(status, resok, resfail);
|
|
399
|
+
}
|
|
400
|
+
decodeReadRequest() {
|
|
401
|
+
const file = this.readFh();
|
|
402
|
+
const xdr = this.xdr;
|
|
403
|
+
const offset = xdr.readUnsignedHyper();
|
|
404
|
+
const count = xdr.readUnsignedInt();
|
|
405
|
+
return new msg.Nfsv3ReadRequest(file, offset, count);
|
|
406
|
+
}
|
|
407
|
+
decodeReadResponse() {
|
|
408
|
+
const status = this.xdr.readUnsignedInt();
|
|
409
|
+
let resok;
|
|
410
|
+
let resfail;
|
|
411
|
+
const fileAttributes = this.readPostOpAttr();
|
|
412
|
+
if (status === 0) {
|
|
413
|
+
const xdr = this.xdr;
|
|
414
|
+
const count = xdr.readUnsignedInt();
|
|
415
|
+
const eof = xdr.readBoolean();
|
|
416
|
+
const data = xdr.readVarlenOpaque();
|
|
417
|
+
resok = new msg.Nfsv3ReadResOk(fileAttributes, count, eof, new Reader_1.Reader(data));
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
resfail = new msg.Nfsv3ReadResFail(fileAttributes);
|
|
421
|
+
}
|
|
422
|
+
return new msg.Nfsv3ReadResponse(status, resok, resfail);
|
|
423
|
+
}
|
|
424
|
+
decodeWriteRequest() {
|
|
425
|
+
const file = this.readFh();
|
|
426
|
+
const xdr = this.xdr;
|
|
427
|
+
const offset = xdr.readUnsignedHyper();
|
|
428
|
+
const count = xdr.readUnsignedInt();
|
|
429
|
+
const stable = xdr.readUnsignedInt();
|
|
430
|
+
const data = xdr.readVarlenOpaque();
|
|
431
|
+
return new msg.Nfsv3WriteRequest(file, offset, count, stable, new Reader_1.Reader(data));
|
|
432
|
+
}
|
|
433
|
+
decodeWriteResponse() {
|
|
434
|
+
const xdr = this.xdr;
|
|
435
|
+
const status = xdr.readUnsignedInt();
|
|
436
|
+
let resok;
|
|
437
|
+
let resfail;
|
|
438
|
+
const fileWcc = this.readWccData();
|
|
439
|
+
if (status === 0) {
|
|
440
|
+
const count = xdr.readUnsignedInt();
|
|
441
|
+
const committed = xdr.readUnsignedInt();
|
|
442
|
+
const verf = xdr.readOpaque(8);
|
|
443
|
+
resok = new msg.Nfsv3WriteResOk(fileWcc, count, committed, new Reader_1.Reader(verf));
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
resfail = new msg.Nfsv3WriteResFail(fileWcc);
|
|
447
|
+
}
|
|
448
|
+
return new msg.Nfsv3WriteResponse(status, resok, resfail);
|
|
449
|
+
}
|
|
450
|
+
decodeCreateRequest() {
|
|
451
|
+
const where = this.readDirOpArgs();
|
|
452
|
+
const how = this.readCreateHow();
|
|
453
|
+
return new msg.Nfsv3CreateRequest(where, how);
|
|
454
|
+
}
|
|
455
|
+
decodeCreateResponse() {
|
|
456
|
+
const status = this.xdr.readUnsignedInt();
|
|
457
|
+
let resok;
|
|
458
|
+
let resfail;
|
|
459
|
+
if (status === 0) {
|
|
460
|
+
const obj = this.readPostOpFh();
|
|
461
|
+
const objAttributes = this.readPostOpAttr();
|
|
462
|
+
const dirWcc = this.readWccData();
|
|
463
|
+
resok = new msg.Nfsv3CreateResOk(obj, objAttributes, dirWcc);
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
const dirWcc = this.readWccData();
|
|
467
|
+
resfail = new msg.Nfsv3CreateResFail(dirWcc);
|
|
468
|
+
}
|
|
469
|
+
return new msg.Nfsv3CreateResponse(status, resok, resfail);
|
|
470
|
+
}
|
|
471
|
+
decodeMkdirRequest() {
|
|
472
|
+
const where = this.readDirOpArgs();
|
|
473
|
+
const attributes = this.readSattr();
|
|
474
|
+
return new msg.Nfsv3MkdirRequest(where, attributes);
|
|
475
|
+
}
|
|
476
|
+
decodeMkdirResponse() {
|
|
477
|
+
const status = this.xdr.readUnsignedInt();
|
|
478
|
+
let resok;
|
|
479
|
+
let resfail;
|
|
480
|
+
if (status === 0) {
|
|
481
|
+
const obj = this.readPostOpFh();
|
|
482
|
+
const objAttributes = this.readPostOpAttr();
|
|
483
|
+
const dirWcc = this.readWccData();
|
|
484
|
+
resok = new msg.Nfsv3MkdirResOk(obj, objAttributes, dirWcc);
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
const dirWcc = this.readWccData();
|
|
488
|
+
resfail = new msg.Nfsv3MkdirResFail(dirWcc);
|
|
489
|
+
}
|
|
490
|
+
return new msg.Nfsv3MkdirResponse(status, resok, resfail);
|
|
491
|
+
}
|
|
492
|
+
decodeSymlinkRequest() {
|
|
493
|
+
const where = this.readDirOpArgs();
|
|
494
|
+
const symlinkAttributes = this.readSattr();
|
|
495
|
+
const symlinkData = this.readFilename();
|
|
496
|
+
return new msg.Nfsv3SymlinkRequest(where, symlinkAttributes, symlinkData);
|
|
497
|
+
}
|
|
498
|
+
decodeSymlinkResponse() {
|
|
499
|
+
const status = this.xdr.readUnsignedInt();
|
|
500
|
+
let resok;
|
|
501
|
+
let resfail;
|
|
502
|
+
if (status === 0) {
|
|
503
|
+
const obj = this.readPostOpFh();
|
|
504
|
+
const objAttributes = this.readPostOpAttr();
|
|
505
|
+
const dirWcc = this.readWccData();
|
|
506
|
+
resok = new msg.Nfsv3SymlinkResOk(obj, objAttributes, dirWcc);
|
|
507
|
+
}
|
|
508
|
+
else {
|
|
509
|
+
const dirWcc = this.readWccData();
|
|
510
|
+
resfail = new msg.Nfsv3SymlinkResFail(dirWcc);
|
|
511
|
+
}
|
|
512
|
+
return new msg.Nfsv3SymlinkResponse(status, resok, resfail);
|
|
513
|
+
}
|
|
514
|
+
decodeMknodRequest() {
|
|
515
|
+
const where = this.readDirOpArgs();
|
|
516
|
+
const what = this.readMknodData();
|
|
517
|
+
return new msg.Nfsv3MknodRequest(where, what);
|
|
518
|
+
}
|
|
519
|
+
decodeMknodResponse() {
|
|
520
|
+
const status = this.xdr.readUnsignedInt();
|
|
521
|
+
let resok;
|
|
522
|
+
let resfail;
|
|
523
|
+
if (status === 0) {
|
|
524
|
+
const obj = this.readPostOpFh();
|
|
525
|
+
const objAttributes = this.readPostOpAttr();
|
|
526
|
+
const dirWcc = this.readWccData();
|
|
527
|
+
resok = new msg.Nfsv3MknodResOk(obj, objAttributes, dirWcc);
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
const dirWcc = this.readWccData();
|
|
531
|
+
resfail = new msg.Nfsv3MknodResFail(dirWcc);
|
|
532
|
+
}
|
|
533
|
+
return new msg.Nfsv3MknodResponse(status, resok, resfail);
|
|
534
|
+
}
|
|
535
|
+
decodeRemoveRequest() {
|
|
536
|
+
const object = this.readDirOpArgs();
|
|
537
|
+
return new msg.Nfsv3RemoveRequest(object);
|
|
538
|
+
}
|
|
539
|
+
decodeRemoveResponse() {
|
|
540
|
+
const status = this.xdr.readUnsignedInt();
|
|
541
|
+
let resok;
|
|
542
|
+
let resfail;
|
|
543
|
+
const dirWcc = this.readWccData();
|
|
544
|
+
if (status === 0) {
|
|
545
|
+
resok = new msg.Nfsv3RemoveResOk(dirWcc);
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
resfail = new msg.Nfsv3RemoveResFail(dirWcc);
|
|
549
|
+
}
|
|
550
|
+
return new msg.Nfsv3RemoveResponse(status, resok, resfail);
|
|
551
|
+
}
|
|
552
|
+
decodeRmdirRequest() {
|
|
553
|
+
const object = this.readDirOpArgs();
|
|
554
|
+
return new msg.Nfsv3RmdirRequest(object);
|
|
555
|
+
}
|
|
556
|
+
decodeRmdirResponse() {
|
|
557
|
+
const status = this.xdr.readUnsignedInt();
|
|
558
|
+
let resok;
|
|
559
|
+
let resfail;
|
|
560
|
+
const dirWcc = this.readWccData();
|
|
561
|
+
if (status === 0) {
|
|
562
|
+
resok = new msg.Nfsv3RmdirResOk(dirWcc);
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
resfail = new msg.Nfsv3RmdirResFail(dirWcc);
|
|
566
|
+
}
|
|
567
|
+
return new msg.Nfsv3RmdirResponse(status, resok, resfail);
|
|
568
|
+
}
|
|
569
|
+
decodeRenameRequest() {
|
|
570
|
+
const from = this.readDirOpArgs();
|
|
571
|
+
const to = this.readDirOpArgs();
|
|
572
|
+
return new msg.Nfsv3RenameRequest(from, to);
|
|
573
|
+
}
|
|
574
|
+
decodeRenameResponse() {
|
|
575
|
+
const status = this.xdr.readUnsignedInt();
|
|
576
|
+
let resok;
|
|
577
|
+
let resfail;
|
|
578
|
+
const fromDirWcc = this.readWccData();
|
|
579
|
+
const toDirWcc = this.readWccData();
|
|
580
|
+
if (status === 0) {
|
|
581
|
+
resok = new msg.Nfsv3RenameResOk(fromDirWcc, toDirWcc);
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
resfail = new msg.Nfsv3RenameResFail(fromDirWcc, toDirWcc);
|
|
585
|
+
}
|
|
586
|
+
return new msg.Nfsv3RenameResponse(status, resok, resfail);
|
|
587
|
+
}
|
|
588
|
+
decodeLinkRequest() {
|
|
589
|
+
const file = this.readFh();
|
|
590
|
+
const link = this.readDirOpArgs();
|
|
591
|
+
return new msg.Nfsv3LinkRequest(file, link);
|
|
592
|
+
}
|
|
593
|
+
decodeLinkResponse() {
|
|
594
|
+
const status = this.xdr.readUnsignedInt();
|
|
595
|
+
let resok;
|
|
596
|
+
let resfail;
|
|
597
|
+
const fileAttributes = this.readPostOpAttr();
|
|
598
|
+
const linkDirWcc = this.readWccData();
|
|
599
|
+
if (status === 0) {
|
|
600
|
+
resok = new msg.Nfsv3LinkResOk(fileAttributes, linkDirWcc);
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
resfail = new msg.Nfsv3LinkResFail(fileAttributes, linkDirWcc);
|
|
604
|
+
}
|
|
605
|
+
return new msg.Nfsv3LinkResponse(status, resok, resfail);
|
|
606
|
+
}
|
|
607
|
+
decodeReaddirRequest() {
|
|
608
|
+
const dir = this.readFh();
|
|
609
|
+
const xdr = this.xdr;
|
|
610
|
+
const cookie = xdr.readUnsignedHyper();
|
|
611
|
+
const cookieverf = xdr.readOpaque(8);
|
|
612
|
+
const count = xdr.readUnsignedInt();
|
|
613
|
+
return new msg.Nfsv3ReaddirRequest(dir, cookie, new Reader_1.Reader(cookieverf), count);
|
|
614
|
+
}
|
|
615
|
+
decodeReaddirResponse() {
|
|
616
|
+
const xdr = this.xdr;
|
|
617
|
+
const status = xdr.readUnsignedInt();
|
|
618
|
+
let resok;
|
|
619
|
+
let resfail;
|
|
620
|
+
const dirAttributes = this.readPostOpAttr();
|
|
621
|
+
if (status === 0) {
|
|
622
|
+
const cookieverf = xdr.readOpaque(8);
|
|
623
|
+
const reply = this.readDirList();
|
|
624
|
+
resok = new msg.Nfsv3ReaddirResOk(dirAttributes, new Reader_1.Reader(cookieverf), reply);
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
resfail = new msg.Nfsv3ReaddirResFail(dirAttributes);
|
|
628
|
+
}
|
|
629
|
+
return new msg.Nfsv3ReaddirResponse(status, resok, resfail);
|
|
630
|
+
}
|
|
631
|
+
decodeReaddirplusRequest() {
|
|
632
|
+
const dir = this.readFh();
|
|
633
|
+
const xdr = this.xdr;
|
|
634
|
+
const cookie = xdr.readUnsignedHyper();
|
|
635
|
+
const cookieverf = xdr.readOpaque(8);
|
|
636
|
+
const dircount = xdr.readUnsignedInt();
|
|
637
|
+
const maxcount = xdr.readUnsignedInt();
|
|
638
|
+
return new msg.Nfsv3ReaddirplusRequest(dir, cookie, new Reader_1.Reader(cookieverf), dircount, maxcount);
|
|
639
|
+
}
|
|
640
|
+
decodeReaddirplusResponse() {
|
|
641
|
+
const xdr = this.xdr;
|
|
642
|
+
const status = xdr.readUnsignedInt();
|
|
643
|
+
let resok;
|
|
644
|
+
let resfail;
|
|
645
|
+
const dirAttributes = this.readPostOpAttr();
|
|
646
|
+
if (status === 0) {
|
|
647
|
+
const cookieverf = xdr.readOpaque(8);
|
|
648
|
+
const reply = this.readDirListPlus();
|
|
649
|
+
resok = new msg.Nfsv3ReaddirplusResOk(dirAttributes, new Reader_1.Reader(cookieverf), reply);
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
resfail = new msg.Nfsv3ReaddirplusResFail(dirAttributes);
|
|
653
|
+
}
|
|
654
|
+
return new msg.Nfsv3ReaddirplusResponse(status, resok, resfail);
|
|
655
|
+
}
|
|
656
|
+
decodeFsstatRequest() {
|
|
657
|
+
const fsroot = this.readFh();
|
|
658
|
+
return new msg.Nfsv3FsstatRequest(fsroot);
|
|
659
|
+
}
|
|
660
|
+
decodeFsstatResponse() {
|
|
661
|
+
const xdr = this.xdr;
|
|
662
|
+
const status = xdr.readUnsignedInt();
|
|
663
|
+
let resok;
|
|
664
|
+
let resfail;
|
|
665
|
+
const objAttributes = this.readPostOpAttr();
|
|
666
|
+
if (status === 0) {
|
|
667
|
+
const tbytes = xdr.readUnsignedHyper();
|
|
668
|
+
const fbytes = xdr.readUnsignedHyper();
|
|
669
|
+
const abytes = xdr.readUnsignedHyper();
|
|
670
|
+
const tfiles = xdr.readUnsignedHyper();
|
|
671
|
+
const ffiles = xdr.readUnsignedHyper();
|
|
672
|
+
const afiles = xdr.readUnsignedHyper();
|
|
673
|
+
const invarsec = xdr.readUnsignedInt();
|
|
674
|
+
resok = new msg.Nfsv3FsstatResOk(objAttributes, tbytes, fbytes, abytes, tfiles, ffiles, afiles, invarsec);
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
resfail = new msg.Nfsv3FsstatResFail(objAttributes);
|
|
678
|
+
}
|
|
679
|
+
return new msg.Nfsv3FsstatResponse(status, resok, resfail);
|
|
680
|
+
}
|
|
681
|
+
decodeFsinfoRequest() {
|
|
682
|
+
const fsroot = this.readFh();
|
|
683
|
+
return new msg.Nfsv3FsinfoRequest(fsroot);
|
|
684
|
+
}
|
|
685
|
+
decodeFsinfoResponse() {
|
|
686
|
+
const xdr = this.xdr;
|
|
687
|
+
const status = xdr.readUnsignedInt();
|
|
688
|
+
let resok;
|
|
689
|
+
let resfail;
|
|
690
|
+
const objAttributes = this.readPostOpAttr();
|
|
691
|
+
if (status === 0) {
|
|
692
|
+
const rtmax = xdr.readUnsignedInt();
|
|
693
|
+
const rtpref = xdr.readUnsignedInt();
|
|
694
|
+
const rtmult = xdr.readUnsignedInt();
|
|
695
|
+
const wtmax = xdr.readUnsignedInt();
|
|
696
|
+
const wtpref = xdr.readUnsignedInt();
|
|
697
|
+
const wtmult = xdr.readUnsignedInt();
|
|
698
|
+
const dtpref = xdr.readUnsignedInt();
|
|
699
|
+
const maxfilesize = xdr.readUnsignedHyper();
|
|
700
|
+
const timeDelta = { seconds: xdr.readUnsignedInt(), nseconds: xdr.readUnsignedInt() };
|
|
701
|
+
const properties = xdr.readUnsignedInt();
|
|
702
|
+
resok = new msg.Nfsv3FsinfoResOk(objAttributes, rtmax, rtpref, rtmult, wtmax, wtpref, wtmult, dtpref, maxfilesize, timeDelta, properties);
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
resfail = new msg.Nfsv3FsinfoResFail(objAttributes);
|
|
706
|
+
}
|
|
707
|
+
return new msg.Nfsv3FsinfoResponse(status, resok, resfail);
|
|
708
|
+
}
|
|
709
|
+
decodePathconfRequest() {
|
|
710
|
+
const object = this.readFh();
|
|
711
|
+
return new msg.Nfsv3PathconfRequest(object);
|
|
712
|
+
}
|
|
713
|
+
decodePathconfResponse() {
|
|
714
|
+
const xdr = this.xdr;
|
|
715
|
+
const status = xdr.readUnsignedInt();
|
|
716
|
+
let resok;
|
|
717
|
+
let resfail;
|
|
718
|
+
const objAttributes = this.readPostOpAttr();
|
|
719
|
+
if (status === 0) {
|
|
720
|
+
const linkmax = xdr.readUnsignedInt();
|
|
721
|
+
const namemax = xdr.readUnsignedInt();
|
|
722
|
+
const noTrunc = xdr.readBoolean();
|
|
723
|
+
const chownRestricted = xdr.readBoolean();
|
|
724
|
+
const caseInsensitive = xdr.readBoolean();
|
|
725
|
+
const casePreserving = xdr.readBoolean();
|
|
726
|
+
resok = new msg.Nfsv3PathconfResOk(objAttributes, linkmax, namemax, noTrunc, chownRestricted, caseInsensitive, casePreserving);
|
|
727
|
+
}
|
|
728
|
+
else {
|
|
729
|
+
resfail = new msg.Nfsv3PathconfResFail(objAttributes);
|
|
730
|
+
}
|
|
731
|
+
return new msg.Nfsv3PathconfResponse(status, resok, resfail);
|
|
732
|
+
}
|
|
733
|
+
decodeCommitRequest() {
|
|
734
|
+
const file = this.readFh();
|
|
735
|
+
const xdr = this.xdr;
|
|
736
|
+
const offset = xdr.readUnsignedHyper();
|
|
737
|
+
const count = xdr.readUnsignedInt();
|
|
738
|
+
return new msg.Nfsv3CommitRequest(file, offset, count);
|
|
739
|
+
}
|
|
740
|
+
decodeCommitResponse() {
|
|
741
|
+
const xdr = this.xdr;
|
|
742
|
+
const status = xdr.readUnsignedInt();
|
|
743
|
+
let resok;
|
|
744
|
+
let resfail;
|
|
745
|
+
const fileWcc = this.readWccData();
|
|
746
|
+
if (status === 0) {
|
|
747
|
+
const verf = xdr.readOpaque(8);
|
|
748
|
+
resok = new msg.Nfsv3CommitResOk(fileWcc, new Reader_1.Reader(verf));
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
resfail = new msg.Nfsv3CommitResFail(fileWcc);
|
|
752
|
+
}
|
|
753
|
+
return new msg.Nfsv3CommitResponse(status, resok, resfail);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
exports.Nfsv3Decoder = Nfsv3Decoder;
|
|
757
|
+
//# sourceMappingURL=Nfsv3Decoder.js.map
|