diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-06-16 01:40:04 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-06-16 01:40:04 +0000 |
commit | ca0f8ee6da0766787fb5f8e7f5c815b9ed88fbcc (patch) | |
tree | b39e9d0ffdaac5c76a2370a9428b070a15a48ced | |
parent | 8c9edf12800bc6d68894dc457e7ebaf994429da8 (diff) |
Make the libwiretap Buffer routines usable from C++, and fix the C++ UI
code to handle the API changes for the seek-read routines.
svn path=/trunk/; revision=49950
-rw-r--r-- | ui/qt/packet_list.cpp | 2 | ||||
-rw-r--r-- | ui/qt/packet_list_model.cpp | 9 | ||||
-rw-r--r-- | wiretap/buffer.h | 8 |
3 files changed, 15 insertions, 4 deletions
diff --git a/ui/qt/packet_list.cpp b/ui/qt/packet_list.cpp index f17979f104..a82ba0b478 100644 --- a/ui/qt/packet_list.cpp +++ b/ui/qt/packet_list.cpp @@ -570,7 +570,7 @@ QString &PacketList::getFilterFromRowAndColumn() epan_dissect_init(&edt, have_custom_cols(&cap_file_->cinfo), FALSE); col_custom_prime_edt(&edt, &cap_file_->cinfo); - epan_dissect_run(&edt, &cap_file_->phdr, cap_file_->pd, fdata, &cap_file_->cinfo); + epan_dissect_run(&edt, &cap_file_->phdr, buffer_start_ptr(&cap_file_->buf), fdata, &cap_file_->cinfo); epan_dissect_fill_in_columns(&edt, TRUE, TRUE); if ((cap_file_->cinfo.col_custom_occurrence[ctx_column_]) || diff --git a/ui/qt/packet_list_model.cpp b/ui/qt/packet_list_model.cpp index c9a688457a..96953f2938 100644 --- a/ui/qt/packet_list_model.cpp +++ b/ui/qt/packet_list_model.cpp @@ -176,7 +176,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const column_info *cinfo; gboolean create_proto_tree; struct wtap_pkthdr phdr; /* Packet header */ - guint8 pd[WTAP_MAX_PACKET_SIZE]; /* Packet data */ + Buffer buf; /* Packet data */ gboolean dissect_columns = TRUE; // XXX - Currently only a placeholder if (dissect_columns && cap_file_) @@ -184,7 +184,8 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const else cinfo = NULL; - if (!cap_file_ || !cf_read_frame_r(cap_file_, fdata, &phdr, pd)) { + buffer_init(&buf, 1500); + if (!cap_file_ || !cf_read_frame_r(cap_file_, fdata, &phdr, &buf)) { /* * Error reading the frame. * @@ -209,6 +210,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const fdata->color_filter = NULL; // record->colorized = TRUE; } + buffer_free(&buf); return QVariant(); /* error reading the frame */ } @@ -224,7 +226,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const if (dissect_columns) col_custom_prime_edt(&edt, cinfo); - epan_dissect_run(&edt, &phdr, pd, fdata, cinfo); + epan_dissect_run(&edt, &phdr, buffer_start_ptr(&buf), fdata, cinfo); if (enable_color_) fdata->color_filter = color_filters_colorize_packet(&edt); @@ -247,6 +249,7 @@ QVariant PacketListModel::data(const QModelIndex &index, int role) const // record->colorized = TRUE; epan_dissect_cleanup(&edt); + buffer_free(&buf); return record->data(col_num, cinfo); } diff --git a/wiretap/buffer.h b/wiretap/buffer.h index 17265e1b6b..792ae0fd5c 100644 --- a/wiretap/buffer.h +++ b/wiretap/buffer.h @@ -27,6 +27,10 @@ #include <glib.h> #include "ws_symbol_export.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define SOME_FUNCTIONS_ARE_DEFINES typedef struct Buffer { @@ -63,4 +67,8 @@ void buffer_remove_start(Buffer* buffer, gsize bytes); void buffer_append_buffer(Buffer* buffer, Buffer* src_buffer); #endif +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif |