diff options
-rw-r--r-- | epan/Makefile.am | 4 | ||||
-rw-r--r-- | epan/Makefile.nmake | 3 | ||||
-rw-r--r-- | epan/bitswap.c | 66 | ||||
-rw-r--r-- | epan/bitswap.h | 28 | ||||
-rw-r--r-- | epan/plugins.c | 48 | ||||
-rw-r--r-- | epan/plugins.h | 3 | ||||
-rw-r--r-- | gtk/plugins_dlg.c | 34 | ||||
-rw-r--r-- | packet-fddi.c | 41 | ||||
-rw-r--r-- | packet-ieee80211.c | 78 |
9 files changed, 174 insertions, 131 deletions
diff --git a/epan/Makefile.am b/epan/Makefile.am index d637180dac..b53a95d0fb 100644 --- a/epan/Makefile.am +++ b/epan/Makefile.am @@ -2,7 +2,7 @@ # Automake file for the EPAN library # (Ethereal Protocol ANalyzer Library) # -# $Id: Makefile.am,v 1.12 2000/10/19 07:18:19 guy Exp $ +# $Id: Makefile.am,v 1.13 2000/11/15 09:37:51 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@zing.org> @@ -37,6 +37,8 @@ noinst_LIBRARIES = libethereal.a INCLUDES = -I$(srcdir)/.. libethereal_a_SOURCES = \ + bitswap.c \ + bitswap.h \ conversation.c \ conversation.h \ dfilter-int.h \ diff --git a/epan/Makefile.nmake b/epan/Makefile.nmake index 4ed7939fcf..539a23fee3 100644 --- a/epan/Makefile.nmake +++ b/epan/Makefile.nmake @@ -16,7 +16,8 @@ libethereal_LIBS = \ {$S}.c{$O}.obj:: $(CC) $(CFLAGS) -Fd$O\ -c $< -OBJECTS=conversation.obj \ +OBJECTS=bitswap.obj \ + conversation.obj \ dfilter-grammar.obj \ dfilter-scanner.obj \ dfilter.obj \ diff --git a/epan/bitswap.c b/epan/bitswap.c new file mode 100644 index 0000000000..73ae4242a9 --- /dev/null +++ b/epan/bitswap.c @@ -0,0 +1,66 @@ +/* bitswap.c + * Table of bit-swapped values of bytes + * + * $Id: bitswap.c,v 1.1 2000/11/15 09:37:51 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@zing.org> + * Copyright 1998 Gerald Combs + * + * + * This program 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> + +/* "swaptab[i]" is the value of "i" with the bits reversed. */ +guint8 swaptab[256] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, +}; diff --git a/epan/bitswap.h b/epan/bitswap.h new file mode 100644 index 0000000000..b07dd568e7 --- /dev/null +++ b/epan/bitswap.h @@ -0,0 +1,28 @@ +/* bitswap.h + * Macro to bitswap a byte by looking it up in a table + * + * $Id: bitswap.h,v 1.1 2000/11/15 09:37:51 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@zing.org> + * Copyright 1998 Gerald Combs + * + * + * This program 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +extern guint8 swaptab[256]; + +#define BIT_SWAP(b) (swaptab[b]) diff --git a/epan/plugins.c b/epan/plugins.c index 386aed2f58..c3be06f4c7 100644 --- a/epan/plugins.c +++ b/epan/plugins.c @@ -1,7 +1,7 @@ /* plugins.c * plugin routines * - * $Id: plugins.c,v 1.9 2000/11/15 07:07:47 guy Exp $ + * $Id: plugins.c,v 1.10 2000/11/15 09:37:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -66,7 +66,7 @@ #ifdef PLUGINS_NEED_ADDRESS_TABLE #include "plugins/plugin_table.h" -plugin_address_table_t patable; +static plugin_address_table_t patable; #endif /* linked list of all plugins */ @@ -332,7 +332,6 @@ check_plugin_status(gchar *name, gchar *version, GModule *handle, gchar *ref_string; guint16 ref_string_len; gchar line[512]; - void (*plugin_init)(void*); dfilter *filter; if (!statusfile) return; @@ -348,19 +347,8 @@ check_plugin_status(gchar *name, gchar *version, GModule *handle, } else { /* found the plugin */ if (line[ref_string_len+1] == '1') { - enable_plugin(name, version); - if (g_module_symbol(handle, "plugin_init", (gpointer*)&plugin_init) == TRUE) { -#ifdef PLUGINS_NEED_ADDRESS_TABLE - plugin_init(&patable); -#else - plugin_init(NULL); -#endif - } -#ifdef PLUGINS_NEED_ADDRESS_TABLE - else { + if (init_plugin(name, version) != NULL) return; - } -#endif } if (fgets(line, 512, statusfile) == NULL) return; @@ -423,6 +411,36 @@ new_add_plugin(void *handle, gchar *name, gchar *version, return 0; } +/* + * Initialize a plugin. + * Returns NULL on success, pointer to an error message on error. + */ +char * +init_plugin(gchar *name, gchar *version) +{ + plugin *pt_plug; + gpointer symbol; + void (*plugin_init)(void*); + + /* Try to find the plugin. */ + if ((pt_plug = enable_plugin(name, version)) == NULL) + return "Plugin not found"; + + /* Try to get the initialization routine for the plugin. */ + if (!g_module_symbol(pt_plug->handle, "plugin_init", &symbol)) + return "Failed to find plugin_init()"; + plugin_init = symbol; + + /* We found it; now call it. */ +#ifdef PLUGINS_NEED_ADDRESS_TABLE + plugin_init(&patable); +#else + plugin_init(NULL); +#endif + + return NULL; +} + static void plugins_scan_dir(const char *dirname) { diff --git a/epan/plugins.h b/epan/plugins.h index 9cdec6e313..6221823b71 100644 --- a/epan/plugins.h +++ b/epan/plugins.h @@ -1,7 +1,7 @@ /* plugins.h * definitions for plugins structures * - * $Id: plugins.h,v 1.2 2000/10/16 23:17:40 guy Exp $ + * $Id: plugins.h,v 1.3 2000/11/15 09:37:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -57,6 +57,7 @@ void *disable_plugin(const gchar *, const gchar *); void *find_plugin(const gchar *, const gchar *); gboolean is_enabled(const gchar *, const gchar *); void plugin_replace_filter(const gchar *, const gchar *, const gchar *, dfilter *); +char *init_plugin(gchar *name, gchar *version); int save_plugin_status(void); void init_plugins(const char *); diff --git a/gtk/plugins_dlg.c b/gtk/plugins_dlg.c index 3c0672900d..1d6a72230e 100644 --- a/gtk/plugins_dlg.c +++ b/gtk/plugins_dlg.c @@ -1,7 +1,7 @@ /* plugins_dlg.c * Dialog boxes for plugins * - * $Id: plugins_dlg.c,v 1.19 2000/10/20 04:26:40 gram Exp $ + * $Id: plugins_dlg.c,v 1.20 2000/11/15 09:37:53 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -44,11 +44,6 @@ #include "prefs_dlg.h" #include "simple_dialog.h" -#ifdef PLUGINS_NEED_ADDRESS_TABLE -#include "plugins/plugin_api.h" -extern plugin_address_table_t patable; -#endif - #ifdef HAVE_PLUGINS static gint selected_row; @@ -246,39 +241,20 @@ void plugins_clist_unselect_cb(GtkWidget *clist, gint row, gint column, static void plugins_enable_cb(GtkWidget *button, gpointer clist) { - plugin *pt_plug; - gpointer symbol; - void (*plugin_init)(void*); + char *errmsg; /* nothing selected */ if (selected_row == -1) return; /* already enabled */ if (strcmp(selected_enabled, "Yes") == 0) return; - if ((pt_plug = enable_plugin(selected_name, selected_version)) == NULL) + errmsg = init_plugin(selected_name, selected_version); + if (errmsg != NULL) { - simple_dialog(ESD_TYPE_CRIT, NULL, "Plugin not found"); + simple_dialog(ESD_TYPE_CRIT, NULL, errmsg); return; } - /* Try to get the initialization routine for the plugin, and, if it - has one, call it. */ - if (g_module_symbol(pt_plug->handle, "plugin_init", &symbol) == TRUE) { - plugin_init = symbol; -#ifdef PLUGINS_NEED_ADDRESS_TABLE - plugin_init(&patable); -#else - plugin_init(NULL); -#endif - } -#ifdef PLUGINS_NEED_ADDRESS_TABLE - else { - simple_dialog(ESD_TYPE_WARN, NULL, "Failed to find plugin_init()"); - return; - } -#endif - - gtk_clist_set_text(GTK_CLIST(clist), selected_row, 3, "Yes"); } diff --git a/packet-fddi.c b/packet-fddi.c index f96dbe3acb..b92e037bdb 100644 --- a/packet-fddi.c +++ b/packet-fddi.c @@ -3,7 +3,7 @@ * * Laurent Deniel <deniel@worldnet.fr> * - * $Id: packet-fddi.c,v 1.38 2000/08/13 14:08:10 deniel Exp $ + * $Id: packet-fddi.c,v 1.39 2000/11/15 09:37:49 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -35,6 +35,7 @@ #include <stdio.h> #include <glib.h> +#include "bitswap.h" #include "packet.h" #include "packet-fddi.h" #include "packet-llc.h" @@ -92,49 +93,13 @@ static gint ett_fddi = -1; #define FDDI_P_DHOST 1 #define FDDI_P_SHOST 7 -/* "swaptab[i]" is the value of "i" with the bits reversed. */ -static u_char swaptab[256] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, -}; - static void swap_mac_addr(u_char *swapped_addr, const u_char *orig_addr) { int i; for (i = 0; i < 6; i++) { - swapped_addr[i] = swaptab[orig_addr[i]]; + swapped_addr[i] = BIT_SWAP(orig_addr[i]); } } diff --git a/packet-ieee80211.c b/packet-ieee80211.c index 3f665380bb..4ec355ecb2 100644 --- a/packet-ieee80211.c +++ b/packet-ieee80211.c @@ -3,7 +3,7 @@ * Copyright 2000, Axis Communications AB * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com * - * $Id: packet-ieee80211.c,v 1.1 2000/11/15 05:41:42 guy Exp $ + * $Id: packet-ieee80211.c,v 1.2 2000/11/15 09:37:49 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -52,6 +52,7 @@ #include <string.h> #include <glib.h> +#include "bitswap.h" #include "proto.h" #include "etypes.h" #include "packet.h" @@ -65,23 +66,6 @@ #define MGT_FRAME_LEN 24 /* ************************************************************************* */ -/* Insane macro used to convert from the even more insane IEEE octet format */ -/* to a more sane format used by the rest of the world!!! */ -/* ************************************************************************* */ -#define I2H8(x) \ - ({ guint8 __result__; \ - __result__ = (( (x) & 0x01) << 7); \ - __result__ |= (( (x) & 0x02) << 5); \ - __result__ |= (( (x) & 0x04) << 3); \ - __result__ |= (( (x) & 0x08) << 1); \ - __result__ |= (( (x) & 0x10) >> 1); \ - __result__ |= (( (x) & 0x20) >> 3); \ - __result__ |= (( (x) & 0x40) >> 5); \ - __result__ |= (( (x) & 0x80) >> 8); \ - __result__; }) - - -/* ************************************************************************* */ /* Define some very useful macros that are used to analyze frame types etc. */ /* ************************************************************************* */ #define COMPOSE_FRAME_TYPE(x) (((x & 0x0C)<< 2)+((x & 0xF0) >> 4)) /* Create key to (sub)type */ @@ -406,12 +390,14 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) dataptr = tvb_get_ptr (tvb, offset, 8); memset (out_buff, 0, SHORT_STR); snprintf (out_buff, SHORT_STR, "0x%02X%02X%02X%02X%02X%02X%02X%02X", - I2H8 (dataptr[7]), - I2H8 (dataptr[6]), - I2H8 (dataptr[5]), - I2H8 (dataptr[4]), - I2H8 (dataptr[3]), - I2H8 (dataptr[2]), I2H8 (dataptr[1]), I2H8 (dataptr[0])); + BIT_SWAP (dataptr[7]), + BIT_SWAP (dataptr[6]), + BIT_SWAP (dataptr[5]), + BIT_SWAP (dataptr[4]), + BIT_SWAP (dataptr[3]), + BIT_SWAP (dataptr[2]), + BIT_SWAP (dataptr[1]), + BIT_SWAP (dataptr[0])); proto_tree_add_string (tree, ff_timestamp, tvb, offset, 8, out_buff); break; @@ -419,8 +405,8 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) case FIELD_BEACON_INTERVAL: dataptr = tvb_get_ptr (tvb, offset, 2); - out_buff[0] = I2H8 (dataptr[1]); - out_buff[1] = I2H8 (dataptr[0]); + out_buff[0] = BIT_SWAP (dataptr[1]); + out_buff[1] = BIT_SWAP (dataptr[0]); temp16 = (guint16 *) out_buff; proto_tree_add_uint (tree, ff_beacon_interval, tvb, offset, 2, pntohs (temp16)); @@ -429,8 +415,8 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) case FIELD_CAP_INFO: dataptr = tvb_get_ptr (tvb, offset, 2); - out_buff[0] = I2H8 (dataptr[1]); - out_buff[0] = I2H8 (dataptr[0]); + out_buff[0] = BIT_SWAP (dataptr[1]); + out_buff[0] = BIT_SWAP (dataptr[0]); temp16 = (guint16 *) out_buff; cap_item = proto_tree_add_uint_format (tree, ff_capture, @@ -457,8 +443,8 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) case FIELD_AUTH_ALG: dataptr = tvb_get_ptr (tvb, offset, 2); - out_buff[0] = I2H8 (dataptr[1]); - out_buff[1] = I2H8 (dataptr[0]); + out_buff[0] = BIT_SWAP (dataptr[1]); + out_buff[1] = BIT_SWAP (dataptr[0]); temp16 = (guint16 *) out_buff; proto_tree_add_uint (tree, ff_auth_alg, tvb, offset, 2, pntohs (temp16)); @@ -467,8 +453,8 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) case FIELD_AUTH_TRANS_SEQ: dataptr = tvb_get_ptr (tvb, offset, 2); - out_buff[0] = I2H8 (dataptr[1]); - out_buff[1] = I2H8 (dataptr[0]); + out_buff[0] = BIT_SWAP (dataptr[1]); + out_buff[1] = BIT_SWAP (dataptr[0]); temp16 = (guint16 *) out_buff; proto_tree_add_uint (tree, ff_auth_seq, tvb, offset, 2, pntohs (temp16)); @@ -478,12 +464,12 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) case FIELD_CURRENT_AP_ADDR: dataptr = tvb_get_ptr (tvb, offset, 6); memset (out_buff, 0, SHORT_STR); - out_buff[0] = I2H8 (dataptr[5]); - out_buff[1] = I2H8 (dataptr[4]); - out_buff[2] = I2H8 (dataptr[3]); - out_buff[3] = I2H8 (dataptr[2]); - out_buff[4] = I2H8 (dataptr[1]); - out_buff[5] = I2H8 (dataptr[0]); + out_buff[0] = BIT_SWAP (dataptr[5]); + out_buff[1] = BIT_SWAP (dataptr[4]); + out_buff[2] = BIT_SWAP (dataptr[3]); + out_buff[3] = BIT_SWAP (dataptr[2]); + out_buff[4] = BIT_SWAP (dataptr[1]); + out_buff[5] = BIT_SWAP (dataptr[0]); proto_tree_add_string (tree, ff_current_ap, tvb, offset, 6, out_buff); break; @@ -491,8 +477,8 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) case FIELD_LISTEN_IVAL: dataptr = tvb_get_ptr (tvb, offset, 2); - out_buff[0] = I2H8 (dataptr[1]); - out_buff[1] = I2H8 (dataptr[0]); + out_buff[0] = BIT_SWAP (dataptr[1]); + out_buff[1] = BIT_SWAP (dataptr[0]); temp16 = (guint16 *) out_buff; proto_tree_add_uint (tree, ff_listen_ival, tvb, offset, 2, pntohs (temp16)); @@ -501,8 +487,8 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) case FIELD_REASON_CODE: dataptr = tvb_get_ptr (tvb, offset, 2); - out_buff[0] = I2H8 (dataptr[1]); - out_buff[1] = I2H8 (dataptr[0]); + out_buff[0] = BIT_SWAP (dataptr[1]); + out_buff[1] = BIT_SWAP (dataptr[0]); temp16 = (guint16 *) out_buff; proto_tree_add_uint (tree, ff_reason, tvb, offset, 2, pntohs (temp16)); break; @@ -510,16 +496,16 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode) case FIELD_ASSOC_ID: dataptr = tvb_get_ptr (tvb, offset, 2); - out_buff[0] = I2H8 (dataptr[1]); - out_buff[1] = I2H8 (dataptr[0]); + out_buff[0] = BIT_SWAP (dataptr[1]); + out_buff[1] = BIT_SWAP (dataptr[0]); temp16 = (guint16 *) out_buff; proto_tree_add_uint (tree, ff_assoc_id, tvb, offset, 2, pntohs (temp16)); break; case FIELD_STATUS_CODE: dataptr = tvb_get_ptr (tvb, offset, 2); - out_buff[0] = I2H8 (dataptr[1]); - out_buff[1] = I2H8 (dataptr[0]); + out_buff[0] = BIT_SWAP (dataptr[1]); + out_buff[1] = BIT_SWAP (dataptr[0]); temp16 = (guint16 *) out_buff; proto_tree_add_uint (tree, ff_status_code, tvb, offset, 2, pntohs (temp16)); |