/*****************************************************************************/
/*
                                  Put.h
*/
/*****************************************************************************/

#ifndef PUT_H_LOADED
#define PUT_H_LOADED 1

#include "wasd.h"

/**********/
/* macros */
/**********/

/* default is UDF */
#define PUT_RFM_STM    1
#define PUT_RFM_STMCR  2
#define PUT_RFM_STMLF  3
#define PUT_RFM_FIX512 4
#define PUT_RFM_UDF    5

#define PUT_MULTIBLOCK_COUNT_DEFAULT 127

/**************/
/* structures */
/**************/

typedef struct PutTaskStruct PUT_TASK;

struct PutTaskStruct
{
   BOOL  /* the body is an object not a composite like a form or multipart */
         ContentLengthFixed,
         /* a file has been created and is currently with this request */
         FileOpen,
         /* document posted is "text/..." */
         ContentTypeText,
         /* file is to be deleted with request rundown */
         PreviewOnly;

   int  /* length of file contents pointed to in buffer */
        ContentFileLength,
        /* just notes the size of the file for reporting */
        FileSizeBytes,
        /* length of file name */
        FileNameLength,
        /* length of server specified directory */
        SpecifiedDirectoryLength,
        /* status returned from sys$create() */
        SysCreateStatus;

   unsigned long  /* when creating files and directories */
                  ProtectionMask;

   char  /* points to start of file contents in buffer */
         *ContentFilePtr,
         /* used as pointer into buffer */
         *FileContentPtr,
         /* used as pointer into buffer */
         *FileContentTypePtr;

   char  /* buffer file name */
         FileName [ODS_MAX_FILE_NAME_LENGTH+1],
         /* file is to be put into this server-specified directory */
         SpecifiedDirectory [ODS_MAX_FILE_NAME_LENGTH+1];

   /* structure for file system access */
   ODS_STRUCT  FileOds,
               SearchOds;

   REQUEST_AST  /* function used for specifying AST function following */
                NextFunction,
                /* function used for specifying the next task */
                NextTaskFunction,
                /* function used for specifying AST function following */
                WriteFileNextFunction;
};

/***********************/
/* function prototypes */
/***********************/

PutBegin (REQUEST_STRUCT*, REQUEST_AST);
PutIfBegin (REQUEST_STRUCT*);
int PutChangeFileAttributes (REQUEST_STRUCT*);
int PutCheckAccess (char*);
PutCreateDirectory (REQUEST_STRUCT*);
PutDelete (REQUEST_STRUCT*);
PutEnd (REQUEST_STRUCT*);
PutWasdBegin (REQUEST_STRUCT*);
PutWriteFile (REQUEST_STRUCT*);
PutWriteFileAst (struct RAB*); 
PutWriteFileOpen (REQUEST_STRUCT*);
PutWriteFileClose (REQUEST_STRUCT*);
int PutText (REQUEST_STRUCT*);

#endif /* PUT_H_LOADED */

/*****************************************************************************/

