/*****************************************************************************/
/* File name: DirectoryOperationArguments.java                               */
/* Purpose: to represent NFS directory operation arguments - the diropargs   */
/*          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

DirectoryOperationArguments
{

  private final static String RCSID =
"$Header: /d/NFS/nfs/RCS/DirectoryOperationArguments.java,v 1.2 1999/06/26 00:02:07 vklimov Exp $";

  protected mount.Fhandle directoryFHandle = null;
  protected String fileName = null;


  public

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

      directoryFHandle = new Fhandle();

    }
/*end of DirectoryOperationArguments*/


  public
  void

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

      if ( (directoryFHandle == null) ||
           (fileName == null)
         )
        return;                                        /* return ! */
      else
        ;
    /*end of if*/

      directoryFHandle.
        putItselfIntoRPCMessage(
          rpcMessage             );

      rpcMessage.
        putString( fileName,
                   Constants.MAXNAMLEN );

    }
/*end of putItselfIntoRPCMessage*/


  public
  boolean

  getItselfFromRPCMessage( rpc.Message rpcMessage )
/*****************************************************************************/
/* Function name: getItselfFromRPCMessage                                    */
/* File name: DirectoryOperationArguments.java                               */
/* Purpose: to get this DirectoryOperationArguments 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 (directoryFHandle == null)
        return false;                                        /* return ! */
      else
        ;
    /*end of if*/

      result =
        directoryFHandle.
          getItselfFromRPCMessage(
            rpcMessage             );

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

      fileName = rpcMessage.getString();

      return true;

    }
/*end of getItselfFromRPCMessage*/


  public
  String

  toString()
/*****************************************************************************/
/* Function name: toString                                                   */
/* File name: DirectoryOperationArguments.java                               */
/* Purpose: to represent this DirectoryOperationArguments 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 += ( (directoryFHandle == null) ?
                  "directoryFHandle is null" :
                  (directoryFHandle.toString()) ) + "\n";

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

      return result;

    }
/*end of toString*/


} /* end of DirectoryOperationArguments class */

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