1 |
/* |
---|
2 |
* Copyright (c) 2007, OmniTI Computer Consulting, Inc. |
---|
3 |
* All rights reserved. |
---|
4 |
*/ |
---|
5 |
|
---|
6 |
#ifndef _NOIT_CHECK_TOOLS_H |
---|
7 |
#define _NOIT_CHECK_TOOLS_H |
---|
8 |
|
---|
9 |
#include "noit_defines.h" |
---|
10 |
#include "eventer/eventer.h" |
---|
11 |
#include "noit_module.h" |
---|
12 |
#include "noit_check.h" |
---|
13 |
#include "utils/noit_hash.h" |
---|
14 |
|
---|
15 |
typedef int (*dispatch_func_t)(noit_module_t *, noit_check_t *); |
---|
16 |
|
---|
17 |
API_EXPORT(int) |
---|
18 |
noit_check_interpolate(char *buff, int len, const char *fmt, |
---|
19 |
noit_hash_table *attrs, |
---|
20 |
noit_hash_table *config); |
---|
21 |
|
---|
22 |
API_EXPORT(int) |
---|
23 |
noit_check_schedule_next(noit_module_t *self, |
---|
24 |
struct timeval *last_check, noit_check_t *check, |
---|
25 |
struct timeval *now, dispatch_func_t recur); |
---|
26 |
|
---|
27 |
API_EXPORT(void) |
---|
28 |
noit_check_run_full_asynch(noit_check_t *check, eventer_func_t callback); |
---|
29 |
|
---|
30 |
#define INITIATE_CHECK(func, self, check) do { \ |
---|
31 |
if(once) { \ |
---|
32 |
func(self, check); \ |
---|
33 |
} \ |
---|
34 |
else if(!check->fire_event) { \ |
---|
35 |
struct timeval epoch = { 0L, 0L }; \ |
---|
36 |
noit_check_fake_last_check(check, &epoch, NULL); \ |
---|
37 |
noit_check_schedule_next(self, &epoch, check, NULL, func); \ |
---|
38 |
} \ |
---|
39 |
} while(0) |
---|
40 |
|
---|
41 |
API_EXPORT(void) |
---|
42 |
noit_check_make_attrs(noit_check_t *check, noit_hash_table *attrs); |
---|
43 |
API_EXPORT(void) |
---|
44 |
noit_check_release_attrs(noit_hash_table *attrs); |
---|
45 |
|
---|
46 |
|
---|
47 |
#endif |
---|
48 |
|
---|