home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / network / src_1218.zip / PKTDRVR.H < prev    next >
C/C++ Source or Header  |  1991-03-28  |  4KB  |  120 lines

  1. #ifndef    _PKTDRVR_H
  2. #define    _PKTDRVR_H
  3.  
  4. #ifndef    _MBUF_H
  5. #include "mbuf.h"
  6. #endif
  7.  
  8. #ifndef    _IFACE_H
  9. #include "iface.h"
  10. #endif
  11.  
  12. #define    PK_MAX    3    /* Add extra interrupt hooks if you increase this */
  13.  
  14. /* Packet driver interface classes */
  15. #define    CL_NONE        0
  16. #define    CL_ETHERNET    1
  17. #define    CL_PRONET_10    2
  18. #define    CL_IEEE8025    3
  19. #define    CL_OMNINET    4
  20. #define    CL_APPLETALK    5
  21. #define    CL_SERIAL_LINE    6
  22. #define    CL_STARLAN    7
  23. #define    CL_ARCNET    8
  24. #define    CL_AX25        9
  25. #define    CL_KISS        10
  26. #define CL_IEEE8023    11
  27. #define CL_FDDI     12
  28. #define CL_INTERNET_X25 13
  29. #define CL_LANSTAR    14
  30. #define CL_SLFP     15
  31. #define    CL_NETROM    16
  32. #define CL_PPP        17
  33. #define NCLASS        18
  34.  
  35. #ifdef    MSDOS
  36.  
  37. /* Packet driver interface types (not a complete list) */
  38. #define    TC500        1
  39. #define    PC2000        10
  40. #define    WD8003        14
  41. #define    PC8250        15
  42. #define    ANYTYPE        0xffff
  43.  
  44. /* Packet driver function call numbers. From Appendix B. */
  45. #define    DRIVER_INFO        1
  46. #define    ACCESS_TYPE        2
  47. #define    RELEASE_TYPE        3
  48. #define    SEND_PKT        4
  49. #define    TERMINATE        5
  50. #define    GET_ADDRESS        6
  51. #define    RESET_INTERFACE        7
  52. #define GET_PARAMETERS        10
  53. #define AS_SEND_PKT        11
  54. #define    SET_RCV_MODE        20
  55. #define    GET_RCV_MODE        21
  56. #define    SET_MULTICAST_LIST    22
  57. #define    GET_MULTICAST_LIST    23
  58. #define    GET_STATISTICS        24
  59. #define SET_ADDRESS        25
  60.  
  61. /* Packet driver error return codes. From Appendix C. */
  62.  
  63. #define    NO_ERROR    0
  64. #define    BAD_HANDLE    1    /* invalid handle number */
  65. #define    NO_CLASS    2    /* no interfaces of specified class found */
  66. #define    NO_TYPE        3    /* no interfaces of specified type found */
  67. #define    NO_NUMBER    4    /* no interfaces of specified number found */
  68. #define    BAD_TYPE    5    /* bad packet type specified */
  69. #define    NO_MULTICAST    6    /* this interface does not support multicast */
  70. #define    CANT_TERMINATE    7    /* this packet driver cannot terminate */
  71. #define    BAD_MODE    8    /* an invalid receiver mode was specified */
  72. #define    NO_SPACE    9    /* operation failed because of insufficient space */
  73. #define    TYPE_INUSE    10    /* the type had previously been accessed, and not released */
  74. #define    BAD_COMMAND    11    /* the command was out of range, or not    implemented */
  75. #define    CANT_SEND    12    /* the packet couldn't be sent (usually    hardware error) */
  76. #define CANT_SET    13    /* hardware address couldn't be changed (> 1 handle open) */
  77. #define BAD_ADDRESS    14    /* hardware address has bad length or format */
  78. #define CANT_RESET    15    /* couldn't reset interface (> 1 handle open) */
  79.  
  80. typedef union {
  81.     struct {
  82.         unsigned char lo;
  83.         unsigned char hi;
  84.     } byte;
  85.     unsigned short word;
  86. } ureg;
  87.  
  88. #define    CARRY_FLAG    0x1
  89.  
  90. struct pktdrvr {
  91.     int class;    /* Interface class (ether/slip/etc) */
  92.     int intno;    /* Interrupt vector */
  93.     short handle1;    /* Driver handle(s) */
  94.     short handle2;
  95.     short handle3;
  96.     struct mbuf *buffer;    /* Currently allocated rx buffer */
  97.     struct mbuf *rcvq;    /* Receive queue */
  98.     struct iface *iface;
  99. };
  100.  
  101. extern struct pktdrvr Pktdrvr[];
  102.  
  103. /* In pktdrvr.c: */
  104. INTERRUPT pkint __ARGS((unsigned short bp, unsigned short di,
  105.      unsigned short si, unsigned short ds, unsigned short es,
  106.      unsigned short dx, unsigned short cx, unsigned short bx,
  107.      unsigned short ax, unsigned short ip, unsigned short cs,
  108.      unsigned short flags, int dev));
  109. int pk_send __ARGS((struct mbuf *bp,struct iface *iface,int32 gateway,
  110.     int prec,int del,int tput,int rel));
  111.  
  112. /* In pkvec.asm: */
  113. INTERRUPT pkvec0 __ARGS((void));
  114. INTERRUPT pkvec1 __ARGS((void));
  115. INTERRUPT pkvec2 __ARGS((void));
  116.  
  117. #endif    /* MSDOS */
  118.  
  119. #endif    /* _PKTDRVR_H */
  120.