RCS_ID_C="$Id: init.c,v 3.1 1994/01/23 02:46:18 ppessi Exp $"; 
/*
 * init.c --- netinfo.device main functions
 *
 * Author: ppessi <Pekka.Pessi@hut.fi>
 *
 * This file is part of the AmiTCP/IP NetInfo device.
 *
 * Copyright © 1993 AmiTCP/IP Group, <AmiTCP-Group@hut.fi>
 *                  Helsinki University of Technology, Finland.
 *
 * Created      : Sun Nov 28 17:45:55 1993 ppessi
 * Last modified: Sat Jan 22 15:46:51 1994 ppessi
 *
 * $Log: init.c,v $
 * Revision 3.1  1994/01/23  02:46:18  ppessi
 * New command semantics, new version.
 *
 * Revision 2.3  1994/01/23  02:42:01  ppessi
 * Removed the path from device name.
 *
 * Revision 2.2  1994/01/21  12:11:44  ppessi
 * Removed <sys/errno.h> from includes
 *
 * Revision 2.1  1994/01/18  09:10:44  ppessi
 * Basic functionality
 *
 */

#include "base.h"

#include <dos/dostags.h>
#include <exec/resident.h>

#include "netinfo.device_rev.h"

extern const LONG __far _LibInitTab[];
extern const UBYTE _DevName[];

LONG _libstart(void)
{
  return -1;
}

const static struct Resident LibRomTag =
{
  RTC_MATCHWORD,
  &LibRomTag,
  (APTR)_LibInit,
  RTF_AUTOINIT,
  VERSION,
  NT_DEVICE,
  0,
  _DevName,
  VSTRING,
  (APTR)&_LibInitTab,
};

static const APTR _LibFuncTable[] =
{
  (APTR) _DevOpen,
  (APTR) _DevClose,
  (APTR) _DevExpunge,
  (APTR) _DevRes,
  (APTR) _NetInfoBeginIO,
  (APTR) _NetInfoAbortIO,
  (APTR)-1,
};

const LONG __far _LibInitTab[] =  {
  NETINFOSIZE,
  (LONG)_LibFuncTable,
  NULL,                        /* will initialize my own data */
  (LONG)_LibInit,
};

const UBYTE _DevName[] = "netinfo.device";

/*
 * Device initialization routine
 * 
 * Called after device has been allocated.
 * This routine is single threaded
 *
 * return pointer to device when successful, NULL otherwise
 */
SAVEDS ASM ULONG _LibInit(REG(a0) APTR seglist, 
			  REG(d0) struct Library *devbase)
{
  /* init. library structure (since I don't do automatic data init.) */
  devbase->lib_Node.ln_Type = NT_LIBRARY;
  devbase->lib_Node.ln_Name =  (STRPTR)_DevName;
  devbase->lib_Flags = LIBF_SUMUSED | LIBF_CHANGED;
  devbase->lib_Version = VERSION;
  devbase->lib_Revision = REVISION;
  devbase->lib_IdString = (APTR) VSTRING;

  return _DevInit((struct NetInfoDevice*)devbase, seglist);
}

