root/src/noit_module.h

Revision 5f413b75efe299d3b88314bbcc3c21cbbcec36a7, 1.2 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 6 years ago)

more work... framework for submitting arbitrary metrics

  • Property mode set to 100644
Line 
1 /*
2  * Copyright (c) 2007, 2008, OmniTI Computer Consulting, Inc.
3  * All rights reserved.
4  */
5
6 #ifndef _NOIT_MODULE_H
7 #define _NOIT_MODULE_H
8
9 #include "noit_defines.h"
10 #include "utils/noit_hash.h"
11 #include "noit_poller.h"
12
13 #define NOIT_MODULE_MAGIC         0x4017DA7A
14 #define NOIT_MODULE_ABI_VERSION   1
15
16 typedef struct _noit_module {
17   uint32_t magic;
18   uint32_t version;
19   char *name;
20   char *description;
21   int (*onload)(struct _noit_module *);
22   int (*config)(struct _noit_module *, noit_hash_table *options);
23   int (*init)(struct _noit_module *);
24   int (*initiate_check)(struct _noit_module *, noit_check_t check,
25                         int once, noit_check_t cause);
26   void *opaque_handle;
27 } noit_module_t;
28
29 #define MODULE_MAGIC(a)          ((a)->magic)
30 #define MODULE_VERSION(a)        ((a)->version)
31
32 #define noit_module_validate_magic(a) \
33   ((MODULE_MAGIC(a) == NOIT_MODULE_MAGIC)?0:-1)
34
35 API_EXPORT(void)
36   noit_module_init();
37 API_EXPORT(int)
38   noit_module_load(const char *file, const char *name);
39 API_EXPORT(noit_module_t *)
40   noit_module_lookup(const char *name);
41
42 API_EXPORT(void *)
43   noit_module_get_userdata(noit_module_t *mod);
44 API_EXPORT(void)
45   noit_module_set_userdata(noit_module_t *mod, void *newdata);
46
47 #endif
Note: See TracBrowser for help on using the browser.