home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D4.DMS / in.adf / Interfaces / Sana2.mod < prev    next >
Encoding:
Text File  |  1993-05-20  |  9.9 KB  |  253 lines

  1. (*(********************************************************************
  2.  
  3. :Program.    Sana2.mod
  4. :Contents.   Structure definitions for SANA-II devices
  5. :Author.     (Original) Raymond S. Brand, Dale Larson
  6. :Author.     (Oberon) bene@amokut.adsp.sub.org (Nicolas Benezan)
  7. :Copyright.  (C) Copyright 1991 Commodore-Amiga Inc.
  8. :Copyright.  All Rights Reserved
  9. :Language.   Oberon
  10. :Translator. Amiga Oberon Compiler V3.0
  11. :History.    V1.4 bene 25-Nov-91 ported from sana.h 91/11/07
  12. :History.    V1.5 bene 23-Apr-92 + LONGBOOL
  13. :History.    V1.6 bene 11-Jun-92 adapted to compiler 2.25
  14. :History.    V1.7 bene 24-Jul-92 compiler 2.39, BYTE -> SHORTINT
  15. :History.    V1.8 bene 10-Dec-92 DeviceStats bug fixed
  16. :History.    V1.9 bene 16-May-93 + amokNet
  17. :History.    V1.10 hG  20-May-93 updated to V39, rearranged
  18. :Version.    $VER: Sana2.mod 1.10 (20.5.93)
  19.  
  20. ********************************************************************)*)
  21.  
  22. MODULE Sana2; (* $Implementation- *)
  23.  
  24. IMPORT e: Exec, s: SYSTEM, t: Timer, u: Utility;
  25.  
  26. CONST
  27.   maxAddrBits  * = 128;
  28.   maxAddrBytes * = (maxAddrBits + 7) DIV 8;
  29.  
  30. TYPE
  31.   Sana2Address         * = ARRAY maxAddrBytes OF SHORTINT;
  32.   StatDataPtr          * = UNTRACED POINTER TO StatData;
  33.   IOSana2ReqPtr        * = UNTRACED POINTER TO IOSana2Req;
  34.   DeviceQueryPtr       * = UNTRACED POINTER TO DeviceQuery;
  35.   PacketTypeStatsPtr   * = UNTRACED POINTER TO PacketTypeStats;
  36.   SpecialStatHeaderPtr * = UNTRACED POINTER TO SpecialStatHeader;
  37.   DeviceStatsPtr       * = UNTRACED POINTER TO DeviceStats;
  38.   BufferMngDataPtr     * = UNTRACED POINTER TO BufferMngData;
  39.  
  40.   CopyBuffProc * = PROCEDURE (to{8}   : e.APTR;
  41.                               from{9} : e.APTR;
  42.                               count{0}: LONGINT): e.LONGBOOL;
  43.  
  44.   BufferMngData * = STRUCT END;
  45.   BufferTagList * = STRUCT (dummy: BufferMngData)
  46.     tags *: u.Tags2;
  47.   END;
  48.  
  49.   IOSana2Req * = STRUCT (ioReq *: e.IORequest)
  50.     wireError  * : LONGINT;           (* wire type specific error     *)
  51.     packetType * : LONGINT;           (* packet type                  *)
  52.     srcAddr    * : Sana2Address;      (* source address               *)
  53.     dstAddr    * : Sana2Address;      (* dest address                 *)
  54.     dataLength * : LONGINT;           (* from header                  *)
  55.     data       * : s.ADDRESS;         (* packet data                  *)
  56.     statData   * : StatDataPtr;       (* statics data pointer         *)
  57.     bufferMng  * : BufferMngDataPtr;  (* TagList / ProcTable          *)
  58.   END;
  59.  
  60. CONST
  61. (* defines for IOSana2Req.ioReq.flags *)
  62.  
  63.   raw   * = 7;         (* raw packet IO requested      *)
  64.   bcast * = 6;         (* broadcast packet (received)  *)
  65.   mcast * = 5;         (* multicast packet (received)  *)
  66.   quick * = e.quick;   (* quick IO requested (0)       *)
  67.  
  68. (* defines for OpenDevice() *)
  69.  
  70.   mine  * = 0;         (* exclusive access requested   *)
  71.   prom  * = 1;         (* promiscuous mode requested   *)
  72.  
  73. (* defines for OpenDevice() tags *)
  74.  
  75.   dummy        * = u.user + 0B0000H;
  76.   copyToBuff   * = dummy + 1;
  77.   copyFromBuff * = dummy + 2;
  78.  
  79. TYPE
  80.   StatData * = STRUCT END; (* dummy *)
  81.  
  82.   DeviceQuery * = STRUCT (stat: StatData)
  83.     (* standard information *)
  84.     sizeAvailable  * : LONGINT;    (* bytes available              *)
  85.     sizeSupplied   * : LONGINT;    (* bytes supplied               *)
  86.     devQueryFormat * : LONGINT;    (* this is type 0               *)
  87.     deviceLevel    * : LONGINT;    (* this document is level 0     *)
  88.     (* common information *)
  89.     addrFieldSize  * : INTEGER;    (* address size in bits         *)
  90.     mtu            * : LONGINT;    (* maximum packet data size     *)
  91.     bps            * : LONGINT;    (* line rate (bits/sec)         *)
  92.     hardwareType   * : LONGINT;    (* what the wire is             *)
  93.     (* format specific information *)
  94.   END;
  95.  
  96. CONST
  97. (*
  98. ** defined Hardware types
  99. **
  100. **  If your hardware type isn't listed below contact CATS to get a new
  101. **  type number added for your hardware.
  102. *)
  103.  
  104.   ethernet  * = 1;
  105.   ieee802   * = 6;
  106.   arcnet    * = 7;
  107.   localTalk * = 11;
  108.   dyLan     * = 12;
  109.   amokNet   * = 200;
  110.   PPP       * = 253;
  111.   SLIP      * = 254;
  112.   CSLIP     * = 255;
  113.  
  114. TYPE
  115.   PacketTypeStats * = STRUCT (stat: StatData)
  116.     packetsSent     * : LONGINT;  (* transmitted count            *)
  117.     packetsReceived * : LONGINT;  (* received count               *)
  118.     bytesSent       * : LONGINT;  (* bytes transmitted count      *)
  119.     bytesReceived   * : LONGINT;  (* bytes received count         *)
  120.     packetsDropped  * : LONGINT;  (* packets dropped count        *)
  121.   END;
  122.  
  123.   SpecialStatRecord * = STRUCT
  124.     type   * : LONGINT;           (* statistic identifier         *)
  125.     count  * : LONGINT;           (* the statistic                *)
  126.     string * : e.STRPTR;          (* statistic name               *)
  127.   END;
  128.  
  129.   SpecialStatHeader * = STRUCT (stat: StatData)
  130.     recordCountMax      * : LONGINT;  (* room available               *)
  131.     recordCountSupplied * : LONGINT;  (* number supplied              *)
  132.     (* struct Sana2SpecialStatRecord[RecordCountMax]; *)
  133.   END;
  134.  
  135.   DeviceStats * = STRUCT (stat: StatData)
  136.     packetsReceived      * : LONGINT;  (* received count               *)
  137.     packetsSent          * : LONGINT;  (* transmitted count            *)
  138.     badData              * : LONGINT;  (* bad packets received         *)
  139.     overruns             * : LONGINT;  (* hardware miss count          *)
  140.     unused               * : LONGINT;  (* 12-Nov-92 release bugfix     *)
  141.     unknownTypesReceived * : LONGINT;  (* orphan count                 *)
  142.     reconfigurations     * : LONGINT;  (* network reconfigurations     *)
  143.     lastStart            * : t.TimeVal;(* time of last online          *)
  144.   END;
  145.  
  146. CONST
  147. (* device commands *)
  148.   start              * = e.nonstd;
  149.  
  150.   deviceQuery         * = start + 0;
  151.   getStationAddress   * = start + 1;
  152.   configInterface     * = start + 2;
  153.   addMulticastAddress * = start + 5;
  154.   delMulticastAddress * = start + 6;
  155.   multicast           * = start + 7;
  156.   broadcast           * = start + 8;
  157.   trackType           * = start + 9;
  158.   untrackType         * = start + 10;
  159.   getTypeStats        * = start + 11;
  160.   getSpecialStats     * = start + 12;
  161.   getGlobalStats      * = start + 13;
  162.   onEvent             * = start + 14;
  163.   readOrphan          * = start + 15;
  164.   online              * = start + 16;
  165.   offline             * = start + 17;
  166.  
  167.   end                 * = start+18;
  168.  
  169. (* defined errors for IOSana2Req.ioReq.error (see also <exec/errors.h>) *)
  170.  
  171.   noError             * = 0;      (* peachy-keen                  *)
  172.   noResources         * = 1;      (* resource allocation failure  *)
  173.   badArgument         * = 3;      (* garbage somewhere            *)
  174.   badState            * = 4;      (* inappropriate state          *)
  175.   badAddress          * = 5;      (* who?                         *)
  176.   mtuExceeded         * = 6;      (* too much to chew             *)
  177.   notSupported        * = 8;      (* command not supported        *)
  178.   software            * = 9;      (* software error detected      *)
  179.   outOfService        * = 10;     (* driver is OFFLINE            *)
  180. (*
  181. ** From <exec/errors.h>
  182. **
  183. **  openFail    * = -1; (* device/unit failed to open *)
  184. **  aborted     * = -2; (* request terminated early [after AbortIO()] *)
  185. **  noCmd       * = -3; (* command not supported by device *)
  186. **  badLength   * = -4; (* not a valid length (usually IO_LENGTH) *)
  187. **  badAddress  * = -5; (* invalid address (misaligned or bad range) *)
  188. **  unitBusy    * = -6; (* device opens ok, but requested unit is busy *)
  189. **  selfTest    * = -7; (* hardware failed self-test *)
  190. **
  191. *)
  192.  
  193. (* defined errors for S2io_WireError *)
  194.  
  195.   genericError        * = 0;       (* no specific info available   *)
  196.   notConfigured       * = 1;       (* unit not configured          *)
  197.   unitOnline          * = 2;       (* unit is currently online     *)
  198.   unitOffline         * = 3;       (* unit is currently offline    *)
  199.   alreadyTracked      * = 4;       (* protocol already tracked     *)
  200.   notTracked          * = 5;       (* protocol not tracked         *)
  201.   buffError           * = 6;       (* buff mgt func returned error *)
  202.   srcAddress          * = 7;       (* source address problem       *)
  203.   dstAddress          * = 8;       (* destination address problem  *)
  204.   badBroadcast        * = 9;       (* broadcast address problem    *)
  205.   badMulticast        * = 10;      (* multicast address problem    *)
  206.   multicastFull       * = 11;      (* multicast address list full  *)
  207.   badEvent            * = 12;      (* unsupported event class      *)
  208.   badStatData         * = 13;      (* statdata failed sanity check *)
  209.   isConfigured        * = 15;      (* attempt to config twice      *)
  210.   nullPointer         * = 16;      (* null pointer detected        *)
  211.  
  212. (* defined events *)
  213.  
  214.   eventError          * = 0;       (* error catch all              *)
  215.   eventTx             * = 1;       (* transmitter error catch all  *)
  216.   eventRx             * = 2;       (* receiver error catch all     *)
  217.   eventOnline         * = 3;       (* unit is in service           *)
  218.   eventOffline        * = 4;       (* unit is not in service       *)
  219.   eventBuff           * = 5;       (* buff mgt function error      *)
  220.   eventHardware       * = 6;       (* hardware error catch all     *)
  221.   eventSoftware       * = 7;       (* software error catch all     *)
  222.  
  223. (*
  224. ** The SANA-II special statistic identifier is an unsigned 32 number.
  225. ** The upper 16 bits identify the type of network wire type to which
  226. ** the statistic applies and the lower 16 bits identify the particular
  227. ** statistic.
  228. **
  229. ** If you desire to add a new statistic identifier, contacts CATS.
  230. *)
  231.  
  232.   ethernetIDDummy * =  ASH(ethernet,16);
  233.  
  234. (*
  235. ** defined ethernet special statistics
  236. *)
  237.  
  238.   ethernetBadMulticast * =  ethernetIDDummy + 0;
  239. (*
  240. ** This count will record the number of times a received packet tripped
  241. ** the hardware's multicast filtering mechanism but was not actually in
  242. ** the current multicast table.
  243. *)
  244.  
  245.   ethernetRetries      * = ethernetIDDummy +1;
  246. (*
  247. ** This count records the total number of retries which have resulted
  248. ** from transmissions on this board.
  249. *)
  250.  
  251. END Sana2.
  252.  
  253.