/* Copyright 2009 Myhailo Danylenko
This file is part of lua-lm.
lua-lm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef LLM_TYPES_H
#define LLM_TYPES_H
#include <lua.h>
#include <loudmouth/loudmouth.h>
#ifndef LLM_OBJREGISTRY
#define LLM_OBJREGISTRY "llm.obj_registry"
#endif
typedef struct {
int reference;
lua_State *L;
} llm_callback_t;
void llm_callback_destroy (llm_callback_t *cb);
#define LLM_DECLARE(WHAT, TYPE) \
typedef struct { \
TYPE *WHAT; \
} llm_##WHAT##_t; \
\
llm_##WHAT##_t *luaL_checklm_##WHAT (lua_State *L, int index); \
llm_##WHAT##_t *bless_lm_##WHAT (lua_State *L, TYPE *WHAT);
LLM_DECLARE (connection, LmConnection)
LLM_DECLARE (message, LmMessage)
LLM_DECLARE (handler, LmMessageHandler)
LLM_DECLARE (node, LmMessageNode)
LLM_DECLARE (proxy, LmProxy)
LLM_DECLARE (ssl, LmSSL)
LmMessageNode *luaL_checkLmMessageNode (lua_State *L, int index);
#undef LLM_DECLARE
#endif