Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

net_instance_protocol_unregister(9f) [opensolaris man page]

net_protocol_notify_register(9F)			   Kernel Functions for Drivers 			  net_protocol_notify_register(9F)

NAME
net_protocol_notify_register, net_instance_protocol_unregister - add/delete a function to be called for changes to a protocol SYNOPSIS
#include <sys/hook.h> #include <sys/neti.h> int net_protocol_notify_register(net_handle_t family, hook_notify_fn_t *callback, void *arg); int net_protocol_notify_unregister(net_handle_t family, hook_notify_fn_t *callback); typedef int (* hook_notify_fn_t)(hook_notify_cmd_t command, void *arg, const char *name1, const char *name2, const char *name3); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
family value returned from net_protocol_lookup(). callback function to call when a change occurs. arg pointer to pass into the callback() function when a change occurs. DESCRIPTION
The net_protocol_notify_register() function registers a function represented by the pointer callback to be called when there is a change to the protocol represented by family. The types of changes for which notifications are available for is currently limited to the addition and removal of protocols. The net_protocol_notify_unregister() function removes the function specified by the pointer callback from the list of functions to call. This call may fail if the specified function cannot be found. Multiple callback functions may be registered through this interface. The same set of parameters is passed to each callback function. The memory referenced through the pointers passed to the callback should be treated as pointing to read-only memory. Changing this data is strictly prohibited. The function that is called must not block any other protocols. The arguments passed through to the callback are as follows (the command is either HN_REGISTER or HN_UNREGISTER): name1 is the name of the protocol name2 is NULL. name3 is the name of the protocol being added/removed RETURN VALUES
If these functions succeed, 0 is returned. Otherwise, the following error is returned: EEXIST the given callback function is already registered. CONTEXT
These functions may be called from user or kernel context. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5), net_protocol_lookup(9F) SunOS 5.11 30 Oct 2008 net_protocol_notify_register(9F)

Check Out this Related Man Page

CALLBACK(9)						   BSD Kernel Developer's Manual					       CALLBACK(9)

NAME
callback -- generic callback interface SYNOPSIS
#include <sys/callback.h> void callback_head_init(struct callback_head *ch, int ipl); void callback_head_destroy(struct callback_head *ch); void callback_register(struct callback_head *ch, struct callback_entry *ce, void *obj, int (*fn)(struct callback_entry *, void *, void *)); void callback_unregister(struct callback_head *ch, struct callback_entry *ce); int callback_run_roundrobin(struct callback_head *ch, void *arg); DESCRIPTION
The generic callback interface allows lower-level layer code to execute a registered function, or set of functions, from the higher-level layer. Registered functions must return one of these constants: CALLBACK_CHAIN_CONTINUE Indicates that the function call was successful. The following functions in the chain will be called. CALLBACK_CHAIN_ABORT Indicates a failure case in the function call. Any following functions in the chain will not be executed. FUNCTIONS
The callback structure callback_head should be initialized and destroyed using the functions described below. This structure contains the list of callback entries and other internal data. The callback_entry structure is an entry, normally associated with the higher-level object. It contains the internal data of the callback interface. callback_head_init(ch, ipl) Initialize the callback structure specified by ch. The highest IPL at which this callback can be used is specified by ipl. callback_head_destroy(ch) Destroy the callback structure specified by ch. The caller must unregister all functions before destroying the callback structure. callback_register(ch, ce, obj, fn) Register the callback function in the callback structure specified by ch. ce should point to the entry structure of the callback object. The callback object itself is specified by obj. The function pointer is specified by fn. callback_unregister(ch, ce) Unregister the callback function from the structure specified by ch. The entry should be passed as ce. This function may block. callback_run_roundrobin(ch, arg) Executes all functions registered in the callback structure, specified by ch. The functions are executed in round-robin fashion. The value of arg will be passed to the callback functions. CODE REFERENCES
The callback interface is implemented within the file sys/kern/subr_callback.c. SEE ALSO
intro(9) BSD
October 28, 2009 BSD
Man Page