1/*
2 * Copyright (c) 2001-2002
3 *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 *	All rights reserved.
5 * Copyright (c) 2003-2004
6 *	Hartmut Brandt
7 *	All rights reserved.
8 *
9 * Author: Hartmut Brandt <harti@freebsd.org>
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 *    notice, this list of conditions and the following disclaimer in the
18 *    documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $Begemot: libunimsg/snmp_atm/snmp_atm.h,v 1.2 2004/08/06 17:30:40 brandt Exp $
33 */
34#ifndef _BSNMP_SNMP_ATM_H
35#define _BSNMP_SNMP_ATM_H
36
37enum atmif_notify {
38	ATMIF_NOTIFY_DESTROY,	/* interface has been destroyed */
39	ATMIF_NOTIFY_CARRIER,	/* carriere change */
40	ATMIF_NOTIFY_VCC	/* VCC change */
41};
42
43enum atmif_carrier_state {
44	ATMIF_CARRIER_ON	= 1,
45	ATMIF_CARRIER_OFF	= 2,
46	ATMIF_CARRIER_UNKNOWN	= 3,
47	ATMIF_CARRIER_NONE	= 4
48};
49
50enum atmif_suni_mode {
51	ATMIF_SUNI_MODE_SONET	= 1,
52	ATMIF_SUNI_MODE_SDH	= 2,
53	ATMIF_SUNI_MODE_UNKNOWN	= 3
54};
55
56/* forward declaration */
57struct atmif;
58typedef void (*atmif_event_f)(struct atmif *, enum atmif_notify, uintptr_t,
59    void *);
60
61struct atmif_mib {
62	u_int	version;	/* currently 0 */
63
64	u_int	device;		/* type of hardware (system specific) */
65	u_int	serial;		/* card serial number (device specific) */
66	u_int	hw_version;	/* card version (device specific) */
67	u_int	sw_version;	/* firmware version (device specific) */
68	u_int	media;		/* physical media (see MIB) */
69
70	u_char	esi[6];		/* end system identifier (MAC) */
71	u_int	pcr;		/* supported peak cell rate */
72	u_int	vpi_bits;	/* number of used bits in VPI field */
73	u_int	vci_bits;	/* number of used bits in VCI field */
74	u_int	max_vpcs;	/* maximum number of VPCs */
75	u_int	max_vccs;	/* maximum number of VCCs */
76};
77
78struct atmif {
79	struct mibif	*ifp;		/* common interface data */
80	struct atmif_mib *mib;		/* ATM MIB */
81	enum atmif_carrier_state carrier;
82	enum atmif_suni_mode mode;	/* SUNI mode SDH or SONET */
83};
84
85/* find an ATM interface by name */
86struct atmif *atm_find_if_name(const char *);
87
88/* get the interface from the interface index */
89struct atmif *atm_find_if(u_int);
90
91/* register for notifications */
92void *atm_notify_aif(struct atmif *, const struct lmodule *mod,
93    atmif_event_f, void *);
94void atm_unnotify_aif(void *);
95
96/* return the If for a system-specific node number */
97struct atmif *atm_node2if(u_int);
98
99/* return the node id for the if */
100u_int atm_if2node(struct atmif *);
101
102#endif
103