1net_hook_register(9F) Kernel Functions for Drivers net_hook_register(9F)
2
3
4
6 net_hook_register - add a hook to be called in event processing
7
9 #include <sys/neti.h>
10
11 net_hook_t net_hook_register(const net_data_t net, hook_t *hook);
12
13
15 Solaris DDI specific (Solaris DDI).
16
18 net value returned from a successful call to net_protocol_regis‐
19 ter().
20
21
22 hook pointer to a hook_t structure.
23
24
26 The net_hook_register() function uses hooks that allow callbacks to be
27 registered with events that belong to a network protocol. A successful
28 call to net_hook_register() requires that a valid handle for a network
29 protocol be provided (the net parameter), along with a hook description
30 that includes a reference to an available event.
31
32
33 While it is possible to use the same hook_t structure with multiple
34 calls to net_hook_register(), it is not encouraged.
35
36
37 The hook_t structure passed in with this function is described by
38 hook_t(9S). The following describes how this structure is used.
39
40 h_func Must be non-NULL and represent a function that
41 fits the specified interface.
42
43
44 h_name Gives the hook a name that represents its owner.
45 No duplication of h_name among the hooks present
46 for an event is allowed.
47
48
49 h_flags Currently unused and must be set to 0.
50
51
52 h_hint, h_hintvalue Specify a hint to net_hook_register() on how to
53 insert this hook. If the hint cannot be speci‐
54 fied, then an error is returned.
55
56
57 h_arg; May take any value that the consumer wishes to
58 have passed back when the hook is activated.
59
60
62 If the net_hook_register() function succeeds, 0 is returned. Otherwise,
63 one of the following errors is returned:
64
65 ENOMEM The system cannot allocate any more memory to support regis‐
66 tering this hook.
67
68
69 ENXIO A hook cannot be found among the given family of events.
70
71
72 EEXIST A hook with the given h_name already exists on that event.
73
74
75 ESRCH A before or after dependency cannot be satisfied due to the
76 hook with
77
78
79 EBUSY The h_hint field specifies a hint that cannot currently be
80 satisfied because it conflicts with another hook. An example
81 of this might be specifying HH_FIRST or HH_LAST when another
82 hook has already been registered with this value.
83
84
86 The net_hook_register() function may be called from user or kernel
87 context.
88
90 See attributes(5) for descriptions of the following attributes:
91
92
93
94
95 ┌─────────────────────────────┬─────────────────────────────┐
96 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
97 ├─────────────────────────────┼─────────────────────────────┤
98 │Availability │SUNWcsu │
99 ├─────────────────────────────┼─────────────────────────────┤
100 │Interface Stability │Committed │
101 └─────────────────────────────┴─────────────────────────────┘
102
104 net_hook_unregister(9F), hook_t(9S)
105
106
107
108SunOS 5.11 1 May 2008 net_hook_register(9F)