| Line | |
|---|
| 1 |
/* |
|---|
| 2 |
* Copyright (c) 2007, OmniTI Computer Consulting, Inc. |
|---|
| 3 |
* All rights reserved. |
|---|
| 4 |
*/ |
|---|
| 5 |
|
|---|
| 6 |
#ifndef LUA_NOIT_H |
|---|
| 7 |
#define LUA_NOIT_H |
|---|
| 8 |
|
|---|
| 9 |
#include "noit_defines.h" |
|---|
| 10 |
|
|---|
| 11 |
#include "noit_conf.h" |
|---|
| 12 |
#include "noit_module.h" |
|---|
| 13 |
#include "noit_check.h" |
|---|
| 14 |
#include "noit_check_tools.h" |
|---|
| 15 |
#include "utils/noit_log.h" |
|---|
| 16 |
|
|---|
| 17 |
#include <assert.h> |
|---|
| 18 |
|
|---|
| 19 |
#include "lua.h" |
|---|
| 20 |
#include "lauxlib.h" |
|---|
| 21 |
#include "lualib.h" |
|---|
| 22 |
|
|---|
| 23 |
typedef struct lua_module_closure { |
|---|
| 24 |
char *object; |
|---|
| 25 |
lua_State *lua_state; |
|---|
| 26 |
int object_ref; |
|---|
| 27 |
} lua_module_closure_t; |
|---|
| 28 |
|
|---|
| 29 |
typedef struct noit_lua_check_info { |
|---|
| 30 |
noit_module_t *self; |
|---|
| 31 |
noit_check_t *check; |
|---|
| 32 |
int timed_out; |
|---|
| 33 |
eventer_t timeout_event; |
|---|
| 34 |
lua_module_closure_t *lmc; |
|---|
| 35 |
lua_State *coro_state; |
|---|
| 36 |
int coro_state_ref; |
|---|
| 37 |
struct timeval finish_time; |
|---|
| 38 |
stats_t current; |
|---|
| 39 |
noit_hash_table *events; /* Any eventers we need to cleanup */ |
|---|
| 40 |
} noit_lua_check_info_t; |
|---|
| 41 |
|
|---|
| 42 |
int luaopen_noit(lua_State *L); |
|---|
| 43 |
noit_lua_check_info_t *get_ci(lua_State *L); |
|---|
| 44 |
int noit_lua_yield(noit_lua_check_info_t *ci, int nargs); |
|---|
| 45 |
int noit_lua_resume(noit_lua_check_info_t *ci, int nargs); |
|---|
| 46 |
void noit_lua_check_register_event(noit_lua_check_info_t *ci, eventer_t e); |
|---|
| 47 |
void noit_lua_check_deregister_event(noit_lua_check_info_t *ci, eventer_t e, |
|---|
| 48 |
int tofree); |
|---|
| 49 |
|
|---|
| 50 |
#endif |
|---|