|
|
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: * Copyright (c) 1988, 1989 Apple Computer, Inc.
27: *
28: * The information contained herein is subject to change without
29: * notice and should not be construed as a commitment by Apple
30: * Computer, Inc. Apple Computer, Inc. assumes no responsibility
31: * for any errors that may appear.
32: *
33: * Confidential and Proprietary to Apple Computer, Inc.
34: */
35:
36: /* @(#)lap.h: 2.0, 1.4; 2/16/90; Copyright 1988-89, Apple Computer, Inc. */
37:
38: /* Definitions for generic access to AppleTalk link level protocols.
39: */
40:
41: #ifndef __LAP__
42: #define __LAP__
43: #include <h/if_cnt.h>
44: #include <at/nbp.h>
45:
46:
47:
48:
49: /* struture containing general information regarding the state of
50: * the Appletalk networking
51: */
52: typedef struct at_state {
53: unsigned int flags; /* various init flags (INIT_FL_XXX */
54: int pats_online; /* count of pat's that are online */
55: int ifs_online; /* count of all i/fs that are online */
56: int home_port; /* the ddp logical port, or -1 if not set */
57: } at_state_t;
58:
59: /* at_state_t 'flags' defines */
60: #define AT_ST_PAT_INIT 0x0001 /* pat init done */
61: #define AT_ST_DDP_INIT 0x0002 /* ddp initialized */
62: #define AT_ST_ELAP_INIT 0x0004 /* elap initialized */
63: #define AT_ST_MULTIHOME 0x0080 /* set if multihome mode */
64: #define AT_ST_ROUTER 0x0100 /* set if we are a router */
65: #define AT_ST_IF_CHANGED 0x0200 /* set when state of any I/F
66: changes (for SNMP) */
67: #define AT_ST_RT_CHANGED 0x0400 /* route table changed (for SNMP)*/
68: #define AT_ST_ZT_CHANGED 0x0800 /* zone table changed (for SNMP) */
69: #define AT_ST_NBP_CHANGED 0x1000 /* if nbp table changed (for SNMP)*/
70:
71:
72: /* mode defines */
73: #define AT_MODE_SPORT 1 /* single port */
74: #define AT_MODE_MHOME 2 /* multi-homing */
75: #define AT_MODE_ROUTER 3 /* router */
76:
77: /* GET_ZONES defines */
78: #define GET_ALL_ZONES 0
79: #define GET_LOCAL_ZONES_ONLY 1
80:
81: struct atalk_options { /* for appletalk command */
82: int router; /* if true, tells lap_init we're a router */
83: int t_option; /* for development, test cfg w/o stack loaded */
84: int start; /* cable start */
85: int end; /* cable end */
86: char *f_option; /* optional alternate router.cfg file */
87: short c_option; /* if true, just check config file */
88: short e_option; /* display configuration only */
89: short r_table; /* optional RTMP table size param */
90: short z_table; /* optional ZIP table size param */
91: short h_option; /* multihoming mode of router */
92: short q_option; /* run quiet, don't ask for zones */
93: };
94:
95: /* I/F status structure, returned from kernel to indicate status of stack
96: the each element of the avail and stat arrays is assigned to one I/F type
97: as defined above. For each type there is one bit assigned to each physical
98: I/F with the lsb equal to if0 (e.g. et0) through the msb equal to if32 .
99: If a bit is set in the avail element, then that I/F exists in the system.
100: the state element contains the at_if_t.ifState value
101: To indicate the home port there are 2 elements, home_type (same as above
102: defines) and the home_number (the n in etn).
103: */
104: typedef struct if_cfg {
105: unsigned avail[IF_TYPENO_CNT];
106: char state[IF_TYPENO_CNT][IF_ANY_MAX];
107: unsigned max[IF_TYPENO_CNT];
108: unsigned home_type; /* type of home interface */
109: unsigned home_number;
110: unsigned ver_major; /* major & minor version no's (m.n) */
111: unsigned ver_minor;
112: unsigned ver_date; /* version date (YYMMDD) */
113: char comp_date[50]; /* compile date & time string */
114: } if_cfg_t;
115:
116: typedef struct if_zone_info {
117: at_nvestr_t zone_name; /* the zone name & len */
118: unsigned zone_ifs[IF_TYPENO_CNT]; /* bitmapped I/F usage for zone */
119: unsigned zone_home; /* TRUE for home zone */
120: } if_zone_info_t;
121:
122: typedef union if_zone_nve {
123: at_nvestr_t ifnve;
124: int zone;
125: } if_zone_nve_t;
126:
127: /* this struct used to obtain local zones for specific
128: ifID's from the kernel and to set default zones for
129: specific ifID numbers */
130: typedef struct if_zone {
131: if_zone_nve_t ifzn;
132: char usage[IF_TOTAL_MAX]; /* I/F usage (1 set if
133: I/F in this zone */
134: int index; /* zone index in ZT_table */
135: } if_zone_t;
136:
137: /* struct for multihoming config info read from file */
138: typedef struct mh_cfg {
139: char ifName[IF_NAME_LEN];/* interface name (e.g.et0) */
140: at_nvestr_t zone; /* default zone */
141: } mh_cfg_t;
142:
143: #define IFID_HOME 0 /* home port in ifID_table */
144:
145:
146:
147: #define ATALK_VALUE(a) ((*(u_long *) &(a))&0x00ffffff)
148:
149: #define ATALK_EQUAL(a, b) (ATALK_VALUE(a) == ATALK_VALUE(b))
150:
151: #define ATALK_ASSIGN(a, net, node, unused ) \
152: a.atalk_unused = unused; a.atalk_node = node; NET_ASSIGN(a.atalk_net, net)
153:
154: #define NO_IFS 4
155:
156: #define AT_IFF_IFMASK 0xffff /* lower 16 bits define interface type*/
157: #define AT_IFF_LOCALTALK 0x1 /* This is a LocalTalk interface */
158: #define AT_IFF_ETHERTALK 0x2 /* This is an EtherTalk interface */
159: #define AT_IFF_DEFAULT 0x40000
160: #define AT_IFF_AURP 0x20000
161:
162: /* Generic LAP ioctl's. Each LAP may implement other ioctl's specific to
163: * its functionality.
164: */
165: #define LAP_IOC_MYIOCTL(i) ((i>>8) == AT_MID_LAP)
166: #define LAP_IOC_ONLINE ((AT_MID_LAP<<8) | 1)
167: #define LAP_IOC_OFFLINE ((AT_MID_LAP<<8) | 2)
168: #define LAP_IOC_GET_IFS_STAT ((AT_MID_LAP<<8) | 3)
169: #define LAP_IOC_ADD_ZONE ((AT_MID_LAP<<8) | 4)
170: #define LAP_IOC_ROUTER_START ((AT_MID_LAP<<8) | 5)
171: #define LAP_IOC_ROUTER_SHUTDOWN ((AT_MID_LAP<<8) | 6)
172: #define LAP_IOC_ROUTER_INIT ((AT_MID_LAP<<8) | 7)
173: #define LAP_IOC_GET_IFID ((AT_MID_LAP<<8) | 8)
174: #define LAP_IOC_ADD_ROUTE ((AT_MID_LAP<<8) | 9)
175: #define LAP_IOC_GET_DBG ((AT_MID_LAP<<8) | 10)
176: #define LAP_IOC_SET_DBG ((AT_MID_LAP<<8) | 11)
177: #define LAP_IOC_GET_ZONE ((AT_MID_LAP<<8) | 12)
178: #define LAP_IOC_GET_ROUTE ((AT_MID_LAP<<8) | 13)
179: #define LAP_IOC_ADD_IFNAME ((AT_MID_LAP<<8) | 14)
180: #define LAP_IOC_DO_DEFER ((AT_MID_LAP<<8) | 15)
181: #define LAP_IOC_DO_DELAY ((AT_MID_LAP<<8) | 16)
182: #define LAP_IOC_SHUT_DOWN ((AT_MID_LAP<<8) | 17)
183: #define LAP_IOC_CHECK_STATE ((AT_MID_LAP<<8) | 18)
184: #define LAP_IOC_DEL_IFNAME ((AT_MID_LAP<<8) | 19)
185: #define LAP_IOC_SET_MIX ((AT_MID_LAP<<8) | 20)
186: #define LAP_IOC_SNMP_GET_CFG ((AT_MID_LAP<<8) | 21)
187: #define LAP_IOC_SNMP_GET_AARP ((AT_MID_LAP<<8) | 22)
188: #define LAP_IOC_SNMP_GET_RTMP ((AT_MID_LAP<<8) | 23)
189: #define LAP_IOC_SNMP_GET_ZIP ((AT_MID_LAP<<8) | 24)
190: #define LAP_IOC_SNMP_GET_DDP ((AT_MID_LAP<<8) | 25)
191: #define LAP_IOC_SNMP_GET_NBP ((AT_MID_LAP<<8) | 26)
192: #define LAP_IOC_SNMP_GET_PORTS ((AT_MID_LAP<<8) | 27)
193: #define LAP_IOC_SET_LOCAL_ZONES ((AT_MID_LAP<<8) | 28)
194: #define LAP_IOC_GET_LOCAL_ZONE ((AT_MID_LAP<<8) | 29)
195: #define LAP_IOC_IS_ZONE_LOCAL ((AT_MID_LAP<<8) | 30)
196: #define LAP_IOC_GET_MODE ((AT_MID_LAP<<8) | 31)
197: #define LAP_IOC_GET_IF_NAMES ((AT_MID_LAP<<8) | 32)
198: #define LAP_IOC_GET_DEFAULT_ZONE ((AT_MID_LAP<<8) | 33)
199: #define LAP_IOC_SET_DEFAULT_ZONES ((AT_MID_LAP<<8) | 34)
200:
201:
202: #endif /* __LAP__ */
203:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.