Lines Matching full:hook

100 typedef	int	ng_newhook_t(node_p node, hook_p hook, const char *name);
102 typedef int ng_connect_t(hook_p hook);
104 typedef int ng_rcvdata_t(hook_p hook, item_p item);
105 typedef int ng_disconnect_t(hook_p hook);
106 typedef int ng_rcvitem (node_p node, hook_p hook, item_p item);
109 ***************** Hook Structure and Methods **************************
112 * Structure of a hook
116 void *hk_private; /* node dependent ID for this hook */
117 int hk_flags; /* info about this hook/link */
118 int hk_type; /* tbd: hook data link type */
120 struct ng_node *hk_node; /* The node this hook is attached to */
133 /* Flags for a hook */
137 #define HK_DEAD 0x0008 /* This is the dead hook.. don't free */
138 #define HK_HI_STACK 0x0010 /* Hook has hi stack usage */
139 #define HK_TO_INBOUND 0x0020 /* Hook on ntw. stack inbound path. */
142 * Public Methods for hook
145 void ng_unref_hook(hook_p hook); /* don't move this */
146 #define _NG_HOOK_REF(hook) refcount_acquire(&(hook)->hk_refs) argument
147 #define _NG_HOOK_NAME(hook) ((hook)->hk_name) argument
148 #define _NG_HOOK_UNREF(hook) ng_unref_hook(hook) argument
149 #define _NG_HOOK_SET_PRIVATE(hook, val) do {(hook)->hk_private = val;} while (0) argument
150 #define _NG_HOOK_SET_RCVMSG(hook, val) do {(hook)->hk_rcvmsg = val;} while (0) argument
151 #define _NG_HOOK_SET_RCVDATA(hook, val) do {(hook)->hk_rcvdata = val;} while (0) argument
152 #define _NG_HOOK_PRIVATE(hook) ((hook)->hk_private) argument
153 #define _NG_HOOK_NOT_VALID(hook) ((hook)->hk_flags & HK_INVALID) argument
154 #define _NG_HOOK_IS_VALID(hook) (!((hook)->hk_flags & HK_INVALID)) argument
155 #define _NG_HOOK_NODE(hook) ((hook)->hk_node) /* only rvalue! */ argument
156 #define _NG_HOOK_PEER(hook) ((hook)->hk_peer) /* only rvalue! */ argument
157 #define _NG_HOOK_FORCE_WRITER(hook) \ argument
158 do { hook->hk_flags |= HK_FORCE_WRITER; } while (0)
159 #define _NG_HOOK_FORCE_QUEUE(hook) do { hook->hk_flags |= HK_QUEUE; } while (0) argument
160 #define _NG_HOOK_SET_TO_INBOUND(hook) \ argument
161 do { hook->hk_flags |= HK_TO_INBOUND; } while (0)
162 #define _NG_HOOK_HI_STACK(hook) do { hook->hk_flags |= HK_HI_STACK; } while (0) argument
165 #define NG_PEER_NODE(hook) NG_HOOK_NODE(NG_HOOK_PEER(hook)) argument
166 #define NG_PEER_HOOK_NAME(hook) NG_HOOK_NAME(NG_HOOK_PEER(hook)) argument
167 #define NG_PEER_NODE_NAME(hook) NG_NODE_NAME(NG_PEER_NODE(hook)) argument
171 void dumphook (hook_p hook, char *file, int line);
172 static __inline void _chkhook(hook_p hook, char *file, int line);
173 static __inline void _ng_hook_ref(hook_p hook, char * file, int line);
174 static __inline char * _ng_hook_name(hook_p hook, char * file, int line);
175 static __inline void _ng_hook_unref(hook_p hook, char * file, int line);
176 static __inline void _ng_hook_set_private(hook_p hook,
178 static __inline void _ng_hook_set_rcvmsg(hook_p hook,
180 static __inline void _ng_hook_set_rcvdata(hook_p hook,
182 static __inline void * _ng_hook_private(hook_p hook, char * file, int line);
183 static __inline int _ng_hook_not_valid(hook_p hook, char * file, int line);
184 static __inline int _ng_hook_is_valid(hook_p hook, char * file, int line);
185 static __inline node_p _ng_hook_node(hook_p hook, char * file, int line);
186 static __inline hook_p _ng_hook_peer(hook_p hook, char * file, int line);
187 static __inline void _ng_hook_force_writer(hook_p hook, char * file,
189 static __inline void _ng_hook_force_queue(hook_p hook, char * file,
191 static __inline void _ng_hook_set_to_inbound(hook_p hook, char * file,
195 _chkhook(hook_p hook, char *file, int line) in _chkhook() argument
197 if (hook->hk_magic != HK_MAGIC) { in _chkhook()
199 dumphook(hook, file, line); in _chkhook()
201 hook->lastline = line; in _chkhook()
202 hook->lastfile = file; in _chkhook()
206 _ng_hook_ref(hook_p hook, char * file, int line) in _ng_hook_ref() argument
208 _chkhook(hook, file, line); in _ng_hook_ref()
209 _NG_HOOK_REF(hook); in _ng_hook_ref()
213 _ng_hook_name(hook_p hook, char * file, int line) in _ng_hook_name() argument
215 _chkhook(hook, file, line); in _ng_hook_name()
216 return (_NG_HOOK_NAME(hook)); in _ng_hook_name()
220 _ng_hook_unref(hook_p hook, char * file, int line) in _ng_hook_unref() argument
222 _chkhook(hook, file, line); in _ng_hook_unref()
223 _NG_HOOK_UNREF(hook); in _ng_hook_unref()
227 _ng_hook_set_private(hook_p hook, void *val, char * file, int line) in _ng_hook_set_private() argument
229 _chkhook(hook, file, line); in _ng_hook_set_private()
230 _NG_HOOK_SET_PRIVATE(hook, val); in _ng_hook_set_private()
234 _ng_hook_set_rcvmsg(hook_p hook, ng_rcvmsg_t *val, char * file, int line) in _ng_hook_set_rcvmsg() argument
236 _chkhook(hook, file, line); in _ng_hook_set_rcvmsg()
237 _NG_HOOK_SET_RCVMSG(hook, val); in _ng_hook_set_rcvmsg()
241 _ng_hook_set_rcvdata(hook_p hook, ng_rcvdata_t *val, char * file, int line) in _ng_hook_set_rcvdata() argument
243 _chkhook(hook, file, line); in _ng_hook_set_rcvdata()
244 _NG_HOOK_SET_RCVDATA(hook, val); in _ng_hook_set_rcvdata()
248 _ng_hook_private(hook_p hook, char * file, int line) in _ng_hook_private() argument
250 _chkhook(hook, file, line); in _ng_hook_private()
251 return (_NG_HOOK_PRIVATE(hook)); in _ng_hook_private()
255 _ng_hook_not_valid(hook_p hook, char * file, int line) in _ng_hook_not_valid() argument
257 _chkhook(hook, file, line); in _ng_hook_not_valid()
258 return (_NG_HOOK_NOT_VALID(hook)); in _ng_hook_not_valid()
262 _ng_hook_is_valid(hook_p hook, char * file, int line) in _ng_hook_is_valid() argument
264 _chkhook(hook, file, line); in _ng_hook_is_valid()
265 return (_NG_HOOK_IS_VALID(hook)); in _ng_hook_is_valid()
269 _ng_hook_node(hook_p hook, char * file, int line) in _ng_hook_node() argument
271 _chkhook(hook, file, line); in _ng_hook_node()
272 return (_NG_HOOK_NODE(hook)); in _ng_hook_node()
276 _ng_hook_peer(hook_p hook, char * file, int line) in _ng_hook_peer() argument
278 _chkhook(hook, file, line); in _ng_hook_peer()
279 return (_NG_HOOK_PEER(hook)); in _ng_hook_peer()
283 _ng_hook_force_writer(hook_p hook, char * file, int line) in _ng_hook_force_writer() argument
285 _chkhook(hook, file, line); in _ng_hook_force_writer()
286 _NG_HOOK_FORCE_WRITER(hook); in _ng_hook_force_writer()
290 _ng_hook_force_queue(hook_p hook, char * file, int line) in _ng_hook_force_queue() argument
292 _chkhook(hook, file, line); in _ng_hook_force_queue()
293 _NG_HOOK_FORCE_QUEUE(hook); in _ng_hook_force_queue()
297 _ng_hook_set_to_inbound(hook_p hook, char * file, int line) in _ng_hook_set_to_inbound() argument
299 _chkhook(hook, file, line); in _ng_hook_set_to_inbound()
300 _NG_HOOK_SET_TO_INBOUND(hook); in _ng_hook_set_to_inbound()
304 _ng_hook_hi_stack(hook_p hook, char * file, int line) in _ng_hook_hi_stack() argument
306 _chkhook(hook, file, line); in _ng_hook_hi_stack()
307 _NG_HOOK_HI_STACK(hook); in _ng_hook_hi_stack()
310 #define NG_HOOK_REF(hook) _ng_hook_ref(hook, _NN_) argument
311 #define NG_HOOK_NAME(hook) _ng_hook_name(hook, _NN_) argument
312 #define NG_HOOK_UNREF(hook) _ng_hook_unref(hook, _NN_) argument
313 #define NG_HOOK_SET_PRIVATE(hook, val) _ng_hook_set_private(hook, val, _NN_) argument
314 #define NG_HOOK_SET_RCVMSG(hook, val) _ng_hook_set_rcvmsg(hook, val, _NN_) argument
315 #define NG_HOOK_SET_RCVDATA(hook, val) _ng_hook_set_rcvdata(hook, val, _NN_) argument
316 #define NG_HOOK_PRIVATE(hook) _ng_hook_private(hook, _NN_) argument
317 #define NG_HOOK_NOT_VALID(hook) _ng_hook_not_valid(hook, _NN_) argument
318 #define NG_HOOK_IS_VALID(hook) _ng_hook_is_valid(hook, _NN_) argument
319 #define NG_HOOK_NODE(hook) _ng_hook_node(hook, _NN_) argument
320 #define NG_HOOK_PEER(hook) _ng_hook_peer(hook, _NN_) argument
321 #define NG_HOOK_FORCE_WRITER(hook) _ng_hook_force_writer(hook, _NN_) argument
322 #define NG_HOOK_FORCE_QUEUE(hook) _ng_hook_force_queue(hook, _NN_) argument
323 #define NG_HOOK_SET_TO_INBOUND(hook) _ng_hook_set_to_inbound(hook, _NN_) argument
324 #define NG_HOOK_HI_STACK(hook) _ng_hook_hi_stack(hook, _NN_) argument
328 #define NG_HOOK_REF(hook) _NG_HOOK_REF(hook) argument
329 #define NG_HOOK_NAME(hook) _NG_HOOK_NAME(hook) argument
330 #define NG_HOOK_UNREF(hook) _NG_HOOK_UNREF(hook) argument
331 #define NG_HOOK_SET_PRIVATE(hook, val) _NG_HOOK_SET_PRIVATE(hook, val) argument
332 #define NG_HOOK_SET_RCVMSG(hook, val) _NG_HOOK_SET_RCVMSG(hook, val) argument
333 #define NG_HOOK_SET_RCVDATA(hook, val) _NG_HOOK_SET_RCVDATA(hook, val) argument
334 #define NG_HOOK_PRIVATE(hook) _NG_HOOK_PRIVATE(hook) argument
335 #define NG_HOOK_NOT_VALID(hook) _NG_HOOK_NOT_VALID(hook) argument
336 #define NG_HOOK_IS_VALID(hook) _NG_HOOK_IS_VALID(hook) argument
337 #define NG_HOOK_NODE(hook) _NG_HOOK_NODE(hook) argument
338 #define NG_HOOK_PEER(hook) _NG_HOOK_PEER(hook) argument
339 #define NG_HOOK_FORCE_WRITER(hook) _NG_HOOK_FORCE_WRITER(hook) argument
340 #define NG_HOOK_FORCE_QUEUE(hook) _NG_HOOK_FORCE_QUEUE(hook) argument
341 #define NG_HOOK_SET_TO_INBOUND(hook) _NG_HOOK_SET_TO_INBOUND(hook) argument
342 #define NG_HOOK_HI_STACK(hook) _NG_HOOK_HI_STACK(hook) argument
424 * The hook iterator.
426 * hook attached to the node. If the function returns 0, then the
427 * iterator will stop and return a pointer to the hook that returned 0.
429 typedef int ng_fn_eachhook(hook_p hook, void* arg);
618 typedef void ng_item_fn(node_p node, hook_p hook, void *arg1, int arg2);
619 typedef int ng_item_fn2(node_p node, struct ng_item *item, hook_p hook);
631 hook_p el_hook; /* Entering hook. Optional in Control messages */
880 #define NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, flags) \ argument
883 ng_address_hook(NULL, (item), (hook), NG_NOFLAGS); \
890 #define NG_FWD_ITEM_HOOK(error, item, hook) \ argument
891 NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, NG_NOFLAGS)
900 #define NG_FWD_NEW_DATA_FLAGS(error, item, hook, m, flags) \ argument
904 NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, flags); \
906 #define NG_FWD_NEW_DATA(error, item, hook, m) \ argument
907 NG_FWD_NEW_DATA_FLAGS(error, item, hook, m, NG_NOFLAGS)
913 #define NG_SEND_DATA_FLAGS(error, hook, m, flags) \ argument
917 NG_FWD_ITEM_HOOK_FLAGS(error, _item, hook, flags);\
924 #define NG_SEND_DATA_ONLY(error, hook, m) \ argument
925 NG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS)
927 #define NG_SEND_DATA(error, hook, m, x) \ argument
928 NG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS)
950 #define NG_SEND_MSG_HOOK(error, here, msg, hook, retaddr) \ argument
959 (hook), (retaddr))) == 0) { \
999 * Redirect the message to the next hop using the given hook.
1003 #define NG_FWD_MSG_HOOK(error, here, item, hook, retaddr) \ argument
1006 (hook), (retaddr))) == 0) { \
1060 * the flags word of the peer (receiving) hook. The dequeuing mechanism will
1076 ng_newhook_t *newhook; /* first notification of new hook */
1078 ng_connect_t *connect; /* final notification of new hook */
1132 int ng_address_hook(node_p here, item_p item, hook_p hook, ng_ID_t retaddr);
1144 item_p ng_package_msg_self(node_p here, hook_p hook, struct ng_mesg *msg);
1146 int ng_rmhook_self(hook_p hook); /* if a node wants to kill a hook */
1150 int ng_send_fn(node_p node, hook_p hook, ng_item_fn *fn, void *arg1,
1152 int ng_send_fn1(node_p node, hook_p hook, ng_item_fn *fn, void *arg1,
1154 int ng_send_fn2(node_p node, hook_p hook, item_p pitem, ng_item_fn2 *fn,
1158 int ng_callout(struct callout *c, node_p node, hook_p hook, int ticks,