'\" te .\" Copyright (C) 2008, Sun Microsystems, 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_PROTOCOL_NOTIFY_REGISTER 9F "Oct 30, 2008" .SH NAME net_protocol_notify_register, net_instance_protocol_unregister \- add/delete a function to be called for changes to a protocol .SH SYNOPSIS .LP .nf #include #include \fBint\fR \fBnet_protocol_notify_register\fR(\fBnet_handle_t\fR \fIfamily\fR, \fBhook_notify_fn_t\fR *\fIcallback\fR, \fBvoid\fR *\fIarg\fR); \fBint\fR \fBnet_protocol_notify_unregister\fR(\fBnet_handle_t\fR \fIfamily\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 .na \fB\fIfamily\fR\fR .ad .RS 12n value returned from \fBnet_protocol_lookup()\fR. .RE .sp .ne 2 .na \fB\fIcallback\fR\fR .ad .RS 12n function to call when a change occurs. .RE .sp .ne 2 .na \fB\fIarg\fR\fR .ad .RS 12n pointer to pass into the \fBcallback()\fR function when a change occurs. .RE .SH DESCRIPTION .sp .LP The \fBnet_protocol_notify_register()\fR function registers a function represented by the pointer \fIcallback\fR to be called when there is a change to the protocol represented by \fIfamily\fR. The types of changes for which notifications are available for is currently limited to the addition and removal of protocols. .sp .LP The \fBnet_protocol_notify_unregister()\fR function removes the function specified by the pointer \fIcallback\fR from the list of functions to call. This call may fail if the specified function cannot be found. .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 must not block any other protocols. .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 .na \fB\fIname1\fR\fR .ad .RS 9n is the name of the protocol .RE .sp .ne 2 .na \fB\fIname2\fR\fR .ad .RS 9n is \fBNULL\fR. .RE .sp .ne 2 .na \fB\fIname3\fR\fR .ad .RS 9n is the name of the protocol 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 .na \fBEEXIST\fR .ad .RS 10n 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 box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed .TE .SH SEE ALSO .sp .LP \fBattributes\fR(5), \fBnet_protocol_lookup\fR(9F)