home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / Open Transport 1.3 / Open Transport SDK / Open Tpt Module Developer / Samples / DLPI Template / dlpiuser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-30  |  7.8 KB  |  241 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        dlpiuser.h
  3.  
  4.     Contains:    Header file for the DLPI template.  These are definitions
  5.                 that users need to take advantage of features in the DLPI drivers
  6.                 
  7.                  ** dlpiuser.h 5.3, last change 27 Mar 1996
  8.  
  9.     Copyright:    © 1996 by Mentat Inc. and Apple Computer, Inc., all rights reserved.
  10.  
  11. */
  12.  
  13. #ifndef __DLPIUSER__
  14. #define __DLPIUSER__
  15.  
  16. #ifndef __OPENTRANSPORT__
  17. #include <OpenTransport.h>
  18. #endif
  19.  
  20. /* Flags for various structures. */
  21.  
  22. enum
  23. {
  24.     DL_NORMAL_STATUS    = 0x01,
  25.     DL_ERROR_STATUS        = 0x02,
  26.     DL_TRUNCATED_PACKET    = 0x04,
  27.     DL_VERSION            = 0x00,
  28.     DL_VERSION_BITS        = 0xF0000000
  29. };
  30.  
  31. /*
  32.  * Receive and send error flags, these should not overlap with other
  33.  * flags above.
  34.  */
  35. enum
  36. {
  37.     DL_CRC_ERROR        = 0x10,
  38.     DL_RUNT_ERROR        = 0x20,
  39.     DL_FRAMING_ERROR    = 0x40,
  40.     DL_BAD_802_3_LENGTH    = 0x80,
  41.     DL_ERROR_MASK        = DL_CRC_ERROR | DL_RUNT_ERROR | DL_FRAMING_ERROR | DL_BAD_802_3_LENGTH
  42. };
  43.  
  44. /* Input and output structure for I_OTSetRawMode kOTSetRecvMode ioctl. */
  45. struct dl_recv_control_t {
  46.     unsigned long    dl_primitive;
  47.     unsigned long    dl_flags;
  48.     unsigned long    dl_truncation_length;
  49. };
  50.  
  51. typedef struct dl_recv_control_t dl_recv_control_t;
  52.  
  53. /* Structure returned with every inbound packet after kOTSetRecvMode. */
  54. struct dl_recv_status_t {
  55.     unsigned long    dl_overall_length;
  56.     unsigned long    dl_flags;
  57.     unsigned long    dl_packet_length_before_truncation;
  58.     unsigned long    dl_pad;
  59.     OTTimeStamp        dl_timestamp;
  60. };
  61.  
  62. typedef struct dl_recv_status_t    dl_recv_status_t;
  63.  
  64. /* Input structure for I_OTSetRawMode kOTSendErrorPacket. */
  65. struct dl_send_control_t {
  66.     unsigned long    dl_primitive;
  67.     unsigned long    dl_flags;
  68. };
  69.  
  70. typedef struct dl_send_control_t    dl_send_control_t;
  71.  
  72. /*
  73.  * The statistics data in DL_GET_STATISTICS_ACK messages is structured
  74.  * as follows:
  75.  *
  76.  *    TOptionHeader
  77.  *    dle_interface_status_t
  78.  *    TOptionHeader
  79.  *    dle_ethernet_status_t
  80.  *
  81.  * Anyone reading the statistics should pay attention to the length fields
  82.  * in the TOptionHeader structures.  This will allow the statistics
  83.  * structures to grow in the future.
  84.  */
  85.  
  86. /* Level value for DL_GET_STATISTICS_ACK */
  87. enum
  88. {
  89.     DLPI_XTI_LEVEL        = 12
  90. };
  91.  
  92. /* Option names for DL_GET_STATISTICS_ACK */
  93. enum
  94. {
  95.     DL_INTERFACE_MIB        = 1,
  96.     DL_ETHERNET_MIB            = 2
  97. };
  98.  
  99. /*
  100.  * Interface MIB statistics (RFC 1573).  The receive counters are
  101.  * maintained by the common code in dlpiether.c.  The transmit counters
  102.  * must be maintained by the board-specific code; dlpiether code does
  103.  * not see outbound fast path packets and so it is impossible for the
  104.  * counters to be handled in common code.
  105.  */
  106. struct dle_interface_status_s {
  107.     /* Total number of octets received, including framing bytes. */
  108.     unsigned long    bytes_received;
  109.  
  110.     /* Number of packets, delivered by this sublayer to a higher layer,
  111.      * which were not addressed to a multicast or broadcast address. */
  112.     unsigned long    unicast_frames_received;
  113.  
  114.     /* Total number of octets transmitted, including framing characters. */
  115.     unsigned long    bytes_sent;
  116.  
  117.     /* Total number of packets that higher-level protocols requested
  118.      * be transmitted, and which were not addressed to a multicast
  119.      * or broadcast address, including those that were discarded or
  120.      * not sent. */
  121.     unsigned long    unicast_frames_sent;
  122.  
  123.     /* Number of packets, delivered by this sublayer to a higher layer,
  124.      * which were addressed to a multicast address. */
  125.     unsigned long    multicast_frames_received;
  126.  
  127.     /* Number of packets, delivered by this sublayer to a higher layer,
  128.      * which were addressed to a address. */
  129.     unsigned long    broadcast_frames_received;
  130.  
  131.     /* Number of inbound packets which were chosen to be discarded
  132.      * even though no errors had been detected to prevent their being
  133.      * deliverable to a higher-layer protocol.  The board-specific
  134.      * code should increment this count if it cannot deliver a
  135.      * packet for which dle_inbound_probe returned a valid cookie,
  136.      * for instance, if an mblk could not be allocated. */
  137.     unsigned long    receive_discards;
  138.  
  139.     /* Number of inbound packets that contained errors preventing them
  140.      * from being deliverable to a higher-layer protocol.  This count
  141.      * is created by the dle code from adding together all of Ethernet
  142.      * receive error counts. */
  143.     unsigned long    receive_errors;
  144.  
  145.     /* Number of packets received which were discarded because of an
  146.      * unknown or unsupported protocol. */
  147.     unsigned long    receive_unknown_protos;
  148.  
  149.     /* Total number of packets that higher-level protocols requested
  150.      * be transmitted, and which were addressed to a multicast address. */
  151.     unsigned long    multicast_frames_sent;
  152.  
  153.     /* Total number of packets that higher-level protocols requested
  154.      * be transmitted, and which were addressed to a broadcast address. */
  155.     unsigned long    broadcast_frames_sent;
  156.  
  157.     /* Number of outbound packets which were chosen to be discarded even
  158.      * though no errors had been detected to prevent their being
  159.      * transmitted.  One possible reason could be to free up buffer space.*/
  160.     unsigned long    transmit_discards;
  161.  
  162.     /* Number of outbound packets that could not be transmitted because
  163.      * of errors.  This count is created by the dle code when necessary
  164.      * by adding together all of the Ethernet transmit errors. The
  165.      * common code also adds in packets that could not be sent because
  166.      * they were malformed by the upper-level protocol. */
  167.     unsigned long    transmit_errors;
  168.  
  169.     /* Size of the largest packet which can be sent/received, in octets.
  170.      * Set to 1514 by default; board-specific software may change
  171.      * this after dle_install if a different size is supported. */
  172.     unsigned long    mtu;
  173.  
  174.     /* An estimate of the interface's current bandwidth in bits/second.
  175.      * The common code (dle_install) will set this value to 10Mb/second;
  176.      * if the board supports a higher speed, then internal code should
  177.      * change the value after calling dle_install. */
  178.     unsigned long    speed;
  179. };
  180.  
  181. typedef struct dle_interface_status_s    dle_interface_status_t;
  182.  
  183. /*
  184.  * Ethernet MIB statistics (RFC 1643).  These are maintained by the board-specific
  185.  * software as learned from the underlying hardware.
  186.  */
  187. struct dle_ethernet_status_s {
  188.     /* Identifies the chipset used to realize the interface. */
  189.     unsigned long    ether_chip_set;
  190.  
  191.     /* Frames received that are not an integral number of octets
  192.      * in length and do not pass the FCS check. */
  193.     unsigned long    receive_alignment_errors;
  194.  
  195.     /* Frames received that are an integral number of octets in
  196.      * length but do not pass the FCS check. */
  197.     unsigned long    receive_fcs_errors;
  198.  
  199.     /* Frames received that exceed the maximum permitted frame size. */
  200.     unsigned long    receive_frames_too_long;
  201.  
  202.     /* Frames for which reception fails due to an internal sublayer
  203.      * error.  Only counted here if not counted as any other error. */
  204.     unsigned long    receive_internal_mac_errors;
  205.  
  206.     /* Successfully transmitted frames for which transmission is
  207.      * inhibited by exactly one collision. */
  208.     unsigned long    transmit_single_collision_frames;
  209.  
  210.     /* Successfully transmitted frames for which transmission is
  211.      * inhibited by more than one collision. */
  212.     unsigned long    transmit_multiple_collision_frames;
  213.  
  214.     /* A count of times that the SQE TEST ERROR message is generated
  215.      * by the PLS sublayer. */
  216.     unsigned long    transmit_sqe_test_errors;
  217.  
  218.     /* Frames for which the first transmission attempt is delayed
  219.      * because the medium is busy. */
  220.     unsigned long    transmit_deferred_transmissions;
  221.  
  222.     /* The number of times that a collision is detected later than
  223.      * 512 bit-times into the transmission of a packet. */
  224.     unsigned long    transmit_late_collisions;
  225.  
  226.     /* Frames for which transmission fails due to excessive collisions. */
  227.     unsigned long    transmit_excessive_collisions;
  228.  
  229.     /* Frames for which transmission fails due to an internal sublayer
  230.      * error.  Count should be independent of collision counters. */
  231.     unsigned long    transmit_internal_mac_errors;
  232.  
  233.     /* The number of times that the carrier sense condition was lost
  234.      * or never asserted when attempting to transmit a frame. */
  235.     unsigned long    transmit_carrier_sense_errors;
  236. };
  237.  
  238. typedef struct dle_ethernet_status_s    dle_ethernet_status_t;
  239.  
  240. #endif
  241.