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/] [iso88025.h] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/net/iso88025.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
 * Copyright (c) 1998, Larry Lile
24
 * All rights reserved.
25
 *
26
 * For latest sources and information on this driver, please
27
 * go to http://anarchy.stdio.com.
28
 *
29
 * Questions, comments or suggestions should be directed to
30
 * Larry Lile <lile@stdio.com>.
31
 *
32
 * Redistribution and use in source and binary forms, with or without
33
 * modification, are permitted provided that the following conditions
34
 * are met:
35
 * 1. Redistributions of source code must retain the above copyright
36
 *    notice unmodified, this list of conditions, and the following
37
 *    disclaimer.
38
 * 2. Redistributions in binary form must reproduce the above copyright
39
 *    notice, this list of conditions and the following disclaimer in the
40
 *    documentation and/or other materials provided with the distribution.
41
 *
42
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
43
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
46
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
48
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
50
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
51
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52
 * SUCH DAMAGE.
53
 *
54
 * $FreeBSD: src/sys/net/iso88025.h,v 1.3.2.1 2000/10/14 20:01:06 lile Exp $
55
 *
56
 * Information gathered from tokenring@freebsd, /sys/net/ethernet.h and
57
 * the Mach token ring driver.
58
 */
59
 
60
/*
61
 * Fundamental constants relating to iso 802.5
62
 */
63
 
64
#ifndef _NET_ISO88025_H_
65
#define _NET_ISO88025_H_
66
 
67
/*
68
 * General ISO 802.5 definitions
69
 */
70
#define ISO88025_ADDR_LEN       6
71
#define ISO88025_HDR_LEN        (ISO88025_CF_LEN + (ISO88025_ADDR_LEN * 2))
72
#define ISO88025_CF_LEN         2
73
#define RCF_LEN                 2
74
#define RIF_MAX_RD              14
75
#define RIF_MAX_LEN             16
76
 
77
#define TR_AC                   0x10
78
#define TR_LLC_FRAME            0x40
79
 
80
#define TR_4MBPS                4000000
81
#define TR_16MBPS               16000000
82
#define TR_100MBPS              100000000
83
 
84
/*
85
 * Source routing
86
 */
87
#define TR_RII                  0x80
88
#define TR_RCF_BCST_MASK        0xe000
89
#define TR_RCF_LEN_MASK         0x1f00
90
#define TR_RCF_DIR              0x0080
91
#define TR_RCF_LF_MASK          0x0070
92
 
93
#define TR_RCF_RIFLEN(x)        ((ntohs(x) & TR_RCF_LEN_MASK) >> 8)
94
 
95
/*
96
 * Minimum and maximum packet payload lengths.
97
 */
98
#define ISO88025_MIN_LEN        0 
99
#define ISO88025_MAX_LEN        17960   
100
 
101
/*
102
 * A macro to validate a length with
103
 */
104
#define ISO88025_IS_VALID_LEN(foo)      \
105
        ((foo) >= ISO88025_MIN_LEN && (foo) <= ISO88025_MAX_LEN)
106
 
107
/*
108
 * ISO 802.5 physical header
109
 */
110
struct iso88025_header {
111
        u_char  ac;                                 /* access control field */
112
        u_char  fc;                                 /* frame control field */
113
        u_char  iso88025_dhost[ISO88025_ADDR_LEN];  /* destination address */
114
        u_char  iso88025_shost[ISO88025_ADDR_LEN];  /* source address */
115
        u_short rcf;                                /* route control field */
116
        u_short rd[RIF_MAX_RD];                     /* routing designators */
117
};
118
 
119
struct iso88025_sockaddr_data {
120
        u_char ether_dhost[ISO88025_ADDR_LEN];
121
        u_char ether_shost[ISO88025_ADDR_LEN];
122
        u_char ac;
123
        u_char fc;
124
};
125
 
126
/*
127
 * Structure of a 48-bit iso 802.5 address.
128
 *  ( We could also add the 16 bit addresses as a union)
129
 */
130
struct  iso88025_addr {
131
        u_char octet[ISO88025_ADDR_LEN];
132
};
133
 
134
#define ISO88025_MAX_MTU        18000
135
#define ISO88025_DEFAULT_MTU    1500
136
#define senderr(e) { error = (e); goto bad;}
137
 
138
void    iso88025_ifattach __P((struct ifnet *));
139
int     iso88025_ioctl __P((struct ifnet *, int , caddr_t ));
140
int     iso88025_output __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *));
141
void    iso88025_input __P((struct ifnet *, struct iso88025_header *, struct mbuf *));
142
 
143
#endif

powered by: WebSVN 2.1.0

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