8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / man / man9f / net_event_notify_register.9f
blobad4d374281e210b33875ff4b2983de6390b939f4
1 '\" te
2 .\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH NET_EVENT_NOTIFY_REGISTER 9F "Oct 30, 2008"
7 .SH NAME
8 net_event_notify_register, net_event_notify_unregister \- add/delete a function
9 to be called for changes to a event
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <sys/hook.h>
14 #include <sys/neti.h>
16 \fBint\fR \fBnet_event_notify_register\fR(\fBnet_handle_t\fR \fIfamily\fR, \fBchar\fR
17      *\fIevent\fR, \fBhook_notify_fn_t\fR *\fIcallback\fR, \fBvoid\fR *\fIarg\fR);
19 \fBint\fR \fBnet_event_notify_unregister\fR(\fBnet_handle_t\fR \fIfamily\fR, \fBchar\fR
20      *\fIevent\fR, \fBhook_notify_fn_t\fR *\fIcallback\fR);
22 \fBtypedef int\fR (* \fBhook_notify_fn_t\fR)(\fBhook_notify_cmd_t command,\fR
23      \fBvoid\fR *\fIarg\fR, \fBconst char\fR *\fIname1\fR, \fBconst char\fR *\fIname2\fR, \fBconst char\fR
24      *\fIname3\fR);
25 .fi
27 .SH INTERFACE LEVEL
28 .sp
29 .LP
30 Solaris DDI specific (Solaris DDI).
31 .SH PARAMETERS
32 .sp
33 .ne 2
34 .na
35 \fB\fIfamily\fR\fR
36 .ad
37 .RS 12n
38 value returned from a successful call to \fBnet_protocol_lookup()\fR.
39 .RE
41 .sp
42 .ne 2
43 .na
44 \fB\fIcallback\fR\fR
45 .ad
46 .RS 12n
47 function to call when a change occurs.
48 .RE
50 .sp
51 .ne 2
52 .na
53 \fB\fIevent\fR\fR
54 .ad
55 .RS 12n
56 name of the event for which notification of change is desired.
57 .RE
59 .sp
60 .ne 2
61 .na
62 \fB\fIarg\fR\fR
63 .ad
64 .RS 12n
65 pointer to pass into the \fBcallback()\fR function when a change occurs.
66 .RE
68 .SH DESCRIPTION
69 .sp
70 .LP
71 The \fBnet_event_notify_register()\fR function registers a function represented
72 by the pointer \fIcallback\fR to be called when there is a change to the event
73 represented by \fIfamily\fR. The types of changes for which notifications are
74 available for is currently limited to the addition and removal of hooks.
75 .sp
76 .LP
77 The \fBnet_event_notify_unregister()\fR function indicates that there is no
78 longer any desire to receive notification of changes to the event through
79 function calls to the specified \fIcallback\fR.
80 .sp
81 .LP
82 The name of a hook should be considered a private interface unless otherwise
83 specified. The hook names used by \fBIPFilter\fR in Solaris are a public, but
84 uncommitted, interface.
85 .sp
86 .LP
87 Multiple \fIcallback\fR functions may be registered through this interface. The
88 same set of parameters is passed to each \fIcallback\fR function. The memory
89 referenced through the pointers passed to  the  \fIcallback\fR should be
90 treated as pointing to read-only memory. Changing this data is strictly
91 prohibited.
92 .sp
93 .LP
94 The function that is called when the \fIevent\fR occurs must not block any
95 other events.
96 .sp
97 .LP
98 The arguments passed through to the \fBcallback\fR are as follows (the command
99 is either \fBHN_REGISTER\fR or \fBHN_UNREGISTER\fR):
101 .ne 2
103 \fB\fIname1\fR\fR
105 .RS 9n
106 is the name of the protocol.
110 .ne 2
112 \fB\fIname2\fR\fR
114 .RS 9n
115 is the name of the event
119 .ne 2
121 \fB\fIname3\fR\fR
123 .RS 9n
124 is the name of the hook being added/removed
127 .SH RETURN VALUES
130 If these functions succeed, 0 is returned. Otherwise, the following error is
131 returned:
133 .ne 2
135 \fBEEXIST\fR
137 .RS 10n
138 the given callback function is already registered.
141 .SH CONTEXT
144 These functions may be called from user or kernel context.
145 .SH ATTRIBUTES
148 See \fBattributes\fR(5) for descriptions of the following attributes:
153 box;
154 c | c
155 l | l .
156 ATTRIBUTE TYPE  ATTRIBUTE VALUE
158 Interface Stability     Committed
161 .SH SEE ALSO
164 \fBattributes\fR(5), \fBnet_hook_register\fR(9F),
165 \fBnet_hook_unregister\fR(9F), \fBnet_protocol_lookup\fR(9F)