xref: /titanic_41/usr/src/cmd/cmd-inet/usr.lib/bridged/global.h (revision e5816e352629470f540696fb7aa56c52d6719e67)
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
42 extern "C" {
43 #endif
44 
45 struct 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 */
69 extern int lock_engine(void);
70 extern void unlock_engine(void);
71 extern ssize_t strioctl(int, int, void *, size_t);
72 extern struct portdata *find_by_linkid(datalink_id_t);
73 extern void get_dladm_speed(struct portdata *);
74 extern void enable_forwarding(struct portdata *);
75 extern boolean_t debugging;
76 extern uint32_t tablemax;
77 extern const char *instance_name;
78 extern dladm_handle_t dlhandle;
79 extern boolean_t shutting_down;
80 extern struct pollfd *fdarray;
81 
82 /* door.c */
83 extern void init_door(void);
84 
85 /* dlpi.c */
86 extern boolean_t port_dlpi_open(const char *, struct portdata *,
87     datalink_class_t);
88 
89 /* rstp.c */
90 extern void rstp_init(void);
91 extern void rstp_refresh(void);
92 extern void rstp_change_mac(struct portdata *, const unsigned char *);
93 extern boolean_t rstp_add_port(struct portdata *);
94 
95 /* events.c */
96 extern void open_bridge_control(void);
97 extern void event_loop(void);
98 extern int refresh_count;
99 extern dladm_bridge_prot_t protect;
100 extern uint_t nextport;
101 extern struct portdata **allports;
102 extern int control_fd;
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif /* _BRIDGED_GLOBAL_H */
109