|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: *
27: *
28: * ORIGINS: 82
29: *
30: * APPLE CONFIDENTIAL
31: * (C) COPYRIGHT Apple Computer, Inc. 1992-1996
32: * All Rights Reserved
33: *
34: */
35:
36: /* The at_if structure identifies a LAP interface to DDP. These structs
37: * are stored in a doubly-linked list. When DDP needs to send a packet,
38: * it traverses this list for the interface to send the packet on.
39: * For an end-node this will usually be the first and only interface.
40: * If we're a router and the destination network is non-zero, DDP
41: * calls the internet router routine instead of traversing its list.
42: *
43: * Feb-June 1994: Modified for Router support
44: */
45: #ifndef __AT_LAP__
46: #define __AT_LAP__
47: #include <at/nbp.h>
48:
49: typedef struct at_if_statstics {
50: u_long fwdBytes; /* bytes received & forwarded */
51: u_long fwdPkts; /* pkts received & forwarded */
52: u_long droppedBytes; /* bytes received & dropped */
53: u_long droppedPkts; /* pkts received & dropped */
54: u_long outBytes; /* bytes sent */
55: u_long outPkts; /* pkts sent */
56: u_long routes; /* count of routes in rtmptable */
57: } at_if_statistics_t;
58:
59: typedef char if_name_t[IF_NAME_LEN];
60:
61:
62: typedef struct at_if {
63: /* The DDP sets these values: */
64: struct at_if *FwdLink;
65: struct at_if *BwdLink;
66:
67: u_char ifState; /* State of the interface;
68: * See values below
69: */
70: u_char ifUnit;
71:
72: at_net_al ifThisCableStart;
73: at_net_al ifThisCableEnd;
74:
75: /* Note: these are legacy fields used only in user mode */
76:
77: struct atalk_addr ifARouter;
78: u_char ifRouterState;
79: u_long ifARouterTimer;
80:
81: char *ddpInputQueue; /* Input queue for DDP,
82: * used by lap
83: */
84: /* The LAP layer sets these values before calling
85: * at_ddp_add_if():
86: */
87:
88: void *tmo_1;
89: void *tmo_2;
90: void *tmo_3;
91: void *tmo_4;
92: int ifFlags; /* Flags, see AT_IFF_* */
93: struct atalk_addr ifThisNode; /* AppleTalk node ID */
94:
95: /* for use by ZIP */
96:
97: u_char ifNumRetries;
98: at_nvestr_t ifZoneName;
99: int ifZipError;
100:
101: /* Added for routing support */
102:
103: void *ifLapp; /* parent lapp struct. Cast to
104: correct type ( elap_specifics_t etc.) */
105: int ifPort; /* the unique ddp logical port number */
106: if_name_t ifName; /* added to support LAP_IOC_GET_IFID */
107: char ifType;
108:
109: u_short ifDefZone; /* Default Zone index in ZoneTable*/
110: char ifZipNeedQueries; /* ZIP/RTMP Query flag */
111: char ifRoutingState; /* Port (as a router) state */
112: at_if_statistics_t ifStatistics; /* statistics */
113: } at_if_t;
114:
115:
116: typedef union at_if_name {
117: at_if_t ifID;
118: if_name_t if_name;
119: }at_if_name_t;
120:
121:
122: /* for ifType above */
123: #define IFTYPE_ETHERTALK 1
124: #define IFTYPE_TOKENTALK 2
125: #define IFTYPE_FDDITALK 3
126: #define IFTYPE_NULLTALK 4
127: #define IFTYPE_LOCALTALK 5
128: #define IFTYPE_OTHERTALK 9
129:
130: /* for ifRouterState field above */
131: #define NO_ROUTER 1 /* there's no router around */
132: #define ROUTER_WARNING 2 /* there's a router around that */
133: /* we are ignoring, warning has */
134: /* been issued to the user */
135: #define ROUTER_AROUND 3 /* A router is around and we've */
136: /* noted its presence */
137:
138: #define ROUTER_UPDATED 4 /* for mh tracking of routers. Value decremented
139: with rtmp aging timer, a value of 4 allows a
140: minimum of 40 secs to laps before we decide
141: to revert to cable multicasts */
142:
143: /* for ifState above */
144: #define LAP_OFFLINE 0 /* LAP_OFFLINE MUST be 0 */
145: #define LAP_ONLINE 1
146: #define LAP_ONLINE_FOR_ZIP 2
147: #define LAP_HANGING_UP 3
148: #define LAP_ONLINE_ZONELESS 4 /* for non-home router ports */
149:
150: /* addr lengths */
151: #define ETHERNET_ADDR_LEN 6
152:
153: /* macros */
154: #define IF_NO(c) (atoi(&c[2])) /* return i/f number from h/w name
155: (e.g. 'et2' returns 2) */
156:
157: /* returns elap_specfics_t ptr from ifID pointer */
158: #define IFID2ELAP(ifid) ((elap_specifics_t *)((ifid)->ifLapp))
159: /* returns ptr to if_name from elap_specifics_t ptr */
160: #define ELAPP2IFNAME(elapp) (elapp->cfg.if_name)
161: /* returns ptr to if_name from ifID ptr */
162: #define IFID2IFNAME(ifid) (ELAPP2IFNAME(IFID2ELAP(ifid)))
163:
164: /* returns ddp port # from elap unit # */
165: #define ELAP_UNIT2PORT(n) elap_specifics[(n)].elap_if.ifPort
166:
167: /* returns cable range end from
168: elap unit # */
169: #define ELAP_UNIT2NETSTOP(n) \
170: elap_specifics[(n)].elap_if.ifThisCableEnd
171:
172: /* sanity check for ifID validity. Evaluates
173: to TRUE if ifID is OK */
174: #define IFID_VALID(ifID) \
175: (&((elap_specifics_t *)ifID->ifLapp)->elap_if == ifID)
176:
177: #endif /* __AT_LAP__ */
178:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.