1 /* dev.h */ 2 /* 3 Copyright (C) 1992 Ross Biro 4
5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2, or (at your option) 8 any later version. 9
10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14
15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18
19 The Author may be reached as bir7@leland.stanford.edu or 20 C/O Department of Mathematics; Stanford University; Stanford, CA 94305 21 */ 22 /* $Id: dev.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */ 23 /* $Log: dev.h,v $ 24 * Revision 0.8.4.1 1992/11/10 00:17:18 bir7 25 * version change only. 26 * 27 * Revision 0.8.3.2 1992/11/10 00:14:47 bir7 28 * Changed malloc to kmalloc and added $iId$ and $Log: dev.h,v $ 29 * Revision 0.8.4.1 1992/11/10 00:17:18 bir7 30 * version change only. 31 *. 32 * */ 33
34 #ifndef_TCP_DEV_H 35 #define_TCP_DEV_H 36 /* for future expansion when we will have different priorities. */ 37 #defineDEV_NUMBUFFS 3
38 #defineMAX_ADDR_LEN 6
39 #defineMAX_HEADER 14
40 #defineMAX_ROUTE 16
41
42 structdevice 43 { 44 char *name;
45 unsignedlongrmem_end;
46 unsignedlongrmem_start;
47 unsignedlongmem_end;
48 unsignedlongmem_start;
49 unsignedshortbase_addr;
50 unsignedcharirq;
51 unsignedcharstart:1,
52 tbusy:1,
53 loopback:1,
54 interrupt:1,
55 up:1;
56 structdevice *next;
57 void (*init)(structdevice *dev);
58 unsignedlongtrans_start;
59 structsk_buff *buffs[DEV_NUMBUFFS];
60 structsk_buff *backlog;
61 int (*open)(structdevice *dev);
62 int (*stop)(structdevice *dev);
63 int (*hard_start_xmit) (structsk_buff *skb, structdevice *dev);
64 int (*hard_header) (unsignedchar *buff, structdevice *dev,
65 unsignedshorttype, unsignedlongdaddr,
66 unsignedlongsaddr, unsignedlen);
67 void (*add_arp) (unsignedlongaddr, structsk_buff *skb,
68 structdevice *dev);
69 void (*queue_xmit)(structsk_buff *skb, structdevice *dev, intpri);
70 int (*rebuild_header)(void *eth, structdevice *dev);
71 unsignedshort (*type_trans) (structsk_buff *skb, structdevice *dev);
72 void (*send_packet)(structsk_buff *skb, structdevice *dev);
73 void *private;
74
75 unsignedshorttype;
76 unsignedshorthard_header_len;
77 unsignedshortmtu;
78 unsignedcharbroadcast[MAX_ADDR_LEN];
79 unsignedchardev_addr[MAX_ADDR_LEN];
80 unsignedcharaddr_len;
81 };
82
83 externstructdevice *dev_base;
84
85 structpacket_type 86 { 87 unsignedshorttype; /* This is really NET16(ether_type) other devices 88 will have to translate appropriately. */ 89 unsignedshortcopy:1;
90 int (*func) (structsk_buff *, structdevice *, structpacket_type *);
91 void *data;
92 structpacket_type *next;
93 };
94
95 /* used by dev_rint */ 96 #defineIN_SKBUFF 1
97
98 externstructpacket_type *ptype_base;
99 voiddev_queue_xmit (structsk_buff *skb, structdevice *dev, intpri);
100 intdev_rint (unsignedchar *buff, unsignedlonglen, intflags,
101 structdevice *dev);
102 unsignedlongdev_tint (unsignedchar *buff, structdevice *dev);
103 voiddev_add_pack (structpacket_type *pt);
104 voiddev_remove_pack (structpacket_type *pt);
105 structdevice *get_dev (char *name);
106
107
108 #endif