#ifndef TALKBASE_H
#define TALKBASE_H

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

#include <exec/types.h>
#include <exec/libraries.h>
#include <exec/lists.h>
#include <exec/semaphores.h>
#include <exec/execbase.h>
#include <utility/tagitem.h>
#include <dos/dos.h>
#include <dos/dosextens.h>
#include <dos/dostags.h>
#include <dos.h>
#include <envoy/nipc.h>

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

struct TALKSvc
{
    struct Library           TALK_Lib;
    struct Library          *TALK_DOSBase;
    struct Library          *TALK_NIPCBase;
    struct ExecBase         *TALK_SysBase;
    struct Library          *TALK_UtilityBase;
    APTR                     TALK_Entity;
    BPTR                     TALK_SegList;

    struct SignalSemaphore   TALK_OpenLock;
};

#define ASM           __asm
#define REG(x)        register __ ## x

#define TALKBase       ((struct TALKSvc *)getreg(REG_A6))
#define SysBase       TALKBase->TALK_SysBase
#define DOSBase       TALKBase->TALK_DOSBase
#define UtilityBase   TALKBase->TALK_UtilityBase
#define NIPCBase      TALKBase->TALK_NIPCBase

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

ULONG __saveds ASM StartService(REG(a0) struct TagItem *st_list);

VOID ASM Server(REG(a0) STRPTR userName,
                REG(a1) STRPTR password,
                REG(a2) STRPTR entityName);

VOID ASM FlushLib(VOID);

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

kprintf(STRPTR,...);
sprintf(STRPTR,...);

#endif /* TALKBASE */
