| Current File : //usr/share/man/man9f/net_hook_register.9f |
'\" te
.\" Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
.TH net_hook_register 9F "8 Dec 2010" "SunOS 5.11" "Kernel Functions for Drivers"
.SH NAME
net_hook_register \- add a hook to be called in event processing
.SH SYNOPSIS
.LP
.nf
#include <sys/neti.h>
\fBint\fR \fBnet_hook_unregister\fR(\fBnet_handle_t\fR \fInet\fR, \fBchar *\fR\fIhook_name\fR, \fBhook_t\fR \fIhook\fR);
.fi
.SH INTERFACE LEVEL
.sp
.LP
Solaris DDI specific (Solaris DDI).
.SH PARAMETERS
.sp
.ne 2
.mk
.na
\fB\fInet\fR\fR
.ad
.RS 13n
.rt
value returned from a successful call to \fBnet_protocol_register()\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fIhook_name\fR\fR
.ad
.RS 13n
.rt
hook name to be registered
.RE
.sp
.ne 2
.mk
.na
\fB\fIhook\fR\fR
.ad
.RS 13n
.rt
pointer to a \fBhook_t\fR structure
.RE
.SH DESCRIPTION
.sp
.LP
The \fBnet_hook_register()\fR function uses hooks that allow callbacks to be registered with events that belong to a network protocol. A successful call to \fBnet_hook_register()\fR requires that a valid handle for a network protocol be provided (the \fInet\fR parameter), along with a hook description that includes a reference to an available event.
.sp
.LP
While it is possible to use the same \fBhook_t\fR structure with multiple calls to \fBnet_hook_register()\fR, it is not encouraged.
.sp
.LP
The \fBhook_t\fR structure passed in with this function is described by \fBhook_t\fR(9S). The following describes how this structure is used.
.sp
.ne 2
.mk
.na
\fB\fBh_func\fR\fR
.ad
.RS 23n
.rt
Must be non-NULL and represent a function that fits the specified interface.
.RE
.sp
.ne 2
.mk
.na
\fB\fBh_name\fR\fR
.ad
.RS 23n
.rt
Gives the hook a name that represents its owner. No duplication of \fBh_name\fR among the hooks present for an event is allowed.
.RE
.sp
.ne 2
.mk
.na
\fB\fBh_flags\fR\fR
.ad
.RS 23n
.rt
Currently unused and must be set to 0.
.RE
.sp
.ne 2
.mk
.na
\fB\fBh_hint, h_hintvalue\fR\fR
.ad
.RS 23n
.rt
Specify a hint to \fBnet_hook_register()\fR on how to insert this hook. If the hint cannot be specified, then an error is returned.
.RE
.sp
.ne 2
.mk
.na
\fB\fBh_arg;\fR\fR
.ad
.RS 23n
.rt
May take any value that the consumer wishes to have passed back when the hook is activated.
.RE
.SH RETURN VALUES
.sp
.LP
If the \fBnet_hook_register()\fR function succeeds, 0 is returned. Otherwise, one of the following errors is returned:
.sp
.ne 2
.mk
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
.rt
The system cannot allocate any more memory to support registering this hook.
.RE
.sp
.ne 2
.mk
.na
\fB\fBENXIO\fR\fR
.ad
.RS 10n
.rt
A hook cannot be found among the given family of events.
.RE
.sp
.ne 2
.mk
.na
\fB\fBEEXIST\fR\fR
.ad
.RS 10n
.rt
A hook with the given \fBh_name\fR already exists on that event.
.RE
.sp
.ne 2
.mk
.na
\fB\fBESRCH\fR\fR
.ad
.RS 10n
.rt
A before or after dependency cannot be satisfied due to the hook with
.RE
.sp
.ne 2
.mk
.na
\fB\fBEBUSY\fR\fR
.ad
.RS 10n
.rt
The \fBh_hint\fR field specifies a hint that cannot currently be satisfied because it conflicts with another hook. An example of this might be specifying \fBHH_FIRST\fR or \fBHH_LAST\fR when another hook has already been registered with this value.
.RE
.SH CONTEXT
.sp
.LP
The \fBnet_hook_register()\fR function 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
\fBnet_hook_unregister\fR(9F), \fBhook_t\fR(9S)