OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [bsd_tcpip/] [v2_0/] [include/] [net/] [ethernet.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/net/ethernet.h
4
//
5
//==========================================================================
6
//####BSDCOPYRIGHTBEGIN####
7
//
8
// -------------------------------------------
9
//
10
// Portions of this software may have been derived from OpenBSD, 
11
// FreeBSD or other sources, and are covered by the appropriate
12
// copyright disclaimers included herein.
13
//
14
// Portions created by Red Hat are
15
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
16
//
17
// -------------------------------------------
18
//
19
//####BSDCOPYRIGHTEND####
20
//==========================================================================
21
 
22
/*
23
 * Fundamental constants relating to ethernet.
24
 *
25
 * $FreeBSD: src/sys/net/ethernet.h,v 1.12.2.5 2000/07/19 21:43:52 archie Exp $
26
 *
27
 */
28
 
29
#ifndef _NET_ETHERNET_H_
30
#define _NET_ETHERNET_H_
31
 
32
/*
33
 * The number of bytes in an ethernet (MAC) address.
34
 */
35
#define ETHER_ADDR_LEN          6
36
 
37
/*
38
 * The number of bytes in the type field.
39
 */
40
#define ETHER_TYPE_LEN          2
41
 
42
/*
43
 * The number of bytes in the trailing CRC field.
44
 */
45
#define ETHER_CRC_LEN           4
46
 
47
/*
48
 * The length of the combined header.
49
 */
50
#define ETHER_HDR_LEN           (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
51
 
52
/*
53
 * The minimum packet length.
54
 */
55
#define ETHER_MIN_LEN           64
56
 
57
/*
58
 * The maximum packet length.
59
 */
60
#define ETHER_MAX_LEN           1518
61
 
62
/*
63
 * A macro to validate a length with
64
 */
65
#define ETHER_IS_VALID_LEN(foo) \
66
        ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
67
 
68
/*
69
 * Structure of a 10Mb/s Ethernet header.
70
 */
71
struct  ether_header {
72
        u_char  ether_dhost[ETHER_ADDR_LEN];
73
        u_char  ether_shost[ETHER_ADDR_LEN];
74
        u_short ether_type;
75
} __attribute__ ((aligned(1), packed));
76
 
77
/*
78
 * Structure of a 48-bit Ethernet address.
79
 */
80
struct  ether_addr {
81
        u_char octet[ETHER_ADDR_LEN];
82
} __attribute__ ((aligned(1), packed));
83
 
84
#define ETHERTYPE_PUP           0x0200  /* PUP protocol */
85
#define ETHERTYPE_IP            0x0800  /* IP protocol */
86
#define ETHERTYPE_ARP           0x0806  /* Addr. resolution protocol */
87
#define ETHERTYPE_REVARP        0x8035  /* reverse Addr. resolution protocol */
88
#define ETHERTYPE_VLAN          0x8100  /* IEEE 802.1Q VLAN tagging */
89
#define ETHERTYPE_IPV6          0x86dd  /* IPv6 */
90
#define ETHERTYPE_LOOPBACK      0x9000  /* used to test interfaces */
91
/* XXX - add more useful types here */
92
 
93
/*
94
 * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
95
 * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
96
 * by an ETHER type (as given above) and then the (variable-length) header.
97
 */
98
#define ETHERTYPE_TRAIL         0x1000          /* Trailer packet */
99
#define ETHERTYPE_NTRAILER      16
100
 
101
#define ETHERMTU        (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
102
#define ETHERMIN        (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
103
 
104
#ifdef _KERNEL
105
 
106
/*
107
 * For device drivers to specify whether they support BPF or not
108
 */
109
#define ETHER_BPF_UNSUPPORTED   0
110
#define ETHER_BPF_SUPPORTED     1
111
 
112
struct ifnet;
113
struct mbuf;
114
 
115
extern  void (*ng_ether_input_p)(struct ifnet *ifp,
116
                struct mbuf **mp, struct ether_header *eh);
117
extern  void (*ng_ether_input_orphan_p)(struct ifnet *ifp,
118
                struct mbuf *m, struct ether_header *eh);
119
extern  int  (*ng_ether_output_p)(struct ifnet *ifp, struct mbuf **mp);
120
extern  void (*ng_ether_attach_p)(struct ifnet *ifp);
121
extern  void (*ng_ether_detach_p)(struct ifnet *ifp);
122
 
123
#else /* _KERNEL */
124
 
125
#include <sys/param.h>
126
 
127
/*
128
 * Ethernet address conversion/parsing routines.
129
 */
130
__BEGIN_DECLS
131
struct  ether_addr *ether_aton __P((const char *));
132
int     ether_hostton __P((const char *, struct ether_addr *));
133
int     ether_line __P((const char *, struct ether_addr *, char *));
134
char    *ether_ntoa __P((const struct ether_addr *));
135
int     ether_ntohost __P((char *, const struct ether_addr *));
136
__END_DECLS
137
 
138
#endif /* !_KERNEL */
139
 
140
#endif /* !_NET_ETHERNET_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.