Blame view

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