#ifndef CLIB_AMARQUEE_PROTOS_H
#define CLIB_AMARQUEE_PROTOS_H

/*
**  $VER: amarquee_protos.h 52.2 (04.08.2001)
**
**  C prototypes. For use with 32 bit integers only.
**
**  Copyright © 2001 Håkan Parting
**      All Rights Reserved
**
**  Note:
**  Use only this version of the protos together with the pragmas for version 49 of amarquee.
**  If you require a better version of AMarquee than 49 don't use this version.
*/

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif

#ifndef REXX_STORAGE_H
#include <rexx/storage.h>
#endif

#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif

#ifndef LIBRARIES_AMARQUEE49_H
#include <libraries/AMarquee49.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/* Open or close a connection */
struct QSession * QNewSession(STRPTR hostname, LONG port, STRPTR progname);
struct QSession * QNewSessionAsync(STRPTR hostname, LONG port, STRPTR progname);
/* Closes a QNew*Session */
LONG QFreeSession(struct QSession * session);

/* Transactions--these return their transaction ID #, or zero on no memory. */
LONG QDebugOp(struct QSession * session, STRPTR string);
LONG QGetOp(struct QSession * session, STRPTR wildpath, LONG maxBytes);
LONG QDeleteOp(struct QSession * session, STRPTR wildpath);
LONG QMessageOp(struct QSession * session, STRPTR hosts, void * buffer, ULONG bufferLength);
LONG QRenameOp(struct QSession * session, STRPTR path, STRPTR label);
LONG QSubscribeOp(struct QSession * session, STRPTR wildpath, LONG maxBytes);
LONG QSetOp(struct QSession * session, STRPTR path, void * buffer, ULONG bufferLength);
LONG QStreamOp(struct QSession * session, STRPTR path, void * buffer, ULONG bufferLength);
LONG QClearSubscriptionsOp(struct QSession * session, LONG which);
LONG QPingOp(struct QSession * session);
LONG QInfoOp(struct QSession * session);
LONG QSetAccessOp(struct QSession * session, STRPTR newAccess);
LONG QSetMessageAccessOp(struct QSession * session, STRPTR newAccess, LONG maxBytes);
LONG QGo(struct QSession * session, ULONG flags);

/* Call this function to free your QMessage! */
void FreeQMessage(struct QSession * session, struct QMessage * qmsg);

/* Use this to open a host QSession to receive connections on. */
struct QSession * QNewHostSession(STRPTR hostnames, LONG * port, STRPTR progNames);
/* Receive connection through INETD */
struct QSession * QNewServerSession(STRPTR hostNames, STRPTR progNames);

/* Get data about the session */
ULONG QNumQueuedPackets(struct QSession * session);
ULONG QNumQueuedBytes(struct QSession * session);
STRPTR QGetHostName(struct QSession * session);
STRPTR QGetProgName(struct QSession * session);
STRPTR QErrorName(LONG error);

/* Administrative calls, introduced for v1.45 */
LONG QRequestPrivilegesOp(struct QSession * session, ULONG privBits);
LONG QReleasePrivilegesOp(struct QSession * session, ULONG privBits);
LONG QKillClientsOp(struct QSession * session, STRPTR hosts);
LONG QSetParameterOp(struct QSession * session, STRPTR paramName, STRPTR newValue);
LONG QGetParameterOp(struct QSession * session, STRPTR paramName);
LONG QSysMessageOp(struct QSession * session, STRPTR hosts, STRPTR message);

/* Convenience method, introduced for v1.46 */
LONG QGetAndSubscribeOp(struct QSession * session, STRPTR wildpath, LONG maxBytes);

/* Introduced for v1.47, to support sharing QSessions between threads */
BOOL QDetachSession(struct QSession * session, ULONG flags);
BOOL QReattachSession(struct QSession * session, ULONG flags);

/* These functions are wrappers for normal bsdsocket.library calls which makes it possible */
/* to connect to standard servers, like FTP and HTTP. You could also open a socket which */
/* listens on a specified port. Use it to make a server that also programs not using */
/* amarquee.library may connect to. */

/* Open a raw socket connection. Introduced in v49 */

struct QSession * QNewSocketSession(STRPTR hostname, LONG port, struct TagItem *tags );
struct QSession * QNewSocketSessionTags(STRPTR hostname, LONG port, Tag tag1, ... );

struct QSession * QNewSocketSessionAsync(STRPTR hostname, LONG port, struct TagItem *tags );
struct QSession * QNewSocketSessionAsyncTags(STRPTR hostname, LONG port, Tag tag1, ... );

/* Use this to open a raw socket server QSession to receive connections on. */
struct QSession * QNewSocketServerSession(LONG *port, struct TagItem *tags );
struct QSession * QNewSocketServerSessionTags(LONG *port, Tag tag1, ... );

/* Transactions allowed on raw socket connections. All these return an ID #, or 0 on no memory */
LONG QSendRawOp(struct QSession * session, void * buffer, ULONG bufferLength);
/* QGo must be called to send queued transactions */

/* Transactions--these return their transaction ID #, or zero on no memory. */
/* Not for use with a raw Socket Session */
/* Introduced in v.49 */
LONG QSetKeyAccessOp(struct QSession * session, STRPTR path, STRPTR newAccess);
 

#ifdef __cplusplus
}
#endif

#endif /* CLIB_AMARQUEE_PROTOS_H */
