1 /*
2  * ethernet_darwin.h - Darwin Ethernet support (via TUN/TAP driver)
3  *
4  * Copyright (c) 2007 ARAnyM dev team (see AUTHORS)
5  *
6  * Inspired by Bernie Meyer's UAE-JIT and Gwenole Beauchesne's Basilisk II-JIT
7  *
8  * This file is part of the ARAnyM project which builds a new and powerful
9  * TOS/FreeMiNT compatible virtual machine running on almost any hardware.
10  *
11  * ARAnyM is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * ARAnyM is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with ARAnyM; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  *
25  * Last modified: 2007-08-09 Jens Heitmann
26  *
27  */
28 
29 #ifndef _ETHERNET_DARWIN_H
30 #define _ETHERNET_DARWIN_H
31 
32 #include "ethernet.h"
33 
34 class TunTapEthernetHandler : public ETHERNETDriver::Handler {
35 	int fd;
36 
37 	// the /dev/net/tun driver (TAP)
38 	int tapOpenOld(char *dev);
39 	int tapOpen(char *dev);
40 
41 public:
42 	TunTapEthernetHandler(int eth_idx);
43 	virtual ~TunTapEthernetHandler();
44 
45 	virtual bool open();
46 	virtual void close();
47 	virtual int recv(uint8 *buf, int len);
48 	virtual int send(const uint8 *buf, int len);
49 };
50 
51 #define ETHERNET_HANDLER_CLASSNAME TunTapEthernetHandler
52 
53 #endif // _ETHERNET_DARWIN_H
54 
55