Rev 633 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
633 | giacomo | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * Massimiliano Giorgi <massy@gandalf.sssup.it> |
||
11 | * Luca Abeni <luca@gandalf.sssup.it> |
||
12 | * (see the web pages for full authors list) |
||
13 | * |
||
14 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
15 | * |
||
16 | * http://www.sssup.it |
||
17 | * http://retis.sssup.it |
||
18 | * http://shark.sssup.it |
||
19 | */ |
||
20 | |||
21 | /** |
||
22 | ------------ |
||
23 | CVS : $Id: eth.h,v 1.1 2004-05-11 15:14:48 giacomo Exp $ |
||
24 | |||
25 | File: $File$ |
||
26 | Revision: $Revision: 1.1 $ |
||
27 | Last update: $Date: 2004-05-11 15:14:48 $ |
||
28 | ------------ |
||
29 | |||
30 | **/ |
||
31 | |||
32 | /* |
||
33 | * Copyright (C) 2000 Luca Abeni |
||
34 | * |
||
35 | * This program is free software; you can redistribute it and/or modify |
||
36 | * it under the terms of the GNU General Public License as published by |
||
37 | * the Free Software Foundation; either version 2 of the License, or |
||
38 | * (at your option) any later version. |
||
39 | * |
||
40 | * This program is distributed in the hope that it will be useful, |
||
41 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
42 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
43 | * GNU General Public License for more details. |
||
44 | * |
||
45 | * You should have received a copy of the GNU General Public License |
||
46 | * along with this program; if not, write to the Free Software |
||
47 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
48 | * |
||
49 | */ |
||
50 | |||
51 | /* Project: HARTIK 3.0 Network Library */ |
||
52 | /* Description: Hard Real TIme Kernel for 8086 compatible */ |
||
53 | /* Author: Luca Abeni */ |
||
54 | /* Date: 4/12/1997 */ |
||
55 | |||
56 | /* File: Eth.H */ |
||
57 | /* Revision: 2.0 */ |
||
58 | |||
59 | #ifndef __ETH_H__ |
||
60 | #define __ETH_H__ |
||
61 | |||
62 | #include <ll/ll.h> |
||
63 | #include <endian.h> |
||
64 | |||
65 | #ifdef __cplusplus |
||
66 | extern "C" { |
||
67 | #endif |
||
68 | |||
69 | #define LOOPBACK 2 |
||
70 | |||
71 | #define ETH_MAX_LEN 1528 |
||
72 | #define ETH_ARP_TYPE 0x0806 |
||
73 | #define ETH_IP_TYPE 0x0800 |
||
74 | #define ETH_HRT_TYPE 0x8FFF |
||
75 | #define ETH_MAX_PROTOCOLS 5 |
||
76 | |||
77 | typedef struct eth_addr { |
||
78 | BYTE ad[6]; |
||
79 | } ETH_ADDR; |
||
80 | |||
81 | typedef struct eth_header { |
||
82 | struct eth_addr dest; |
||
83 | struct eth_addr source; |
||
84 | WORD type; |
||
85 | } ETH_HEADER; |
||
86 | |||
87 | typedef struct eth_device { |
||
88 | DWORD BaseAddress; |
||
89 | BYTE IntLine; |
||
90 | struct eth_addr addr; |
||
91 | } ETH_DEVICE; |
||
92 | |||
93 | #define setEthAddr(q,w) memcpy(q.ad,w.ad,sizeof(struct eth_addr)) |
||
94 | |||
95 | /* |
||
96 | --- These functions are declared into endian.h that includes bits/endian.h |
||
97 | that includes ../oslib/libm/machine/endian.h :-( |
||
98 | Maybe the code needs a BIG cleanup... PJ |
||
99 | unsigned short htons(unsigned short host); |
||
100 | unsigned short ntohs(unsigned short net); |
||
101 | */ |
||
102 | |||
103 | void eth_str2Addr(char *add, struct eth_addr *ds); |
||
104 | void eth_printHeader(struct eth_header *p); |
||
105 | void eth_printPkt(char *pkt,int len); |
||
106 | int eth_setProtocol(WORD type, void (*recv)(void *pkt)); |
||
107 | void *eth_setHeader(void *b, struct eth_addr dest, WORD type); |
||
108 | int eth_sendPkt(void *p, int len); |
||
109 | void *eth_getFDB(void *pkt); |
||
110 | int eth_init(int mode, TASK_MODEL *m); |
||
111 | void eth_close(void *a); |
||
112 | void eth_getAddress(struct eth_addr *eth); |
||
113 | |||
114 | #ifdef __cplusplus |
||
115 | }; |
||
116 | #endif |
||
117 | |||
118 | #endif |