xref: /onnv-gate/usr/src/uts/common/sys/hook_event.h (revision 2958:98aa41c076f5)
1*2958Sdr146992 /*
2*2958Sdr146992  * CDDL HEADER START
3*2958Sdr146992  *
4*2958Sdr146992  * The contents of this file are subject to the terms of the
5*2958Sdr146992  * Common Development and Distribution License (the "License").
6*2958Sdr146992  * You may not use this file except in compliance with the License.
7*2958Sdr146992  *
8*2958Sdr146992  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*2958Sdr146992  * or http://www.opensolaris.org/os/licensing.
10*2958Sdr146992  * See the License for the specific language governing permissions
11*2958Sdr146992  * and limitations under the License.
12*2958Sdr146992  *
13*2958Sdr146992  * When distributing Covered Code, include this CDDL HEADER in each
14*2958Sdr146992  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*2958Sdr146992  * If applicable, add the following below this CDDL HEADER, with the
16*2958Sdr146992  * fields enclosed by brackets "[]" replaced with your own identifying
17*2958Sdr146992  * information: Portions Copyright [yyyy] [name of copyright owner]
18*2958Sdr146992  *
19*2958Sdr146992  * CDDL HEADER END
20*2958Sdr146992  */
21*2958Sdr146992 /*
22*2958Sdr146992  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*2958Sdr146992  * Use is subject to license terms.
24*2958Sdr146992  */
25*2958Sdr146992 
26*2958Sdr146992 /*
27*2958Sdr146992  * This file include definition of message passed from hook provider
28*2958Sdr146992  * to hook consumer.  If necessary, each hook provider can add its
29*2958Sdr146992  * own message definition here.
30*2958Sdr146992  */
31*2958Sdr146992 
32*2958Sdr146992 #ifndef _SYS_HOOK_EVENT_H
33*2958Sdr146992 #define	_SYS_HOOK_EVENT_H
34*2958Sdr146992 
35*2958Sdr146992 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36*2958Sdr146992 
37*2958Sdr146992 #include <sys/neti.h>
38*2958Sdr146992 #include <sys/hook.h>
39*2958Sdr146992 
40*2958Sdr146992 #ifdef	__cplusplus
41*2958Sdr146992 extern "C" {
42*2958Sdr146992 #endif
43*2958Sdr146992 
44*2958Sdr146992 /*
45*2958Sdr146992  * The hook_pkt_event_t structure is supplied with packet events on
46*2958Sdr146992  * associated network interfaces.
47*2958Sdr146992  *
48*2958Sdr146992  * The members of this structure are defined as follows:
49*2958Sdr146992  * hpe_ifp - "in" interface for packets coming into the system or forwarded
50*2958Sdr146992  * hpe_ofp - "out" interface for packets being transmitted or forwarded
51*2958Sdr146992  * hpe_hdr - pointer to protocol header within the packet
52*2958Sdr146992  * hpe_mp  - pointer to the mblk pointer starting the chain for this packet
53*2958Sdr146992  * hpe_mb  - pointer to the mblk that contains hpe_hdr
54*2958Sdr146992  */
55*2958Sdr146992 typedef struct hook_pkt_event {
56*2958Sdr146992 	phy_if_t		hpe_ifp;
57*2958Sdr146992 	phy_if_t		hpe_ofp;
58*2958Sdr146992 	void			*hpe_hdr;
59*2958Sdr146992 	mblk_t			**hpe_mp;
60*2958Sdr146992 	mblk_t			*hpe_mb;
61*2958Sdr146992 } hook_pkt_event_t;
62*2958Sdr146992 
63*2958Sdr146992 /*
64*2958Sdr146992  * NIC events hook provider
65*2958Sdr146992  */
66*2958Sdr146992 typedef enum nic_event {
67*2958Sdr146992 	NE_PLUMB = 1,
68*2958Sdr146992 	NE_UNPLUMB,
69*2958Sdr146992 	NE_UP,
70*2958Sdr146992 	NE_DOWN,
71*2958Sdr146992 	NE_ADDRESS_CHANGE
72*2958Sdr146992 } nic_event_t;
73*2958Sdr146992 
74*2958Sdr146992 typedef void *nic_event_data_t;
75*2958Sdr146992 
76*2958Sdr146992 /*
77*2958Sdr146992  * The hook_nic_event data structure is provided with all network interface
78*2958Sdr146992  * events.
79*2958Sdr146992  *
80*2958Sdr146992  * hne_family  - network family of events, returned from net_lookup
81*2958Sdr146992  * hne_nic     - physical interface associated with event
82*2958Sdr146992  * hne_lif     - logical interface (if any) associated with event
83*2958Sdr146992  * hne_event   - type of event occuring
84*2958Sdr146992  * hne_data    - pointer to extra data about event or NULL if none
85*2958Sdr146992  * hne_datalen - size of data pointed to by hne_data (can be 0)
86*2958Sdr146992  */
87*2958Sdr146992 typedef struct hook_nic_event {
88*2958Sdr146992 	net_data_t		hne_family;
89*2958Sdr146992 	phy_if_t		hne_nic;
90*2958Sdr146992 	lif_if_t		hne_lif;
91*2958Sdr146992 	nic_event_t		hne_event;
92*2958Sdr146992 	nic_event_data_t	hne_data;
93*2958Sdr146992 	size_t			hne_datalen;
94*2958Sdr146992 } hook_nic_event_t;
95*2958Sdr146992 
96*2958Sdr146992 #ifdef	__cplusplus
97*2958Sdr146992 }
98*2958Sdr146992 #endif
99*2958Sdr146992 
100*2958Sdr146992 #endif /* _SYS_HOOK_EVENT_H */
101