Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

hook_t(9s) [opensolaris man page]

hook_t(9S)						    Data Structures for Drivers 						hook_t(9S)

NAME
hook_t - callback structure for subscribing to netinfo events SYNOPSIS
#include <sys/hook.h> INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). DESCRIPTION
The hook_t data structure defines a callback that is to be inserted into a networking event. This data structure must be allocated with a call to hook_alloc() and released with a call to hook_free(). STRUCTURE MEMBERS
hook_func_t h_func; /* callback function to invoke */ char *h_name; /* unique name given to the hook */ int h_flags; hook_hint_t h_hint; /* insertion hint type */ uintptr_t h_hintvalue; /* used with h_hint */ void *h_arg; /* value to pass into h_func */ typedef int (*hook_func_t)(net_event_t token, hook_data_t info, void *); HINT TYPES Hook hints are hints that are used at the time of insertion and are not rules that enforce where a hook lives for its entire lifetime on an event. The valid values for the h_hint field are: HH_NONE Insert the hook wherever convenient. HH_FIRST Place the hook first on the list of hooks. HH_LAST Place the hook last on the list of hooks. HH_BEFORE Place the hook before another hook on the list of hooks. The value in h_hintvalue must be a pointer to the name of another hook. HH_AFTER Place the hook after another hook on the list of hooks. The value in h_hintvalue must be a pointer to the name of another hook. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ SEE ALSO
netinfo(9F) SunOS 5.11 1 May 2008 hook_t(9S)

Check Out this Related Man Page

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

NAME
net_event_notify_register, net_event_notify_unregister - add/delete a function to be called for changes to a event SYNOPSIS
#include <sys/hook.h> #include <sys/neti.h> int net_event_notify_register(net_handle_t family, char *event, hook_notify_fn_t *callback, void *arg); int net_event_notify_unregister(net_handle_t family, char *event, 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 a successful call to net_protocol_lookup(). callback function to call when a change occurs. event name of the event for which notification of change is desired. arg pointer to pass into the callback() function when a change occurs. DESCRIPTION
The net_event_notify_register() function registers a function represented by the pointer callback to be called when there is a change to the event represented by family. The types of changes for which notifications are available for is currently limited to the addition and removal of hooks. The net_event_notify_unregister() function indicates that there is no longer any desire to receive notification of changes to the event through function calls to the specified callback. The name of a hook should be considered a private interface unless otherwise specified. The hook names used by IPFilter in Solaris are a public, but uncommitted, interface. 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 when the event occurs must not block any other events. 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 the name of the event name3 is the name of the hook 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_hook_register(9F), net_hook_unregister(9F), net_protocol_lookup(9F) SunOS 5.11 30 Oct 2008 net_event_notify_register(9F)
Man Page