1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef _BRIDGED_GLOBAL_H
28#define	_BRIDGED_GLOBAL_H
29
30/*
31 * Globally visible symbols within the "bridged" bridging daemon
32 */
33
34#include <sys/types.h>
35#include <sys/ethernet.h>
36#include <net/bridge.h>
37#include <libdlpi.h>
38#include <libdladm.h>
39#include <libdlbridge.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45struct portdata {
46	int vlan_id;
47	int port_index;
48	unsigned int speed;
49	boolean_t phys_status;		/* physical layer status */
50	boolean_t admin_status;		/* administrative status */
51	boolean_t kern_added;		/* set when added to kernel bridge */
52	boolean_t stp_added;		/* set when added to STP machine */
53	boolean_t referenced;		/* used for refresh */
54	boolean_t sdu_failed;		/* set for non-matching max SDU */
55	boolean_t admin_non_stp;	/* copy of STP library config */
56	boolean_t bpdu_protect;		/* BPDU seen when non-STP */
57	bridge_state_t state;
58	dlpi_handle_t dlpi;
59	dlpi_notifyid_t notifyid;
60	datalink_id_t linkid;
61	const char *name;
62	uchar_t mac_addr[ETHERADDRL];
63};
64
65/* Number of reserved (internal) fdarray entries */
66#define	FDOFFSET	2
67
68/* main.c */
69extern int lock_engine(void);
70extern void unlock_engine(void);
71extern ssize_t strioctl(int, int, void *, size_t);
72extern struct portdata *find_by_linkid(datalink_id_t);
73extern void get_dladm_speed(struct portdata *);
74extern void enable_forwarding(struct portdata *);
75extern boolean_t debugging;
76extern uint32_t tablemax;
77extern const char *instance_name;
78extern dladm_handle_t dlhandle;
79extern boolean_t shutting_down;
80extern struct pollfd *fdarray;
81
82/* door.c */
83extern void init_door(void);
84
85/* dlpi.c */
86extern boolean_t port_dlpi_open(const char *, struct portdata *,
87    datalink_class_t);
88
89/* rstp.c */
90extern void rstp_init(void);
91extern void rstp_refresh(void);
92extern void rstp_change_mac(struct portdata *, const unsigned char *);
93extern boolean_t rstp_add_port(struct portdata *);
94
95/* events.c */
96extern void open_bridge_control(void);
97extern void event_loop(void);
98extern int refresh_count;
99extern dladm_bridge_prot_t protect;
100extern uint_t nextport;
101extern struct portdata **allports;
102extern int control_fd;
103
104#ifdef __cplusplus
105}
106#endif
107
108#endif /* _BRIDGED_GLOBAL_H */
109