revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-unix / devs / networks / eth / eth.h
blob6fe5b8e475ac39d4d40a35fbbd2742f18db074e5
1 /*
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.
8 */
10 #ifndef _ETH_DEVICE_H
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>
25 #include <oop/oop.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
34 via fcntl.h */
35 #undef __unused
36 #include <fcntl.h>
37 #include <sys/ioctl.h>
39 #include <netinet/in.h>
40 #include <linux/if.h>
41 #include <linux/if_tun.h>
42 #include <linux/if_ether.h>
44 #include <poll.h>
45 #include <stdio.h>
47 #undef timeval
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"
64 struct eth_opener {
65 struct MinNode node;
67 struct MsgPort read_pending;
69 BOOL (*rx)(APTR, APTR, ULONG);
70 BOOL (*tx)(APTR, APTR, ULONG);
72 struct Hook *filter;
75 struct eth_tracker {
76 struct MinNode node;
77 ULONG refcount;
78 ULONG packet_type;
79 struct Sana2PacketTypeStats stats;
82 struct eth_unit
84 ULONG num;
85 ULONG refcount;
87 APTR pd;
88 int fd;
90 char name[IFNAMSIZ];
91 UBYTE hwaddr[6];
93 struct Sana2DeviceQuery info;
95 ULONG flags;
97 struct MinList openers;
99 struct MinList trackers;
100 struct Sana2DeviceStats stats;
102 struct MsgPort *iosyncport;
103 struct Task *iotask;
105 LONG abort_signal;
106 LONG io_signal;
108 struct MsgPort *write_queue;
110 struct uioInterrupt irq;
113 struct eth_base
115 struct Device eth_device;
116 struct eth_unit unit[MAX_ETH_UNITS];
117 OOP_AttrBase UnixIOAttrBase;
118 OOP_Object *unixio;
121 #undef HiddUnixIOAttrBase
122 #define HiddUnixIOAttrBase LIBBASE->UnixIOAttrBase
124 /* unit flags */
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);
135 #endif