2 * tap - TUN/TAP network driver for AROS
3 * Copyright (c) 2007 Robert Norris. All rights reserved.
4 * Copyright (c) 2010-2011 The AROS Development Team. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the same terms as AROS itself.
11 #define _ETH_DEVICE_H 1
13 #include <aros/debug.h>
14 #include <exec/types.h>
15 #include <exec/libraries.h>
16 #include <exec/semaphores.h>
17 #include <exec/devices.h>
18 #include <exec/interrupts.h>
19 #include <exec/errors.h>
20 #include <exec/lists.h>
21 #include <devices/sana2.h>
22 #include <devices/sana2specialstats.h>
23 #include <devices/newstyle.h>
24 #include <hidd/unixio.h>
26 #include <proto/exec.h>
27 #include <proto/utility.h>
28 #include <aros/libcall.h>
29 #include <aros/symbolsets.h>
31 #define timeval sys_timeval
33 /* avoid conflicts between our __unused define and the ones that might come in
37 #include <sys/ioctl.h>
39 #include <netinet/in.h>
41 #include <linux/if_tun.h>
42 #include <linux/if_ether.h>
49 #include LC_LIBDEFS_FILE
51 /* explicitly prototype rand() so we don't have pull in stdlib.h */
52 extern int rand(void);
54 /* NewStyle device support */
55 #define NEWSTYLE_DEVICE 1
57 #define MAX_ETH_UNITS (32)
59 #define ETH_DEV_NODE "/dev/net/eth"
60 #define ETH_IFACE_FORMAT "eth%ld"
61 #define ETH_TASK_FORMAT "eth%d"
67 struct MsgPort read_pending
;
69 BOOL (*rx
)(APTR
, APTR
, ULONG
);
70 BOOL (*tx
)(APTR
, APTR
, ULONG
);
79 struct Sana2PacketTypeStats stats
;
93 struct Sana2DeviceQuery info
;
97 struct MinList openers
;
99 struct MinList trackers
;
100 struct Sana2DeviceStats stats
;
102 struct MsgPort
*iosyncport
;
108 struct MsgPort
*write_queue
;
110 struct uioInterrupt irq
;
115 struct Device eth_device
;
116 struct eth_unit unit
[MAX_ETH_UNITS
];
117 OOP_AttrBase UnixIOAttrBase
;
121 #undef HiddUnixIOAttrBase
122 #define HiddUnixIOAttrBase LIBBASE->UnixIOAttrBase
125 #define eu_CONFIGURED (1<<0)
126 #define eu_ONLINE (1<<1)
129 extern void eth_handle_request(struct IOSana2Req
*req
);
131 extern void eth_hexdump(unsigned char *buf
, int bufsz
);
133 extern void eth_iotask(struct eth_base
*TAPBase
, struct eth_unit
*unit
);