atm.h revision 146611
1133488Sharti/* 2133488Sharti * Copyright (c) 2004 3133488Sharti * Deutsches Zentrum fuer Luft- und Raumfahrt. 4133488Sharti * All rights reserved. 5133488Sharti * 6133488Sharti * Author: Hartmut Brandt <harti@freebsd.org> 7133488Sharti * 8133488Sharti * Redistribution and use in source and binary forms, with or without 9133488Sharti * modification, are permitted provided that the following conditions 10133488Sharti * are met: 11133488Sharti * 1. Redistributions of source code must retain the above copyright 12133488Sharti * notice, this list of conditions and the following disclaimer. 13133488Sharti * 2. Redistributions in binary form must reproduce the above copyright 14133488Sharti * notice, this list of conditions and the following disclaimer in the 15133488Sharti * documentation and/or other materials provided with the distribution. 16133488Sharti * 17133488Sharti * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18133488Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19133488Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20133488Sharti * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 21133488Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22133488Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23133488Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24133488Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25133488Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26133488Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27133488Sharti * SUCH DAMAGE. 28133488Sharti * 29146532Sharti * $Begemot: libunimsg/snmp_atm/atm.h,v 1.3 2005/05/23 11:46:46 brandt_h Exp $ 30133488Sharti */ 31133488Sharti 32133488Sharti#include <sys/types.h> 33133488Sharti#include <sys/queue.h> 34133488Sharti#include <sys/socket.h> 35133488Sharti 36133488Sharti#include <net/if.h> 37133488Sharti#include <net/if_mib.h> 38133488Sharti 39146611Sharti#include <bsnmp/snmpmod.h> 40146611Sharti#include <bsnmp/snmp_mibII.h> 41146611Sharti#include <bsnmp/snmp_atm.h> 42133488Sharti 43133488Sharti/* 44133488Sharti * Event registrations 45133488Sharti */ 46133488Shartistruct atmif_reg { 47133488Sharti TAILQ_ENTRY(atmif_reg) link; 48133488Sharti void *data; 49133488Sharti atmif_event_f func; 50133488Sharti const struct lmodule *mod; 51133488Sharti struct atmif_priv *aif; /* back pointer */ 52133488Sharti}; 53133488ShartiTAILQ_HEAD(atmif_reg_list, atmif_reg); 54133488Sharti 55133488Sharti/* 56133488Sharti * Interface data 57133488Sharti */ 58133488Shartistruct atmif_priv { 59133488Sharti struct atmif pub; /* public part, must be first */ 60133488Sharti TAILQ_ENTRY(atmif_priv) link; 61133488Sharti u_int index; /* if_index */ 62133488Sharti void *ifpreg; 63133488Sharti struct atmif_sys *sys; 64133488Sharti struct atmif_reg_list notify; 65133488Sharti}; 66133488ShartiTAILQ_HEAD(atmif_list, atmif_priv); 67133488Sharti 68133488Sharti/* list of all (known) ATM interfaces */ 69133488Shartiextern struct atmif_list atmif_list; 70133488Sharti 71133488Shartiextern struct lmodule *module; 72133488Sharti 73133488Sharti/* Check the carrier state of the interface */ 74133488Shartivoid atmif_check_carrier(struct atmif_priv *); 75133488Sharti 76133488Sharti/* Send notification to all listeners. */ 77133488Shartivoid atmif_send_notification(struct atmif_priv *, enum atmif_notify, uintptr_t); 78133488Sharti 79133488Sharti/* Get the interface point for a table access */ 80133488Shartiint atmif_get_aif(struct snmp_value *, u_int, enum snmp_op, 81133488Sharti struct atmif_priv **); 82133488Sharti 83133488Sharti/* Destroy system dependend stuff. */ 84133488Shartivoid atmif_sys_destroy(struct atmif_priv *); 85133488Sharti 86133488Sharti/* Attach to an ATM interface */ 87133488Shartiint atmif_sys_attach_if(struct atmif_priv *); 88133488Sharti 89133488Sharti/* Get vendor string */ 90133488Shartiint atm_sys_get_hw_vendor(struct atmif_priv *, struct snmp_value *); 91133488Sharti 92133488Sharti/* Get device string */ 93133488Shartiint atm_sys_get_hw_device(struct atmif_priv *, struct snmp_value *); 94133488Sharti 95133488Sharti/* Extract the ATM MIB from the interface's private MIB */ 96133488Shartivoid atmif_sys_fill_mib(struct atmif_priv *); 97