aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>2006-03-05 02:01:16 +0000
committerlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>2006-03-05 02:01:16 +0000
commitc7bcd2f163a630f36cc074664e6db7b25520093c (patch)
treea2ce1e3e794df584285e60b4955acb0493070301
parentfff24dfb1a49de5dad83401768136532a9da6581 (diff)
+ retap_packets()
+ complete gtk TextWindow + fix elua_dumper + fix elua_proto git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17462 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--epan/funnel.h2
-rw-r--r--gtk/funnel_stat.c57
-rw-r--r--plugins/lua/elua_dumper.c8
-rw-r--r--plugins/lua/elua_proto.c24
-rw-r--r--tap-funnel.c3
5 files changed, 62 insertions, 32 deletions
diff --git a/epan/funnel.h b/epan/funnel.h
index da0de68c5f..ab3428329f 100644
--- a/epan/funnel.h
+++ b/epan/funnel.h
@@ -71,6 +71,8 @@ typedef struct _funnel_ops_t {
GLogLevelFlags log_level,
const gchar *message,
gpointer user_data);
+
+ void (*retap_packets)(void);
} funnel_ops_t;
diff --git a/gtk/funnel_stat.c b/gtk/funnel_stat.c
index 0e775f4ddf..eb0e9239bf 100644
--- a/gtk/funnel_stat.c
+++ b/gtk/funnel_stat.c
@@ -234,6 +234,7 @@ static void text_window_append(funnel_text_window_t* tw, const char *str)
#if GTK_MAJOR_VERSION < 2
+ gtk_text_set_point(GTK_TEXT(txt),gtk_text_get_length(GTK_TEXT(txt)));
gtk_text_insert(GTK_TEXT(txt), user_font_get_regular(), NULL, NULL, str, nchars);
#else
buf= gtk_text_view_get_buffer(GTK_TEXT_VIEW(txt));
@@ -268,16 +269,57 @@ static void text_window_set_text(funnel_text_window_t* tw, const gchar* text)
static void text_window_prepend(funnel_text_window_t* tw, const char *str _U_) {
+ GtkWidget *txt;
+ int nchars = strlen(str);
+#if GTK_MAJOR_VERSION >= 2
+ GtkTextBuffer *buf;
+ GtkTextIter iter;
+#endif
+
if (! tw->win) return;
- /* XXX todo */
+
+ txt = tw->txt;
+ nchars = strlen(str);
+
+
+#if GTK_MAJOR_VERSION < 2
+ gtk_text_set_point(GTK_TEXT(txt),0);
+ gtk_text_insert(GTK_TEXT(txt), user_font_get_regular(), NULL, NULL, str, nchars);
+#else
+ buf= gtk_text_view_get_buffer(GTK_TEXT_VIEW(txt));
+
+ gtk_text_buffer_get_start_iter(buf, &iter);
+ gtk_widget_modify_font(GTK_WIDGET(txt), user_font_get_regular());
+
+ if (!g_utf8_validate(str, -1, NULL))
+ printf("Invalid utf8 encoding: %s\n", str);
+
+ gtk_text_buffer_insert(buf, &iter, str, nchars);
+#endif
}
static const gchar* text_window_get_text(funnel_text_window_t* tw) {
-
+ GtkWidget *txt;
+#if GTK_MAJOR_VERSION >= 2
+ GtkTextBuffer *buf;
+ GtkTextIter start;
+ GtkTextIter end;
+#endif
+
if (! tw->win) return "";
- /* XXX todo */
- return "";
+ txt = tw->txt;
+
+#if GTK_MAJOR_VERSION < 2
+ /* to do */
+ return "";
+#else
+ buf= gtk_text_view_get_buffer(GTK_TEXT_VIEW(txt));
+ gtk_text_buffer_get_start_iter(buf, &start);
+ gtk_text_buffer_get_end_iter(buf, &end);
+
+ return gtk_text_buffer_get_text(buf, &start, &end, FALSE);
+#endif
}
static void text_window_set_close_cb(funnel_text_window_t* tw, text_win_close_cb_t cb, void* data) {
@@ -414,6 +456,10 @@ static void funnel_logger(const gchar *log_domain _U_,
fputs(message,stderr);
}
+static void elua_retap_packets(void) {
+ cf_retap_packets(&cfile, FALSE);
+}
+
static const funnel_ops_t funnel_ops = {
new_text_window,
@@ -426,7 +472,8 @@ static const funnel_ops_t funnel_ops = {
text_window_destroy,
/*...,*/
funnel_new_dialog,
- funnel_logger
+ funnel_logger,
+ funnel_retap_packets
};
diff --git a/plugins/lua/elua_dumper.c b/plugins/lua/elua_dumper.c
index abe0035633..6f667cd5c3 100644
--- a/plugins/lua/elua_dumper.c
+++ b/plugins/lua/elua_dumper.c
@@ -117,9 +117,9 @@ ELUA_CONSTRUCTOR PseudoHeader_atm(lua_State* L) {
ELUA_CONSTRUCTOR PseudoHeader_mtp2(lua_State* L) {
/* Creates an MTP2 PseudoHeader */
-#define ELUA_OPTARG_PseudoHeader_mtp2_SENT /* True if the packet is sent, False if received. */
-#define ELUA_OPTARG_PseudoHeader_mtp2_ANNEXA /* True if annex A is used */
-#define ELUA_OPTARG_PseudoHeader_mtp2_LINKNUM /* Link Number */
+#define ELUA_OPTARG_PseudoHeader_mtp2_SENT 1 /* True if the packet is sent, False if received. */
+#define ELUA_OPTARG_PseudoHeader_mtp2_ANNEXA 2 /* True if annex A is used */
+#define ELUA_OPTARG_PseudoHeader_mtp2_LINKNUM 3 /* Link Number */
PseudoHeader ph = g_malloc(sizeof(struct lua_pseudo_header));
ph->type = PHDR_MTP2;
ph->wph = g_malloc(sizeof(union wtap_pseudo_header));
@@ -171,7 +171,7 @@ ELUA_CONSTRUCTOR Dumper_new(lua_State* L) {
Dumper:new_for_current() will probably be a better choice.
*/
#define ELUA_ARG_Dumper_new_FILENAME 1 /* The name of the capture file to be created */
-#define ELUA_OPTARG_Dumper_new_FILETYPE 3 /* The type of the file to be created */
+#define ELUA_OPTARG_Dumper_new_FILETYPE 2 /* The type of the file to be created */
#define ELUA_OPTARG_Dumper_new_ENCAP 3 /* The encapsulation to be used in the file to be created */
Dumper d;
const char* filename = luaL_checkstring(L,1);
diff --git a/plugins/lua/elua_proto.c b/plugins/lua/elua_proto.c
index 6adfbe73e6..fb778fc951 100644
--- a/plugins/lua/elua_proto.c
+++ b/plugins/lua/elua_proto.c
@@ -627,25 +627,9 @@ static const luaL_reg ProtoField_meta[] = {
};
int ProtoField_register(lua_State* L) {
- const eth_ft_types_t* ts;
- const struct base_display_string_t* b;
ELUA_REGISTER_CLASS(ProtoField);
-
- /* add a global FT_* variable for each FT_ type */
- for (ts = ftenums; ts->str; ts++) {
- lua_pushstring(L, ts->str);
- lua_pushstring(L, ts->str);
- lua_settable(L, LUA_GLOBALSINDEX);
- }
-
- /* add a global BASE_* variable for each BASE_ */
- for (b=base_displays;b->str;b++) {
- lua_pushstring(L, b->str);
- lua_pushstring(L, b->str);
- lua_settable(L, LUA_GLOBALSINDEX);
- }
-
+
return 1;
}
@@ -862,7 +846,7 @@ static int Proto_tostring(lua_State* L) {
return 1;
}
-static int Proto_register_postdissector(lua_State* L) {
+ELUA_FUNCTION elua_register_postdissector(lua_State* L) {
Proto proto = checkProto(L,1);
if (!proto) return 0;
@@ -1028,10 +1012,6 @@ int Proto_register(lua_State* L) {
ELUA_REGISTER_META(Proto);
- lua_pushstring(L, "register_postdissector");
- lua_pushcfunction(L, Proto_register_postdissector);
- lua_settable(L, LUA_GLOBALSINDEX);
-
lua_pushstring(L, "Proto");
lua_pushcfunction(L, Proto_new);
lua_settable(L, LUA_GLOBALSINDEX);
diff --git a/tap-funnel.c b/tap-funnel.c
index 96c9455dae..558ad2e660 100644
--- a/tap-funnel.c
+++ b/tap-funnel.c
@@ -72,7 +72,8 @@ static const funnel_ops_t funnel_ops = {
NULL,
/*...,*/
NULL,
- funnel_logger
+ funnel_logger,
+ NULL
};