~jan-kneschke/mysql-proxy/packet-tracking-assertions

« back to all changes in this revision

Viewing changes to trunk/src/lua-scope.h

  • Committer: Kay Roepke
  • Author(s): Jan Kneschke
  • Date: 2008-01-23 22:00:28 UTC
  • Revision ID: kay@mysql.com-20080123220028-hq2xqb69apa75fnx
first round on mysql-shell based on the proxy code

this is mostly a verification if the proxy-code is flexible enough to handle 
all three scenarios of: client, server and forwarding (proxy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $%BEGINLICENSE%$
2
 
 Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
3
 
 
4
 
 This program is free software; you can redistribute it and/or
5
 
 modify it under the terms of the GNU General Public License as
6
 
 published by the Free Software Foundation; version 2 of the
7
 
 License.
8
 
 
9
 
 This program is distributed in the hope that it will be useful,
10
 
 but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
 
 GNU General Public License for more details.
13
 
 
14
 
 You should have received a copy of the GNU General Public License
15
 
 along with this program; if not, write to the Free Software
16
 
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17
 
 02110-1301  USA
18
 
 
19
 
 $%ENDLICENSE%$ */
20
 
 
21
 
 
22
1
#ifndef _LUA_SCOPE_H_
23
2
#define _LUA_SCOPE_H_
24
3
 
25
4
#include <glib.h>
 
5
#include <lua.h>
26
6
 
27
7
#ifdef HAVE_CONFIG_H
28
8
#include "config.h"
29
9
#endif
30
10
 
31
 
#ifdef HAVE_LUA_H
32
 
#include <lua.h>
33
 
#endif
34
 
 
35
 
#include "chassis-exports.h"
36
 
 
37
11
typedef struct {
38
 
#ifdef HAVE_LUA_H
39
12
        lua_State *L;
40
13
        int L_ref;
41
 
#endif
 
14
#ifdef HAVE_GTHREAD
42
15
        GMutex *mutex;
43
 
 
 
16
#endif
44
17
        int L_top;
45
18
} lua_scope;
46
19
 
47
 
CHASSIS_API lua_scope *lua_scope_init(void) G_GNUC_DEPRECATED;
48
 
CHASSIS_API lua_scope *lua_scope_new(void);
49
 
CHASSIS_API void lua_scope_free(lua_scope *sc);
50
 
 
51
 
CHASSIS_API void lua_scope_get(lua_scope *sc, const char* pos);
52
 
CHASSIS_API void lua_scope_release(lua_scope *sc, const char* pos);
53
 
 
54
 
#define LOCK_LUA(sc) \
55
 
        lua_scope_get(sc, G_STRLOC); 
56
 
 
57
 
#define UNLOCK_LUA(sc) \
58
 
        lua_scope_release(sc, G_STRLOC); 
59
 
 
60
 
#ifdef HAVE_LUA_H
61
 
CHASSIS_API lua_State *lua_scope_load_script(lua_scope *sc, const gchar *name);
62
 
CHASSIS_API void proxy_lua_dumpstack_verbose(lua_State *L);
63
 
#endif
 
20
lua_scope *lua_scope_init(void);
 
21
void lua_scope_free(lua_scope *sc);
 
22
 
 
23
void lua_scope_get(lua_scope *sc);
 
24
void lua_scope_release(lua_scope *sc);
 
25
 
 
26
lua_State *lua_scope_load_script(lua_scope *sc, const gchar *name);
64
27
 
65
28
#endif