1/* 2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 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. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 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. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28#ifndef _NETAT_AT_SNMP_H_ 29#define _NETAT_AT_SNMP_H_ 30#include <sys/appleapiopts.h> 31 32#ifdef __APPLE_API_OBSOLETE 33 34#define MAX_PHYS_ADDR_SIZE 6 /* maximum physical addr size */ 35#define MAX_IFS 25 /* max # interfaces */ 36#define IF_NAME_SIZE 6 /* max name length of I/F name */ 37#define DDP_ADDR_SIZE 3 38#define ZONE_SIZE NBP_NVE_STR_SIZE 39#define OBJECT_SIZE NBP_NVE_STR_SIZE 40#define TYPE_SIZE NBP_NVE_STR_SIZE 41#define PORT_DESC_SIZE 50 42#define UPDATE_IF_CHANGED 1 /* for ioctls */ 43#define UPDATE_UNCONDITIONAL 2 44#define SNMP_NBP_HEADER_SIZE (sizeof(snmpNbpTable_t) - sizeof(snmpNbpEntry_t)) 45 46typedef struct snmpIfCfg { 47 u_short ifc_aarpSize; /* AARP table size for this I/F */ 48 u_short ifc_addrSize; /* Mac address size in bytes */ 49 u_short ifc_type; /* port type */ 50 at_net_al ifc_start; /* net range start */ 51 at_net_al ifc_end; /* net range end */ 52 struct at_addr ifc_ddpAddr; /* ddp address of port */ 53 u_short ifc_status; /* port status */ 54 u_short ifc_netCfg; 55 u_short ifc_zoneCfg; 56 at_nvestr_t ifc_zoneName; 57 u_short ifc_index; 58 char ifc_name[IF_NAME_SIZE]; /* I/F name (e.g. ent0 */ 59} snmpIfCfg_t; 60 61 62typedef struct snmpCfg { 63 int pad; /* pad for UPDATE flag when ioctl issued */ 64 u_int cfg_flags; /* at_state flags */ 65 int cfg_ifCnt; /* # I/F's up */ 66 snmpIfCfg_t cfg_ifCfg[MAX_IFS]; 67} snmpCfg_t; 68 69typedef struct snmpAarpEnt { 70 struct at_addr ap_ddpAddr; 71 u_char ap_physAddr[MAX_PHYS_ADDR_SIZE]; 72}snmpAarpEnt_t; 73 74typedef struct snmpAarp { /* aarp info for 1 I/F */ 75 time_t at_time; /* the time() we got this table */ 76 int at_ifno; /* the (SNMP) I/F number of this table */ 77 int at_maxSize; /* allocated size of as_table in entries */ 78 int at_usedSize; /* size of at_table used portion */ 79 snmpAarpEnt_t *at_table; 80} snmpAarp_t; 81 82typedef struct snmpFlags { 83 int lap_changed; /* set when any I/F state changes */ 84 int rtmpAdded; /* set when rtmp entry ADDED */ 85 int zipAdded; /* set when zip entry ADDED */ 86} snmpFlags_t; 87 88typedef struct snmpNbpEntry { 89 at_nvestr_t nbpe_object; 90 at_nvestr_t nbpe_type; 91}snmpNbpEntry_t; 92 93typedef struct snmpNbpTable { 94 int nbpt_entries; 95 at_nvestr_t nbpt_zone; 96 snmpNbpEntry_t nbpt_table[1]; 97}snmpNbpTable_t; 98 99 100 101 102typedef struct snmpStats { 103 104 /* ddp group */ 105 u_int dd_outReq; 106 u_int dd_outShort; 107 u_int dd_outLong; 108 u_int dd_inTotal; 109 u_int dd_fwdReq; 110 u_int dd_inLocal; 111 u_int dd_noHandler; 112 u_int dd_noRoutes; 113 u_int dd_tooShort; 114 u_int dd_tooLong; 115 u_int dd_inBcastErr; 116 u_int dd_shortErr; 117 u_int dd_hopCount; 118 u_int dd_checkSum; 119 120 /* ATEcho group */ 121 122 u_int ec_echoReq; 123 u_int ec_echoReply; 124} snmpStats_t; 125 126#define SNMP_TYPE_OTHER 1 127#define SNMP_TYPE_LOCAL 2 128#define SNMP_TYPE_ETHER1 3 129#define SNMP_TYPE_ETHER2 4 130#define SNMP_TYPE_TOKEN 5 131#define SNMP_TYPE_IP 6 132#define SNMP_TYPE_SERIALPPP 7 133#define SNMP_TYPE_SERIALNONSTD 8 134#define SNMP_TYPE_VIRTUAL 9 135#define SNMP_CFG_CONFIGURED 1 136#define SNMP_CFG_GARNERED 2 137#define SNMP_CFG_GUESSED 3 138#define SNMP_CFG_UNCONFIG 4 139 140#define SNMP_OBJ_TYPE_AARP 0x0100 141#define SNMP_OBJ_TYPE_ECHO 0x0200 142#define SNMP_OBJ_TYPE_PORT 0x0300 143#define SNMP_OBJ_TYPE_DDP 0x0400 144#define SNMP_OBJ_TYPE_RTMP 0x0500 145#define SNMP_OBJ_TYPE_ZIP 0x0600 146#define SNMP_OBJ_TYPE_NBP 0x0700 147#define SNMP_OBJ_TYPE_MASK 0x0f00 148 149#define AARPIFINDEX 2 + SNMP_OBJ_TYPE_AARP 150#define AARPNETADDRESS 3 + SNMP_OBJ_TYPE_AARP 151#define AARPPHYSADDRESS 4 + SNMP_OBJ_TYPE_AARP 152#define ATECHOREPLIES 6 + SNMP_OBJ_TYPE_AARP 153#define ATECHOREQUESTS 7 + SNMP_OBJ_TYPE_AARP 154#define ATPORTDESCR 8 + SNMP_OBJ_TYPE_PORT 155#define ATPORTIFINDEX 10 + SNMP_OBJ_TYPE_PORT 156#define ATPORTINDEX 11 + SNMP_OBJ_TYPE_PORT 157#define ATPORTNETADDRESS 12 + SNMP_OBJ_TYPE_PORT 158#define ATPORTNETCONFIG 13 + SNMP_OBJ_TYPE_PORT 159#define ATPORTNETEND 14 + SNMP_OBJ_TYPE_PORT 160#define ATPORTNETSTART 15 + SNMP_OBJ_TYPE_PORT 161#define ATPORTSTATUS 16 + SNMP_OBJ_TYPE_PORT 162#define ATPORTTYPE 18 + SNMP_OBJ_TYPE_PORT 163#define ATPORTZONE 19 + SNMP_OBJ_TYPE_PORT 164#define ATPORTZONECONFIG 20 + SNMP_OBJ_TYPE_PORT 165#define DDPBROADCASTERRORS 21 + SNMP_OBJ_TYPE_DDP 166#define DDPCHECKSUMERRORS 22 + SNMP_OBJ_TYPE_DDP 167#define DDPFORWREQUESTS 23 + SNMP_OBJ_TYPE_DDP 168#define DDPHOPCOUNTERRORS 24 + SNMP_OBJ_TYPE_DDP 169#define DDPINLOCALDATAGRAMS 25 + SNMP_OBJ_TYPE_DDP 170#define DDPINRECEIVES 26 + SNMP_OBJ_TYPE_DDP 171#define DDPNOPROTOCOLHANDLERS 27 + SNMP_OBJ_TYPE_DDP 172#define DDPOUTLONGS 28 + SNMP_OBJ_TYPE_DDP 173#define DDPOUTNOROUTES 29 + SNMP_OBJ_TYPE_DDP 174#define DDPOUTREQUESTS 30 + SNMP_OBJ_TYPE_DDP 175#define DDPOUTSHORTS 31 + SNMP_OBJ_TYPE_DDP 176#define DDPSHORTDDPERRORS 32 + SNMP_OBJ_TYPE_DDP 177#define DDPTOOLONGERRORS 33 + SNMP_OBJ_TYPE_DDP 178#define DDPTOOSHORTERRORS 34 + SNMP_OBJ_TYPE_DDP 179#define KIPBCASTADDR 35 180#define KIPCORE 36 181#define KIPENTRY 37 182#define KIPHOPCOUNT 38 183#define KIPNETEND 39 184#define KIPNETSTART 40 185#define KIPNEXTHOP 41 186#define KIPSHARE 42 187#define KIPSTATE 43 188#define KIPTABLE 44 189#define KIPTYPE 45 190#define LLAPCOLLISIONS 46 191#define LLAPDEFERS 47 192#define LLAPENTRY 48 193#define LLAPFCSERRORS 49 194#define LLAPIFINDEX 50 195#define LLAPINERRORS 51 196#define LLAPINLENGTHERRORS 52 197#define LLAPINNOHANDLERS 53 198#define LLAPINPKTS 54 199#define LLAPNODATAERRORS 55 200#define LLAPOUTPKTS 56 201#define LLAPRANDOMCTSERRORS 57 202#define NBPINDEX 60 + SNMP_OBJ_TYPE_NBP 203#define NBPOBJECT 61 + SNMP_OBJ_TYPE_NBP 204#define NBPSTATE 62 + SNMP_OBJ_TYPE_NBP 205#define NBPTABLE 63 + SNMP_OBJ_TYPE_NBP 206#define NBPTYPE 64 + SNMP_OBJ_TYPE_NBP 207#define NBPZONE 65 + SNMP_OBJ_TYPE_NBP 208#define RTMPHOPS 67 + SNMP_OBJ_TYPE_RTMP 209#define RTMPNEXTHOP 68 + SNMP_OBJ_TYPE_RTMP 210#define RTMPPORT 69 + SNMP_OBJ_TYPE_RTMP 211#define RTMPRANGEEND 70 + SNMP_OBJ_TYPE_RTMP 212#define RTMPRANGESTART 71 + SNMP_OBJ_TYPE_RTMP 213#define RTMPSTATE 72 + SNMP_OBJ_TYPE_RTMP 214#define RTMPTYPE 74 + SNMP_OBJ_TYPE_RTMP 215#define ZIPZONEINDEX 77 + SNMP_OBJ_TYPE_ZIP 216#define ZIPZONENAME 78 + SNMP_OBJ_TYPE_ZIP 217#define ZIPZONENETEND 79 + SNMP_OBJ_TYPE_ZIP 218#define ZIPZONENETSTART 80 + SNMP_OBJ_TYPE_ZIP 219#define ZIPZONESTATE 81 + SNMP_OBJ_TYPE_ZIP 220 221#define SNMP_TYPE(var,type) ((var & SNMP_OBJ_TYPE_MASK) == type) 222 223#ifdef KERNEL_PRIVATE 224int getNbpTable(snmpNbpEntry_t *, int, int); 225int getNbpTableSize(void); 226snmpAarpEnt_t *getAarp(int *); 227#endif 228 229#endif /* __APPLE_API_OBSOLETE */ 230#endif /* _NETAT_AT_SNMP_H_ */ 231