1 2 /* 3 * Copyright (C) Igor Sysoev 4 * Copyright (C) NGINX, Inc. 5 */ 6 7 #ifndef _NXT_SOURCE_H_INCLUDED_ 8 #define _NXT_SOURCE_H_INCLUDED_ 9 10 11 /* 12 * A source handler should store a pointer to a passed source hook, but not 13 * the hook's values themselves, because a source filter may change the values. 14 */ 15 typedef struct { 16 void *context; 17 nxt_work_handler_t filter; 18 } nxt_source_hook_t; 19 20 21 typedef void (*nxt_source_handler_t)(void *source_context, 22 nxt_source_hook_t *query); 23 24 25 #define nxt_source_filter(thr, wq, task, next, out) \ 26 do { \ 27 if (thr->engine->batch != 0) { \ 28 nxt_thread_work_queue_add(thr, wq, nxt_source_filter_handler, \ 29 task, next, out); \ 30 \ 31 } else { \ 32 (next)->filter(task, (next)->context, out); \ 33 } \ 34 \ 35 } while (0) 36 37 38 NXT_EXPORT void nxt_source_filter_handler(nxt_task_t *task, void *obj, 39 void *data); 40 41 42 #endif /* _NXT_SOURCE_H_INCLUDED_ */ 43