- fixed a bunch of warnings
[bochs-mirror.git] / iodev / eth.h
blobc861a5cb6a0ca087c1a203da191eae405a8222e7
1 /////////////////////////////////////////////////////////////////////////
2 // $Id: eth.h,v 1.19 2008/12/11 18:01:56 vruppert Exp $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2001 MandrakeSoft S.A.
6 //
7 // MandrakeSoft S.A.
8 // 43, rue d'Aboukir
9 // 75002 Paris - France
10 // http://www.linux-mandrake.com/
11 // http://www.mandrakesoft.com/
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2 of the License, or (at your option) any later version.
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 // Peter Grehan (grehan@iprg.nokia.com) coded all of this
28 // NE2000/ether stuff.
30 // eth.h - see eth_null.cc for implementation details
32 #ifndef BX_ETH_H
33 #define BX_ETH_H
35 #define BX_PACKET_BUFSIZE 2048 // Enough for an ether frame
37 typedef void (*eth_rx_handler_t)(void *arg, const void *buf, unsigned len);
39 static const Bit8u broadcast_macaddr[6] = {0xff,0xff,0xff,0xff,0xff,0xff};
41 int execute_script(const char *name, char* arg1);
44 // The eth_pktmover class is used by ethernet chip emulations
45 // to interface to the outside world. An instance of this
46 // would allow frames to be sent to and received from some
47 // entity. An example would be the packet filter on a Unix
48 // system, an NDIS driver in promisc mode on WinNT, or maybe
49 // a simulated network that talks to another process.
51 class eth_pktmover_c {
52 public:
53 virtual void sendpkt(void *buf, unsigned io_len) = 0;
54 virtual ~eth_pktmover_c () {}
55 protected:
56 eth_rx_handler_t rxh; // receive callback
57 void *rxarg;
62 // The eth_locator class is used by pktmover classes to register
63 // their name. Chip emulations use the static 'create' method
64 // to locate and instantiate a pktmover class.
66 class eth_locator_c {
67 public:
68 static eth_pktmover_c *create(const char *type, const char *netif,
69 const char *macaddr,
70 eth_rx_handler_t rxh,
71 void *rxarg,
72 const char *script);
73 protected:
74 eth_locator_c(const char *type);
75 virtual ~eth_locator_c() {}
76 virtual eth_pktmover_c *allocate(const char *netif,
77 const char *macaddr,
78 eth_rx_handler_t rxh,
79 void *rxarg,
80 const char *script) = 0;
81 private:
82 static eth_locator_c *all;
83 eth_locator_c *next;
84 const char *type;
87 #endif