aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2006-03-28 19:25:48 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2006-03-28 19:25:48 +0000
commit6c1b601e6ed4b584714b4f144355f83800bc5d3e (patch)
tree34e7129d7668b4bde1267d0f50874e574d13503c /plugins
parentabb59e809f045aa1682d63e8139b5ba6be662613 (diff)
Fix compilation under Windows.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17751 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'plugins')
-rw-r--r--plugins/lua/Makefile.nmake4
-rw-r--r--plugins/lua/elua_field.c98
2 files changed, 51 insertions, 51 deletions
diff --git a/plugins/lua/Makefile.nmake b/plugins/lua/Makefile.nmake
index c672d96c5a..428b99e8d7 100644
--- a/plugins/lua/Makefile.nmake
+++ b/plugins/lua/Makefile.nmake
@@ -30,7 +30,7 @@ MODULES= \
OBJECTS= \
elua.obj \
elua_dumper.obj \
- elua_field.c \
+ elua_field.obj \
elua_gui.obj \
elua_pinfo.obj \
elua_plugin.obj \
@@ -48,7 +48,7 @@ lua.dll lua.exp lua.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
elua_register.h: elua_makereg.pl $(MODULES)
$(PERL) elua_makereg.pl $(MODULES) > elua_register.h
-$(OBJECTS): elua_register.h
+elua.h: elua_register.h
doc: $(MODULES)
$(PERL) elua_makedoc.pl $(MODULES)
diff --git a/plugins/lua/elua_field.c b/plugins/lua/elua_field.c
index b3695b5d7e..be6b432311 100644
--- a/plugins/lua/elua_field.c
+++ b/plugins/lua/elua_field.c
@@ -39,7 +39,7 @@ ELUA_METAMETHOD FieldInfo__len(lua_State* L) {
*/
FieldInfo fi = checkFieldInfo(L,1);
lua_pushnumber(L,fi->length);
- return 1;
+ return 1;
}
ELUA_METAMETHOD FieldInfo__unm(lua_State* L) {
@@ -48,7 +48,7 @@ ELUA_METAMETHOD FieldInfo__unm(lua_State* L) {
*/
FieldInfo fi = checkFieldInfo(L,1);
lua_pushnumber(L,fi->start);
- return 1;
+ return 1;
}
ELUA_METAMETHOD FieldInfo__call(lua_State* L) {
@@ -56,7 +56,7 @@ ELUA_METAMETHOD FieldInfo__call(lua_State* L) {
The Value of the field
*/
FieldInfo fi = checkFieldInfo(L,1);
-
+
switch(fi->hfinfo->type) {
case FT_UINT8:
case FT_UINT16:
@@ -78,14 +78,14 @@ ELUA_METAMETHOD FieldInfo__call(lua_State* L) {
/*
* XXX: double has 53 bits integer precision, n > 2^22 will cause a loss in precision
*/
- lua_pushnumber(L,(lua_Number)fvalue_get_integer64(&(fi->value)));
+ lua_pushnumber(L,(lua_Number)(gint64)fvalue_get_integer64(&(fi->value)));
return 1;
case FT_ETHER:
case FT_IPv4:
case FT_IPv6:
case FT_IPXNET:
/* XXX: use Address ??? */
-
+
case FT_STRING:
case FT_STRINGZ:
case FT_BYTES:
@@ -98,7 +98,7 @@ ELUA_METAMETHOD FieldInfo__call(lua_State* L) {
luaL_error(L,"FT_ not yet supported");
return 1;
}
-
+
}
ELUA_METAMETHOD FieldInfo__tostring(lua_State* L) {
@@ -116,11 +116,11 @@ ELUA_ATTR_GET FieldInfo_get_data_source(lua_State* L) {
ELUA_ATTR_GET FieldInfo_get_range(lua_State* L) {
FieldInfo fi = checkFieldInfo(L,1);
TvbRange r = ep_alloc(sizeof(struct _eth_tvbrange));
-
+
r->tvb = fi->ds_tvb;
r->offset = fi->start;
r->len = fi->length;
-
+
pushTvbRange(L,r);
return 1;
}
@@ -154,27 +154,27 @@ ELUA_METAMETHOD FieldInfo__index(lua_State* L) {
/*
Other attributes:
*/
- const gchar* index = luaL_checkstring(L,2);
+ const gchar* index = luaL_checkstring(L,2);
const luaL_reg* r;
checkFieldInfo(L,1);
-
+
for (r = FieldInfo_get; r->name; r++) {
if (g_str_equal(r->name, index)) {
return r->func(L);
}
}
-
+
return 0;
-}
+}
ELUA_METAMETHOD FieldInfo__eq(lua_State* L) {
FieldInfo l = checkFieldInfo(L,1);
FieldInfo r = checkFieldInfo(L,2);
-
- if (l->ds_tvb != r->ds_tvb)
+
+ if (l->ds_tvb != r->ds_tvb)
ELUA_ERROR(FieldInfo__eq,"data source must be the same for both fields");
-
+
if (l->start <= r->start && r->start + r->length <= l->start + r->length) {
lua_pushboolean(L,1);
return 1;
@@ -186,10 +186,10 @@ ELUA_METAMETHOD FieldInfo__eq(lua_State* L) {
ELUA_METAMETHOD FieldInfo__le(lua_State* L) {
FieldInfo l = checkFieldInfo(L,1);
FieldInfo r = checkFieldInfo(L,2);
-
- if (l->ds_tvb != r->ds_tvb)
+
+ if (l->ds_tvb != r->ds_tvb)
ELUA_ERROR(FieldInfo__eq,"data source must be the same for both fields");
-
+
if (r->start + r->length <= l->start + r->length) {
lua_pushboolean(L,1);
return 1;
@@ -201,10 +201,10 @@ ELUA_METAMETHOD FieldInfo__le(lua_State* L) {
ELUA_METAMETHOD FieldInfo__lt(lua_State* L) {
FieldInfo l = checkFieldInfo(L,1);
FieldInfo r = checkFieldInfo(L,2);
-
- if (l->ds_tvb != r->ds_tvb)
+
+ if (l->ds_tvb != r->ds_tvb)
ELUA_ERROR(FieldInfo__eq,"data source must be the same for both fields");
-
+
if ( r->start + r->length < l->start ) {
lua_pushboolean(L,1);
return 1;
@@ -236,7 +236,7 @@ ELUA_FUNCTION elua_all_field_infos(lua_State* L) {
GPtrArray* found = proto_all_finfos(lua_tree->tree);
int items_found = 0;
guint i;
-
+
if (found) {
for (i=0; i<found->len; i++) {
pushFieldInfo(L,g_ptr_array_index(found,i));
@@ -268,42 +268,42 @@ void lua_prime_all_fields(proto_tree* tree _U_) {
GString* fake_tap_filter = g_string_new("frame");
guint i;
static gboolean fake_tap = FALSE;
-
+
for(i=0; i < wanted_fields->len; i++) {
Field f = g_ptr_array_index(wanted_fields,i);
gchar* name = *((gchar**)f);
-
+
*f = proto_registrar_get_byname(name);
-
+
if (!*f) {
report_failure("Could not find field `%s'",name);
*f = NULL;
g_free(name);
continue;
}
-
+
g_free(name);
-
+
g_string_sprintfa(fake_tap_filter," || %s",(*f)->abbrev);
fake_tap = TRUE;
}
-
+
g_ptr_array_free(wanted_fields,TRUE);
wanted_fields = NULL;
-
+
if (fake_tap) {
/* a boring tap :-) */
GString* error = register_tap_listener("frame",
&fake_tap,
fake_tap_filter->str,
NULL, NULL, NULL);
-
+
if (error) {
report_failure("while registering lua_fake_tap:\n%s",error->str);
g_string_free(error,TRUE);
}
}
-
+
}
ELUA_CONSTRUCTOR Field_new(lua_State *L) {
@@ -313,20 +313,20 @@ ELUA_CONSTRUCTOR Field_new(lua_State *L) {
#define ELUA_ARG_Field_new_FIELDNAME 1 /* The filter name of the field (e.g. ip.addr) */
const gchar* name = luaL_checkstring(L,ELUA_ARG_Field_new_FIELDNAME);
Field f;
-
+
if (!name) return 0;
-
- if (!proto_registrar_get_byname(name))
+
+ if (!proto_registrar_get_byname(name))
ELUA_ARG_ERROR(Field_new,FIELDNAME,"a field with this name must exist");
-
+
if (!wanted_fields)
ELUA_ERROR(Field_get,"a Field extractor must be defined before Taps or Dissectors get called");
-
+
f = g_malloc(sizeof(void*));
*f = (header_field_info*)g_strdup(name); /* cheating */
-
+
g_ptr_array_add(wanted_fields,f);
-
+
pushField(L,f);
ELUA_RETURN(1); /* The field extractor */
}
@@ -338,14 +338,14 @@ ELUA_METAMETHOD Field__call (lua_State* L) {
if (! in) {
luaL_error(L,"invalid field");
- return 0;
+ return 0;
}
-
+
if (! lua_pinfo ) {
ELUA_ERROR(Field__call,"fields cannot be used outside dissectors or taps");
return 0;
}
-
+
for (;in;in = in->same_name_next) {
GPtrArray* found = proto_get_finfo_ptr_array(lua_tree->tree, in->id);
guint i;
@@ -355,27 +355,27 @@ ELUA_METAMETHOD Field__call (lua_State* L) {
items_found++;
}
}
-
+
g_ptr_array_free(found,TRUE);
}
-
+
ELUA_RETURN(items_found); /* All the values of this field */
}
static int Field_tostring(lua_State* L) {
Field f = checkField(L,1);
-
+
if ( !(f && *f) ) {
luaL_error(L,"invalid Field");
return 0;
}
-
+
if (wanted_fields) {
lua_pushstring(L,*((gchar**)f));
} else {
lua_pushstring(L,(*f)->abbrev);
}
-
+
return 1;
}
@@ -391,11 +391,11 @@ static const luaL_reg Field_meta[] = {
};
int Field_register(lua_State* L) {
-
+
wanted_fields = g_ptr_array_new();
-
+
ELUA_REGISTER_CLASS(Field);
-
+
return 1;
}