2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2006-03-08 00:11:20 +03:00
|
|
|
// $Id: eth.h,v 1.16 2006-03-07 21:11:16 sshwarts Exp $
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2001-04-10 06:20:02 +04:00
|
|
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// MandrakeSoft S.A.
|
|
|
|
// 43, rue d'Aboukir
|
|
|
|
// 75002 Paris - France
|
|
|
|
// http://www.linux-mandrake.com/
|
|
|
|
// http://www.mandrakesoft.com/
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
// Peter Grehan (grehan@iprg.nokia.com) coded all of this
|
|
|
|
// NE2000/ether stuff.
|
|
|
|
|
|
|
|
// eth.h - see eth_null.cc for implementation details
|
|
|
|
|
2004-10-03 23:30:36 +04:00
|
|
|
#ifndef BX_ETH_H
|
|
|
|
#define BX_ETH_H
|
|
|
|
|
2004-10-07 21:38:03 +04:00
|
|
|
#define BX_PACKET_BUFSIZE 2048 // Enough for an ether frame
|
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
typedef void (*eth_rx_handler_t)(void *arg, const void *buf, unsigned len);
|
|
|
|
|
2004-09-18 16:35:13 +04:00
|
|
|
static const Bit8u broadcast_macaddr[6] = {0xff,0xff,0xff,0xff,0xff,0xff};
|
|
|
|
|
2003-04-26 18:48:45 +04:00
|
|
|
int execute_script(char *name, char* arg1);
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
//
|
|
|
|
// The eth_pktmover class is used by ethernet chip emulations
|
|
|
|
// to interface to the outside world. An instance of this
|
|
|
|
// would allow frames to be sent to and received from some
|
|
|
|
// entity. An example would be the packet filter on a Unix
|
|
|
|
// system, an NDIS driver in promisc mode on WinNT, or maybe
|
|
|
|
// a simulated network that talks to another process.
|
|
|
|
//
|
2002-09-02 20:56:24 +04:00
|
|
|
class eth_pktmover_c {
|
2001-04-10 05:04:59 +04:00
|
|
|
public:
|
|
|
|
virtual void sendpkt(void *buf, unsigned io_len) = 0;
|
2006-03-08 00:11:20 +03:00
|
|
|
virtual ~eth_pktmover_c () {}
|
2001-04-10 05:04:59 +04:00
|
|
|
protected:
|
|
|
|
eth_rx_handler_t rxh; // receive callback
|
|
|
|
void *rxarg;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// The eth_locator class is used by pktmover classes to register
|
|
|
|
// their name. Chip emulations use the static 'create' method
|
|
|
|
// to locate and instantiate a pktmover class.
|
|
|
|
//
|
|
|
|
class eth_locator_c {
|
|
|
|
public:
|
|
|
|
static eth_pktmover_c *create(const char *type, const char *netif,
|
|
|
|
const char *macaddr,
|
|
|
|
eth_rx_handler_t rxh,
|
2004-10-07 21:38:03 +04:00
|
|
|
void *rxarg,
|
|
|
|
char *script);
|
2001-04-10 05:04:59 +04:00
|
|
|
protected:
|
|
|
|
eth_locator_c(const char *type);
|
|
|
|
virtual eth_pktmover_c *allocate(const char *netif,
|
|
|
|
const char *macaddr,
|
|
|
|
eth_rx_handler_t rxh,
|
2004-10-07 21:38:03 +04:00
|
|
|
void *rxarg,
|
|
|
|
char *script) = 0;
|
2001-04-10 05:04:59 +04:00
|
|
|
private:
|
|
|
|
static eth_locator_c *all;
|
|
|
|
eth_locator_c *next;
|
|
|
|
const char *type;
|
|
|
|
};
|
|
|
|
|
2004-10-03 23:30:36 +04:00
|
|
|
#endif
|