11573Srgrimes/*-
214272Spst * Copyright (c) 2010 Isilon Systems, Inc.
31573Srgrimes * Copyright (c) 2010 iX Systems, Inc.
41573Srgrimes * Copyright (c) 2010 Panasas, Inc.
51573Srgrimes * All rights reserved.
61573Srgrimes *
71573Srgrimes * Redistribution and use in source and binary forms, with or without
81573Srgrimes * modification, are permitted provided that the following conditions
91573Srgrimes * are met:
101573Srgrimes * 1. Redistributions of source code must retain the above copyright
111573Srgrimes *    notice unmodified, this list of conditions, and the following
121573Srgrimes *    disclaimer.
131573Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
141573Srgrimes *    notice, this list of conditions and the following disclaimer in the
151573Srgrimes *    documentation and/or other materials provided with the distribution.
161573Srgrimes *
171573Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
181573Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
191573Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
201573Srgrimes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
211573Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
221573Srgrimes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
231573Srgrimes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
241573Srgrimes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
251573Srgrimes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
261573Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
271573Srgrimes */
281573Srgrimes
291573Srgrimes#ifndef	_LINUX_NET_NETEVENT_H_
301573Srgrimes#define	_LINUX_NET_NETEVENT_H_
311573Srgrimes
321573Srgrimes#include <netinet/if_ether.h>
331573Srgrimes
3414272Spstenum netevent_notif_type {
351573Srgrimes	NETEVENT_NEIGH_UPDATE = 0,
3692905Sobrien#if 0 /* Unsupported events. */
3792905Sobrien        NETEVENT_PMTU_UPDATE,
381573Srgrimes        NETEVENT_REDIRECT,
391573Srgrimes#endif
401573Srgrimes};
411573Srgrimes
421573Srgrimesstruct llentry;
431573Srgrimes
441573Srgrimesstatic inline void
451573Srgrimes_handle_arp_update_event(void *arg, struct llentry *lle, int evt __unused)
461573Srgrimes{
471573Srgrimes	struct notifier_block *nb;
4892905Sobrien
4992905Sobrien	nb = arg;
5092905Sobrien	nb->notifier_call(nb, NETEVENT_NEIGH_UPDATE, lle);
5192905Sobrien}
5292905Sobrien
531573Srgrimesstatic inline int
541573Srgrimesregister_netevent_notifier(struct notifier_block *nb)
5514272Spst{
5614272Spst	nb->tags[NETEVENT_NEIGH_UPDATE] = EVENTHANDLER_REGISTER(
571573Srgrimes	    lle_event, _handle_arp_update_event, nb, 0);
5814272Spst	return (0);
591573Srgrimes}
601573Srgrimes
61189291Sdelphijstatic inline int
621573Srgrimesunregister_netevent_notifier(struct notifier_block *nb)
631573Srgrimes{
6414272Spst
6514272Spst	EVENTHANDLER_DEREGISTER(lle_event, nb->tags[NETEVENT_NEIGH_UPDATE]);
661573Srgrimes
671573Srgrimes	return (0);
681573Srgrimes}
691573Srgrimes
701573Srgrimes#endif /* _LINUX_NET_NETEVENT_H_ */
711573Srgrimes