root/src/modules/lua_noit.h

Revision 0f81a29f005c4f87e08c22052c27101ab47f8444, 1.6 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 6 years ago)

seems to address these. closes #36

  • Property mode set to 100644
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 struct nl_generic_cl {
43   void (*free)(void *);
44 };
45
46 struct nl_intcl {
47   void (*free)(void *);
48   noit_lua_check_info_t *ci;
49 };
50
51 struct nl_slcl {
52   void (*free)(void *);
53   int send_size;
54   struct timeval start;
55   char *inbuff;
56   int   inbuff_allocd;
57   int   inbuff_len;
58   size_t read_sofar;
59   size_t read_goal;
60   const char *read_terminator;
61   const char *outbuff;
62   size_t write_sofar;
63   size_t write_goal;
64   eventer_t *eptr;
65   lua_State *L;
66 };
67
68 int luaopen_noit(lua_State *L);
69 noit_lua_check_info_t *get_ci(lua_State *L);
70 int noit_lua_yield(noit_lua_check_info_t *ci, int nargs);
71 int noit_lua_resume(noit_lua_check_info_t *ci, int nargs);
72 void noit_lua_check_register_event(noit_lua_check_info_t *ci, eventer_t e);
73 void noit_lua_check_deregister_event(noit_lua_check_info_t *ci, eventer_t e,
74                                      int tofree);
75
76 #endif
Note: See TracBrowser for help on using the browser.