]> The Tcpdump Group git mirrors - libpcap/commitdiff
NDIS2 support is "dead in the water". No one longer cares about such museum piece.
authorGisle Vanem <[email protected]>
Wed, 20 Sep 2017 09:21:04 +0000 (09:21 +0000)
committerGuy Harris <[email protected]>
Sat, 23 Sep 2017 07:21:06 +0000 (00:21 -0700)
msdos/ndis2.c [deleted file]
msdos/ndis2.h [deleted file]
msdos/ndis_0.asm [deleted file]

diff --git a/msdos/ndis2.c b/msdos/ndis2.c
deleted file mode 100644 (file)
index 526b221..0000000
+++ /dev/null
@@ -1,860 +0,0 @@
-/*
- * Copyright (c) 1993,1994
- *      Texas A&M University.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Texas A&M University
- *      and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Developers:
- *             David K. Hess, Douglas Lee Schales, David R. Safford
- *
- * Heavily modified for Metaware HighC + GNU C 2.8+
- *             Gisle Vanem 1998
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <dos.h>
-#include <io.h>
-#include <fcntl.h>
-#include <malloc.h>
-#include <string.h>
-
-#include "pcap-dos.h"
-#include "pcap-int.h"
-#include "msdos/ndis2.h"
-
-#if defined(USE_NDIS2)
-
-/*
- *  Packet buffer handling
- */
-extern int     FreePktBuf  (PktBuf *buf);
-extern int     EnquePktBuf (PktBuf *buf);
-extern PktBuf* AllocPktBuf (void);
-
-/*
- *  Various defines
- */
-#define MAX_NUM_DEBUG_STRINGS 90
-#define DEBUG_STRING_LENGTH   80
-#define STACK_POOL_SIZE       6
-#define STACK_SIZE            256
-
-#define MEDIA_FDDI            1
-#define MEDIA_ETHERNET        2
-#define MEDIA_TOKEN           3
-
-static int     startDebug     = 0;
-static int     stopDebug      = 0;
-
-static DWORD   droppedPackets = 0L;
-static WORD    frameSize      = 0;
-static WORD    headerSize     = 0;
-static int     mediaType      = 0;
-static char   *lastErr        = NULL;
-
-static BYTE    debugStrings [MAX_NUM_DEBUG_STRINGS][DEBUG_STRING_LENGTH];
-static BYTE   *freeStacks   [STACK_POOL_SIZE];
-static int     freeStackPtr = STACK_POOL_SIZE - 1;
-
-static ProtMan protManEntry = NULL;
-static WORD    protManDS    = 0;
-static volatile int xmitPending;
-
-static struct _PktBuf        *txBufPending;
-static struct _CardHandle    *handle;
-static struct _CommonChars    common;
-static struct _ProtocolChars  protChars;
-static struct _ProtDispatch   lowerTable;
-
-static struct _FailingModules failingModules;
-static struct _BindingsList   bindings;
-
-static struct {
-         WORD  err_num;
-         char *err_text;
-       } ndis_errlist[] = {
-
-  { ERR_SUCCESS,
-    "The function completed successfully.\n"  },
-
-  { ERR_WAIT_FOR_RELEASE,
-    "The ReceiveChain completed successfully but the protocol has\n"
-    "retained control of the buffer.\n"  },
-
-  { ERR_REQUEST_QUEUED,
-    "The current request has been queued.\n"  },
-
-  { ERR_FRAME_NOT_RECOGNIZED,
-    "Frame not recognized.\n"  },
-
-  { ERR_FRAME_REJECTED,
-    "Frame was discarded.\n"  },
-
-  { ERR_FORWARD_FRAME,
-    "Protocol wishes to forward frame to another protocol.\n"  },
-
-  { ERR_OUT_OF_RESOURCE,
-    "Out of resource.\n"  },
-
-  { ERR_INVALID_PARAMETER,
-    "Invalid parameter.\n"  },
-
-  { ERR_INVALID_FUNCTION,
-    "Invalid function.\n"  },
-
-  { ERR_NOT_SUPPORTED,
-    "Not supported.\n"  },
-
-  { ERR_HARDWARE_ERROR,
-    "Hardware error.\n"  },
-
-  { ERR_TRANSMIT_ERROR,
-    "The packet was not transmitted due to an error.\n"  },
-
-  { ERR_NO_SUCH_DESTINATION,
-    "Token ring packet was not recognized when transmitted.\n"  },
-
-  { ERR_BUFFER_TOO_SMALL,
-    "Provided buffer was too small.\n"  },
-
-  { ERR_ALREADY_STARTED,
-    "Network drivers already started.\n"  },
-
-  { ERR_INCOMPLETE_BINDING,
-    "Protocol driver could not complete its bindings.\n"  },
-
-  { ERR_DRIVER_NOT_INITIALIZED,
-    "MAC did not initialize properly.\n"  },
-
-  { ERR_HARDWARE_NOT_FOUND,
-    "Hardware not found.\n"  },
-
-  { ERR_HARDWARE_FAILURE,
-    "Hardware failure.\n"  },
-
-  { ERR_CONFIGURATION_FAILURE,
-    "Configuration failure.\n"  },
-
-  { ERR_INTERRUPT_CONFLICT,
-    "Interrupt conflict.\n"  },
-
-  { ERR_INCOMPATIBLE_MAC,
-    "The MAC is not compatible with the protocol.\n"  },
-
-  { ERR_INITIALIZATION_FAILED,
-    "Initialization failed.\n"  },
-
-  { ERR_NO_BINDING,
-    "Binding did not occur.\n"  },
-
-  { ERR_NETWORK_MAY_NOT_BE_CONNECTED,
-    "The network may not be connected to the adapter.\n"  },
-
-  { ERR_INCOMPATIBLE_OS_VERSION,
-    "The version of the operating system is incompatible with the protocol.\n"  },
-
-  { ERR_ALREADY_REGISTERED,
-    "The protocol is already registered.\n"  },
-
-  { ERR_PATH_NOT_FOUND,
-    "PROTMAN.EXE could not be found.\n"  },
-
-  { ERR_INSUFFICIENT_MEMORY,
-    "Insufficient memory.\n"  },
-
-  { ERR_INFO_NOT_FOUND,
-    "Protocol Mananger info structure is lost or corrupted.\n"  },
-
-  { ERR_GENERAL_FAILURE,
-    "General failure.\n"  }
-};
-
-/*
- *  Some handy macros
- */
-#define PERROR(str)    printf("%s (%d): %s\n", __FILE__,__LINE__,str)
-#define DEBUG_RING()   (debugStrings[stopDebug+1 == MAX_NUM_DEBUG_STRINGS ? \
-                        stopDebug = 0 : ++stopDebug])
-
-/*
- * needs rewrite for DOSX
- */
-#define MAC_DISPATCH(hnd)  ((struct _MacUpperDispatch*)(hnd)->common->upperDispatchTable)
-#define MAC_STATUS(hnd)    ((struct _MacStatusTable*)  (hnd)->common->serviceStatus)
-#define MAC_CHAR(hnd)      ((struct _MacChars*)        (hnd)->common->serviceChars)
-
-#ifdef NDIS_DEBUG
-  #define DEBUG0(str)      printf (str)
-  #define DEBUG1(fmt,a)    printf (fmt,a)
-  #define DEBUG2(fmt,a,b)  printf (fmt,a,b)
-  #define TRACE0(str)      sprintf (DEBUG_RING(),str)
-  #define TRACE1(fmt,a)    sprintf (DEBUG_RING(),fmt,a)
-#else
-  #define DEBUG0(str)      ((void)0)
-  #define DEBUG1(fmt,a)    ((void)0)
-  #define DEBUG2(fmt,a,b)  ((void)0)
-  #define TRACE0(str)      ((void)0)
-  #define TRACE1(fmt,a)    ((void)0)
-#endif
-
-/*
- * This routine is called from both threads
- */
-void NdisFreeStack (BYTE *aStack)
-{
-  GUARD();
-
-  if (freeStackPtr == STACK_POOL_SIZE - 1)
-     PERROR ("tried to free too many stacks");
-
-  freeStacks[++freeStackPtr] = aStack;
-
-  if (freeStackPtr == 0)
-     TRACE0 ("freeStackPtr went positive\n");
-
-  UNGUARD();
-}
-
-/*
- * This routine is called from callbacks to allocate local data
- */
-BYTE *NdisAllocStack (void)
-{
-  BYTE *stack;
-
-  GUARD();
-
-  if (freeStackPtr < 0)
-  {
-    /* Ran out of stack buffers. Return NULL which will start
-     * dropping packets
-     */
-    TRACE0 ("freeStackPtr went negative\n");
-    stack = 0;
-  }
-  else
-    stack = freeStacks[freeStackPtr--];
-
-  UNGUARD();
-  return (stack);
-}
-
-CALLBACK (NdisSystemRequest (DWORD param1, DWORD param2, WORD param3,
-                             WORD opcode, WORD targetDS))
-{
-  static int            bindEntry = 0;
-  struct _CommonChars  *macCommon;
-  volatile WORD result;
-
-  switch (opcode)
-  {
-    case REQ_INITIATE_BIND:
-         macCommon = (struct _CommonChars*) param2;
-         if (macCommon == NULL)
-        {
-           printf ("There is an NDIS misconfiguration.\n");
-           result = ERR_GENERAL_FAILURE;
-          break;
-        }
-         DEBUG2 ("module name %s\n"
-                 "module type %s\n",
-                 macCommon->moduleName,
-                 ((MacChars*) macCommon->serviceChars)->macName);
-
-         /* Binding to the MAC */
-         result = macCommon->systemRequest ((DWORD)&common, (DWORD)&macCommon,
-                                            0, REQ_BIND,
-                                            macCommon->moduleDS);
-
-         if (!strcmp(bindings.moduleName[bindEntry], handle->moduleName))
-              handle->common = macCommon;
-         else PERROR ("unknown module");
-         ++bindEntry;
-        break;
-
-    case REQ_INITIATE_UNBIND:
-         macCommon = (struct _CommonChars*) param2;
-         result = macCommon->systemRequest ((DWORD)&common, 0,
-                                            0, REQ_UNBIND,
-                                            macCommon->moduleDS);
-         break;
-
-    default:
-         result = ERR_GENERAL_FAILURE;
-        break;
-  }
-  ARGSUSED (param1);
-  ARGSUSED (param3);
-  ARGSUSED (targetDS);
-  return (result);
-}
-
-CALLBACK (NdisRequestConfirm (WORD protId, WORD macId,   WORD reqHandle,
-                              WORD status, WORD request, WORD protDS))
-{
-  ARGSUSED (protId);    ARGSUSED (macId);
-  ARGSUSED (reqHandle); ARGSUSED (status);
-  ARGSUSED (request);   ARGSUSED (protDS);
-  return (ERR_SUCCESS);
-}
-
-CALLBACK (NdisTransmitConfirm (WORD protId, WORD macId, WORD reqHandle,
-                               WORD status, WORD protDS))
-{
-  xmitPending--;
-  FreePktBuf (txBufPending);  /* Add passed ECB back to the free list */
-
-  ARGSUSED (reqHandle);
-  ARGSUSED (status);
-  ARGSUSED (protDS);
-  return (ERR_SUCCESS);
-}
-
-
-/*
- * The primary function for receiving packets
- */
-CALLBACK (NdisReceiveLookahead (WORD  macId,      WORD  frameSize,
-                                WORD  bytesAvail, BYTE *buffer,
-                                BYTE *indicate,   WORD  protDS))
-{
-  int     result;
-  PktBuf *pktBuf;
-  WORD    bytesCopied;
-  struct _TDBufDescr tDBufDescr;
-
-#if 0
-  TRACE1 ("lookahead length = %d, ", bytesAvail);
-  TRACE1 ("ecb = %08lX, ",          *ecb);
-  TRACE1 ("count = %08lX\n",         count);
-  TRACE1 ("offset = %08lX, ",        offset);
-  TRACE1 ("timesAllowed = %d, ",     timesAllowed);
-  TRACE1 ("packet size = %d\n",      look->dataLookAheadLen);
-#endif
-
-  /* Allocate a buffer for the packet
-   */
-  if ((pktBuf = AllocPktBuf()) == NULL)
-  {
-    droppedPackets++;
-    return (ERR_FRAME_REJECTED);
-  }
-
-  /*
-   * Now kludge things. Note we will have to undo this later. This will
-   * make the packet contiguous after the MLID has done the requested copy.
-   */
-
-  tDBufDescr.tDDataCount = 1;
-  tDBufDescr.tDBufDescrRec[0].tDPtrType = NDIS_PTR_PHYSICAL;
-  tDBufDescr.tDBufDescrRec[0].tDDataPtr = pktBuf->buffer;
-  tDBufDescr.tDBufDescrRec[0].tDDataLen = pktBuf->length;
-  tDBufDescr.tDBufDescrRec[0].dummy     = 0;
-
-  result = MAC_DISPATCH(handle)->transferData (&bytesCopied, 0, &tDBufDescr,
-                                               handle->common->moduleDS);
-  pktBuf->packetLength = bytesCopied;
-
-  if (result == ERR_SUCCESS)
-       EnquePktBuf(pktBuf);
-  else FreePktBuf (pktBuf);
-
-  ARGSUSED (frameSize);
-  ARGSUSED (bytesAvail);
-  ARGSUSED (indicate);
-  ARGSUSED (protDS);
-
-  return (ERR_SUCCESS);
-}
-
-CALLBACK (NdisIndicationComplete (WORD macId, WORD protDS))
-{
-  ARGSUSED (macId);
-  ARGSUSED (protDS);
-
-  /* We don't give a hoot about these. Just return
-   */
-  return (ERR_SUCCESS);
-}
-
-/*
- * This is the OTHER way we may receive packets
- */
-CALLBACK (NdisReceiveChain (WORD macId, WORD frameSize, WORD reqHandle,
-                            struct _RxBufDescr *rxBufDescr,
-                            BYTE *indicate, WORD protDS))
-{
-  struct _PktBuf *pktBuf;
-  int     i;
-
-  /*
-   * For now we copy the entire packet over to a PktBuf structure. This may be
-   * a performance hit but this routine probably isn't called very much, and
-   * it is a lot of work to do it otherwise. Also if it is a filter protocol
-   * packet we could end up sucking up MAC buffes.
-   */
-
-  if ((pktBuf = AllocPktBuf()) == NULL)
-  {
-    droppedPackets++;
-    return (ERR_FRAME_REJECTED);
-  }
-  pktBuf->packetLength = 0;
-
-  /* Copy the packet to the buffer
-   */
-  for (i = 0; i < rxBufDescr->rxDataCount; ++i)
-  {
-    struct _RxBufDescrRec *rxDescr = &rxBufDescr->rxBufDescrRec[i];
-
-    memcpy (pktBuf->buffer + pktBuf->packetLength,
-            rxDescr->rxDataPtr, rxDescr->rxDataLen);
-    pktBuf->packetLength += rxDescr->rxDataLen;
-  }
-
-  EnquePktBuf (pktBuf);
-
-  ARGSUSED (frameSize);
-  ARGSUSED (reqHandle);
-  ARGSUSED (indicate);
-  ARGSUSED (protDS);
-
-  /* This frees up the buffer for the MAC to use
-   */
-  return (ERR_SUCCESS);
-}
-
-CALLBACK (NdisStatusProc (WORD macId,  WORD param1, BYTE *indicate,
-                          WORD opcode, WORD protDS))
-{
-  switch (opcode)
-  {
-    case STATUS_RING_STATUS:
-        break;
-    case STATUS_ADAPTER_CHECK:
-        break;
-    case STATUS_START_RESET:
-        break;
-    case STATUS_INTERRUPT:
-        break;
-    case STATUS_END_RESET:
-        break;
-    default:
-        break;
-  }
-  ARGSUSED (macId);
-  ARGSUSED (param1);
-  ARGSUSED (indicate);
-  ARGSUSED (opcode);
-  ARGSUSED (protDS);
-
-  /* We don't need to do anything about this stuff yet
-   */
-  return (ERR_SUCCESS);
-}
-
-/*
- * Tell the NDIS driver to start the delivery of the packet
- */
-int NdisSendPacket (struct _PktBuf *pktBuf, int macId)
-{
-  struct _TxBufDescr txBufDescr;
-  int     result;
-
-  xmitPending++;
-  txBufPending = pktBuf;    /* we only have 1 pending Tx at a time */
-
-  txBufDescr.txImmedLen  = 0;
-  txBufDescr.txImmedPtr  = NULL;
-  txBufDescr.txDataCount = 1;
-  txBufDescr.txBufDescrRec[0].txPtrType = NDIS_PTR_PHYSICAL;
-  txBufDescr.txBufDescrRec[0].dummy     = 0;
-  txBufDescr.txBufDescrRec[0].txDataLen = pktBuf->packetLength;
-  txBufDescr.txBufDescrRec[0].txDataPtr = pktBuf->buffer;
-
-  result = MAC_DISPATCH(handle)->transmitChain (common.moduleId,
-                                                pktBuf->handle,
-                                                &txBufDescr,
-                                                handle->common->moduleDS);
-  switch (result)
-  {
-    case ERR_OUT_OF_RESOURCE:
-         /* Note that this should not happen but if it does there is not
-          * much we can do about it
-          */
-         printf ("ERROR: transmit queue overflowed\n");
-         return (0);
-
-    case ERR_SUCCESS:
-         /* Everything was hunky dory and synchronous. Free up the
-          * packet buffer
-          */
-         xmitPending--;
-         FreePktBuf (pktBuf);
-         return (1);
-
-    case ERR_REQUEST_QUEUED:
-         /* Everything was hunky dory and asynchronous. Do nothing
-          */
-         return (1);
-
-    default:
-         printf ("Tx fail, code = %04X\n", result);
-         return (0);
-  }
-}
-
-
-
-static int ndis_nerr = sizeof(ndis_errlist) / sizeof(ndis_errlist[0]);
-
-static char *Ndis_strerror (WORD errorCode)
-{
-  static char buf[30];
-  int    i;
-
-  for (i = 0; i < ndis_nerr; i++)
-      if (errorCode == ndis_errlist[i].err_num)
-         return (ndis_errlist[i].err_text);
-
-  sprintf (buf,"unknown error %d",errorCode);
-  return (buf);
-}
-
-
-char *NdisLastError (void)
-{
-  char *errStr = lastErr;
-  lastErr = NULL;
-  return (errStr);
-}
-
-int NdisOpen (void)
-{
-  struct _ReqBlock reqBlock;
-  int     result;
-  int     ndisFd = open (NDIS_PATH, O_RDONLY);
-
-  if (ndisFd < 0)
-  {
-    printf ("Could not open NDIS Protocol Manager device.\n");
-    return (0);
-  }
-
-  memset (&reqBlock, 0, sizeof(ReqBlock));
-
-  reqBlock.opcode = PM_GET_PROTOCOL_MANAGER_LINKAGE;
-
-  result = NdisGetLinkage (ndisFd, (char*)&reqBlock, sizeof(ReqBlock));
-  if (result != 0)
-  {
-    printf ("Could not get Protocol Manager linkage.\n");
-    close (ndisFd);
-    return (0);
-  }
-
-  close (ndisFd);
-  protManEntry = (ProtMan) reqBlock.pointer1;
-  protManDS    = reqBlock.word1;
-
-  DEBUG2 ("Entry Point = %04X:%04X\n", FP_SEG(protManEntry),FP_OFF(protManEntry));
-  DEBUG1 ("ProtMan DS  = %04X\n", protManDS);
-  return (1);
-}
-
-
-int NdisRegisterAndBind (int promis)
-{
-  struct _ReqBlock reqBlock;
-  WORD    result;
-
-  memset (&common,0,sizeof(common));
-
-  common.tableSize = sizeof (common);
-
-  common.majorNdisVersion   = 2;
-  common.minorNdisVersion   = 0;
-  common.majorModuleVersion = 2;
-  common.minorModuleVersion = 0;
-
-  /* Indicates binding from below and dynamically loaded
-   */
-  common.moduleFlags = 0x00000006L;
-
-  strcpy (common.moduleName, "PCAP");
-
-  common.protocolLevelUpper = 0xFF;
-  common.protocolLevelLower = 1;
-  common.interfaceLower     = 1;
-#ifdef __DJGPP__
-  common.moduleDS           = _dos_ds; /* the callback data segment */
-#else
-  common.moduleDS           = _DS;
-#endif
-
-  common.systemRequest      = (SystemRequest) systemRequestGlue;
-  common.serviceChars       = (BYTE*) &protChars;
-  common.serviceStatus      = NULL;
-  common.upperDispatchTable = NULL;
-  common.lowerDispatchTable = (BYTE*) &lowerTable;
-
-  protChars.length  = sizeof (protChars);
-  protChars.name[0] = 0;
-  protChars.type    = 0;
-
-  lowerTable.backPointer        = &common;
-  lowerTable.requestConfirm     = requestConfirmGlue;
-  lowerTable.transmitConfirm    = transmitConfirmGlue;
-  lowerTable.receiveLookahead   = receiveLookaheadGlue;
-  lowerTable.indicationComplete = indicationCompleteGlue;
-  lowerTable.receiveChain       = receiveChainGlue;
-  lowerTable.status             = statusGlue;
-  lowerTable.flags              = 3;
-  if (promis)
-     lowerTable.flags |= 4;   /* promiscous mode (receive everything) */
-
-  bindings.numBindings = 1;
-  strcpy (bindings.moduleName[0], handle->moduleName);
-
-  /* Register ourselves with NDIS
-   */
-  reqBlock.opcode   = PM_REGISTER_MODULE;
-  reqBlock.pointer1 = (BYTE FAR*) &common;
-  reqBlock.pointer2 = (BYTE FAR*) &bindings;
-
-  result = (*protManEntry) (&reqBlock, protManDS);
-  if (result)
-  {
-    printf ("Protman registering failed: %s\n", Ndis_strerror(result));
-    return (0);
-  }
-
-  /* Start the binding process
-   */
-  reqBlock.opcode   = PM_BIND_AND_START;
-  reqBlock.pointer1 = (BYTE FAR*) &failingModules;
-
-  result = (*protManEntry) (&reqBlock, protManDS);
-  if (result)
-  {
-    printf ("Start binding failed: %s\n", Ndis_strerror(result));
-    return (0);
-  }
-  return (1);
-}
-
-static int CheckMacFeatures (CardHandle *card)
-{
-  DWORD      serviceFlags;
-  BYTE _far *mediaString;
-  BYTE _far *mac_addr;
-
-  DEBUG2 ("checking card features\n"
-          "common table address = %08lX, macId = %d\n",
-          card->common, card->common->moduleId);
-
-  serviceFlags = MAC_CHAR (handle)->serviceFlags;
-
-  if ((serviceFlags & SF_PROMISCUOUS) == 0)
-  {
-    printf ("The MAC %s does not support promiscuous mode.\n",
-            card->moduleName);
-    return (0);
-  }
-
-  mediaString = MAC_CHAR (handle)->macName;
-
-  DEBUG1 ("media type = %s\n",mediaString);
-
-  /* Get the media type. And set the header size
-   */
-  if (!strncmp(mediaString,"802.3",5) ||
-      !strncmp(mediaString,"DIX",3)   ||
-      !strncmp(mediaString,"DIX+802.3",9))
-       headerSize = sizeof (EthernetIIHeader);
-
-  else if (!strncmp(mediaString,"FDDI",4))
-       headerSize = sizeof (FddiHeader) +
-                    sizeof (Ieee802Dot2SnapHeader);
-  else
-  {
-    printf ("Unsupported MAC type: `%s'\n", mediaString);
-    return (0);
-  }
-
-  frameSize = MAC_CHAR (handle)->maxFrameSize;
-  mac_addr  = MAC_CHAR (handle)->currentAddress;
-
-  printf ("Hardware address: %02X:%02X:%02X:%02X:%02X:%02X\n",
-          mac_addr[0], mac_addr[1], mac_addr[2],
-          mac_addr[3], mac_addr[4], mac_addr[5]);
-  return (1);
-}
-
-static int NdisStartMac (CardHandle *card)
-{
-  WORD result;
-
-  /* Set the lookahead length
-   */
-  result = MAC_DISPATCH(handle)->request (common.moduleId, 0,
-                                          headerSize, 0,
-                                          REQ_SET_LOOKAHEAD,
-                                          card->common->moduleDS);
-
-  /* We assume that if we got INVALID PARAMETER then either this
-   * is not supported or will work anyway. NE2000 does this.
-   */
-  if (result != ERR_SUCCESS && result != ERR_INVALID_PARAMETER)
-  {
-    DEBUG1 ("Set lookahead failed: %s\n", Ndis_strerror(result));
-    return (0);
-  }
-
-  /* Set the packet filter. Note that for some medias and drivers we
-   * must specify all three flags or the card(s) will not operate correctly.
-   */
-  result = MAC_DISPATCH(handle)->request (common.moduleId, 0,
-                      /* all packets */   FILTER_PROMISCUOUS |
-                      /* packets to us */ FILTER_DIRECTED    |
-                      /* broadcasts */    FILTER_BROADCAST,
-                                          0, REQ_SET_PACKET_FILTER,
-                                          card->common->moduleDS);
-  if (result != ERR_SUCCESS)
-  {
-    DEBUG1 ("Set packet filter failed: %s\n", Ndis_strerror(result));
-    return (0);
-  }
-
-  /* If OPEN/CLOSE supported then open the adapter
-   */
-  if (MAC_CHAR(handle)->serviceFlags & SF_OPEN_CLOSE)
-  {
-    result = MAC_DISPATCH(handle)->request (common.moduleId, 0, 0, NULL,
-                                            REQ_OPEN_ADAPTER,
-                                            card->common->moduleDS);
-    if (result != ERR_SUCCESS)
-    {
-      DEBUG1 ("Opening the MAC failed: %s\n", Ndis_strerror(result));
-      return (0);
-    }
-  }
-  return (1);
-}
-
-void NdisShutdown (void)
-{
-  struct _ReqBlock reqBlock;
-  int     result, i;
-
-  if (!handle)
-     return;
-
-  /* If the adapters support open and are open then close them
-   */
-  if ((MAC_CHAR(handle)->serviceFlags & SF_OPEN_CLOSE) &&
-      (MAC_STATUS(handle)->macStatus & MAC_OPEN))
-  {
-    result = MAC_DISPATCH(handle)->request (common.moduleId, 0, 0, 0,
-                                            REQ_CLOSE_ADAPTER,
-                                            handle->common->moduleDS);
-    if (result != ERR_SUCCESS)
-    {
-      printf ("Closing the MAC failed: %s\n", Ndis_strerror(result));
-      return;
-    }
-  }
-
-  /* Tell the Protocol Manager to unbind and stop
-   */
-  reqBlock.opcode   = PM_UNBIND_AND_STOP;
-  reqBlock.pointer1 = (BYTE FAR*) &failingModules;
-  reqBlock.pointer2 = NULL;
-
-  result = (*protManEntry) (&reqBlock, protManDS);
-  if (result)
-     printf ("Unbind failed: %s\n",  Ndis_strerror(result));
-
-  for (i = 0; i < STACK_POOL_SIZE; ++i)
-     free (freeStacks[i] - STACK_SIZE);
-
-  handle = NULL;
-}
-
-int NdisInit (int promis)
-{
-  int i, result;
-
-  /* Allocate the real mode stacks used for NDIS callbacks
-   */
-  for (i = 0; i < STACK_POOL_SIZE; ++i)
-  {
-    freeStacks[i] = malloc (STACK_SIZE);
-    if (!freeStacks[i])
-       return (0);
-    freeStacks[i] += STACK_SIZE;
-  }
-
-  if (!NdisOpen())
-     return (0);
-
-  if (!NdisRegisterAndBind(promis))
-     return (0);
-
-  DEBUG1 ("My module id: %d\n", common.moduleId);
-  DEBUG1 ("Handle id;    %d\n", handle->common->moduleId);
-  DEBUG1 ("MAC card:     %-16s - ", handle->moduleName);
-
-  atexit (NdisShutdown);
-
-  if (!CheckMacFeatures(&handle))
-     return (0);
-
-  switch (mediaType)
-  {
-    case MEDIA_FDDI:
-         DEBUG0 ("Media type: FDDI");
-        break;
-    case MEDIA_ETHERNET:
-         DEBUG0 ("Media type: ETHERNET");
-        break;
-    default:
-         DEBUG0 ("Unsupported media.\n");
-         return (0);
-  }
-
-  DEBUG1 (" - Frame size: %d\n", frameSize);
-
-  if (!NdisStartMac(&handle))
-     return (0);
-  return (1);
-}
-#endif  /* USE_NDIS2 */
-
diff --git a/msdos/ndis2.h b/msdos/ndis2.h
deleted file mode 100644 (file)
index f278b5d..0000000
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
- * Copyright (c) 1993,1994
- *      Texas A&M University.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Texas A&M University
- *      and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Developers:
- *             David K. Hess, Douglas Lee Schales, David R. Safford
- *
- * Heavily modified for Metaware HighC + GNU C 2.8+
- *             Gisle Vanem 1998
- */
-
-#ifndef __PCAP_NDIS_H
-#define __PCAP_NDIS_H
-
-#if defined (__HIGHC__)
-  #define pascal          _CC(_CALLEE_POPS_STACK & ~_REVERSE_PARMS) /* calling convention */
-  #define CALLBACK(foo)   pascal WORD foo
-  #define PAS_PTR(x,arg)  typedef FAR WORD pascal (*x) arg
-  #define GUARD()         _inline (0x9C,0xFA)   /* pushfd, cli */
-  #define UNGUARD()       _inline (0x9D)        /* popfd */
-  #define FAR             _far
-
-#elif defined(__GNUC__)
-  #define CALLBACK(foo)   WORD foo __attribute__((stdcall))
-  #define PAS_PTR(x,arg)  typedef WORD (*x) arg __attribute__((stdcall))
-  #define GUARD()         __asm__ __volatile__ ("pushfd; cli")
-  #define UNGUARD()       __asm__ __volatile__ ("popfd")
-  #define FAR
-
-#elif defined (__TURBOC__)
-  #define CALLBACK(foo)   WORD pascal foo
-  #define PAS_PTR(x,arg)  typedef WORD pascal (_far *x) arg
-  #define GUARD()         _asm { pushf; cli }
-  #define UNGUARD()       _asm { popf }
-  #define FAR             _far
-
-#elif defined (__WATCOMC__)
-  #define CALLBACK(foo)   WORD pascal foo
-  #define PAS_PTR(x,arg)  typedef WORD pascal (_far *x) arg
-  #define GUARD()         _disable()
-  #define UNGUARD()       _enable()
-  #define FAR             _far
-
-#else
-  #error Unsupported compiler
-#endif
-
-
-/*
- *  Forwards
- */
-struct _ReqBlock;
-struct _TxBufDescr;
-struct _TDBufDescr;
-
-/*
- * Protocol Manager API
- */
-PAS_PTR (ProtMan, (struct _ReqBlock FAR*, WORD));
-
-/*
- * System request
- */
-PAS_PTR (SystemRequest, (DWORD, DWORD, WORD, WORD, WORD));
-
-/*
- * MAC API
- */
-PAS_PTR (TransmitChain, (WORD, WORD, struct _TxBufDescr FAR*, WORD));
-PAS_PTR (TransferData,  (WORD*,WORD, struct _TDBufDescr FAR*, WORD));
-PAS_PTR (Request,       (WORD, WORD, WORD, DWORD, WORD, WORD));
-PAS_PTR (ReceiveRelease,(WORD, WORD));
-PAS_PTR (IndicationOn,  (WORD));
-PAS_PTR (IndicationOff, (WORD));
-
-
-typedef enum {
-        HARDWARE_NOT_INSTALLED  = 0,
-        HARDWARE_FAILED_DIAG    = 1,
-        HARDWARE_FAILED_CONFIG  = 2,
-        HARDWARE_HARD_FAULT     = 3,
-        HARDWARE_SOFT_FAULT     = 4,
-        HARDWARE_OK             = 7,
-        HARDWARE_MASK           = 0x0007,
-        MAC_BOUND               = 0x0008,
-        MAC_OPEN                = 0x0010,
-        DIAG_IN_PROGRESS        = 0x0020
-      } NdisMacStatus;
-
-typedef enum {
-        STATUS_RING_STATUS      = 1,
-        STATUS_ADAPTER_CHECK    = 2,
-        STATUS_START_RESET      = 3,
-        STATUS_INTERRUPT        = 4,
-        STATUS_END_RESET        = 5
-      } NdisStatus;
-
-typedef enum {
-        FILTER_DIRECTED         = 1,
-        FILTER_BROADCAST        = 2,
-        FILTER_PROMISCUOUS      = 4,
-        FILTER_SOURCE_ROUTE     = 8
-      } NdisPacketFilter;
-
-typedef enum {
-        REQ_INITIATE_DIAGNOSTICS     = 1,
-        REQ_READ_ERROR_LOG           = 2,
-        REQ_SET_STATION_ADDRESS      = 3,
-        REQ_OPEN_ADAPTER             = 4,
-        REQ_CLOSE_ADAPTER            = 5,
-        REQ_RESET_MAC                = 6,
-        REQ_SET_PACKET_FILTER        = 7,
-        REQ_ADD_MULTICAST_ADDRESS    = 8,
-        REQ_DELETE_MULTICAST_ADDRESS = 9,
-        REQ_UPDATE_STATISTICS        = 10,
-        REQ_CLEAR_STATISTICS         = 11,
-        REQ_INTERRUPT_REQUEST        = 12,
-        REQ_SET_FUNCTIONAL_ADDRESS   = 13,
-        REQ_SET_LOOKAHEAD            = 14
-      } NdisGeneralRequest;
-
-typedef enum {
-        SF_BROADCAST             = 0x00000001L,
-        SF_MULTICAST             = 0x00000002L,
-        SF_FUNCTIONAL            = 0x00000004L,
-        SF_PROMISCUOUS           = 0x00000008L,
-        SF_SOFT_ADDRESS          = 0x00000010L,
-        SF_STATS_CURRENT         = 0x00000020L,
-        SF_INITIATE_DIAGS        = 0x00000040L,
-        SF_LOOPBACK              = 0x00000080L,
-        SF_RECEIVE_CHAIN         = 0x00000100L,
-        SF_SOURCE_ROUTING        = 0x00000200L,
-        SF_RESET_MAC             = 0x00000400L,
-        SF_OPEN_CLOSE            = 0x00000800L,
-        SF_INTERRUPT_REQUEST     = 0x00001000L,
-        SF_SOURCE_ROUTING_BRIDGE = 0x00002000L,
-        SF_VIRTUAL_ADDRESSES     = 0x00004000L
-      } NdisMacServiceFlags;
-
-typedef enum {
-        REQ_INITIATE_BIND        = 1,
-        REQ_BIND                 = 2,
-        REQ_INITIATE_PREBIND     = 3,
-        REQ_INITIATE_UNBIND      = 4,
-        REQ_UNBIND               = 5
-      } NdisSysRequest;
-
-typedef enum  {
-        PM_GET_PROTOCOL_MANAGER_INFO      = 1,
-        PM_REGISTER_MODULE                = 2,
-        PM_BIND_AND_START                 = 3,
-        PM_GET_PROTOCOL_MANAGER_LINKAGE   = 4,
-        PM_GET_PROTOCOL_INI_PATH          = 5,
-        PM_REGISTER_PROTOCOL_MANAGER_INFO = 6,
-        PM_INIT_AND_REGISTER              = 7,
-        PM_UNBIND_AND_STOP                = 8,
-        PM_BIND_STATUS                    = 9,
-        PM_REGISTER_STATUS                = 10
-      } NdisProtManager;
-
-
-typedef enum {
-        ERR_SUCCESS                      = 0x00,
-        ERR_WAIT_FOR_RELEASE             = 0x01,
-        ERR_REQUEST_QUEUED               = 0x02,
-        ERR_FRAME_NOT_RECOGNIZED         = 0x03,
-        ERR_FRAME_REJECTED               = 0x04,
-        ERR_FORWARD_FRAME                = 0x05,
-        ERR_OUT_OF_RESOURCE              = 0x06,
-        ERR_INVALID_PARAMETER            = 0x07,
-        ERR_INVALID_FUNCTION             = 0x08,
-        ERR_NOT_SUPPORTED                = 0x09,
-        ERR_HARDWARE_ERROR               = 0x0A,
-        ERR_TRANSMIT_ERROR               = 0x0B,
-        ERR_NO_SUCH_DESTINATION          = 0x0C,
-        ERR_BUFFER_TOO_SMALL             = 0x0D,
-        ERR_ALREADY_STARTED              = 0x20,
-        ERR_INCOMPLETE_BINDING           = 0x21,
-        ERR_DRIVER_NOT_INITIALIZED       = 0x22,
-        ERR_HARDWARE_NOT_FOUND           = 0x23,
-        ERR_HARDWARE_FAILURE             = 0x24,
-        ERR_CONFIGURATION_FAILURE        = 0x25,
-        ERR_INTERRUPT_CONFLICT           = 0x26,
-        ERR_INCOMPATIBLE_MAC             = 0x27,
-        ERR_INITIALIZATION_FAILED        = 0x28,
-        ERR_NO_BINDING                   = 0x29,
-        ERR_NETWORK_MAY_NOT_BE_CONNECTED = 0x2A,
-        ERR_INCOMPATIBLE_OS_VERSION      = 0x2B,
-        ERR_ALREADY_REGISTERED           = 0x2C,
-        ERR_PATH_NOT_FOUND               = 0x2D,
-        ERR_INSUFFICIENT_MEMORY          = 0x2E,
-        ERR_INFO_NOT_FOUND               = 0x2F,
-        ERR_GENERAL_FAILURE              = 0xFF
-      } NdisError;
-
-#define NDIS_PARAM_INTEGER   0
-#define NDIS_PARAM_STRING    1
-
-#define NDIS_TX_BUF_LENGTH   8
-#define NDIS_TD_BUF_LENGTH   1
-#define NDIS_RX_BUF_LENGTH   8
-
-#define NDIS_PTR_PHYSICAL    0
-#define NDIS_PTR_VIRTUAL     2
-
-#define NDIS_PATH    "PROTMAN$"
-
-
-typedef struct _CommonChars {
-        WORD  tableSize;
-        BYTE  majorNdisVersion;        /* 2 - Latest version */
-        BYTE  minorNdisVersion;        /* 0                  */
-        WORD  reserved1;
-        BYTE  majorModuleVersion;
-        BYTE  minorModuleVersion;
-        DWORD moduleFlags;
-        /* 0 - Binding at upper boundary supported
-         * 1 - Binding at lower boundary supported
-         * 2 - Dynamically bound.
-         * 3-31 - Reserved, must be zero.
-         */
-        BYTE  moduleName[16];
-        BYTE  protocolLevelUpper;
-        /* 1 - MAC
-         * 2 - Data Link
-         * 3 - Network
-         * 4 - Transport
-         * 5 - Session
-         * -1 - Not specified
-         */
-        BYTE  interfaceUpper;
-        BYTE  protocolLevelLower;
-        /* 0 - Physical
-         * 1 - MAC
-         * 2 - Data Link
-         * 3 - Network
-         * 4 - Transport
-         * 5 - Session
-         * -1 - Not specified
-         */
-        BYTE  interfaceLower;
-        WORD  moduleId;
-        WORD  moduleDS;
-        SystemRequest systemRequest;
-        BYTE *serviceChars;
-        BYTE *serviceStatus;
-        BYTE *upperDispatchTable;
-        BYTE *lowerDispatchTable;
-        BYTE *reserved2;            /* Must be NULL */
-        BYTE *reserved3;            /* Must be NULL */
-      } CommonChars;
-
-
-typedef struct _MulticastList {
-        WORD   maxMulticastAddresses;
-        WORD   numberMulticastAddresses;
-        BYTE   multicastAddress[16][16];
-      } MulticastList;
-
-
-typedef struct _MacChars {
-        WORD   tableSize;
-        BYTE   macName[16];
-        WORD   addressLength;
-        BYTE   permanentAddress[16];
-        BYTE   currentAddress[16];
-        DWORD  currentFunctionalAddress;
-        MulticastList *multicastList;
-        DWORD  linkSpeed;
-        DWORD  serviceFlags;
-        WORD   maxFrameSize;
-        DWORD  txBufferSize;
-        WORD   txBufferAllocSize;
-        DWORD  rxBufferSize;
-        WORD   rxBufferAllocSize;
-        BYTE   ieeeVendor[3];
-        BYTE   vendorAdapter;
-        BYTE  *vendorAdapterDescription;
-        WORD   interruptLevel;
-        WORD   txQueueDepth;
-        WORD   maxDataBlocks;
-      } MacChars;
-
-
-typedef struct _ProtocolChars {
-        WORD   length;
-        BYTE   name[16];
-        WORD   type;
-      } ProtocolChars;
-
-
-typedef struct _MacUpperDispatch {
-        CommonChars      *backPointer;
-        Request           request;
-        TransmitChain     transmitChain;
-        TransferData      transferData;
-        ReceiveRelease    receiveRelease;
-        IndicationOn      indicationOn;
-        IndicationOff     indicationOff;
-      } MacUpperDispatch;
-
-
-typedef struct _MacStatusTable {
-        WORD   tableSize;
-        DWORD  lastDiag;
-        DWORD  macStatus;
-        WORD   packetFilter;
-        BYTE  *mediaSpecificStats;
-        DWORD  lastClear;
-        DWORD  totalFramesRx;
-        DWORD  totalFramesCrc;
-        DWORD  totalBytesRx;
-        DWORD  totalDiscardBufSpaceRx;
-        DWORD  totalMulticastRx;
-        DWORD  totalBroadcastRx;
-        DWORD  obsolete1[5];
-        DWORD  totalDiscardHwErrorRx;
-        DWORD  totalFramesTx;
-        DWORD  totalBytesTx;
-        DWORD  totalMulticastTx;
-        DWORD  totalBroadcastTx;
-        DWORD  obsolete2[2];
-        DWORD  totalDiscardTimeoutTx;
-        DWORD  totalDiscardHwErrorTx;
-      } MacStatusTable;
-
-
-typedef struct _ProtDispatch {
-        CommonChars *backPointer;
-        DWORD        flags;
-        /* 0 - handles non-LLC frames
-         * 1 - handles specific-LSAP LLC frames
-         * 2 - handles specific-LSAP LLC frames
-         * 3-31 - reserved must be 0
-         */
-        void  (*requestConfirm) (void);
-        void  (*transmitConfirm) (void);
-        void  (*receiveLookahead) (void);
-        void  (*indicationComplete) (void);
-        void  (*receiveChain) (void);
-        void  (*status) (void);
-      } ProtDispatch;
-
-
-typedef struct _ReqBlock {
-        WORD      opcode;
-        WORD      status;
-        BYTE FAR *pointer1;
-        BYTE FAR *pointer2;
-        WORD      word1;
-      } ReqBlock;
-
-
-typedef struct _TxBufDescrRec {
-        BYTE   txPtrType;
-        BYTE   dummy;
-        WORD   txDataLen;
-        BYTE  *txDataPtr;
-      } TxBufDescrRec;
-
-
-typedef struct _TxBufDescr {
-        WORD          txImmedLen;
-        BYTE         *txImmedPtr;
-        WORD          txDataCount;
-        TxBufDescrRec txBufDescrRec[NDIS_TX_BUF_LENGTH];
-      } TxBufDescr;
-
-
-typedef struct _TDBufDescrRec {
-        BYTE   tDPtrType;
-        BYTE   dummy;
-        WORD   tDDataLen;
-        BYTE  *tDDataPtr;
-      } TDBufDescrRec;
-
-
-typedef struct _TDBufDescr {
-        WORD          tDDataCount;
-        TDBufDescrRec tDBufDescrRec[NDIS_TD_BUF_LENGTH];
-      } TDBufDescr;
-
-
-typedef struct _RxBufDescrRec {
-        WORD   rxDataLen;
-        BYTE  *rxDataPtr;
-      } RxBufDescrRec;
-
-
-typedef struct _RxBufDescr {
-        WORD          rxDataCount;
-        RxBufDescrRec rxBufDescrRec[NDIS_RX_BUF_LENGTH];
-      } RxBufDescr;
-
-
-typedef struct _PktBuf {
-       struct _PktBuf *nextLink;
-       struct _PktBuf *prevLink;
-        int    handle;
-        int    length;
-        int    packetLength;
-        DWORD  sequence;
-        BYTE  *buffer;
-      } PktBuf;
-
-
-typedef struct _CardHandle {
-        BYTE         moduleName[16];
-        CommonChars *common;
-      } CardHandle;
-
-
-typedef struct _BindingsList {
-        WORD  numBindings;
-        BYTE  moduleName[2][16];
-      } BindingsList;
-
-
-typedef struct _FailingModules {
-        BYTE  upperModuleName[16];
-        BYTE  lowerModuleName[16];
-      } FailingModules;
-
-
-typedef union _HardwareAddress {
-        BYTE  bytes[6];
-        WORD  words[3];
-        struct {
-          BYTE bytes[6];
-        } addr;
-      } HardwareAddress;
-
-
-typedef struct _FddiHeader {
-        BYTE             frameControl;
-        HardwareAddress  etherDestHost;
-        HardwareAddress  etherSrcHost;
-      } FddiHeader;
-
-
-typedef struct _EthernetIIHeader {
-        HardwareAddress  etherDestHost;
-        HardwareAddress  etherSrcHost;
-        WORD             etherType;
-      } EthernetIIHeader;
-
-
-typedef struct _Ieee802Dot5Header {
-        HardwareAddress  etherDestHost;
-        HardwareAddress  etherSrcHost;
-        BYTE             routeInfo[30];
-      } Ieee802Dot5Header;
-
-
-typedef struct _Ieee802Dot2SnapHeader {
-        BYTE  dsap;                      /* 0xAA */
-        BYTE  ssap;                      /* 0xAA */
-        BYTE  control;                   /* 3    */
-        BYTE protocolId[5];
-      } Ieee802Dot2SnapHeader;
-
-
-/*
- *  Prototypes
- */
-extern char *NdisLastError        (void);
-extern int   NdisOpen             (void);
-extern int   NdisInit             (int promis);
-extern int   NdisRegisterAndBind  (int promis);
-extern void  NdisShutdown         (void);
-extern void  NdisCheckMacFeatures (struct _CardHandle *card);
-extern int   NdisSendPacket       (struct _PktBuf *pktBuf, int macId);
-
-/*
- *  Assembly "glue" functions
- */
-extern int systemRequestGlue();
-extern int requestConfirmGlue();
-extern int transmitConfirmGlue();
-extern int receiveLookaheadGlue();
-extern int indicationCompleteGlue();
-extern int receiveChainGlue();
-extern int statusGlue();
-
-/*
- *  IOCTL function
- */
-#ifdef __SMALL__
-extern int _far NdisGetLinkage (int handle, char *data, int size);
-#else
-extern int NdisGetLinkage (int handle, char *data, int size);
-#endif
-
-/*
- *  NDIS callback handlers
- */
-CALLBACK (NdisSystemRequest     (DWORD,DWORD, WORD, WORD, WORD));
-CALLBACK (NdisRequestConfirm    ( WORD, WORD, WORD, WORD, WORD,WORD));
-CALLBACK (NdisTransmitConfirm   ( WORD, WORD, WORD, WORD, WORD));
-CALLBACK (NdisReceiveLookahead  ( WORD, WORD, WORD, BYTE*, BYTE*, WORD));
-CALLBACK (NdisReceiveChain      ( WORD, WORD, WORD, struct _RxBufDescr*, BYTE*, WORD));
-CALLBACK (NdisStatusProc        ( WORD, WORD, BYTE*, WORD,WORD));
-CALLBACK (NdisIndicationComplete( WORD, WORD));
-
-BYTE *NdisAllocStack (void);
-void  NdisFreeStack  (BYTE*);
-
-#ifdef __HIGHC__
-  #define RENAME_ASM_SYM(x) pragma Alias(x,"@" #x "")  /* prepend `@' */
-  #define RENAME_C_SYM(x)   pragma Alias(x,"_" #x "")  /* prepend `_' */
-
-  RENAME_ASM_SYM (systemRequestGlue);
-  RENAME_ASM_SYM (requestConfirmGlue);
-  RENAME_ASM_SYM (transmitConfirmGlue);
-  RENAME_ASM_SYM (receiveLookaheadGlue);
-  RENAME_ASM_SYM (indicationCompleteGlue);
-  RENAME_ASM_SYM (receiveChainGlue);
-  RENAME_ASM_SYM (statusGlue);
-  RENAME_ASM_SYM (NdisGetLinkage);
-  RENAME_C_SYM   (NdisSystemRequest);
-  RENAME_C_SYM   (NdisRequestConfirm);
-  RENAME_C_SYM   (NdisTransmitConfirm);
-  RENAME_C_SYM   (NdisReceiveLookahead);
-  RENAME_C_SYM   (NdisIndicationComplete);
-  RENAME_C_SYM   (NdisReceiveChain);
-  RENAME_C_SYM   (NdisStatusProc);
-  RENAME_C_SYM   (NdisAllocStack);
-  RENAME_C_SYM   (NdisFreeStack);
-#endif
-
-#endif
diff --git a/msdos/ndis_0.asm b/msdos/ndis_0.asm
deleted file mode 100644 (file)
index ea65e0f..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-PAGE 60,132
-NAME NDIS_0
-
-ifdef DOSX
-  .386
-  _TEXT   SEGMENT PUBLIC DWORD USE16 'CODE'
-  _TEXT   ENDS
-  _DATA   SEGMENT PUBLIC DWORD USE16 'CODE'
-  _DATA   ENDS
-  _TEXT32 SEGMENT PUBLIC BYTE  USE32 'CODE'
-  _TEXT32 ENDS
-  CB_DSEG EQU <CS>                          ; DOSX is tiny-model
-  D_SEG   EQU <_TEXT SEGMENT>
-  D_END   EQU <_TEXT ENDS>
-  ASSUME  CS:_TEXT,DS:_TEXT
-
-  PUSHREGS equ <pushad>
-  POPREGS  equ <popad>
-
-  PUBPROC macro name
-          align 4
-          public @&name
-          @&name label near
-          endm
-else
-  .286
-  _TEXT   SEGMENT PUBLIC DWORD 'CODE'
-  _TEXT   ENDS
-  _DATA   SEGMENT PUBLIC DWORD 'DATA'
-  _DATA   ENDS
-  CB_DSEG EQU <SEG _DATA>                   ; 16bit is small/large model
-  D_SEG   EQU <_DATA SEGMENT>
-  D_END   EQU <_DATA ENDS>
-  ASSUME  CS:_TEXT,DS:_DATA
-
-  PUSHREGS equ <pusha>
-  POPREGS  equ <popa>
-
-  PUBPROC  macro name
-           public _&name
-           _&name label far
-           endm
-endif
-
-;-------------------------------------------
-
-D_SEG
-
-D_END
-
-
-_TEXT SEGMENT
-
-EXTRN _NdisSystemRequest      : near
-EXTRN _NdisRequestConfirm     : near
-EXTRN _NdisTransmitConfirm    : near
-EXTRN _NdisReceiveLookahead   : near
-EXTRN _NdisIndicationComplete : near
-EXTRN _NdisReceiveChain       : near
-EXTRN _NdisStatusProc         : near
-EXTRN _NdisAllocStack         : near
-EXTRN _NdisFreeStack          : near
-
-;
-; *ALL* interrupt threads come through this macro.
-;
-CALLBACK macro callbackProc, argsSize
-
-     pushf
-     PUSHREGS                ;; Save the registers
-
-     push es
-     push ds
-     mov  ax,CB_DSEG         ;; Load DS
-     mov  ds,ax
-     call _NdisAllocStack    ;; Get and install a stack.
-
-     mov  bx,ss              ;; Save off the old stack in other regs
-     mov  cx,sp
-     mov  ss,dx              ;; Install the new one
-     mov  sp,ax
-     push bx                 ;; Save the old one on to the new stack
-     push cx
-     sub  sp,&argsSize       ;; Allocate space for arguments on the stack
-
-     mov  ax,ss              ;; Set up the destination for the move
-     mov  es,ax
-     mov  di,sp
-     mov  ds,bx              ;; Set up the source for the move.
-     mov  si,cx
-     add  si,4+6+32
-
-     mov  cx,&argsSize       ;; Move the arguments to the stack.
-     shr  cx,1
-     cld
-     rep  movsw
-
-     mov  ax,CB_DSEG         ;; Set my data segment again.
-     mov  ds,ax
-
-     call &callbackProc      ;; Call the real callback.
-     pop  di                 ;; Pop off the old stack
-     pop  si
-     mov  bx,ss              ;; Save off the current allocated stack.
-     mov  cx,sp
-     mov  ss,si              ;; Restore the old stack
-     mov  sp,di
-     push ax                 ;; Save the return code
-     push bx                 ;; Free the stack. Push the pointer to it
-     push cx
-     call _NdisFreeStack
-     add  sp,4
-     pop  ax                 ;; Get the return code back
-     add  di,32              ;; Get a pointer to ax on the stack
-     mov  word ptr ss:[di],ax
-     pop  ds
-     pop  es
-
-     POPREGS
-     popf
-endm
-
-;
-; Define all of the callbacks for the NDIS procs.
-;
-
-PUBPROC systemRequestGlue
-CALLBACK _NdisSystemRequest,14
-RETF
-
-PUBPROC requestConfirmGlue
-CALLBACK _NdisRequestConfirm,12
-RETF
-
-PUBPROC transmitConfirmGlue
-CALLBACK _NdisTransmitConfirm,10
-RETF
-
-PUBPROC receiveLookaheadGlue
-CALLBACK _NdisReceiveLookahead,16
-RETF
-
-PUBPROC indicationCompleteGlue
-CALLBACK _NdisIndicationComplete,4
-RETF
-
-PUBPROC receiveChainGlue
-CALLBACK _NdisReceiveChain,16
-RETF
-
-PUBPROC statusGlue
-CALLBACK _NdisStatusProc,12
-RETF
-
-;
-; int FAR NdisGetLinkage (int handle, char *data, int size);
-;
-
-ifdef DOSX
-  PUBPROC NdisGetLinkage
-          push ebx
-          mov ebx, [esp+8]              ; device handle
-          mov eax, 4402h                ; IOCTRL read function
-          mov edx, [esp+12]             ; DS:EDX -> result data
-          mov ecx, [esp+16]             ; ECX = length
-          int 21h
-          pop ebx
-          jc  @fail
-          xor eax, eax
-  @fail:  ret
-
-else
-  PUBPROC NdisGetLinkage
-          enter 0, 0
-          mov bx, [bp+6]
-          mov ax, 4402h
-          mov dx, [bp+8]
-          mov cx, [bp+12]
-          int 21h
-          jc  @fail
-          xor ax, ax
-  @fail:  leave
-          retf
-endif
-
-ENDS
-
-END