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_
24 #include <sys/appleapiopts.h>
26 #define MAX_PHYS_ADDR_SIZE 6 /* maximum physical addr size */
27 #define MAX_IFS 25 /* max # interfaces */
28 #define IF_NAME_SIZE 6 /* max name length of I/F name */
29 #define DDP_ADDR_SIZE 3
30 #define ZONE_SIZE NBP_NVE_STR_SIZE
31 #define OBJECT_SIZE NBP_NVE_STR_SIZE
32 #define TYPE_SIZE NBP_NVE_STR_SIZE
33 #define PORT_DESC_SIZE 50
34 #define UPDATE_IF_CHANGED 1 /* for ioctls */
35 #define UPDATE_UNCONDITIONAL 2
36 #define SNMP_NBP_HEADER_SIZE (sizeof(snmpNbpTable_t) - sizeof(snmpNbpEntry_t))
38 typedef struct snmpIfCfg
{
39 u_short ifc_aarpSize
; /* AARP table size for this I/F */
40 u_short ifc_addrSize
; /* Mac address size in bytes */
41 u_short ifc_type
; /* port type */
42 at_net_al ifc_start
; /* net range start */
43 at_net_al ifc_end
; /* net range end */
44 struct at_addr ifc_ddpAddr
; /* ddp address of port */
45 u_short ifc_status
; /* port status */
48 at_nvestr_t ifc_zoneName
;
50 char ifc_name
[IF_NAME_SIZE
]; /* I/F name (e.g. ent0 */
54 typedef struct snmpCfg
{
55 int pad
; /* pad for UPDATE flag when ioctl issued */
56 u_int cfg_flags
; /* at_state flags */
57 int cfg_ifCnt
; /* # I/F's up */
58 snmpIfCfg_t cfg_ifCfg
[MAX_IFS
];
61 typedef struct snmpAarpEnt
{
62 struct at_addr ap_ddpAddr
;
63 u_char ap_physAddr
[MAX_PHYS_ADDR_SIZE
];
66 typedef struct snmpAarp
{ /* aarp info for 1 I/F */
67 time_t at_time
; /* the time() we got this table */
68 int at_ifno
; /* the (SNMP) I/F number of this table */
69 int at_maxSize
; /* allocated size of as_table in entries */
70 int at_usedSize
; /* size of at_table used portion */
71 snmpAarpEnt_t
*at_table
;
74 typedef struct snmpFlags
{
75 int lap_changed
; /* set when any I/F state changes */
76 int rtmpAdded
; /* set when rtmp entry ADDED */
77 int zipAdded
; /* set when zip entry ADDED */
80 typedef struct snmpNbpEntry
{
81 at_nvestr_t nbpe_object
;
82 at_nvestr_t nbpe_type
;
85 typedef struct snmpNbpTable
{
87 at_nvestr_t nbpt_zone
;
88 snmpNbpEntry_t nbpt_table
[1];
94 typedef struct snmpStats
{
118 #define SNMP_TYPE_OTHER 1
119 #define SNMP_TYPE_LOCAL 2
120 #define SNMP_TYPE_ETHER1 3
121 #define SNMP_TYPE_ETHER2 4
122 #define SNMP_TYPE_TOKEN 5
123 #define SNMP_TYPE_IP 6
124 #define SNMP_TYPE_SERIALPPP 7
125 #define SNMP_TYPE_SERIALNONSTD 8
126 #define SNMP_TYPE_VIRTUAL 9
127 #define SNMP_CFG_CONFIGURED 1
128 #define SNMP_CFG_GARNERED 2
129 #define SNMP_CFG_GUESSED 3
130 #define SNMP_CFG_UNCONFIG 4
132 #define SNMP_OBJ_TYPE_AARP 0x0100
133 #define SNMP_OBJ_TYPE_ECHO 0x0200
134 #define SNMP_OBJ_TYPE_PORT 0x0300
135 #define SNMP_OBJ_TYPE_DDP 0x0400
136 #define SNMP_OBJ_TYPE_RTMP 0x0500
137 #define SNMP_OBJ_TYPE_ZIP 0x0600
138 #define SNMP_OBJ_TYPE_NBP 0x0700
139 #define SNMP_OBJ_TYPE_MASK 0x0f00
141 #define AARPIFINDEX 2 + SNMP_OBJ_TYPE_AARP
142 #define AARPNETADDRESS 3 + SNMP_OBJ_TYPE_AARP
143 #define AARPPHYSADDRESS 4 + SNMP_OBJ_TYPE_AARP
144 #define ATECHOREPLIES 6 + SNMP_OBJ_TYPE_AARP
145 #define ATECHOREQUESTS 7 + SNMP_OBJ_TYPE_AARP
146 #define ATPORTDESCR 8 + SNMP_OBJ_TYPE_PORT
147 #define ATPORTIFINDEX 10 + SNMP_OBJ_TYPE_PORT
148 #define ATPORTINDEX 11 + SNMP_OBJ_TYPE_PORT
149 #define ATPORTNETADDRESS 12 + SNMP_OBJ_TYPE_PORT
150 #define ATPORTNETCONFIG 13 + SNMP_OBJ_TYPE_PORT
151 #define ATPORTNETEND 14 + SNMP_OBJ_TYPE_PORT
152 #define ATPORTNETSTART 15 + SNMP_OBJ_TYPE_PORT
153 #define ATPORTSTATUS 16 + SNMP_OBJ_TYPE_PORT
154 #define ATPORTTYPE 18 + SNMP_OBJ_TYPE_PORT
155 #define ATPORTZONE 19 + SNMP_OBJ_TYPE_PORT
156 #define ATPORTZONECONFIG 20 + SNMP_OBJ_TYPE_PORT
157 #define DDPBROADCASTERRORS 21 + SNMP_OBJ_TYPE_DDP
158 #define DDPCHECKSUMERRORS 22 + SNMP_OBJ_TYPE_DDP
159 #define DDPFORWREQUESTS 23 + SNMP_OBJ_TYPE_DDP
160 #define DDPHOPCOUNTERRORS 24 + SNMP_OBJ_TYPE_DDP
161 #define DDPINLOCALDATAGRAMS 25 + SNMP_OBJ_TYPE_DDP
162 #define DDPINRECEIVES 26 + SNMP_OBJ_TYPE_DDP
163 #define DDPNOPROTOCOLHANDLERS 27 + SNMP_OBJ_TYPE_DDP
164 #define DDPOUTLONGS 28 + SNMP_OBJ_TYPE_DDP
165 #define DDPOUTNOROUTES 29 + SNMP_OBJ_TYPE_DDP
166 #define DDPOUTREQUESTS 30 + SNMP_OBJ_TYPE_DDP
167 #define DDPOUTSHORTS 31 + SNMP_OBJ_TYPE_DDP
168 #define DDPSHORTDDPERRORS 32 + SNMP_OBJ_TYPE_DDP
169 #define DDPTOOLONGERRORS 33 + SNMP_OBJ_TYPE_DDP
170 #define DDPTOOSHORTERRORS 34 + SNMP_OBJ_TYPE_DDP
171 #define KIPBCASTADDR 35
174 #define KIPHOPCOUNT 38
176 #define KIPNETSTART 40
177 #define KIPNEXTHOP 41
182 #define LLAPCOLLISIONS 46
183 #define LLAPDEFERS 47
185 #define LLAPFCSERRORS 49
186 #define LLAPIFINDEX 50
187 #define LLAPINERRORS 51
188 #define LLAPINLENGTHERRORS 52
189 #define LLAPINNOHANDLERS 53
190 #define LLAPINPKTS 54
191 #define LLAPNODATAERRORS 55
192 #define LLAPOUTPKTS 56
193 #define LLAPRANDOMCTSERRORS 57
194 #define NBPINDEX 60 + SNMP_OBJ_TYPE_NBP
195 #define NBPOBJECT 61 + SNMP_OBJ_TYPE_NBP
196 #define NBPSTATE 62 + SNMP_OBJ_TYPE_NBP
197 #define NBPTABLE 63 + SNMP_OBJ_TYPE_NBP
198 #define NBPTYPE 64 + SNMP_OBJ_TYPE_NBP
199 #define NBPZONE 65 + SNMP_OBJ_TYPE_NBP
200 #define RTMPHOPS 67 + SNMP_OBJ_TYPE_RTMP
201 #define RTMPNEXTHOP 68 + SNMP_OBJ_TYPE_RTMP
202 #define RTMPPORT 69 + SNMP_OBJ_TYPE_RTMP
203 #define RTMPRANGEEND 70 + SNMP_OBJ_TYPE_RTMP
204 #define RTMPRANGESTART 71 + SNMP_OBJ_TYPE_RTMP
205 #define RTMPSTATE 72 + SNMP_OBJ_TYPE_RTMP
206 #define RTMPTYPE 74 + SNMP_OBJ_TYPE_RTMP
207 #define ZIPZONEINDEX 77 + SNMP_OBJ_TYPE_ZIP
208 #define ZIPZONENAME 78 + SNMP_OBJ_TYPE_ZIP
209 #define ZIPZONENETEND 79 + SNMP_OBJ_TYPE_ZIP
210 #define ZIPZONENETSTART 80 + SNMP_OBJ_TYPE_ZIP
211 #define ZIPZONESTATE 81 + SNMP_OBJ_TYPE_ZIP
213 #define SNMP_TYPE(var,type) ((var & SNMP_OBJ_TYPE_MASK) == type)
215 #endif _NETAT_AT_SNMP_H_