aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/ngatm/snmp_atm/atm.h
blob: 0df6f7e3eaecebdcae973509a98e57372d4940a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * Copyright (c) 2004
 *	Deutsches Zentrum fuer Luft- und Raumfahrt.
 *	All rights reserved.
 *
 * Author: Hartmut Brandt <harti@freebsd.org>
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $Begemot: libunimsg/snmp_atm/atm.h,v 1.2 2004/08/11 07:55:22 brandt Exp $
 */

#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>

#include <net/if.h>
#include <net/if_mib.h>

#include <bsnmp/snmpmod.h>
#include <bsnmp/snmp_mibII.h>
#include "snmp_atm.h"

/*
 * Event registrations
 */
struct atmif_reg {
	TAILQ_ENTRY(atmif_reg) link;
	void		*data;
	atmif_event_f	func;
	const struct lmodule *mod;
	struct atmif_priv *aif;		/* back pointer */
};
TAILQ_HEAD(atmif_reg_list, atmif_reg);

/*
 * Interface data
 */
struct atmif_priv {
	struct atmif	pub;	/* public part, must be first */
	TAILQ_ENTRY(atmif_priv) link;
	u_int		index;		/* if_index */
	void		*ifpreg;
	struct atmif_sys *sys;
	struct atmif_reg_list notify;
};
TAILQ_HEAD(atmif_list, atmif_priv);

/* list of all (known) ATM interfaces */
extern struct atmif_list atmif_list;

extern struct lmodule *module;

/* Check the carrier state of the interface */
void atmif_check_carrier(struct atmif_priv *);

/* Send notification to all listeners. */
void atmif_send_notification(struct atmif_priv *, enum atmif_notify, uintptr_t);

/* Get the interface point for a table access */
int atmif_get_aif(struct snmp_value *, u_int, enum snmp_op,
	struct atmif_priv **);

/* Destroy system dependend stuff. */
void atmif_sys_destroy(struct atmif_priv *);

/* Attach to an ATM interface */
int atmif_sys_attach_if(struct atmif_priv *);

/* Get vendor string */
int atm_sys_get_hw_vendor(struct atmif_priv *, struct snmp_value *);

/* Get device string */
int atm_sys_get_hw_device(struct atmif_priv *, struct snmp_value *);

/* Extract the ATM MIB from the interface's private MIB */
void atmif_sys_fill_mib(struct atmif_priv *);