/*****************************************************************************/
/* File name: ReadArguments.java                                             */
/* Purpose: to represent NFS file read arguments - the readargs              */
/*          structure in NFS                                                 */
/* Last modified: 25.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General */
/* Public License for more details.                                          */
/*                                                                           */
/* This software is distributed under the terms                              */
/* of the GNU General Public License as published                            */
/* by the Free Software Foundation; either version 2, or (at your option)    */
/* any later version.                                                        */
/* See file COPYING for your rights (GNU GPL)                                */
/*****************************************************************************/

package nfs;

import mount.*;

public
class

ReadArguments
{

  private final static String RCSID =
"$Header: /d/NFS/nfs/RCS/ReadArguments.java,v 1.1 1999/06/27 20:23:28 vklimov Exp $";

  protected mount.Fhandle fileHandle = null;
  protected long offset = 0;
  protected long count = 0;
  protected long totalcount = 0; /* not used */


  public

  ReadArguments()
/*****************************************************************************/
/* Function name: ReadArguments                                              */
/* File name: ReadArguments.java                                             */
/* Purpose: constructor for the ReadArguments class                          */
/* Parameters:                                                               */
/* Returns:                                                                  */
/* Last modified: 24.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
                                                        /* ReadArguments */
/*---------------------------------------------------------------------------*/

      fileHandle = new Fhandle();

    }
/*end of ReadArguments*/


  public
  void

  putItselfIntoRPCMessage( rpc.Message rpcMessage )
/*****************************************************************************/
/* Function name: putItselfIntoRPCMessage                                    */
/* File name: ReadArguments.java                                             */
/* Purpose: to put this ReadArguments object into a RPC message              */
/* Parameters: rpcMessage                                                    */
/* Returns:                                                                  */
/* Last modified: 25.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
                                              /* putItselfIntoRPCMessage */
/*---------------------------------------------------------------------------*/

      if (fileHandle == null)
        return;                                        /* return ! */
      else
        ;
    /*end of if*/

      fileHandle.
        putItselfIntoRPCMessage(
          rpcMessage             );

      rpcMessage.
        putUnsignedInteger( offset );

      rpcMessage.
        putUnsignedInteger( count );

      rpcMessage.
        putUnsignedInteger( totalcount );

    }
/*end of putItselfIntoRPCMessage*/


  public
  boolean

  getItselfFromRPCMessage( rpc.Message rpcMessage )
/*****************************************************************************/
/* Function name: getItselfFromRPCMessage                                    */
/* File name: ReadArguments.java                                             */
/* Purpose: to get this ReadArguments object from a RPC message              */
/* Parameters: rpcMessage                                                    */
/* Returns: true - if got OK, false - otherwise                              */
/* Last modified: 25.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
      boolean result;
                                              /* getItselfFromRPCMessage */
/*---------------------------------------------------------------------------*/

      if (fileHandle == null)
        return false;                                        /* return ! */
      else
        ;
    /*end of if*/

      result =
        fileHandle.
          getItselfFromRPCMessage(
            rpcMessage             );

      if ( ! result ) return false;                         /* return ! */

      offset =
        rpcMessage.
          getUnsignedInteger();

      count =
        rpcMessage.
          getUnsignedInteger();

      totalcount =
        rpcMessage.
          getUnsignedInteger();

      return true;

    }
/*end of getItselfFromRPCMessage*/


  public
  String

  toString()
/*****************************************************************************/
/* Function name: toString                                                   */
/* File name: ReadArguments.java                                             */
/* Purpose: to represent this ReadArguments object as a string               */
/* Parameters:                                                               */
/* Returns: the string representation of the object                          */
/* Last modified: 25.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
      String result = "";
                                                       /* toString */
/*---------------------------------------------------------------------------*/

      result += ( (fileHandle == null) ?
                  "fileHandle is null" :
                  (fileHandle.toString()) ) + "\n";

      result += "offset=" + offset +
                " count=" + count;


      return result;

    }
/*end of toString*/


} /* end of ReadArguments class */

/*****************************************************************************/
/* End of file: ReadArguments.java                                           */
/*****************************************************************************/
