1 #ifndef __PKTDRVR_H 2 #define __PKTDRVR_H 3 4 #define PUBLIC 5 #define LOCAL static 6 7 #define RX_BUF_SIZE ETH_MTU /* buffer size variables. NB !! */ 8 #define TX_BUF_SIZE ETH_MTU /* must be same as in pkt_rx*.* */ 9 10 #ifdef __HIGHC__ 11 #pragma Off(Align_members) 12 #else 13 #pragma pack(1) 14 #endif 15 16 typedef enum { /* Packet-driver classes */ 17 PD_ETHER = 1, 18 PD_PRONET10 = 2, 19 PD_IEEE8025 = 3, 20 PD_OMNINET = 4, 21 PD_APPLETALK = 5, 22 PD_SLIP = 6, 23 PD_STARTLAN = 7, 24 PD_ARCNET = 8, 25 PD_AX25 = 9, 26 PD_KISS = 10, 27 PD_IEEE8023_2 = 11, 28 PD_FDDI8022 = 12, 29 PD_X25 = 13, 30 PD_LANstar = 14, 31 PD_PPP = 18 32 } PKT_CLASS; 33 34 typedef enum { /* Packet-driver receive modes */ 35 PDRX_OFF = 1, /* turn off receiver */ 36 PDRX_DIRECT, /* receive only to this interface */ 37 PDRX_BROADCAST, /* DIRECT + broadcast packets */ 38 PDRX_MULTICAST1, /* BROADCAST + limited multicast */ 39 PDRX_MULTICAST2, /* BROADCAST + all multicast */ 40 PDRX_ALL_PACKETS, /* receive all packets on network */ 41 } PKT_RX_MODE; 42 43 typedef struct { 44 char type[8]; 45 char len; 46 } PKT_FRAME; 47 48 49 typedef struct { 50 BYTE class; /* = 1 for DEC/Intel/Xerox Ethernet */ 51 BYTE number; /* = 0 for single LAN adapter */ 52 WORD type; /* = 13 for 3C523 */ 53 BYTE funcs; /* Basic/Extended/HiPerf functions */ 54 WORD intr; /* user interrupt vector number */ 55 WORD handle; /* Handle associated with session */ 56 BYTE name [15]; /* Name of adapter interface,ie.3C523*/ 57 BOOL quiet; /* (don't) print errors to stdout */ 58 const char *error; /* address of error string */ 59 BYTE majVer; /* Major driver implementation ver. */ 60 BYTE minVer; /* Minor driver implementation ver. */ 61 BYTE dummyLen; /* length of following data */ 62 WORD MAClength; /* HiPerformance data, N/A */ 63 WORD MTU; /* HiPerformance data, N/A */ 64 WORD multicast; /* HiPerformance data, N/A */ 65 WORD rcvrBuffers; /* valid for */ 66 WORD UMTbufs; /* High Performance drivers only */ 67 WORD postEOIintr; /* Usage ?? */ 68 } PKT_INFO; 69 70 #define PKT_PARAM_SIZE 14 /* members majVer - postEOIintr */ 71 72 73 typedef struct { 74 DWORD inPackets; /* # of packets received */ 75 DWORD outPackets; /* # of packets transmitted */ 76 DWORD inBytes; /* # of bytes received */ 77 DWORD outBytes; /* # of bytes transmitted */ 78 DWORD inErrors; /* # of reception errors */ 79 DWORD outErrors; /* # of transmission errors */ 80 DWORD lost; /* # of packets lost (RX) */ 81 } PKT_STAT; 82 83 84 typedef struct { 85 ETHER destin; 86 ETHER source; 87 WORD proto; 88 BYTE data [TX_BUF_SIZE]; 89 } TX_ELEMENT; 90 91 typedef struct { 92 WORD firstCount; /* # of bytes on 1st */ 93 WORD secondCount; /* and 2nd upcall */ 94 WORD handle; /* instance that upcalled */ 95 ETHER destin; /* E-net destination address */ 96 ETHER source; /* E-net source address */ 97 WORD proto; /* protocol number */ 98 BYTE data [RX_BUF_SIZE]; 99 } RX_ELEMENT; 100 101 102 #ifdef __HIGHC__ 103 #pragma pop(Align_members) 104 #else 105 #pragma pack() 106 #endif 107 108 109 /* 110 * Prototypes for publics 111 */ 112 113 #ifdef __cplusplus 114 extern "C" { 115 #endif 116 117 extern PKT_STAT pktStat; /* statistics for packets */ 118 extern PKT_INFO pktInfo; /* packet-driver information */ 119 120 extern PKT_RX_MODE receiveMode; 121 extern ETHER myAddress, ethBroadcast; 122 123 extern BOOL PktInitDriver (PKT_RX_MODE mode); 124 extern BOOL PktExitDriver (void); 125 126 extern const char *PktGetErrorStr (int errNum); 127 extern const char *PktGetClassName (WORD class); 128 extern const char *PktRXmodeStr (PKT_RX_MODE mode); 129 extern BOOL PktSearchDriver (void); 130 extern int PktReceive (BYTE *buf, int max); 131 extern BOOL PktTransmit (const void *eth, int len); 132 extern DWORD PktRxDropped (void); 133 extern BOOL PktReleaseHandle (WORD handle); 134 extern BOOL PktTerminHandle (WORD handle); 135 extern BOOL PktResetInterface (WORD handle); 136 extern BOOL PktSetReceiverMode(PKT_RX_MODE mode); 137 extern BOOL PktGetReceiverMode(PKT_RX_MODE *mode); 138 extern BOOL PktGetStatistics (WORD handle); 139 extern BOOL PktSessStatistics (WORD handle); 140 extern BOOL PktResetStatistics(WORD handle); 141 extern BOOL PktGetAddress (ETHER *addr); 142 extern BOOL PktSetAddress (const ETHER *addr); 143 extern BOOL PktGetDriverInfo (void); 144 extern BOOL PktGetDriverParam (void); 145 extern void PktQueueBusy (BOOL busy); 146 extern WORD PktBuffersUsed (void); 147 148 #ifdef __cplusplus 149 } 150 #endif 151 152 #endif /* __PKTDRVR_H */ 153 154