aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2006-10-19 22:43:38 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2006-10-19 22:43:38 +0000
commitfda3b676d76651b7f6f0a330c19ec51e56516c47 (patch)
tree524aa5c409370eb73d2e88cd9b66fa347696e677
parentb53966b3c3cdf5c73c6ed9c12f38746766a8b9f1 (diff)
Rename get_epan_and_portaudio_version_info() to get_gui_compiled_info()
and add version info for AirPcap. Add a corresponding get_gui_runtime_info(). Fix up whitespace. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19620 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--airpcap_loader.c32
-rw-r--r--airpcap_loader.h26
-rw-r--r--gtk/main.c89
-rw-r--r--tshark.c2
-rw-r--r--version_info.c15
-rw-r--r--version_info.h3
6 files changed, 117 insertions, 50 deletions
diff --git a/airpcap_loader.c b/airpcap_loader.c
index 93395382ef..80befdb047 100644
--- a/airpcap_loader.c
+++ b/airpcap_loader.c
@@ -53,7 +53,7 @@
* We load dinamically the dag library in order link it only when
* it's present on the system
*/
-static HMODULE AirpcapLib;
+static HMODULE AirpcapLib = NULL;
static AirpcapGetLastErrorHandler g_PAirpcapGetLastError;
static AirpcapGetDeviceListHandler g_PAirpcapGetDeviceList;
@@ -82,6 +82,7 @@ static AirpcapSetDeviceKeysHandler g_PAirpcapSetDeviceKeys;
static AirpcapGetDecryptionStateHandler g_PAirpcapGetDecryptionState;
static AirpcapSetDecryptionStateHandler g_PAirpcapSetDecryptionState;
static AirpcapStoreCurConfigAsAdapterDefaultHandler g_PAirpcapStoreCurConfigAsAdapterDefault;
+static AirpcapGetVersionHandler g_PAirpcapGetVersion;
/* Airpcap interface list */
GList *airpcap_if_list = NULL;
@@ -1674,8 +1675,37 @@ BOOL load_airpcap(void)
if((g_PAirpcapGetDecryptionState = (AirpcapGetDecryptionStateHandler) GetProcAddress(AirpcapLib, "AirpcapGetDecryptionState")) == NULL) return FALSE;
if((g_PAirpcapSetDecryptionState = (AirpcapSetDecryptionStateHandler) GetProcAddress(AirpcapLib, "AirpcapSetDecryptionState")) == NULL) return FALSE;
if((g_PAirpcapStoreCurConfigAsAdapterDefault = (AirpcapStoreCurConfigAsAdapterDefaultHandler) GetProcAddress(AirpcapLib, "AirpcapStoreCurConfigAsAdapterDefault")) == NULL) return FALSE;
+ if((g_PAirpcapGetVersion = (AirpcapGetVersionHandler) GetProcAddress(AirpcapLib, "AirpcapGetVersion")) == NULL) return FALSE;
return TRUE;
}
}
+/*
+ * Append the version of AirPcap with which we were compiled to a GString.
+ */
+void
+get_compiled_airpcap_version(GString *str)
+{
+ g_string_append(str, "with AirPcap");
+}
+
+/*
+ * Append the version of AirPcap with which we we're running to a GString.
+ */
+void
+get_runtime_airpcap_version(GString *str)
+{
+ guint vmaj, vmin, vrev, build;
+
+ /* See if the DLL has been loaded successfully. Bail if it hasn't */
+ if (AirpcapLib == NULL || g_PAirpcapGetVersion == NULL) {
+ g_string_append(str, "without AirPcap");
+ return;
+ }
+
+ g_PAirpcapGetVersion(&vmaj, &vmin, &vrev, &build);
+ g_string_sprintfa(str, "with AirPcap %d.%d.%d build %d", vmaj, vmin,
+ vrev, build);
+}
+
#endif /* _WIN32 */
diff --git a/airpcap_loader.h b/airpcap_loader.h
index 81169c2e72..3a053a8a2d 100644
--- a/airpcap_loader.h
+++ b/airpcap_loader.h
@@ -76,6 +76,7 @@ typedef BOOL (*AirpcapGetDeviceKeysHandler)(PAirpcapHandle AdapterHandle, PAirpc
typedef BOOL (*AirpcapSetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable);
typedef BOOL (*AirpcapGetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable);
typedef BOOL (*AirpcapStoreCurConfigAsAdapterDefaultHandler)(PAirpcapHandle AdapterHandle);
+typedef VOID (*AirpcapGetVersionHandler)(PUINT VersionMajor, PUINT VersionMinor, PUINT VersionRev, PUINT VersionBuild);
/*
* The list of interfaces returned by "get_airpcap_interface_list()" is
* a list of these structures.
@@ -104,7 +105,7 @@ typedef struct {
typedef struct {
GList *list;
int current_index;
- int number_of_keys;
+ int number_of_keys;
} keys_cb_data_t;
/*
@@ -114,7 +115,7 @@ typedef struct {
GString *key;
GString *ssid;
guint bits;
- guint type;
+ guint type;
} decryption_key_t;
/* Airpcap interface list */
@@ -133,13 +134,13 @@ extern airpcap_if_info_t *airpcap_if_active;
* Function used to read the Decryption Keys from the preferences and store them
* properly into the airpcap adapter.
*/
-BOOL
+BOOL
load_wlan_wep_keys(airpcap_if_info_t* info_if);
-/*
+/*
* Function used to save to the prefereces file the Decryption Keys.
*/
-BOOL
+BOOL
save_wlan_wep_keys(airpcap_if_info_t* info_if);
/*
@@ -374,7 +375,7 @@ get_airpcap_device_keys(airpcap_if_info_t* if_info);
/*
* Returns the list of the decryption keys specified for wireshark, NULL if
- * no key is found
+ * no key is found
*/
GList*
get_wireshark_keys();
@@ -395,7 +396,7 @@ merge_key_list(GList* list1, GList* list2);
/*
* If the given key is contained in the list, returns TRUE.
- * Returns FALSE otherwise.
+ * Returns FALSE otherwise.
*/
gboolean
key_is_in_list(decryption_key_t *dk,GList *list);
@@ -407,7 +408,7 @@ gboolean
keys_are_equals(decryption_key_t *k1,decryption_key_t *k2);
/*
- * Use this function to free a key list.
+ * Use this function to free a key list.
*/
void
free_key_list(GList *list);
@@ -436,4 +437,13 @@ set_wireshark_decryption(gboolean on_off);
gboolean
set_airpcap_decryption(gboolean on_off);
+/*
+ * Adds compiled version string to str
+ */
+void
+get_compiled_airpcap_version(GString *str);
+
+void
+get_runtime_airpcap_version(GString *str);
+
#endif
diff --git a/gtk/main.c b/gtk/main.c
index 7ddf4baa8d..396539b107 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -2003,7 +2003,7 @@ static void main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
}
static void
-get_epan_and_portaudio_version_info(GString *str)
+get_gui_compiled_info(GString *str)
{
get_epan_compiled_version_info(str);
@@ -2018,6 +2018,24 @@ get_epan_and_portaudio_version_info(GString *str)
#else /* HAVE_LIBPORTAUDIO */
g_string_append(str, "without PortAudio");
#endif /* HAVE_LIBPORTAUDIO */
+
+ g_string_append(str, ", ");
+
+#ifdef HAVE_AIRPCAP
+ get_compiled_airpcap_version(str);
+#else
+ g_string_append(str, "without AirPcap");
+#endif
+}
+
+static void
+get_gui_runtime_info(GString *str)
+{
+#ifdef HAVE_AIRPCAP
+ get_runtime_airpcap_version(str);
+#else
+ g_string_append(str, "without AirPcap");
+#endif
}
/* And now our feature presentation... [ fade to music ] */
@@ -2106,6 +2124,26 @@ main(int argc, char *argv[])
/* ... and also load the packet.dll from wpcap */
wpcap_packet_load();
+#ifdef HAVE_AIRPCAP
+ /* Load the airpcap.dll. This must also be done before collecting
+ * run-time version information. */
+ if(load_airpcap())
+ {
+ /* load the airpcap interfaces */
+ airpcap_if_list = get_airpcap_interface_list(&err, err_str);
+
+ if (airpcap_if_list == NULL && err == CANT_GET_AIRPCAP_INTERFACE_LIST) {
+ cant_get_if_list_errstr = cant_get_airpcap_if_list_error_message(err_str);
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s",
+ cant_get_if_list_errstr);
+ g_free(cant_get_if_list_errstr);
+ }
+
+ /* select the first ad default (THIS SHOULD BE CHANGED) */
+ airpcap_if_active = airpcap_get_default_if(airpcap_if_list);
+ }
+#endif
+
/* Start windows sockets */
WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
#endif /* _WIN32 */
@@ -2123,11 +2161,11 @@ main(int argc, char *argv[])
#endif
g_string_append(comp_info_str, ", ");
- get_compiled_version_info(comp_info_str, get_epan_and_portaudio_version_info);
+ get_compiled_version_info(comp_info_str, get_gui_compiled_info);
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str);
+ get_runtime_version_info(runtime_info_str, get_gui_runtime_info);
/* "pre-scan" the command line parameters, if we have "console only"
@@ -2324,25 +2362,6 @@ main(int argc, char *argv[])
prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
&pf_open_errno, &pf_read_errno, &pf_path);
-#ifdef HAVE_AIRPCAP
- /* Load the airpcap.dll */
- if(load_airpcap())
- {
- /* load the airpcap interfaces */
- airpcap_if_list = get_airpcap_interface_list(&err, err_str);
-
- if (airpcap_if_list == NULL && err == CANT_GET_AIRPCAP_INTERFACE_LIST) {
- cant_get_if_list_errstr = cant_get_airpcap_if_list_error_message(err_str);
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s",
- cant_get_if_list_errstr);
- g_free(cant_get_if_list_errstr);
- }
-
- /* select the first ad default (THIS SHOULD BE CHANGED) */
- airpcap_if_active = airpcap_get_default_if(airpcap_if_list);
- }
-#endif
-
if (gpf_path != NULL) {
if (gpf_open_errno != 0) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
@@ -3732,7 +3751,7 @@ for(i = 0; i < n; i++)
{
ad = airpcap_if_open(get_airpcap_name_from_description(airpcap_if_list,curr_if->description), ebuf);
if(ad)
- {
+ {
curr_if->DecryptionOn = airpcap_if_selected->DecryptionOn;
airpcap_if_set_decryption_state(ad,curr_if->DecryptionOn);
/* Save configuration for the curr_if */
@@ -3803,7 +3822,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
*channel_cm,
*wrong_crc_lb,
*wrong_crc_cm;
-
+
GtkWidget *enable_decryption_lb;
GtkWidget *enable_decryption_cb;
GList *enable_decryption_cb_items = NULL;
@@ -4055,7 +4074,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
gtk_widget_show (enable_decryption_lb);
gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), enable_decryption_lb,
NULL, "Private");
-
+
enable_decryption_cb = gtk_combo_new ();
gtk_widget_set_name (enable_decryption_cb, "enable_decryption_cb");
gtk_widget_show (enable_decryption_cb);
@@ -4069,16 +4088,16 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
enable_decryption_cb_items = g_list_append (enable_decryption_cb_items, AIRPCAP_DECRYPTION_TYPE_STRING_AIRPCAP);
gtk_combo_set_popdown_strings (GTK_COMBO (enable_decryption_cb), enable_decryption_cb_items);
g_list_free (enable_decryption_cb_items);
-
+
enable_decryption_en = GTK_COMBO (enable_decryption_cb)->entry;
gtk_widget_set_name (enable_decryption_en, "enable_decryption_en");
gtk_widget_show (enable_decryption_en);
gtk_editable_set_editable (GTK_EDITABLE (enable_decryption_en), FALSE);
GTK_WIDGET_UNSET_FLAGS (enable_decryption_en, GTK_CAN_FOCUS);
-
+
gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), enable_decryption_cb,
"Choose a Decryption Mode", "Private");
-
+
/* Set current decryption mode!!!! */
update_decryption_mode_cm(enable_decryption_cb);
SIGNAL_CONNECT (enable_decryption_en, "changed",on_enable_decryption_en_changed, airpcap_tb);
@@ -4129,7 +4148,7 @@ create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
airpcap_set_toolbar_stop_capture(airpcap_if_active);
recent.airpcap_toolbar_show = TRUE;
}
-
+
#endif
/* filter toolbar */
@@ -4277,7 +4296,7 @@ show_main_window(gboolean doing_work)
/*** we have finished all init things, show the main window ***/
gtk_widget_show(top_level);
-
+
/* the window can be maximized only, if it's visible, so do it after show! */
main_load_window_geometry(top_level);
@@ -4287,10 +4306,10 @@ show_main_window(gboolean doing_work)
/* Pop up any queued-up alert boxes. */
display_queued_messages();
-#ifdef HAVE_AIRPCAP
-/*
- * This will read the decryption keys from the preferences file, and will store
- * them into the registry...
+#ifdef HAVE_AIRPCAP
+/*
+ * This will read the decryption keys from the preferences file, and will store
+ * them into the registry...
*/
if(!airpcap_check_decryption_keys(airpcap_if_list))
{
@@ -4299,7 +4318,7 @@ if(!airpcap_check_decryption_keys(airpcap_if_list))
}
else /* Keys from lists are equals, or wireshark has got no keys */
{
- airpcap_load_decryption_keys(airpcap_if_list);
+ airpcap_load_decryption_keys(airpcap_if_list);
}
#endif
}
diff --git a/tshark.c b/tshark.c
index c877b119b9..79188bd7d6 100644
--- a/tshark.c
+++ b/tshark.c
@@ -886,7 +886,7 @@ main(int argc, char *argv[])
/* Assemble the run-time version information string */
runtime_info_str = g_string_new("Running ");
- get_runtime_version_info(runtime_info_str);
+ get_runtime_version_info(runtime_info_str, NULL);
/* Print format defaults to this. */
print_format = PR_FMT_TEXT;
diff --git a/version_info.c b/version_info.c
index d16a588914..f7b6cf69d2 100644
--- a/version_info.c
+++ b/version_info.c
@@ -298,8 +298,10 @@ get_epan_compiled_version_info(GString *str)
* them to the specified GString.
*/
void
-get_runtime_version_info(GString *str)
+get_runtime_version_info(GString *str, void (*additional_info)(GString *))
{
+ gint break_point;
+
#if defined(_WIN32)
OSVERSIONINFO info;
#elif defined(HAVE_SYS_UTSNAME_H)
@@ -462,11 +464,16 @@ get_runtime_version_info(GString *str)
g_string_append(str, "an unknown OS");
#endif
- g_string_append(str, " ");
+ break_point = add_word_wrap_break_point(str);
- get_runtime_pcap_version(str);
+ /* Additional application-dependent information */
+ if (additional_info) {
+ end_item_and_break(str, ",", break_point);
+ break_point = add_word_wrap_break_point(str);
+ (*additional_info)(str);
+ }
- g_string_append(str, ".");
+ end_item_and_break(str, ".", break_point);
/* Compiler info */
diff --git a/version_info.h b/version_info.h
index 7203eac27e..421a9bef65 100644
--- a/version_info.h
+++ b/version_info.h
@@ -57,7 +57,8 @@ void get_epan_compiled_version_info(GString *str);
* Get various library run-time versions, and the OS version, and append
* them to the specified GString.
*/
-void get_runtime_version_info(GString *str);
+void get_runtime_version_info(GString *str,
+ void (*additional_info)(GString *));
/*
* Get copyright information.