#ifndef TKSBASE_H
#define TKSBASE_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 TKSSvc
{
    struct Library           TKS_Lib;
    struct Library          *TKS_DOSBase;
    struct Library          *TKS_NIPCBase;
    struct ExecBase         *TKS_SysBase;
    struct Library          *TKS_UtilityBase;
    APTR                     TKS_Entity;
    BPTR                     TKS_SegList;
    
    struct SignalSemaphore   TKS_OpenLock;
};

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

#define TKSBase       ((struct TKSSvc *)getreg(REG_A6))
#define SysBase       TKSBase->TKS_SysBase
#define DOSBase       TKSBase->TKS_DOSBase
#define UtilityBase   TKSBase->TKS_UtilityBase
#define NIPCBase      TKSBase->TKS_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 /* TKSBASE */
