xref: /onnv-gate/usr/src/uts/common/sys/hook_event.h (revision 8023:faf256d5c16c)
12958Sdr146992 /*
22958Sdr146992  * CDDL HEADER START
32958Sdr146992  *
42958Sdr146992  * The contents of this file are subject to the terms of the
52958Sdr146992  * Common Development and Distribution License (the "License").
62958Sdr146992  * You may not use this file except in compliance with the License.
72958Sdr146992  *
82958Sdr146992  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92958Sdr146992  * or http://www.opensolaris.org/os/licensing.
102958Sdr146992  * See the License for the specific language governing permissions
112958Sdr146992  * and limitations under the License.
122958Sdr146992  *
132958Sdr146992  * When distributing Covered Code, include this CDDL HEADER in each
142958Sdr146992  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152958Sdr146992  * If applicable, add the following below this CDDL HEADER, with the
162958Sdr146992  * fields enclosed by brackets "[]" replaced with your own identifying
172958Sdr146992  * information: Portions Copyright [yyyy] [name of copyright owner]
182958Sdr146992  *
192958Sdr146992  * CDDL HEADER END
202958Sdr146992  */
212958Sdr146992 /*
225868Sdr146992  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
232958Sdr146992  * Use is subject to license terms.
242958Sdr146992  */
252958Sdr146992 
262958Sdr146992 /*
272958Sdr146992  * This file include definition of message passed from hook provider
282958Sdr146992  * to hook consumer.  If necessary, each hook provider can add its
292958Sdr146992  * own message definition here.
302958Sdr146992  */
312958Sdr146992 
322958Sdr146992 #ifndef _SYS_HOOK_EVENT_H
332958Sdr146992 #define	_SYS_HOOK_EVENT_H
342958Sdr146992 
352958Sdr146992 #include <sys/neti.h>
362958Sdr146992 #include <sys/hook.h>
372958Sdr146992 
382958Sdr146992 #ifdef	__cplusplus
392958Sdr146992 extern "C" {
402958Sdr146992 #endif
412958Sdr146992 
422958Sdr146992 /*
432958Sdr146992  * The hook_pkt_event_t structure is supplied with packet events on
442958Sdr146992  * associated network interfaces.
452958Sdr146992  *
462958Sdr146992  * The members of this structure are defined as follows:
477513SDarren.Reed@Sun.COM  * hpe_protocol - protocol identifier that indicates which protocol the
487513SDarren.Reed@Sun.COM  *                header data is associated with.
492958Sdr146992  * hpe_ifp - "in" interface for packets coming into the system or forwarded
502958Sdr146992  * hpe_ofp - "out" interface for packets being transmitted or forwarded
512958Sdr146992  * hpe_hdr - pointer to protocol header within the packet
522958Sdr146992  * hpe_mp  - pointer to the mblk pointer starting the chain for this packet
532958Sdr146992  * hpe_mb  - pointer to the mblk that contains hpe_hdr
542958Sdr146992  */
552958Sdr146992 typedef struct hook_pkt_event {
567513SDarren.Reed@Sun.COM 	net_handle_t		hpe_protocol;
572958Sdr146992 	phy_if_t		hpe_ifp;
582958Sdr146992 	phy_if_t		hpe_ofp;
592958Sdr146992 	void			*hpe_hdr;
602958Sdr146992 	mblk_t			**hpe_mp;
612958Sdr146992 	mblk_t			*hpe_mb;
625868Sdr146992 	int			hpe_flags;
637513SDarren.Reed@Sun.COM 	void			*hpe_reserved[2];
642958Sdr146992 } hook_pkt_event_t;
652958Sdr146992 
665868Sdr146992 #define	HPE_MULTICAST	0x01
675868Sdr146992 #define	HPE_BROADCAST	0x02
685868Sdr146992 
692958Sdr146992 /*
702958Sdr146992  * NIC events hook provider
712958Sdr146992  */
722958Sdr146992 typedef enum nic_event {
732958Sdr146992 	NE_PLUMB = 1,
742958Sdr146992 	NE_UNPLUMB,
752958Sdr146992 	NE_UP,
762958Sdr146992 	NE_DOWN,
77*8023SPhil.Kirk@Sun.COM 	NE_ADDRESS_CHANGE,
78*8023SPhil.Kirk@Sun.COM 	NE_LIF_UP,
79*8023SPhil.Kirk@Sun.COM 	NE_LIF_DOWN
802958Sdr146992 } nic_event_t;
812958Sdr146992 
822958Sdr146992 typedef void *nic_event_data_t;
832958Sdr146992 
842958Sdr146992 /*
852958Sdr146992  * The hook_nic_event data structure is provided with all network interface
862958Sdr146992  * events.
872958Sdr146992  *
887513SDarren.Reed@Sun.COM  * hne_protocol- network protocol for events, returned from net_lookup
892958Sdr146992  * hne_nic     - physical interface associated with event
902958Sdr146992  * hne_lif     - logical interface (if any) associated with event
912958Sdr146992  * hne_event   - type of event occuring
922958Sdr146992  * hne_data    - pointer to extra data about event or NULL if none
932958Sdr146992  * hne_datalen - size of data pointed to by hne_data (can be 0)
942958Sdr146992  */
952958Sdr146992 typedef struct hook_nic_event {
967513SDarren.Reed@Sun.COM 	net_handle_t		hne_protocol;
972958Sdr146992 	phy_if_t		hne_nic;
982958Sdr146992 	lif_if_t		hne_lif;
992958Sdr146992 	nic_event_t		hne_event;
1002958Sdr146992 	nic_event_data_t	hne_data;
1012958Sdr146992 	size_t			hne_datalen;
1022958Sdr146992 } hook_nic_event_t;
1032958Sdr146992 
1047513SDarren.Reed@Sun.COM /*
1057513SDarren.Reed@Sun.COM  * This structure is used internally by ip to queue events.
1067513SDarren.Reed@Sun.COM  */
1077513SDarren.Reed@Sun.COM struct hook_nic_event_int {
1087513SDarren.Reed@Sun.COM 	netstackid_t		hnei_stackid;
1097513SDarren.Reed@Sun.COM 	hook_nic_event_t	hnei_event;
1107513SDarren.Reed@Sun.COM };
1117513SDarren.Reed@Sun.COM typedef struct hook_nic_event_int hook_nic_event_int_t;
1127513SDarren.Reed@Sun.COM 
1132958Sdr146992 #ifdef	__cplusplus
1142958Sdr146992 }
1152958Sdr146992 #endif
1162958Sdr146992 
1172958Sdr146992 #endif /* _SYS_HOOK_EVENT_H */
118