2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 #ifndef _NETAT_AT_SNMP_H_
26 #define _NETAT_AT_SNMP_H_
27 #include <sys/appleapiopts.h>
29 #define MAX_PHYS_ADDR_SIZE 6 /* maximum physical addr size */
30 #define MAX_IFS 25 /* max # interfaces */
31 #define IF_NAME_SIZE 6 /* max name length of I/F name */
32 #define DDP_ADDR_SIZE 3
33 #define ZONE_SIZE NBP_NVE_STR_SIZE
34 #define OBJECT_SIZE NBP_NVE_STR_SIZE
35 #define TYPE_SIZE NBP_NVE_STR_SIZE
36 #define PORT_DESC_SIZE 50
37 #define UPDATE_IF_CHANGED 1 /* for ioctls */
38 #define UPDATE_UNCONDITIONAL 2
39 #define SNMP_NBP_HEADER_SIZE (sizeof(snmpNbpTable_t) - sizeof(snmpNbpEntry_t))
41 typedef struct snmpIfCfg
{
42 u_short ifc_aarpSize
; /* AARP table size for this I/F */
43 u_short ifc_addrSize
; /* Mac address size in bytes */
44 u_short ifc_type
; /* port type */
45 at_net_al ifc_start
; /* net range start */
46 at_net_al ifc_end
; /* net range end */
47 struct at_addr ifc_ddpAddr
; /* ddp address of port */
48 u_short ifc_status
; /* port status */
51 at_nvestr_t ifc_zoneName
;
53 char ifc_name
[IF_NAME_SIZE
]; /* I/F name (e.g. ent0 */
57 typedef struct snmpCfg
{
58 int pad
; /* pad for UPDATE flag when ioctl issued */
59 u_int cfg_flags
; /* at_state flags */
60 int cfg_ifCnt
; /* # I/F's up */
61 snmpIfCfg_t cfg_ifCfg
[MAX_IFS
];
64 typedef struct snmpAarpEnt
{
65 struct at_addr ap_ddpAddr
;
66 u_char ap_physAddr
[MAX_PHYS_ADDR_SIZE
];
69 typedef struct snmpAarp
{ /* aarp info for 1 I/F */
70 time_t at_time
; /* the time() we got this table */
71 int at_ifno
; /* the (SNMP) I/F number of this table */
72 int at_maxSize
; /* allocated size of as_table in entries */
73 int at_usedSize
; /* size of at_table used portion */
74 snmpAarpEnt_t
*at_table
;
77 typedef struct snmpFlags
{
78 int lap_changed
; /* set when any I/F state changes */
79 int rtmpAdded
; /* set when rtmp entry ADDED */
80 int zipAdded
; /* set when zip entry ADDED */
83 typedef struct snmpNbpEntry
{
84 at_nvestr_t nbpe_object
;
85 at_nvestr_t nbpe_type
;
88 typedef struct snmpNbpTable
{
90 at_nvestr_t nbpt_zone
;
91 snmpNbpEntry_t nbpt_table
[1];
97 typedef struct snmpStats
{
121 #define SNMP_TYPE_OTHER 1
122 #define SNMP_TYPE_LOCAL 2
123 #define SNMP_TYPE_ETHER1 3
124 #define SNMP_TYPE_ETHER2 4
125 #define SNMP_TYPE_TOKEN 5
126 #define SNMP_TYPE_IP 6
127 #define SNMP_TYPE_SERIALPPP 7
128 #define SNMP_TYPE_SERIALNONSTD 8
129 #define SNMP_TYPE_VIRTUAL 9
130 #define SNMP_CFG_CONFIGURED 1
131 #define SNMP_CFG_GARNERED 2
132 #define SNMP_CFG_GUESSED 3
133 #define SNMP_CFG_UNCONFIG 4
135 #define SNMP_OBJ_TYPE_AARP 0x0100
136 #define SNMP_OBJ_TYPE_ECHO 0x0200
137 #define SNMP_OBJ_TYPE_PORT 0x0300
138 #define SNMP_OBJ_TYPE_DDP 0x0400
139 #define SNMP_OBJ_TYPE_RTMP 0x0500
140 #define SNMP_OBJ_TYPE_ZIP 0x0600
141 #define SNMP_OBJ_TYPE_NBP 0x0700
142 #define SNMP_OBJ_TYPE_MASK 0x0f00
144 #define AARPIFINDEX 2 + SNMP_OBJ_TYPE_AARP
145 #define AARPNETADDRESS 3 + SNMP_OBJ_TYPE_AARP
146 #define AARPPHYSADDRESS 4 + SNMP_OBJ_TYPE_AARP
147 #define ATECHOREPLIES 6 + SNMP_OBJ_TYPE_AARP
148 #define ATECHOREQUESTS 7 + SNMP_OBJ_TYPE_AARP
149 #define ATPORTDESCR 8 + SNMP_OBJ_TYPE_PORT
150 #define ATPORTIFINDEX 10 + SNMP_OBJ_TYPE_PORT
151 #define ATPORTINDEX 11 + SNMP_OBJ_TYPE_PORT
152 #define ATPORTNETADDRESS 12 + SNMP_OBJ_TYPE_PORT
153 #define ATPORTNETCONFIG 13 + SNMP_OBJ_TYPE_PORT
154 #define ATPORTNETEND 14 + SNMP_OBJ_TYPE_PORT
155 #define ATPORTNETSTART 15 + SNMP_OBJ_TYPE_PORT
156 #define ATPORTSTATUS 16 + SNMP_OBJ_TYPE_PORT
157 #define ATPORTTYPE 18 + SNMP_OBJ_TYPE_PORT
158 #define ATPORTZONE 19 + SNMP_OBJ_TYPE_PORT
159 #define ATPORTZONECONFIG 20 + SNMP_OBJ_TYPE_PORT
160 #define DDPBROADCASTERRORS 21 + SNMP_OBJ_TYPE_DDP
161 #define DDPCHECKSUMERRORS 22 + SNMP_OBJ_TYPE_DDP
162 #define DDPFORWREQUESTS 23 + SNMP_OBJ_TYPE_DDP
163 #define DDPHOPCOUNTERRORS 24 + SNMP_OBJ_TYPE_DDP
164 #define DDPINLOCALDATAGRAMS 25 + SNMP_OBJ_TYPE_DDP
165 #define DDPINRECEIVES 26 + SNMP_OBJ_TYPE_DDP
166 #define DDPNOPROTOCOLHANDLERS 27 + SNMP_OBJ_TYPE_DDP
167 #define DDPOUTLONGS 28 + SNMP_OBJ_TYPE_DDP
168 #define DDPOUTNOROUTES 29 + SNMP_OBJ_TYPE_DDP
169 #define DDPOUTREQUESTS 30 + SNMP_OBJ_TYPE_DDP
170 #define DDPOUTSHORTS 31 + SNMP_OBJ_TYPE_DDP
171 #define DDPSHORTDDPERRORS 32 + SNMP_OBJ_TYPE_DDP
172 #define DDPTOOLONGERRORS 33 + SNMP_OBJ_TYPE_DDP
173 #define DDPTOOSHORTERRORS 34 + SNMP_OBJ_TYPE_DDP
174 #define KIPBCASTADDR 35
177 #define KIPHOPCOUNT 38
179 #define KIPNETSTART 40
180 #define KIPNEXTHOP 41
185 #define LLAPCOLLISIONS 46
186 #define LLAPDEFERS 47
188 #define LLAPFCSERRORS 49
189 #define LLAPIFINDEX 50
190 #define LLAPINERRORS 51
191 #define LLAPINLENGTHERRORS 52
192 #define LLAPINNOHANDLERS 53
193 #define LLAPINPKTS 54
194 #define LLAPNODATAERRORS 55
195 #define LLAPOUTPKTS 56
196 #define LLAPRANDOMCTSERRORS 57
197 #define NBPINDEX 60 + SNMP_OBJ_TYPE_NBP
198 #define NBPOBJECT 61 + SNMP_OBJ_TYPE_NBP
199 #define NBPSTATE 62 + SNMP_OBJ_TYPE_NBP
200 #define NBPTABLE 63 + SNMP_OBJ_TYPE_NBP
201 #define NBPTYPE 64 + SNMP_OBJ_TYPE_NBP
202 #define NBPZONE 65 + SNMP_OBJ_TYPE_NBP
203 #define RTMPHOPS 67 + SNMP_OBJ_TYPE_RTMP
204 #define RTMPNEXTHOP 68 + SNMP_OBJ_TYPE_RTMP
205 #define RTMPPORT 69 + SNMP_OBJ_TYPE_RTMP
206 #define RTMPRANGEEND 70 + SNMP_OBJ_TYPE_RTMP
207 #define RTMPRANGESTART 71 + SNMP_OBJ_TYPE_RTMP
208 #define RTMPSTATE 72 + SNMP_OBJ_TYPE_RTMP
209 #define RTMPTYPE 74 + SNMP_OBJ_TYPE_RTMP
210 #define ZIPZONEINDEX 77 + SNMP_OBJ_TYPE_ZIP
211 #define ZIPZONENAME 78 + SNMP_OBJ_TYPE_ZIP
212 #define ZIPZONENETEND 79 + SNMP_OBJ_TYPE_ZIP
213 #define ZIPZONENETSTART 80 + SNMP_OBJ_TYPE_ZIP
214 #define ZIPZONESTATE 81 + SNMP_OBJ_TYPE_ZIP
216 #define SNMP_TYPE(var,type) ((var & SNMP_OBJ_TYPE_MASK) == type)
218 #endif _NETAT_AT_SNMP_H_