/*  Headers for memory handling

    ©1998,1999 Joseph Walton

    This software is distributed under the terms of the GNU General Public
    License; either version 2 of the License, or (at your option) any
    later version.
*/

#ifndef NFSD_MEMORY_H
#define NFSD_MEMORY_H

#include "rpc.h"
#include "nfs.h"

#include <exec/types.h>

/* Public prototypes */
BOOL init_memory(struct nfsd_Global *g);
void free_memory(void);
APTR AllocVecPooled(ULONG length);
void FreeVecPooled(APTR mem);
STRPTR DupString(STRPTR orig);

/* This is a fair bit, but we want to avoid fragmentation */
#define POOL_SIZE 16384

/* NFS responses will fit in
   int32[5 + 2 + 11 + 3 * 2 + 1 + INT32S(NFS_MAXDATA)]
    That is, header, SUCCESS, NFS_OK, fattr (with timestamps),
        and the actual data payload.
*/

#define SEND_BUFFER_BYTES (SINT32 * (5 + 2 + 11 + 3 * 2 + 1 + INT32S(NFS_MAXDATA)))

/* Requests should be okay with
    int32[6 + 2 * (1 + 3 + 256 + 16) +
        INT32S(NFS_FHSIZE) + 3 + 1 + INT32S(NFS_MAXDATA)]
     That is, header, authentication (and verifier), a file
     handle, position in file and an opaque payload.
*/

#define RECV_BUFFER_BYTES (SINT32 * (6 + 2 * (1 + 3 + 256 + 16) \
    + INT32S(NFS_FHSIZE) + 3 + 1 + INT32S(NFS_MAXDATA)))

#endif

