1133488Sharti/*
2133488Sharti * Copyright (c) 2001-2002
3133488Sharti *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4133488Sharti *	All rights reserved.
5133488Sharti * Copyright (c) 2003-2004
6133488Sharti *	Hartmut Brandt
7133488Sharti *	All rights reserved.
8133488Sharti *
9133488Sharti * Author: Hartmut Brandt <harti@freebsd.org>
10133488Sharti *
11133488Sharti * Redistribution and use in source and binary forms, with or without
12133488Sharti * modification, are permitted provided that the following conditions
13133488Sharti * are met:
14133488Sharti * 1. Redistributions of source code must retain the above copyright
15133488Sharti *    notice, this list of conditions and the following disclaimer.
16133488Sharti * 2. Redistributions in binary form must reproduce the above copyright
17133488Sharti *    notice, this list of conditions and the following disclaimer in the
18133488Sharti *    documentation and/or other materials provided with the distribution.
19133488Sharti *
20133488Sharti * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21133488Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22133488Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23133488Sharti * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
24133488Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25133488Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26133488Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27133488Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28133488Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29133488Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30133488Sharti * SUCH DAMAGE.
31133488Sharti *
32133488Sharti * $Begemot: libunimsg/snmp_atm/snmp_atm.h,v 1.2 2004/08/06 17:30:40 brandt Exp $
33133488Sharti */
34133488Sharti#ifndef _BSNMP_SNMP_ATM_H
35133488Sharti#define _BSNMP_SNMP_ATM_H
36133488Sharti
37133488Shartienum atmif_notify {
38133488Sharti	ATMIF_NOTIFY_DESTROY,	/* interface has been destroyed */
39133488Sharti	ATMIF_NOTIFY_CARRIER,	/* carriere change */
40133488Sharti	ATMIF_NOTIFY_VCC	/* VCC change */
41133488Sharti};
42133488Sharti
43133488Shartienum atmif_carrier_state {
44133488Sharti	ATMIF_CARRIER_ON	= 1,
45133488Sharti	ATMIF_CARRIER_OFF	= 2,
46133488Sharti	ATMIF_CARRIER_UNKNOWN	= 3,
47133488Sharti	ATMIF_CARRIER_NONE	= 4
48133488Sharti};
49133488Sharti
50133488Shartienum atmif_suni_mode {
51133488Sharti	ATMIF_SUNI_MODE_SONET	= 1,
52133488Sharti	ATMIF_SUNI_MODE_SDH	= 2,
53133488Sharti	ATMIF_SUNI_MODE_UNKNOWN	= 3
54133488Sharti};
55133488Sharti
56133488Sharti/* forward declaration */
57133488Shartistruct atmif;
58133488Shartitypedef void (*atmif_event_f)(struct atmif *, enum atmif_notify, uintptr_t,
59133488Sharti    void *);
60133488Sharti
61133488Shartistruct atmif_mib {
62133488Sharti	u_int	version;	/* currently 0 */
63133488Sharti
64133488Sharti	u_int	device;		/* type of hardware (system specific) */
65133488Sharti	u_int	serial;		/* card serial number (device specific) */
66133488Sharti	u_int	hw_version;	/* card version (device specific) */
67133488Sharti	u_int	sw_version;	/* firmware version (device specific) */
68133488Sharti	u_int	media;		/* physical media (see MIB) */
69133488Sharti
70133488Sharti	u_char	esi[6];		/* end system identifier (MAC) */
71133488Sharti	u_int	pcr;		/* supported peak cell rate */
72133488Sharti	u_int	vpi_bits;	/* number of used bits in VPI field */
73133488Sharti	u_int	vci_bits;	/* number of used bits in VCI field */
74133488Sharti	u_int	max_vpcs;	/* maximum number of VPCs */
75133488Sharti	u_int	max_vccs;	/* maximum number of VCCs */
76133488Sharti};
77133488Sharti
78133488Shartistruct atmif {
79133488Sharti	struct mibif	*ifp;		/* common interface data */
80133488Sharti	struct atmif_mib *mib;		/* ATM MIB */
81133488Sharti	enum atmif_carrier_state carrier;
82133488Sharti	enum atmif_suni_mode mode;	/* SUNI mode SDH or SONET */
83133488Sharti};
84133488Sharti
85133488Sharti/* find an ATM interface by name */
86133488Shartistruct atmif *atm_find_if_name(const char *);
87133488Sharti
88133488Sharti/* get the interface from the interface index */
89133488Shartistruct atmif *atm_find_if(u_int);
90133488Sharti
91133488Sharti/* register for notifications */
92133488Shartivoid *atm_notify_aif(struct atmif *, const struct lmodule *mod,
93133488Sharti    atmif_event_f, void *);
94133488Shartivoid atm_unnotify_aif(void *);
95133488Sharti
96133488Sharti/* return the If for a system-specific node number */
97133488Shartistruct atmif *atm_node2if(u_int);
98133488Sharti
99133488Sharti/* return the node id for the if */
100133488Shartiu_int atm_if2node(struct atmif *);
101133488Sharti
102133488Sharti#endif
103