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.5 1992/12/08 20:49:15 bir7 Exp $ */ 23 /* $Log: dev.h,v $ 24 * Revision 0.8.4.5 1992/12/08 20:49:15 bir7 25 * Edited ctrl-h's out of log messages. 26 * 27 * Revision 0.8.4.4 1992/12/06 23:29:59 bir7 28 * Converted to using lower half interrupt routine. 29 * 30 * Revision 0.8.4.3 1992/12/05 21:35:53 bir7 31 * Updated dev->init type. 32 * 33 * Revision 0.8.4.2 1992/12/03 19:54:12 bir7 34 * Added paranoid queue checking. 35 * 36 * Revision 0.8.4.1 1992/11/10 00:17:18 bir7 37 * version change only. 38 * 39 * Revision 0.8.3.2 1992/11/10 00:14:47 bir7 40 * Changed malloc to kmalloc and added Id and Log 41 * 42 */ 43
44 #ifndef_TCP_DEV_H 45 #define_TCP_DEV_H 46 /* for future expansion when we will have different priorities. */ 47 #defineDEV_NUMBUFFS 3
48 #defineMAX_ADDR_LEN 6
49 #defineMAX_HEADER 14
50 #defineMAX_ROUTE 16
51
52 structdevice 53 { 54 char *name;
55 unsignedlongrmem_end;
56 unsignedlongrmem_start;
57 unsignedlongmem_end;
58 unsignedlongmem_start;
59 unsignedshortbase_addr;
60 unsignedcharirq;
61 unsignedcharstart:1,
62 tbusy:1,
63 loopback:1,
64 interrupt:1,
65 up:1;
66 structdevice *next;
67 int (*init)(structdevice *dev);
68 unsignedlongtrans_start;
69 structsk_buff *buffs[DEV_NUMBUFFS];
70 structsk_buff *backlog; /* no longer used. */ 71 int (*open)(structdevice *dev);
72 int (*stop)(structdevice *dev);
73 int (*hard_start_xmit) (structsk_buff *skb, structdevice *dev);
74 int (*hard_header) (unsignedchar *buff, structdevice *dev,
75 unsignedshorttype, unsignedlongdaddr,
76 unsignedlongsaddr, unsignedlen);
77 void (*add_arp) (unsignedlongaddr, structsk_buff *skb,
78 structdevice *dev);
79 void (*queue_xmit)(structsk_buff *skb, structdevice *dev, intpri);
80 int (*rebuild_header)(void *eth, structdevice *dev);
81 unsignedshort (*type_trans) (structsk_buff *skb, structdevice *dev);
82 void (*send_packet)(structsk_buff *skb, structdevice *dev);
83 void *private;
84
85 unsignedshorttype;
86 unsignedshorthard_header_len;
87 unsignedshortmtu;
88 unsignedcharbroadcast[MAX_ADDR_LEN];
89 unsignedchardev_addr[MAX_ADDR_LEN];
90 unsignedcharaddr_len;
91 };
92
93 externstructdevice *dev_base;
94
95 structpacket_type 96 { 97 unsignedshorttype; /* This is really NET16(ether_type) other devices 98 will have to translate appropriately. */ 99 unsignedshortcopy:1;
100 int (*func) (structsk_buff *, structdevice *, structpacket_type *);
101 void *data;
102 structpacket_type *next;
103 };
104
105 /* used by dev_rint */ 106 #defineIN_SKBUFF 1
107 #defineDEV_QUEUE_MAGIC 0x17432895
108
109
110 externstructpacket_type *ptype_base;
111 voiddev_queue_xmit (structsk_buff *skb, structdevice *dev, intpri);
112 intdev_rint (unsignedchar *buff, longlen, intflags, structdevice *dev);
113 unsignedlongdev_tint (unsignedchar *buff, structdevice *dev);
114 voiddev_add_pack (structpacket_type *pt);
115 voiddev_remove_pack (structpacket_type *pt);
116 structdevice *get_dev (char *name);
117 voidinet_bh (void *tmp);
118
119
120 #endif