|
Revision e64e042f4c61e4e3c50af3639e028056d8bbfa88, 1.2 kB
(checked in by Theo Schlossnagle <jesus@omniti.com>, 5 years ago)
|
fix up some apis, allow for firing checks only once
|
- 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, int once); |
|---|
| 25 |
void *opaque_handle; |
|---|
| 26 |
} noit_module_t; |
|---|
| 27 |
|
|---|
| 28 |
#define MODULE_MAGIC(a) ((a)->magic) |
|---|
| 29 |
#define MODULE_VERSION(a) ((a)->version) |
|---|
| 30 |
|
|---|
| 31 |
#define noit_module_validate_magic(a) \ |
|---|
| 32 |
((MODULE_MAGIC(a) == NOIT_MODULE_MAGIC)?0:-1) |
|---|
| 33 |
|
|---|
| 34 |
API_EXPORT(void) |
|---|
| 35 |
noit_module_init(); |
|---|
| 36 |
API_EXPORT(int) |
|---|
| 37 |
noit_module_load(const char *file, const char *name); |
|---|
| 38 |
API_EXPORT(noit_module_t *) |
|---|
| 39 |
noit_module_lookup(const char *name); |
|---|
| 40 |
|
|---|
| 41 |
API_EXPORT(void *) |
|---|
| 42 |
noit_module_get_userdata(noit_module_t *mod); |
|---|
| 43 |
API_EXPORT(void) |
|---|
| 44 |
noit_module_set_userdata(noit_module_t *mod, void *newdata); |
|---|
| 45 |
|
|---|
| 46 |
#endif |
|---|