Current File : //usr/share/man/man9f/net_event_notify_register.9f
'\" te
.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
.TH net_event_notify_register 9F "30 Oct 2008" "SunOS 5.11" "Kernel Functions for Drivers"
.SH NAME
net_event_notify_register, net_event_notify_unregister \- add/delete a function to be called for changes to a event
.SH SYNOPSIS
.LP
.nf
#include <sys/hook.h>
#include <sys/neti.h>

\fBint\fR \fBnet_event_notify_register\fR(\fBnet_handle_t\fR \fIfamily\fR, \fBchar\fR 
     *\fIevent\fR, \fBhook_notify_fn_t\fR *\fIcallback\fR, \fBvoid\fR *\fIarg\fR); 

\fBint\fR \fBnet_event_notify_unregister\fR(\fBnet_handle_t\fR \fIfamily\fR, \fBchar\fR 
     *\fIevent\fR, \fBhook_notify_fn_t\fR *\fIcallback\fR); 

\fBtypedef int\fR (* \fBhook_notify_fn_t\fR)(\fBhook_notify_cmd_t command,\fR
     \fBvoid\fR *\fIarg\fR, \fBconst char\fR *\fIname1\fR, \fBconst char\fR *\fIname2\fR, \fBconst char\fR 
     *\fIname3\fR);
.fi

.SH INTERFACE LEVEL
.sp
.LP
Solaris DDI specific (Solaris DDI).
.SH PARAMETERS
.sp
.ne 2
.mk
.na
\fB\fIfamily\fR\fR
.ad
.RS 12n
.rt  
value returned from a successful call to \fBnet_protocol_lookup()\fR.
.RE

.sp
.ne 2
.mk
.na
\fB\fIcallback\fR\fR
.ad
.RS 12n
.rt  
function to call when a change occurs.
.RE

.sp
.ne 2
.mk
.na
\fB\fIevent\fR\fR
.ad
.RS 12n
.rt  
name of the event for which notification of change is desired.
.RE

.sp
.ne 2
.mk
.na
\fB\fIarg\fR\fR
.ad
.RS 12n
.rt  
pointer to pass into the \fBcallback()\fR function when a change occurs.
.RE

.SH DESCRIPTION
.sp
.LP
The \fBnet_event_notify_register()\fR function registers a function represented by the pointer \fIcallback\fR to be called when there is a change to the event represented by \fIfamily\fR. The types of changes for which notifications are available for is currently limited to the addition and removal of hooks.
.sp
.LP
The \fBnet_event_notify_unregister()\fR function indicates that there is no longer any desire to receive notification of changes to the event through function calls to the specified \fIcallback\fR.
.sp
.LP
The name of a hook should be considered a private interface unless otherwise specified. The hook names used by \fBIPFilter\fR in Solaris are a public, but uncommitted, interface.
.sp
.LP
Multiple \fIcallback\fR functions may be registered through this interface. The same set of parameters is passed to each \fIcallback\fR function. The memory referenced through the pointers passed to  the  \fIcallback\fR should be treated as pointing to read-only memory. Changing this data is strictly prohibited.
.sp
.LP
The function that is called when the \fIevent\fR occurs must not block any other events.
.sp
.LP
The arguments passed through to the \fBcallback\fR are as follows (the command is either \fBHN_REGISTER\fR or \fBHN_UNREGISTER\fR):
.sp
.ne 2
.mk
.na
\fB\fIname1\fR\fR
.ad
.RS 9n
.rt  
is the name of the protocol.
.RE

.sp
.ne 2
.mk
.na
\fB\fIname2\fR\fR
.ad
.RS 9n
.rt  
is the name of the event
.RE

.sp
.ne 2
.mk
.na
\fB\fIname3\fR\fR
.ad
.RS 9n
.rt  
is the name of the hook being added/removed
.RE

.SH RETURN VALUES
.sp
.LP
If these functions succeed, 0 is returned. Otherwise, the following error is returned:
.sp
.ne 2
.mk
.na
\fBEEXIST\fR
.ad
.RS 10n
.rt  
the given callback function is already registered.
.RE

.SH CONTEXT
.sp
.LP
These functions may be called from user or kernel context.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitysystem/core-os
_
Interface StabilityCommitted
.TE

.SH SEE ALSO
.sp
.LP
\fBattributes\fR(5), \fBnet_hook_register\fR(9F), \fBnet_hook_unregister\fR(9F), \fBnet_protocol_lookup\fR(9F)