2 .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright (C) 2012, Joyent, Inc. All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH NET_HOOK_REGISTER 9F "Mar 5, 2012"
9 net_hook_register \- add a hook to be called in event processing
15 \fBint\fR \fBnet_hook_register\fR(\fBnet_handle_t\fR \fIinfo\fR, \fBchar\fR *\fIevent\fR, \fBhook_t\fR *\fIhook\fR);
21 Solaris DDI specific (Solaris DDI).
29 value returned from a successful call to \fBnet_protocol_register()\fR.
38 unique name for this hook.
47 pointer to a \fBhook_t\fR structure.
53 The \fBnet_hook_register()\fR function uses hooks that allow callbacks to be
54 registered with events that belong to a network protocol. A successful call to
55 \fBnet_hook_register()\fR requires that a valid handle for a network protocol be
56 provided (the \fIinfo\fR parameter), along with a unique name and a hook
57 description that includes a reference to an available event. No two hooks on the
58 same netstack may share a name.
61 While it is possible to use the same \fBhook_t\fR structure with multiple calls
62 to \fBnet_hook_register()\fR, it is not encouraged.
65 The \fBhook_t\fR structure passed in with this function is described by
66 \fBhook_t\fR(9S). The following describes how this structure is used.
73 Must be non-NULL and represent a function that fits the specified interface.
82 Gives the hook a name that represents its owner. No duplication of \fBh_name\fR
83 among the hooks present for an event is allowed.
92 Currently unused and must be set to 0.
98 \fB\fBh_hint, h_hintvalue\fR\fR
101 Specify a hint to \fBnet_hook_register()\fR on how to insert this hook. If the
102 hint cannot be specified, then an error is returned.
111 May take any value that the consumer wishes to have passed back when the hook
118 If the \fBnet_hook_register()\fR function succeeds, 0 is returned. Otherwise,
119 one of the following errors is returned:
126 The system cannot allocate any more memory to support registering this hook.
135 A hook cannot be found among the given family of events.
144 A hook with the given \fBh_name\fR already exists on that event.
153 A before or after dependency cannot be satisfied due to the hook with
162 The \fBh_hint\fR field specifies a hint that cannot currently be satisfied
163 because it conflicts with another hook. An example of this might be specifying
164 \fBHH_FIRST\fR or \fBHH_LAST\fR when another hook has already been registered
174 The netstack corresponding to \fIinfo\fR is condemned or no longer exists.
179 The \fBnet_hook_register()\fR function may be called from user or kernel
184 See \fBattributes\fR(5) for descriptions of the following attributes:
192 ATTRIBUTE TYPE ATTRIBUTE VALUE
194 Interface Stability Committed
200 \fBnet_hook_unregister\fR(9F), \fBhook_t\fR(9S)