/******************************************************************************
* UrlManager.h                                                                *
* --------------------------------------------------------------------------- *
* Written & (c) by Serge Emond, 1996                                          *
******************************************************************************/

/// Global Includes
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <proto/exec.h>
#include <exec/execbase.h>
#include <exec/lists.h>
#include <exec/nodes.h>
#include <exec/memory.h>
#include <proto/dos.h>
#include <dos/stdio.h>
#include <proto/rexxsyslib.h>
#include <rexx/storage.h>
#include <proto/utility.h>
///

#define SVER        "1.01"

/// Defines

#define VERSION     "$VER: UrlManager "SVER" "__AMIGADATE__" (c) Serge Emond"

// Command-Line Options

#define OPT_TEMP    "PORT"
#define OPT_PORT    0
#define OPT_CNT     1

// Name of variable to set in calling ARexx script

#define RES_VAR     "UMRES"
#define DEF_PORT    "URLMANAGER"
#define DEF_IOSIZE  4096
#define MINIOSIZE   1024

///

/// Structures

struct Url
{
    struct MinNode n;
    ULONG   id;             // Unique ID
    LONG    depth;          // "Depth"
    UBYTE   type;           // Type of URL (Always MAJ)
    STRPTR  name;           // The URL itself
};

struct Global
{
    struct MinList list;    // Header of URLs list
    void *upool;            // Pool Header for Url
    void *spool;            // Pool Header for names
    ULONG iosize;           // Size of IO buffer to use
    struct RDArgs *rdargs;  // CLI args
    LONG opts[OPT_CNT];     // Args array
    struct MsgPort *mp;     // Message Port
    struct Message *msg;    // Current Message Ptr
    ULONG hid;              // High ID number
    ULONG inmem;            // Number of URLS in memory
    ULONG exenmb;           // Current "exe" fct running
};

struct Functions
{
    STRPTR  cmd;                // ARexx Command Name
    STRPTR  temp;               // Options template
    void (*function)(STRPTR);   // Function, arg is ptr to arguments
};
///

/// Global vars
extern struct Global g;
extern struct Functions fcts[];
///

/// Macros
// TRUE when url-list is empty
#define IsNoData (g.list.mlh_TailPred == (struct MinNode *)&g.list)
///

/// Prototypes

#include "UrlManager_protos.h"
#include "UMRexxFcts_protos.h"
#include "UMUtilities_protos.h"
///


