1 /* 2 * Copyright (c) 2004 3 * Deutsches Zentrum fuer Luft- und Raumfahrt. 4 * All rights reserved. 5 * 6 * Author: Hartmut Brandt <harti@freebsd.org> 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * $Begemot: libunimsg/snmp_atm/atm.h,v 1.3 2005/05/23 11:46:46 brandt_h Exp $ 30 */ 31 32 #include <sys/types.h> 33 #include <sys/queue.h> 34 #include <sys/socket.h> 35 36 #include <net/if.h> 37 #include <net/if_mib.h> 38 39 #include <bsnmp/snmpmod.h> 40 #include <bsnmp/snmp_mibII.h> 41 #include <bsnmp/snmp_atm.h> 42 43 /* 44 * Event registrations 45 */ 46 struct atmif_reg { 47 TAILQ_ENTRY(atmif_reg) link; 48 void *data; 49 atmif_event_f func; 50 const struct lmodule *mod; 51 struct atmif_priv *aif; /* back pointer */ 52 }; 53 TAILQ_HEAD(atmif_reg_list, atmif_reg); 54 55 /* 56 * Interface data 57 */ 58 struct atmif_priv { 59 struct atmif pub; /* public part, must be first */ 60 TAILQ_ENTRY(atmif_priv) link; 61 u_int index; /* if_index */ 62 void *ifpreg; 63 struct atmif_sys *sys; 64 struct atmif_reg_list notify; 65 }; 66 TAILQ_HEAD(atmif_list, atmif_priv); 67 68 /* list of all (known) ATM interfaces */ 69 extern struct atmif_list atmif_list; 70 71 extern struct lmodule *module; 72 73 /* Check the carrier state of the interface */ 74 void atmif_check_carrier(struct atmif_priv *); 75 76 /* Send notification to all listeners. */ 77 void atmif_send_notification(struct atmif_priv *, enum atmif_notify, uintptr_t); 78 79 /* Get the interface point for a table access */ 80 int atmif_get_aif(struct snmp_value *, u_int, enum snmp_op, 81 struct atmif_priv **); 82 83 /* Destroy system dependend stuff. */ 84 void atmif_sys_destroy(struct atmif_priv *); 85 86 /* Attach to an ATM interface */ 87 int atmif_sys_attach_if(struct atmif_priv *); 88 89 /* Get vendor string */ 90 int atm_sys_get_hw_vendor(struct atmif_priv *, struct snmp_value *); 91 92 /* Get device string */ 93 int atm_sys_get_hw_device(struct atmif_priv *, struct snmp_value *); 94 95 /* Extract the ATM MIB from the interface's private MIB */ 96 void atmif_sys_fill_mib(struct atmif_priv *); 97