1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
'\" te
.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (C) 2012, Joyent, Inc. All Rights Reserved.
.\" 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.
.\" 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.
.\" 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]
.TH NET_HOOK_REGISTER 9F "Mar 5, 2012"
.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_register\fR(\fBnet_handle_t\fR \fIinfo\fR, \fBchar\fR *\fIevent\fR, \fBhook_t\fR *\fIhook\fR);
.fi
.SH INTERFACE LEVEL
.sp
.LP
Solaris DDI specific (Solaris DDI).
.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIinfo\fR\fR
.ad
.RS 8n
value returned from a successful call to \fBnet_protocol_register()\fR.
.RE
.sp
.ne 2
.na
\fB\fIname\fR\fR
.ad
.RS 8n
unique name for this hook.
.RE
.sp
.ne 2
.na
\fB\fIhook\fR\fR
.ad
.RS 8n
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 \fIinfo\fR parameter), along with a unique name and a hook
description that includes a reference to an available event. No two hooks on the
same netstack may share a name.
.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
.na
\fB\fBh_func\fR\fR
.ad
.RS 23n
Must be non-NULL and represent a function that fits the specified interface.
.RE
.sp
.ne 2
.na
\fB\fBh_name\fR\fR
.ad
.RS 23n
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
.na
\fB\fBh_flags\fR\fR
.ad
.RS 23n
Currently unused and must be set to 0.
.RE
.sp
.ne 2
.na
\fB\fBh_hint, h_hintvalue\fR\fR
.ad
.RS 23n
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
.na
\fB\fBh_arg;\fR\fR
.ad
.RS 23n
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
.na
\fBENOMEM\fR
.ad
.RS 10n
The system cannot allocate any more memory to support registering this hook.
.RE
.sp
.ne 2
.na
\fBENXIO\fR
.ad
.RS 10n
A hook cannot be found among the given family of events.
.RE
.sp
.ne 2
.na
\fBEEXIST\fR
.ad
.RS 10n
A hook with the given \fBh_name\fR already exists on that event.
.RE
.sp
.ne 2
.na
\fBESRCH\fR
.ad
.RS 10n
A before or after dependency cannot be satisfied due to the hook with
.RE
.sp
.ne 2
.na
\fBEBUSY\fR
.ad
.RS 10n
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
.sp
.ne 2
.na
\fBESHUTDOWN\fR
.ad
.RS 10n
The netstack corresponding to \fIinfo\fR is condemned or no longer exists.
.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
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability Committed
.TE
.SH SEE ALSO
.sp
.LP
\fBnet_hook_unregister\fR(9F), \fBhook_t\fR(9S)
|