Subversion Repositories shark

Rev

Rev 629 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
629 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_priv.h,v 1.4 2004-05-11 14:30:49 giacomo Exp $
24
 
25
 File:        $File$
26
 Revision:    $Revision: 1.4 $
27
 Last update: $Date: 2004-05-11 14:30:49 $
28
 ------------
29
**/
30
 
31
/*
32
 * Copyright (C) 2000 Luca Abeni
33
 *
34
 * This program is free software; you can redistribute it and/or modify
35
 * it under the terms of the GNU General Public License as published by
36
 * the Free Software Foundation; either version 2 of the License, or
37
 * (at your option) any later version.
38
 *
39
 * This program is distributed in the hope that it will be useful,
40
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
42
 * GNU General Public License for more details.
43
 *
44
 * You should have received a copy of the GNU General Public License
45
 * along with this program; if not, write to the Free Software
46
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
47
 *
48
 */
49
 
50
 
51
/* Author:      Luca Abeni                                      */
52
/* Date:        4/12/1997                                       */
53
 
54
/* File:        Eth.H                                           */
55
/* Revision:    2.0                                             */
56
 
57
#ifndef __ETH_H__
58
#define __ETH_H__
59
 
60
#include "ll/sys/cdefs.h"
61
 
62
__BEGIN_DECLS
63
 
64
#define LOOPBACK 2
65
 
66
#define ETH_MAX_LEN     1528
67
#define ETH_ARP_TYPE    0x0806
68
#define ETH_IP_TYPE     0x0800
69
#define ETH_HRT_TYPE    0x8FFF
70
#define ETH_MAX_PROTOCOLS       5
71
 
72
typedef struct eth_addr {
73
        BYTE ad[6];
74
} ETH_ADDR;
75
 
76
typedef struct eth_header {
77
        struct eth_addr dest;
78
        struct eth_addr source;
79
        WORD type;
80
} ETH_HEADER;
81
 
82
typedef struct eth_device {
83
        DWORD BaseAddress;
84
        BYTE IntLine;
85
        struct eth_addr addr;
86
} ETH_DEVICE;
87
 
88
#define setEthAddr(q,w) memcpy(q.ad,w.ad,sizeof(struct eth_addr))
89
 
90
#define ETH_ERROR_BASE          150
91
#define ETH_DRIVER_NOT_FOUND    (ETH_ERROR_BASE+0)
92
#define ETH_RXERROR             (ETH_ERROR_BASE+1)
93
#define ETH_DRIVER_RELEASE      (ETH_ERROR_BASE+2)
94
#define ETH_DRIVER_ADDRESS      (ETH_ERROR_BASE+3)
95
#define ETH_TXERROR             (ETH_ERROR_BASE+4)
96
#define ETH_PROTOCOL_ERROR      (ETH_ERROR_BASE+5)
97
#define ETH_BUFFERS_FULL        (ETH_ERROR_BASE+6)
98
#define ETH_NULLPROTOCOL_EXC    (ETH_ERROR_BASE+7)
99
 
100
/*unsigned short htons(unsigned short host);
101
unsigned short ntohs(unsigned short net);*/
102
void eth_str2Addr(char *add, struct eth_addr *ds);
103
void eth_printHeader(struct eth_header *p);
104
void eth_printPkt(char *pkt,int len);
105
int eth_setProtocol(WORD type, void (*recv)(void *pkt));
106
void *eth_setHeader(void *b, struct eth_addr dest, WORD type);
107
int eth_sendPkt(void *p, int len);
108
void *eth_getFDB(void *pkt);
109
int eth_init(int mode, TASK_MODEL *m);
110
void eth_close(void *a);
111
void eth_getAddress(struct eth_addr *eth);
112
 
113
 
114
__END_DECLS
115
#endif