1335640Shselasky#ifndef __PKTDRVR_H
2335640Shselasky#define __PKTDRVR_H
3335640Shselasky
4335640Shselasky#define PUBLIC
5335640Shselasky#define LOCAL        static
6335640Shselasky
7335640Shselasky#define RX_BUF_SIZE  ETH_MTU   /* buffer size variables. NB !! */
8335640Shselasky#define TX_BUF_SIZE  ETH_MTU   /* must be same as in pkt_rx*.* */
9335640Shselasky
10335640Shselasky#ifdef __HIGHC__
11335640Shselasky#pragma Off(Align_members)
12335640Shselasky#else
13335640Shselasky#pragma pack(1)
14335640Shselasky#endif
15335640Shselasky
16335640Shselaskytypedef enum  {                /* Packet-driver classes */
17335640Shselasky        PD_ETHER      = 1,
18335640Shselasky        PD_PRONET10   = 2,
19335640Shselasky        PD_IEEE8025   = 3,
20335640Shselasky        PD_OMNINET    = 4,
21335640Shselasky        PD_APPLETALK  = 5,
22335640Shselasky        PD_SLIP       = 6,
23335640Shselasky        PD_STARTLAN   = 7,
24335640Shselasky        PD_ARCNET     = 8,
25335640Shselasky        PD_AX25       = 9,
26335640Shselasky        PD_KISS       = 10,
27335640Shselasky        PD_IEEE8023_2 = 11,
28335640Shselasky        PD_FDDI8022   = 12,
29335640Shselasky        PD_X25        = 13,
30335640Shselasky        PD_LANstar    = 14,
31335640Shselasky        PD_PPP        = 18
32335640Shselasky      } PKT_CLASS;
33335640Shselasky
34335640Shselaskytypedef enum  {             /* Packet-driver receive modes    */
35335640Shselasky        PDRX_OFF    = 1,    /* turn off receiver              */
36335640Shselasky        PDRX_DIRECT,        /* receive only to this interface */
37335640Shselasky        PDRX_BROADCAST,     /* DIRECT + broadcast packets     */
38335640Shselasky        PDRX_MULTICAST1,    /* BROADCAST + limited multicast  */
39335640Shselasky        PDRX_MULTICAST2,    /* BROADCAST + all multicast      */
40335640Shselasky        PDRX_ALL_PACKETS,   /* receive all packets on network */
41335640Shselasky      } PKT_RX_MODE;
42335640Shselasky
43335640Shselaskytypedef struct {
44335640Shselasky        char type[8];
45335640Shselasky        char len;
46335640Shselasky      } PKT_FRAME;
47335640Shselasky
48335640Shselasky
49335640Shselaskytypedef struct {
50335640Shselasky        BYTE  class;        /* = 1 for DEC/Interl/Xerox Ethernet */
51335640Shselasky        BYTE  number;       /* = 0 for single LAN adapter        */
52335640Shselasky        WORD  type;         /* = 13 for 3C523                    */
53335640Shselasky        BYTE  funcs;        /* Basic/Extended/HiPerf functions   */
54335640Shselasky        WORD  intr;         /* user interrupt vector number      */
55335640Shselasky        WORD  handle;       /* Handle associated with session    */
56335640Shselasky        BYTE  name [15];    /* Name of adapter interface,ie.3C523*/
57335640Shselasky        BOOL  quiet;        /* (don't) print errors to stdout    */
58335640Shselasky        const char *error;  /* address of error string           */
59335640Shselasky        BYTE  majVer;       /* Major driver implementation ver.  */
60335640Shselasky        BYTE  minVer;       /* Minor driver implementation ver.  */
61335640Shselasky        BYTE  dummyLen;     /* length of following data          */
62335640Shselasky        WORD  MAClength;    /* HiPerformance data, N/A           */
63335640Shselasky        WORD  MTU;          /* HiPerformance data, N/A           */
64335640Shselasky        WORD  multicast;    /* HiPerformance data, N/A           */
65335640Shselasky        WORD  rcvrBuffers;  /* valid for                         */
66335640Shselasky        WORD  UMTbufs;      /*   High Performance drivers only   */
67335640Shselasky        WORD  postEOIintr;  /*                  Usage ??         */
68335640Shselasky      } PKT_INFO;
69335640Shselasky
70335640Shselasky#define PKT_PARAM_SIZE  14    /* members majVer - postEOIintr */
71335640Shselasky
72335640Shselasky
73335640Shselaskytypedef struct {
74335640Shselasky        DWORD inPackets;          /* # of packets received    */
75335640Shselasky        DWORD outPackets;         /* # of packets transmitted */
76335640Shselasky        DWORD inBytes;            /* # of bytes received      */
77335640Shselasky        DWORD outBytes;           /* # of bytes transmitted   */
78335640Shselasky        DWORD inErrors;           /* # of reception errors    */
79335640Shselasky        DWORD outErrors;          /* # of transmission errors */
80335640Shselasky        DWORD lost;               /* # of packets lost (RX)   */
81335640Shselasky      } PKT_STAT;
82335640Shselasky
83335640Shselasky
84335640Shselaskytypedef struct {
85335640Shselasky        ETHER destin;
86335640Shselasky        ETHER source;
87335640Shselasky        WORD  proto;
88335640Shselasky        BYTE  data [TX_BUF_SIZE];
89335640Shselasky      } TX_ELEMENT;
90335640Shselasky
91335640Shselaskytypedef struct {
92335640Shselasky        WORD  firstCount;         /* # of bytes on 1st         */
93335640Shselasky        WORD  secondCount;        /* and 2nd upcall            */
94335640Shselasky        WORD  handle;             /* instance that upcalled    */
95335640Shselasky        ETHER destin;             /* E-net destination address */
96335640Shselasky        ETHER source;             /* E-net source address      */
97335640Shselasky        WORD  proto;              /* protocol number           */
98335640Shselasky        BYTE  data [RX_BUF_SIZE];
99335640Shselasky      } RX_ELEMENT;
100335640Shselasky
101335640Shselasky
102335640Shselasky#ifdef __HIGHC__
103335640Shselasky#pragma pop(Align_members)
104335640Shselasky#else
105335640Shselasky#pragma pack()
106335640Shselasky#endif
107335640Shselasky
108335640Shselasky
109335640Shselasky/*
110335640Shselasky * Prototypes for publics
111335640Shselasky */
112335640Shselasky
113335640Shselasky#ifdef __cplusplus
114335640Shselaskyextern "C" {
115335640Shselasky#endif
116335640Shselasky
117335640Shselaskyextern PKT_STAT    pktStat;     /* statistics for packets */
118335640Shselaskyextern PKT_INFO    pktInfo;     /* packet-driver information */
119335640Shselasky
120335640Shselaskyextern PKT_RX_MODE receiveMode;
121335640Shselaskyextern ETHER       myAddress, ethBroadcast;
122335640Shselasky
123335640Shselaskyextern BOOL  PktInitDriver (PKT_RX_MODE mode);
124335640Shselaskyextern BOOL  PktExitDriver (void);
125335640Shselasky
126335640Shselaskyextern const char *PktGetErrorStr    (int errNum);
127335640Shselaskyextern const char *PktGetClassName   (WORD class);
128335640Shselaskyextern const char *PktRXmodeStr      (PKT_RX_MODE mode);
129335640Shselaskyextern BOOL        PktSearchDriver   (void);
130335640Shselaskyextern int         PktReceive        (BYTE *buf, int max);
131335640Shselaskyextern BOOL        PktTransmit       (const void *eth, int len);
132335640Shselaskyextern DWORD       PktRxDropped      (void);
133335640Shselaskyextern BOOL        PktReleaseHandle  (WORD handle);
134335640Shselaskyextern BOOL        PktTerminHandle   (WORD handle);
135335640Shselaskyextern BOOL        PktResetInterface (WORD handle);
136335640Shselaskyextern BOOL        PktSetReceiverMode(PKT_RX_MODE  mode);
137335640Shselaskyextern BOOL        PktGetReceiverMode(PKT_RX_MODE *mode);
138335640Shselaskyextern BOOL        PktGetStatistics  (WORD handle);
139335640Shselaskyextern BOOL        PktSessStatistics (WORD handle);
140335640Shselaskyextern BOOL        PktResetStatistics(WORD handle);
141335640Shselaskyextern BOOL        PktGetAddress     (ETHER *addr);
142335640Shselaskyextern BOOL        PktSetAddress     (const ETHER *addr);
143335640Shselaskyextern BOOL        PktGetDriverInfo  (void);
144335640Shselaskyextern BOOL        PktGetDriverParam (void);
145335640Shselaskyextern void        PktQueueBusy      (BOOL busy);
146335640Shselaskyextern WORD        PktBuffersUsed    (void);
147335640Shselasky
148335640Shselasky#ifdef __cplusplus
149335640Shselasky}
150335640Shselasky#endif
151335640Shselasky
152335640Shselasky#endif /* __PKTDRVR_H */
153335640Shselasky
154