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