#ifndef AMARQUEE_H
#define AMARQUEE_H

#ifndef EXEC_PORTS_H
#include <exec/ports.h>
#endif

/* This library contains definitions and structures necessary to use amarquee.library. */

/* Different error types that can be returned to the client */
#define QERROR_NO_ERROR       0 /* Everything is okay */
#define QERROR_UNKNOWN       -1 /* Don't know what the error was. */
#define QERROR_MALFORMED_KEY -2 /* Keystring could not be parsed or "dir" does not exist */
#define QERROR_NO_SERVER_MEM -3 /* Server did not have enough mem available to complete request */
#define QERROR_NO_CONNECTION -4 /* The connection to the server went south */
#define QERROR_UNPRIVILEGED  -5 /* You're not allowed to do that! */
#define QERROR_UNIMPLEMENTED -6 /* Feature you requested does not exist yet */
#define QERROR_NO_CLIENT_MEM -7 /* Your computer didn't have enough memory available to complete an action */

/* Flags to use with QGo() */
#define QGOF_SYNC (1L<<0)     /* Send a sync packet when all has settled */

/* All events from AMarquee come in this package! */
struct QMessage 
{
  struct Message qm_Msg;/* Don't directly use the contents of qm_Msg! */
  LONG    qm_ID;        /* Message ID # of transaction related to this opCode, or -1 if no ID is applicable. */
  int     qm_Status;    /* One of the QERROR_* codes defined in AMarquee headers. */
  char  * qm_Path;      /* Pathname of a node, or NULL if not applicable. */
  void  * qm_Data;      /* Pointer to beginning of data buffer, or NULL if not applicable. */
  ULONG   qm_DataLen;   /* Length of qm_Data buffer, or 0 if not applicable. */
  ULONG   qm_ActualLen; /* Length of the data buffer stored on the AMarquee server. */
  ULONG   qm_ErrorLine; /* Line # of the server source code that generated the error.  Useful for debugging. */
  void  * qm_Private;   /* Private info used by FreeQMessage() */
};

struct QSession
{
  struct MsgPort * qMsgPort;  /* Wait() on this for QMessages! */

  /********************************************************************/
  /* Invisible, private info is here... don't trust sizeof(QSession)! */
  /********************************************************************/
};

struct QRunInfo
{
  LONG qr_Allowed; /* The theoretical maximum number of bytes your server may allocate. */
  LONG qr_Alloced; /* The number of bytes currently allocated by your server. */
  LONG qr_Avail;   /* The number of bytes that may actually be allocated by your server. */
};

#endif
