home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 534.lha / SANA_II / sana2packetmagic.h < prev    next >
C/C++ Source or Header  |  1991-08-08  |  2KB  |  90 lines

  1. #ifndef SANA2_SANA2PACKETMAGIC_H
  2. #define SANA2_SANA2PACKETMAGIC_H 1
  3. /*
  4. **    $Filename: sana2packetmagic.h $
  5. **    $Release: Developer Information$
  6. **    $Revision: 1.2 $
  7. **    $Date: 91/05/08 $
  8. **
  9. **    Defined types of magic for the Sana2PacketType structure.
  10. **
  11. **    (C) Copyright 1991 Commodore-Amiga Inc.
  12. **        All Rights Reserved
  13. */
  14.  
  15. /*
  16. ** Contributions from:
  17. **    Raymond S. Brand,   rsbx@cbmvax.commodore.com,  (215) 431-9100
  18. **    Martin Hunt,      martin@cbmvax.commodore.com,  (215) 431-9100
  19. **    Perry Kivolowitz,           ASDG Incorporated,  (608) 273-6585
  20. */
  21.  
  22. #ifndef SANA2_SANA2DEVICE_H
  23. #include <sana2/sana2device.h>
  24. #endif    /* !SANA2_SANA2DEVICE_H */
  25.  
  26.  
  27. /*
  28.  * The SANA-II Sana2PacketType structure Magic value is an unsigned 32
  29.  * number. The upper 16 bits identify the type of network wire to which
  30.  * the Magic value applies and the lower 16 bits identify the particular
  31.  * type of magic.
  32.  */
  33.  
  34.  
  35. /*
  36.  * defined types of ethernet magic
  37.  */
  38.  
  39. #define S2MAGIC_ETHERNET_E2    ((((S2WireType_Ethernet)&0xffff)<<16)|0x0000)
  40. /*
  41.  * For ethernet, this is the default case. Mask is ignored, Length is 2,
  42.  * Match points to a UWORD to match against the type field of the packet.
  43.  */
  44.  
  45. #define S2MAGIC_ETHERNET_8023    ((((S2WireType_Ethernet)&0xffff)<<16)|0x0001)
  46. /*
  47.  * The caller is declaring his intent to receive any of the valid 802.3
  48.  * ethernet packet types. The Match and Mask fields are ignored, Length
  49.  * is 0.
  50.  * 
  51.  * SANA-II ethernet driver writers need to support a read queue for 802.3
  52.  * packets separate from packets of any non-802.3 type.
  53.  * 
  54.  * A possible flow through an ethernet driver's read interrupt routine
  55.  * might look like the following:
  56.  * 
  57.  *     ...
  58.  * 
  59.  *     sniff packet type...
  60.  * 
  61.  *     if (NoSpecificReadWaiting())
  62.  *         {
  63.  *         if (IsAn802() && 802ReadWaiting())
  64.  *             {
  65.  *             Return802();
  66.  *             }
  67.  *         else
  68.  *             {
  69.  *             if (OrphanReadWaiting())
  70.  *                 {
  71.  *                 ReturnOrphan();
  72.  *                 }
  73.  *             else
  74.  *                 {
  75.  *                 DropPacket();
  76.  *                 }
  77.  *             }
  78.  *         }
  79.  *     else
  80.  *         {
  81.  *         ReturnSpecificPacket();
  82.  *         }
  83.  * 
  84.  *     ...
  85.  * 
  86.  */
  87.  
  88.  
  89. #endif    /* SANA2_SANA2PACKETMAGIC_H */
  90.