@@ -54,19 +54,20 @@ export class Nfsv4Decoder {
5454 }
5555
5656 private decodeRequest ( op : Nfsv4Op ) : msg . Nfsv4Request | undefined {
57+ const xdr = this . xdr ;
5758 switch ( op ) {
5859 case Nfsv4Op . ACCESS :
59- return this . decodeAccessRequest ( ) ;
60+ return msg . Nfsv4AccessRequest . decode ( xdr ) ;
6061 case Nfsv4Op . CLOSE :
61- return this . decodeCloseRequest ( ) ;
62+ return msg . Nfsv4CloseRequest . decode ( xdr ) ;
6263 case Nfsv4Op . COMMIT :
63- return this . decodeCommitRequest ( ) ;
64+ return msg . Nfsv4CommitRequest . decode ( xdr ) ;
6465 case Nfsv4Op . CREATE :
6566 return this . decodeCreateRequest ( ) ;
6667 case Nfsv4Op . DELEGPURGE :
67- return this . decodeDelegpurgeRequest ( ) ;
68+ return msg . Nfsv4DelegpurgeRequest . decode ( xdr ) ;
6869 case Nfsv4Op . DELEGRETURN :
69- return this . decodeDelegreturnRequest ( ) ;
70+ return msg . Nfsv4DelegreturnRequest . decode ( xdr ) ;
7071 case Nfsv4Op . GETATTR :
7172 return this . decodeGetattrRequest ( ) ;
7273 case Nfsv4Op . GETFH :
@@ -96,9 +97,9 @@ export class Nfsv4Decoder {
9697 case Nfsv4Op . PUTFH :
9798 return this . decodePutfhRequest ( ) ;
9899 case Nfsv4Op . PUTPUBFH :
99- return this . decodePutpubfhRequest ( ) ;
100+ return new msg . Nfsv4PutpubfhRequest ( ) ;
100101 case Nfsv4Op . PUTROOTFH :
101- return this . decodePutrootfhRequest ( ) ;
102+ return new msg . Nfsv4PutrootfhRequest ( ) ;
102103 case Nfsv4Op . READ :
103104 return this . decodeReadRequest ( ) ;
104105 case Nfsv4Op . READDIR :
@@ -114,7 +115,7 @@ export class Nfsv4Decoder {
114115 case Nfsv4Op . RESTOREFH :
115116 return this . decodeRestorefhRequest ( ) ;
116117 case Nfsv4Op . SAVEFH :
117- return this . decodeSavefhRequest ( ) ;
118+ return new msg . Nfsv4SavefhRequest ( ) ;
118119 case Nfsv4Op . SECINFO :
119120 return this . decodeSecinfoRequest ( ) ;
120121 case Nfsv4Op . SETATTR :
@@ -139,6 +140,7 @@ export class Nfsv4Decoder {
139140 }
140141
141142 private decodeResponse ( op : Nfsv4Op ) : msg . Nfsv4Response | undefined {
143+ const xdr = this . xdr ;
142144 switch ( op ) {
143145 case Nfsv4Op . ACCESS :
144146 return this . decodeAccessResponse ( ) ;
@@ -181,7 +183,7 @@ export class Nfsv4Decoder {
181183 case Nfsv4Op . PUTFH :
182184 return this . decodePutfhResponse ( ) ;
183185 case Nfsv4Op . PUTPUBFH :
184- return this . decodePutpubfhResponse ( ) ;
186+ return msg . Nfsv4PutpubfhResponse . decode ( xdr ) ;
185187 case Nfsv4Op . PUTROOTFH :
186188 return this . decodePutrootfhResponse ( ) ;
187189 case Nfsv4Op . READ :
@@ -233,10 +235,7 @@ export class Nfsv4Decoder {
233235 }
234236
235237 private readStateid ( ) : structs . Nfsv4Stateid {
236- const xdr = this . xdr ;
237- const seqid = xdr . readUnsignedInt ( ) ;
238- const other = xdr . readOpaque ( 12 ) ;
239- return new structs . Nfsv4Stateid ( seqid , other ) ;
238+ return structs . Nfsv4Stateid . decode ( this . xdr ) ;
240239 }
241240
242241 private readBitmap ( ) : structs . Nfsv4Bitmap {
@@ -429,11 +428,6 @@ export class Nfsv4Decoder {
429428 return new structs . Nfsv4SecInfoFlavor ( flavor ) ;
430429 }
431430
432- private decodeAccessRequest ( ) : msg . Nfsv4AccessRequest {
433- const access = this . xdr . readUnsignedInt ( ) ;
434- return new msg . Nfsv4AccessRequest ( access ) ;
435- }
436-
437431 private decodeAccessResponse ( ) : msg . Nfsv4AccessResponse {
438432 const xdr = this . xdr ;
439433 const status = xdr . readUnsignedInt ( ) ;
@@ -461,13 +455,6 @@ export class Nfsv4Decoder {
461455 return new msg . Nfsv4CloseResponse ( status ) ;
462456 }
463457
464- private decodeCommitRequest ( ) : msg . Nfsv4CommitRequest {
465- const xdr = this . xdr ;
466- const offset = xdr . readUnsignedHyper ( ) ;
467- const count = xdr . readUnsignedInt ( ) ;
468- return new msg . Nfsv4CommitRequest ( offset , count ) ;
469- }
470-
471458 private decodeCommitResponse ( ) : msg . Nfsv4CommitResponse {
472459 const status = this . xdr . readUnsignedInt ( ) ;
473460 if ( status === 0 ) {
@@ -515,21 +502,11 @@ export class Nfsv4Decoder {
515502 return new msg . Nfsv4CreateResponse ( status ) ;
516503 }
517504
518- private decodeDelegpurgeRequest ( ) : msg . Nfsv4DelegpurgeRequest {
519- const clientid = this . xdr . readUnsignedHyper ( ) ;
520- return new msg . Nfsv4DelegpurgeRequest ( clientid ) ;
521- }
522-
523505 private decodeDelegpurgeResponse ( ) : msg . Nfsv4DelegpurgeResponse {
524506 const status = this . xdr . readUnsignedInt ( ) ;
525507 return new msg . Nfsv4DelegpurgeResponse ( status ) ;
526508 }
527509
528- private decodeDelegreturnRequest ( ) : msg . Nfsv4DelegreturnRequest {
529- const delegStateid = this . readStateid ( ) ;
530- return new msg . Nfsv4DelegreturnRequest ( delegStateid ) ;
531- }
532-
533510 private decodeDelegreturnResponse ( ) : msg . Nfsv4DelegreturnResponse {
534511 const status = this . xdr . readUnsignedInt ( ) ;
535512 return new msg . Nfsv4DelegreturnResponse ( status ) ;
@@ -750,19 +727,6 @@ export class Nfsv4Decoder {
750727 return new msg . Nfsv4PutfhResponse ( status ) ;
751728 }
752729
753- private decodePutpubfhRequest ( ) : msg . Nfsv4PutpubfhRequest {
754- return new msg . Nfsv4PutpubfhRequest ( ) ;
755- }
756-
757- private decodePutpubfhResponse ( ) : msg . Nfsv4PutpubfhResponse {
758- const status = this . xdr . readUnsignedInt ( ) ;
759- return new msg . Nfsv4PutpubfhResponse ( status ) ;
760- }
761-
762- private decodePutrootfhRequest ( ) : msg . Nfsv4PutrootfhRequest {
763- return new msg . Nfsv4PutrootfhRequest ( ) ;
764- }
765-
766730 private decodePutrootfhResponse ( ) : msg . Nfsv4PutrootfhResponse {
767731 const status = this . xdr . readUnsignedInt ( ) ;
768732 return new msg . Nfsv4PutrootfhResponse ( status ) ;
0 commit comments