2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Copyright (c) 1998 Apple Computer, Inc.
32 #ifndef _NETAT_AT_VAR_H_
33 #define _NETAT_AT_VAR_H_
35 #include <sys/appleapiopts.h>
36 #ifdef __APPLE_API_OBSOLETE
37 #include <sys/queue.h>
41 /* at_var.h contains definitions formerly found in: at/at_lap.h & at/elap.h */
43 /* multicast tracking */
44 #define MAX_MCASTS 25 /* #multicast addrs tracked per i/f */
45 #define MCAST_TRACK_ADD 1
46 #define MCAST_TRACK_DELETE 2
47 #define MCAST_TRACK_CHECK 3
49 /* maximum number of I/F's allowed */
50 #define IF_TOTAL_MAX 17 /* max count of any combination of I/F's */
51 /* 17 == (1+(4*4)); 9 and 13 would also be
54 #define FDDI_OR_TOKENRING(i) ((i == IFT_FDDI) || (i == IFT_ISO88025))
55 #define ETHERNET_ADDR_LEN 6
57 typedef struct etalk_addr
{
58 u_char etalk_addr_octet
[ETHERNET_ADDR_LEN
];
60 typedef char if_name_t
[IFNAMESIZ
];
61 typedef struct at_ifname_list
{
62 if_name_t at_if
[IF_TOTAL_MAX
];
65 typedef struct at_if_statstics
{
66 u_long fwdBytes
; /* bytes received & forwarded */
67 u_long fwdPkts
; /* pkts received & forwarded */
68 u_long droppedBytes
; /* bytes received & dropped */
69 u_long droppedPkts
; /* pkts received & dropped */
70 u_long outBytes
; /* bytes sent */
71 u_long outPkts
; /* pkts sent */
72 u_long routes
; /* count of routes in rtmptable */
76 u_int unknown_mblks
; /* number of unknown streams msgs */
77 u_int rcv_bytes
; /* number of data bytes received */
78 u_int rcv_packets
; /* number of packets received */
79 u_int xmit_bytes
; /* number of data bytes xmited */
80 u_int xmit_packets
; /* number of packets xmited */
84 char ifr_name
[IFNAMESIZ
];
85 u_int flags
; /* misc. port flags,
86 (ELAP_CFG_xxx on input
88 struct at_addr node
; /* Our node number. */
89 struct at_addr router
; /* Our router. */
90 u_short netStart
; /* network start range */
91 u_short netEnd
; /* network ending range */
97 at_inet_t addr
; /* net and node are ignored, except in
98 multihoming mode where "addr" is used
99 to specify the interface. */
105 char ifr_name
[IFNAMESIZ
];
106 at_nvestr_t zonename
;
109 typedef struct zone_usage
{
110 int zone_index
; /* index in local_zones */
111 at_nvestr_t zone_name
; /* the zone name & len */
112 int zone_home
; /* used only to set zones in
114 at_ifnames_t zone_iflist
; /* list of interfaces for
116 char usage
[IF_TOTAL_MAX
]; /* I/F usage (set if
125 } at_router_params_t
;
128 typedef struct at_kern_err
{
129 int error
; /* kernel error # (KE_xxx) */
132 char name1
[IFNAMESIZ
];
133 char name2
[IFNAMESIZ
];
136 u_short netr1b
, netr1e
; /* net range 1 begin & end */
137 u_short netr2b
, netr2e
; /* net range 2 begin & end */
141 #define KE_CONF_RANGE 1
142 #define KE_CONF_SEED_RNG 2
143 #define KE_CONF_SEED1 3
144 #define KE_CONF_SEED_NODE 4
145 #define KE_NO_ZONES_FOUND 5
147 #define KE_INVAL_RANGE 7
148 #define KE_SEED_STARTUP 8
150 #define KE_RTMP_OVERFLOW 10
151 #define KE_ZIP_OVERFLOW 11
153 #ifdef KERNEL_PRIVATE
155 * Interface address, AppleTalk version. One of these structures
156 * is allocated for each AppleTalk address on an interface.
158 * The ifaddr structure contains the protocol-independent part
159 * of the structure and is assumed to be first, as it is in
160 * "struct in_ifaddr", defined in bsd/netinet/in_var.h.
162 typedef struct at_ifaddr
{
163 struct ifaddr aa_ifa
;
164 #define aa_ifp aa_ifa.ifa_ifp
165 #define aa_flags aa_ifa.ifa_flags
167 TAILQ_ENTRY(at_ifaddr
) aa_link
; /* tailq macro glue */
169 u_long at_dl_tag
; /* DLIL tag to be used in packet output */
170 u_long aarp_dl_tag
; /* DLIL tag for Appletalk ARP */
172 /* from pat_unit_t */
173 unsigned char mcast
[MAX_MCASTS
];
174 char xaddr
[ETHERNET_ADDR_LEN
];
176 /* from elap_specifics_t */
177 at_elap_stats_t stats
;
179 /* The DDP sets these values: */
180 u_char ifState
; /* State of the interface LAP_* */
181 u_short ifThisCableStart
;
182 u_short ifThisCableEnd
;
183 struct at_addr ifARouter
;
184 u_char ifRouterState
;
185 u_int ifFlags
; /* Flags, see AT_IFF_* */
186 struct sockaddr_at ifNodeAddress
;
187 #define ifThisNode ifNodeAddress.sat_addr
188 /* AppleTalk node ID is ifNodeAddress.sat_addr*/
192 u_char ifGNIScheduled
; /* to keep getnetinfo from being scheduled more than once */
193 at_nvestr_t ifZoneName
;
195 /* Added for routing support */
196 int ifPort
; /* the unique ddp logical port
197 number, also index into
198 at_interfaces[] and ifID_table[] */
199 char ifName
[IFNAMESIZ
];
200 /* added to support LAP_IOC_GET_IFID */
201 u_short ifDefZone
; /* Default Zone index in ZoneTable; used
202 only in routing/multihome modes to be
203 able to answer a ZIP GetNetInfo request */
204 char ifZipNeedQueries
;
205 /* ZIP/RTMP Query flag */
206 char ifRoutingState
; /* Port (as a router) state */
208 ifStatistics
; /* statistics */
209 /* end of elap_if structure */
211 u_short flags
; /* port specific flags */
212 struct etalk_addr ZoneMcastAddr
;
213 /* zone multicast addr */
214 struct etalk_addr cable_multicast_addr
;
215 /* AppleTalk broadcast addr */
217 struct at_addr initial_addr
; /* temporary value used during startup */
218 at_nvestr_t startup_zone
;
219 int startup_error
, /* to get error code back from
220 ZIPwakeup() / AARPwakeup() */
221 startup_inprogress
; /* to decide whether it's the
222 middle of an elap_online operation */
225 #endif /* KERNEL_PRIVATE */
227 #define LAP_OFFLINE 0 /* LAP_OFFLINE MUST be 0 */
229 #define LAP_ONLINE_FOR_ZIP 2
230 #define LAP_ONLINE_ZONELESS 3 /* for non-home router ports */
232 #define NO_ROUTER 1 /* there's no router around */
233 #define ROUTER_WARNING 2 /* there's a router around that */
234 /* we are ignoring, warning has */
235 /* been issued to the user */
236 #define ROUTER_AROUND 3 /* A router is around and we've */
237 /* noted its presence */
238 #define ROUTER_UPDATED 4 /* for mh tracking of routers. Value decremented
239 with rtmp aging timer, a value of 4 allows a
240 minimum of 40 secs to laps before we decide
241 to revert to cable multicasts */
243 /* AppleTalk IOCTLs */
246 #define AIOCSTOPATALK _IOWR('a', 1, int) /* stop AppleTalk */
247 #define AIOCGETIFCFG _IOWR('a', 2, at_if_cfg_t) /* get AT interface cfg */
248 #define AIOCNBPREG _IOWR('a', 3, at_nbp_reg_t) /* NBP register */
249 #define AIOCNBPREMOVE _IOW('a', 4, at_nbp_reg_t) /* NBP remove */
250 #define AIOCGETSTATE _IOR('a', 5, at_state_t) /* get AT global state */
251 #define AIOCSETDEFZONE _IOW('a', 6, at_def_zone_t)
252 /* in single-port, router, and multihome modes, set default zone */
253 #define AIOCSETROUTER _IOW('a', 7, at_router_params_t)
254 #define AIOCGETROUTER _IOR('a', 8, at_router_params_t)
255 #define AIOCSIFADDR _IOW('a', 9, at_if_cfg_t) /* init AT interface */
256 #define AIOCSTARTROUTER _IOR('a',10, at_kern_err_t) /* start AT routing */
257 #define AIOCREGLOCALZN _IOW('a',11, at_nvestr_t)
258 /* in single-port mode, register local zone in kernel table for
259 future use in error checking NBP registration */
260 #define AIOCSETZNUSAGE _IOW('a',12, zone_usage_t)
261 /* in router mode, set up each zone for interfaces being seeded */
262 #define AIOCGETZNUSAGE _IOWR('a',13, zone_usage_t)
263 /* in router and multihome modes, given a zone index, report zone name
264 and interfaces corresponding to that zone */
266 /* values for ifFlags */
267 #define LAP_STATE_MASK 0xf /* low order bits used to report
268 IF state, by AIOCGETIFCFG */
269 #define AT_IFF_DEFAULT 0x40000
270 #define AT_IFF_AURP 0x20000
271 #define RTR_NXNET_PORT 0x10000000 /* Non Extended net port */
272 #define RTR_XNET_PORT 0x20000000 /* Extended net port */
273 #define RTR_SEED_PORT 0x40000000 /* Seed port require config net values*/
275 /* elap_cfg 'flags' defines */
276 #define ELAP_CFG_ZONELESS 0x01 /* true if we shouldn't set a zone
277 (to avoid generating a zip_getnetinfo
279 #define ELAP_CFG_HOME 0x02 /* designate home port (one allowed) */
280 #define ELAP_CFG_SEED 0x08 /* set if it's a seed port */
282 #ifdef KERNEL_PRIVATE
283 extern TAILQ_HEAD(at_ifQueueHd
, at_ifaddr
) at_ifQueueHd
;
285 int at_control(struct socket
*, u_long
, caddr_t
, struct ifnet
*);
286 int ddp_usrreq(struct socket
*, int, struct mbuf
*, struct mbuf
*,
288 int ddp_ctloutput(struct socket
*, struct sockopt
*);
289 void ddp_init(void);;
290 void ddp_slowtimo(void);
291 #endif /* KERNEL_PRIVATE */
294 * Define AppleTalk event subclass and specific AppleTalk events.
297 #define KEV_ATALK_SUBCLASS 5
299 #define KEV_ATALK_ENABLED 1 /* AppleTalk enabled from user space - node/net set and valid */
300 #define KEV_ATALK_DISABLED 2 /* AppleTalk disabled from user space */
301 #define KEV_ATALK_ZONEUPDATED 3 /* Zone for this node set/changed */
302 #define KEV_ATALK_ROUTERUP 4 /* Seed router found with valid cable range */
303 #define KEV_ATALK_ROUTERUP_INVALID 5 /* Seed router found with invalid cable range */
304 #define KEV_ATALK_ROUTERDOWN 6 /* Seed router down */
305 #define KEV_ATALK_ZONELISTCHANGED 7 /* Zone list changed by router */
307 struct kev_atalk_data
{
308 struct net_event_data link_data
;
310 struct at_addr address
;
315 #ifdef KERNEL_PRIVATE
317 void atalk_post_msg(struct ifnet
*ifp
, u_long event_code
, struct at_addr
*address
, at_nvestr_t
*zone
);
318 void aarp_sched_probe(void *);
319 void atalk_lock(void);
320 void atalk_unlock(void);
322 #endif /* KERNEL_PRIVATE */
323 #endif /* __APPLE_API_OBSOLETE */
324 #endif /* _NETAT_AT_VAR_H_ */