5 * Giorgio Tino <giorgio.tino@cacetech.com>
6 * Copyright (c) CACE Technologies, LLC 2006
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 2000 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 #include <epan/filesystem.h>
39 #include <epan/strutil.h>
40 #include <epan/frequency-utils.h>
41 #include <epan/crypt/airpdcap_ws.h>
43 #include "../simple_dialog.h"
46 #include "gtk/dlg_utils.h"
47 #include "gtk/gui_utils.h"
48 #include "gtk/dfilter_expr_dlg.h"
49 #include "gtk/help_dlg.h"
53 #include "airpcap_loader.h"
54 #include "airpcap_gui_utils.h"
57 /* Controls the releay of settings back to the adapter. */
58 gboolean change_airpcap_settings = FALSE;
61 * Used to retrieve a string containing a list of all the channels
62 * on which at least one adapter is capturing. This is true
63 * if the adapter passed as parameter is "Any" ... if not,
64 * this function returns the only channel number string.
67 airpcap_get_all_channels_list(airpcap_if_info_t* if_info)
72 airpcap_if_info_t* current_adapter;
73 GString *freq_str = g_string_new("");
77 if(airpcap_if_is_any(if_info))
79 n = g_list_length(airpcap_if_list);
81 for(i = 0; i < n; i++)
83 current_item = g_list_nth(airpcap_if_list,i);
84 current_adapter = (airpcap_if_info_t*)current_item->data;
85 if(current_adapter != if_info && g_ascii_strncasecmp("AirPcap USB wireless capture adapter nr.", current_adapter->description, 40) == 0)
87 chan_str = ieee80211_mhz_to_str(current_adapter->channelInfo.Frequency);
88 g_string_append_printf(freq_str, "%s%s", sep, chan_str);
95 frequencies = freq_str->str;
96 g_string_free(freq_str, FALSE);
101 * Set up the airpcap toolbar for the new capture interface
104 airpcap_set_toolbar_start_capture(airpcap_if_info_t* if_info)
106 GtkWidget *airpcap_toolbar_label;
107 GtkWidget *airpcap_toolbar_channel;
108 GtkWidget *airpcap_toolbar_channel_lb;
109 GtkWidget *airpcap_toolbar_channel_offset;
110 GtkWidget *airpcap_toolbar_channel_offset_lb;
111 GtkWidget *airpcap_toolbar_button;
112 GtkWidget *airpcap_toolbar_fcs;
113 GtkWidget *airpcap_toolbar_fcs_lb;
114 GtkWidget *airpcap_toolbar_decryption;
115 GtkWidget *airpcap_toolbar_decryption_lb;
116 GtkWidget *airpcap_toolbar_keys_button;
118 gchar *if_label_text;
120 airpcap_toolbar_label = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_INTERFACE_KEY);
121 airpcap_toolbar_channel = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_CHANNEL_KEY);
122 airpcap_toolbar_channel_lb = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_CHANNEL_LABEL_KEY);
123 airpcap_toolbar_channel_offset = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_CHANNEL_OFFSET_KEY);
124 airpcap_toolbar_channel_offset_lb = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_CHANNEL_OFFSET_LABEL_KEY);
125 airpcap_toolbar_fcs = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_FCS_FILTER_KEY);
126 airpcap_toolbar_fcs_lb = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_FCS_FILTER_LABEL_KEY);
127 airpcap_toolbar_button = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_ADVANCED_KEY);
128 airpcap_toolbar_decryption = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_DECRYPTION_KEY);
129 airpcap_toolbar_decryption_lb = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_DECRYPTION_LABEL_KEY);
130 airpcap_toolbar_keys_button = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_KEY_MANAGEMENT_KEY);
132 /* The current interface is an airpcap interface */
135 gtk_widget_set_sensitive(airpcap_tb,TRUE);
136 gtk_widget_set_sensitive(airpcap_toolbar_label,TRUE);
137 gtk_widget_set_sensitive(airpcap_toolbar_channel,TRUE);
138 gtk_widget_set_sensitive(airpcap_toolbar_channel_lb,TRUE);
139 gtk_widget_set_sensitive(airpcap_toolbar_channel_offset,TRUE);
140 gtk_widget_set_sensitive(airpcap_toolbar_channel_offset_lb,TRUE);
141 gtk_widget_set_sensitive(airpcap_toolbar_fcs,FALSE);
142 gtk_widget_set_sensitive(airpcap_toolbar_fcs_lb,FALSE);
143 gtk_widget_set_sensitive(airpcap_toolbar_button,FALSE);
144 gtk_widget_set_sensitive(airpcap_toolbar_button,FALSE);
145 gtk_widget_set_sensitive(airpcap_toolbar_decryption,FALSE);
146 gtk_widget_set_sensitive(airpcap_toolbar_decryption_lb,FALSE);
147 gtk_widget_set_sensitive(airpcap_toolbar_keys_button,FALSE);
149 /*decription check box*/
150 g_signal_handlers_block_by_func (airpcap_toolbar_decryption,airpcap_toolbar_encryption_cb, airpcap_tb);
151 if(if_info->DecryptionOn == AIRPCAP_DECRYPTION_ON)
152 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(airpcap_toolbar_decryption),TRUE);
154 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(airpcap_toolbar_decryption),FALSE);
155 g_signal_handlers_unblock_by_func (airpcap_toolbar_decryption,airpcap_toolbar_encryption_cb, airpcap_tb);
157 if_label_text = g_strdup_printf("Current Wireless Interface: #%s", airpcap_get_if_string_number(if_info));
158 gtk_label_set_text(GTK_LABEL(airpcap_toolbar_label),if_label_text);
159 g_free(if_label_text);
161 change_airpcap_settings = FALSE;
162 if (if_info->pSupportedChannels != NULL && if_info->numSupportedChannels > 0){
164 GList *channel_list = NULL;
166 for (; i<if_info->numSupportedChannels; i++){
167 channel_list = g_list_append(channel_list, ieee80211_mhz_to_str(if_info->pSupportedChannels[i].Frequency));
169 gtk_combo_set_popdown_strings( GTK_COMBO(airpcap_toolbar_channel), channel_list);
170 airpcap_free_channel_combo_list(channel_list);
173 airpcap_update_channel_offset_combo_entry(airpcap_toolbar_channel_offset, if_info->channelInfo.ExtChannel);
174 airpcap_update_channel_combo(GTK_WIDGET(airpcap_toolbar_channel),if_info);
175 airpcap_update_channel_offset_cb(if_info, if_info->channelInfo.Frequency, airpcap_toolbar_channel_offset);
176 change_airpcap_settings = TRUE;
178 else /* Current interface is NOT an AirPcap one... */
180 gtk_widget_set_sensitive(airpcap_tb,FALSE);
181 gtk_widget_set_sensitive(airpcap_toolbar_label,FALSE);
182 gtk_widget_set_sensitive(airpcap_toolbar_channel,FALSE);
183 gtk_widget_set_sensitive(airpcap_toolbar_channel_lb,FALSE);
184 gtk_widget_set_sensitive(airpcap_toolbar_channel_offset,FALSE);
185 gtk_widget_set_sensitive(airpcap_toolbar_channel_offset_lb,FALSE);
186 gtk_widget_set_sensitive(airpcap_toolbar_fcs,FALSE);
187 gtk_widget_set_sensitive(airpcap_toolbar_fcs_lb,FALSE);
188 gtk_widget_set_sensitive(airpcap_toolbar_button,FALSE);
189 gtk_widget_set_sensitive(airpcap_toolbar_button,FALSE);
190 gtk_widget_set_sensitive(airpcap_toolbar_decryption,FALSE);
191 gtk_widget_set_sensitive(airpcap_toolbar_decryption_lb,FALSE);
192 gtk_widget_set_sensitive(airpcap_toolbar_keys_button,FALSE);
193 airpcap_set_toolbar_no_if(airpcap_tb);
198 * Set up the airpcap toolbar for the new capture interface
201 airpcap_set_toolbar_stop_capture(airpcap_if_info_t* if_info)
203 GtkWidget *airpcap_toolbar_crc_filter_combo;
204 GtkWidget *airpcap_toolbar_label;
205 GtkWidget *airpcap_toolbar_channel;
206 GtkWidget *airpcap_toolbar_channel_lb;
207 GtkWidget *airpcap_toolbar_channel_offset;
208 GtkWidget *airpcap_toolbar_channel_offset_lb;
209 GtkWidget *airpcap_toolbar_button;
210 GtkWidget *airpcap_toolbar_fcs;
211 GtkWidget *airpcap_toolbar_fcs_lb;
212 GtkWidget *airpcap_toolbar_decryption;
213 GtkWidget *airpcap_toolbar_decryption_lb;
214 GtkWidget *airpcap_toolbar_keys_button;
216 gchar *if_label_text;
218 airpcap_toolbar_crc_filter_combo = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_FCS_FILTER_KEY);
219 airpcap_toolbar_label = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_INTERFACE_KEY);
220 airpcap_toolbar_channel = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_CHANNEL_KEY);
221 airpcap_toolbar_channel_lb = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_CHANNEL_LABEL_KEY);
222 airpcap_toolbar_channel_offset = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_CHANNEL_OFFSET_KEY);
223 airpcap_toolbar_channel_offset_lb = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_CHANNEL_OFFSET_LABEL_KEY);
224 airpcap_toolbar_fcs = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_FCS_FILTER_KEY);
225 airpcap_toolbar_fcs_lb = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_FCS_FILTER_LABEL_KEY);
226 airpcap_toolbar_button = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_ADVANCED_KEY);
227 airpcap_toolbar_decryption = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_DECRYPTION_KEY);
228 airpcap_toolbar_decryption_lb = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_DECRYPTION_LABEL_KEY);
229 airpcap_toolbar_keys_button = g_object_get_data(G_OBJECT(airpcap_tb),AIRPCAP_TOOLBAR_KEY_MANAGEMENT_KEY);
231 /* The current interface is an airpcap interface */
234 gtk_widget_set_sensitive(airpcap_tb,TRUE);
235 gtk_widget_set_sensitive(airpcap_toolbar_label,TRUE);
236 gtk_widget_set_sensitive(airpcap_toolbar_channel,TRUE);
237 gtk_widget_set_sensitive(airpcap_toolbar_channel_lb,TRUE);
238 gtk_widget_set_sensitive(airpcap_toolbar_channel_offset,TRUE);
239 gtk_widget_set_sensitive(airpcap_toolbar_channel_offset_lb,TRUE);
240 gtk_widget_set_sensitive(airpcap_toolbar_fcs,TRUE);
241 gtk_widget_set_sensitive(airpcap_toolbar_fcs_lb,TRUE);
242 gtk_widget_set_sensitive(airpcap_toolbar_button,TRUE);
243 gtk_widget_set_sensitive(airpcap_toolbar_crc_filter_combo,TRUE);
244 gtk_widget_set_sensitive(airpcap_toolbar_decryption,TRUE);
245 gtk_widget_set_sensitive(airpcap_toolbar_decryption_lb,TRUE);
246 gtk_widget_set_sensitive(airpcap_toolbar_keys_button,TRUE);
247 airpcap_validation_type_combo_set_by_type(GTK_WIDGET(airpcap_toolbar_crc_filter_combo),if_info->CrcValidationOn);
249 /*decription check box*/
250 g_signal_handlers_block_by_func (airpcap_toolbar_decryption,airpcap_toolbar_encryption_cb, airpcap_tb);
251 if(if_info->DecryptionOn == AIRPCAP_DECRYPTION_ON)
252 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(airpcap_toolbar_decryption),TRUE);
254 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(airpcap_toolbar_decryption),FALSE);
255 g_signal_handlers_unblock_by_func (airpcap_toolbar_decryption,airpcap_toolbar_encryption_cb, airpcap_tb);
257 if_label_text = g_strdup_printf("Current Wireless Interface: #%s", airpcap_get_if_string_number(if_info));
258 gtk_label_set_text(GTK_LABEL(airpcap_toolbar_label),if_label_text);
259 g_free(if_label_text);
261 change_airpcap_settings = FALSE;
262 if (if_info->pSupportedChannels != NULL && if_info->numSupportedChannels > 0){
264 GList *channel_list = NULL;
266 for (; i<if_info->numSupportedChannels; i++){
267 channel_list = g_list_append(channel_list, ieee80211_mhz_to_str(if_info->pSupportedChannels[i].Frequency));
269 gtk_combo_set_popdown_strings( GTK_COMBO(airpcap_toolbar_channel), channel_list);
270 airpcap_free_channel_combo_list(channel_list);
273 airpcap_update_channel_combo(GTK_WIDGET(airpcap_toolbar_channel),if_info);
274 airpcap_update_channel_offset_cb(if_info, if_info->channelInfo.Frequency, airpcap_toolbar_channel_offset);
275 airpcap_update_channel_offset_combo_entry(airpcap_toolbar_channel_offset, if_info->channelInfo.ExtChannel);
276 change_airpcap_settings = TRUE;
280 gtk_widget_set_sensitive(airpcap_tb,TRUE);
281 gtk_widget_set_sensitive(airpcap_toolbar_label,FALSE);
282 gtk_widget_set_sensitive(airpcap_toolbar_channel,FALSE);
283 gtk_widget_set_sensitive(airpcap_toolbar_channel_lb,FALSE);
284 gtk_widget_set_sensitive(airpcap_toolbar_channel_offset,FALSE);
285 gtk_widget_set_sensitive(airpcap_toolbar_channel_offset_lb,FALSE);
286 gtk_widget_set_sensitive(airpcap_toolbar_fcs,FALSE);
287 gtk_widget_set_sensitive(airpcap_toolbar_fcs_lb,FALSE);
288 gtk_widget_set_sensitive(airpcap_toolbar_button,FALSE);
289 gtk_widget_set_sensitive(airpcap_toolbar_crc_filter_combo,FALSE);
290 gtk_widget_set_sensitive(airpcap_toolbar_decryption,TRUE);
291 gtk_widget_set_sensitive(airpcap_toolbar_decryption_lb,TRUE);
292 gtk_widget_set_sensitive(airpcap_toolbar_keys_button,TRUE);
293 airpcap_set_toolbar_no_if(airpcap_tb);
294 change_airpcap_settings = FALSE;
299 * Add a key (string) to the given list
302 airpcap_add_key_to_list(GtkWidget *keylist, gchar* type, gchar* key, gchar* ssid)
306 new_row[0] = g_strdup(type);
307 new_row[1] = g_strdup(key);
308 new_row[2] = g_strdup(ssid);
310 gtk_clist_append(GTK_CLIST(keylist),new_row);
318 * Modify a key given a list and a row
321 airpcap_modify_key_in_list(GtkWidget *keylist, gint row, gchar* type, gchar* key, gchar* ssid)
325 new_row[0] = g_strdup(type);
326 new_row[1] = g_strdup(key);
327 new_row[2] = g_strdup(ssid);
329 gtk_clist_set_text(GTK_CLIST(keylist),row,0,new_row[0]);
330 gtk_clist_set_text(GTK_CLIST(keylist),row,1,new_row[1]);
331 gtk_clist_set_text(GTK_CLIST(keylist),row,2,new_row[2]);
339 * Fill the list with the keys. BEWARE! At this point, Wireshark and Drivers
340 * keys should be EQUALS! But is better to load keys from Wireshark, because
341 * the driver is not always present, and maybe that cannot support some keys
342 * (i.e. the WPA problem)
345 airpcap_fill_key_list(GtkWidget *keylist)
351 airpcap_if_info_t* fake_if_info;
352 GList* wireshark_key_list=NULL;
353 decryption_key_t* curr_key = NULL;
357 fake_if_info = airpcap_driver_fake_if_info_new();
359 /* We can retrieve the driver's key list (i.e. we have the right .dll)*/
360 wireshark_key_list = get_wireshark_keys();
361 n = g_list_length(wireshark_key_list);
363 for(i = 0; i < n; i++)
365 curr_key = (decryption_key_t*)g_list_nth_data(wireshark_key_list,i);
367 if(curr_key->type == AIRPDCAP_KEY_TYPE_WEP)
369 s = g_strdup(curr_key->key->str);
371 new_row[0] = g_strdup(AIRPCAP_WEP_KEY_STRING);
372 new_row[1] = g_strdup(s);
373 new_row[2] = g_strdup("");
375 gtk_clist_append(GTK_CLIST(keylist),new_row);
383 else if(curr_key->type == AIRPDCAP_KEY_TYPE_WPA_PWD)
385 s = g_strdup(curr_key->key->str);
386 if(curr_key->ssid != NULL)
387 s2= g_strdup(format_uri(curr_key->ssid, ":"));
391 new_row[0] = g_strdup(AIRPCAP_WPA_PWD_KEY_STRING);
392 new_row[1] = g_strdup(s);
394 if(curr_key->ssid != NULL)
395 new_row[2] = g_strdup(s2);
397 new_row[2] = g_strdup("");
399 gtk_clist_append(GTK_CLIST(keylist),new_row);
409 else if(curr_key->type == AIRPDCAP_KEY_TYPE_WPA_PMK)
411 s = g_strdup(curr_key->key->str);
413 new_row[0] = g_strdup(AIRPCAP_WPA_BIN_KEY_STRING);
414 new_row[1] = g_strdup(s);
415 new_row[2] = g_strdup("");
417 gtk_clist_append(GTK_CLIST(keylist),new_row);
427 airpcap_if_info_free(fake_if_info);
432 * Function used to retrieve the AirpcapValidationType given the string name.
434 AirpcapValidationType
435 airpcap_get_validation_type(const gchar* name)
437 if(!(g_ascii_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_ALL,name)))
439 return AIRPCAP_VT_ACCEPT_EVERYTHING;
441 else if(!(g_ascii_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_CORRECT,name)))
443 return AIRPCAP_VT_ACCEPT_CORRECT_FRAMES;
445 else if(!(g_ascii_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_CORRUPT,name)))
447 return AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES;
451 return AIRPCAP_VT_UNKNOWN;
456 * Function used to retrieve the string name given an AirpcapValidationType,
457 * or NULL in case of error
460 airpcap_get_validation_name(AirpcapValidationType vt)
462 if(vt == AIRPCAP_VT_ACCEPT_EVERYTHING)
464 return AIRPCAP_VALIDATION_TYPE_NAME_ALL;
466 else if(vt == AIRPCAP_VT_ACCEPT_CORRECT_FRAMES)
468 return AIRPCAP_VALIDATION_TYPE_NAME_CORRECT;
470 else if(vt == AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES)
472 return AIRPCAP_VALIDATION_TYPE_NAME_CORRUPT;
474 else if(vt == AIRPCAP_VT_UNKNOWN)
476 return AIRPCAP_VALIDATION_TYPE_NAME_UNKNOWN;
482 * Returns the AirpcapLinkType corresponding to the given string name.
485 airpcap_get_link_type(const gchar* name)
487 if(!(g_ascii_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_ONLY,name))){
488 return AIRPCAP_LT_802_11;
489 }else if(!(g_ascii_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_RADIO,name))){
490 return AIRPCAP_LT_802_11_PLUS_RADIO;
491 }else if(!(g_ascii_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_PPI,name))){
492 return AIRPCAP_LT_802_11_PLUS_PPI;
494 return AIRPCAP_LT_UNKNOWN;
499 * Returns the string name corresponding to the given AirpcapLinkType, or
500 * NULL in case of error.
503 airpcap_get_link_name(AirpcapLinkType lt)
505 if(lt == AIRPCAP_LT_802_11){
506 return AIRPCAP_LINK_TYPE_NAME_802_11_ONLY;
507 }else if(lt == AIRPCAP_LT_802_11_PLUS_RADIO){
508 return AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_RADIO;
509 }else if(lt == AIRPCAP_LT_802_11_PLUS_PPI){
510 return AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_PPI;
511 }else if(lt == AIRPCAP_LT_UNKNOWN){
512 return AIRPCAP_LINK_TYPE_NAME_UNKNOWN;
518 * Sets the entry of the link type combo using the AirpcapLinkType.
521 airpcap_link_type_combo_set_by_type(GtkWidget* c, AirpcapLinkType type)
525 s = airpcap_get_link_name(type);
526 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(c)->entry),s);
530 * Retrieves the name in link type the combo entry.
533 airpcap_link_type_combo_get_type(GtkWidget* c)
537 s = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(c)->entry));
539 return airpcap_get_link_type(s);
543 * Sets the entry of the validation combo using the AirpcapValidationType.
546 airpcap_validation_type_combo_set_by_type(GtkWidget* c, AirpcapValidationType type)
550 s = airpcap_get_validation_name(type);
551 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(c)->entry),s);
555 * Retrieves the name in the validation combo entry.
557 AirpcapValidationType
558 airpcap_validation_type_combo_get_type(GtkWidget* c)
562 s = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(c)->entry));
564 return airpcap_get_validation_type(s);
568 * Retrieve the UINT corresponding to the given string (channel only, handle with care!)
571 airpcap_get_frequency_from_str(const gchar* s)
575 sscanf(s,"%ld",&ch_freq);
577 /* XXX - check for ch_num btween 1-14, and return -1 otherwise??? */
583 * Returns the string corresponding to the given UINT (1-14, for channel only)
586 airpcap_get_channel_name(UINT n)
588 return g_strdup_printf("%d",n);
592 * Free a channel combo list
595 free_channel_string(gpointer data, gpointer user_data _U_)
601 airpcap_free_channel_combo_list(GList *channel_list)
603 if (channel_list != NULL) {
604 g_list_foreach(channel_list, free_channel_string, NULL);
605 g_list_free(channel_list);
610 * Set the combo box entry string given an UINT channel number
613 airpcap_channel_combo_set_by_number(GtkWidget* w,UINT chan_freq)
617 entry_text = ieee80211_mhz_to_str(chan_freq);
618 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(w)->entry),entry_text);
623 * Change channel of Airpcap Adapter
626 airpcap_update_frequency_and_offset(airpcap_if_info_t* if_info)
628 gchar ebuf[AIRPCAP_ERRBUF_SIZE];
630 gboolean return_value = FALSE;
632 if (if_info != NULL){
633 ad = airpcap_if_open(if_info->name, ebuf);
636 return_value = airpcap_if_set_device_channel_ex(ad,if_info->channelInfo);
637 airpcap_if_close(ad);
645 * Update the channel offset of the given combobox
648 airpcap_update_channel_offset_cb(airpcap_if_info_t* if_info, ULONG ch_freq, GtkWidget *channel_offset_cb)
650 const gchar *current_offset;
651 gchar current_offset_copy[10];
652 gchar *new_offset_str;
655 if (airpcap_if_is_any(if_info)){
656 gtk_widget_set_sensitive(GTK_WIDGET(channel_offset_cb),FALSE);
657 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(channel_offset_cb)->entry), "0");
661 current_offset = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(channel_offset_cb)->entry));
662 g_strlcpy (current_offset_copy, current_offset, sizeof(current_offset_copy));
663 chan_flags = airpcap_load_channel_offset_cb(if_info, channel_offset_cb, ch_freq);
665 new_offset_str = current_offset_copy;
667 /* If current_offset == -1 && new_offset cannot be -1 */
668 if (strcmp(current_offset_copy, "-1") == 0 && !(chan_flags & FLAG_CAN_BE_HIGH)){
669 if ((chan_flags & FLAG_CAN_BE_LOW)){
670 new_offset_str = "+1";
672 new_offset_str = "0";
674 }else if (strcmp(current_offset_copy, "+1") == 0 && !(chan_flags & FLAG_CAN_BE_LOW)){
675 if ((chan_flags & FLAG_CAN_BE_HIGH)){
676 new_offset_str = "-1";
678 new_offset_str = "0";
682 change_airpcap_settings = FALSE;
683 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(channel_offset_cb)->entry), new_offset_str);
684 change_airpcap_settings = TRUE;
686 sscanf(new_offset_str,"%c",&(if_info->channelInfo.ExtChannel));
687 if (!airpcap_update_frequency_and_offset(if_info)){
688 simple_dialog(ESD_TYPE_ERROR,ESD_BTN_OK,"Adapter failed to be set with the following settings: Frequency - %d Extension Channel - %d", if_info->channelInfo.Frequency, if_info->channelInfo.ExtChannel);
693 * Returns '1' if this is the "Any" adapter, '0' otherwise
696 airpcap_if_is_any(airpcap_if_info_t* if_info)
698 if(g_ascii_strcasecmp(if_info->name,AIRPCAP_DEVICE_ANY_EXTRACT_STRING)==0)
705 * Update channel combo box. If the airpcap interface is "Any", the combo box will be disabled.
708 airpcap_update_channel_combo(GtkWidget* w, airpcap_if_info_t* if_info)
710 gchar* frequency_list;
712 if(airpcap_if_is_any(if_info))
714 frequency_list = airpcap_get_all_channels_list(if_info);
715 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(w)->entry),frequency_list);
716 g_free(frequency_list);
717 change_airpcap_settings = FALSE;
718 gtk_widget_set_sensitive(GTK_WIDGET(w),FALSE);
722 airpcap_channel_combo_set_by_number(w,if_info->channelInfo.Frequency);
723 change_airpcap_settings = TRUE;
724 gtk_widget_set_sensitive(GTK_WIDGET(w),TRUE);
729 * Update channel offset combo box to 'offset'.
732 airpcap_update_channel_offset_combo_entry(GtkWidget* w, gchar extChannel)
734 gchar channel_offset_value[3];
737 g_snprintf(channel_offset_value, sizeof(channel_offset_value), "+%d", extChannel);
739 g_snprintf(channel_offset_value, sizeof(channel_offset_value), "%d", extChannel);
742 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(w)->entry), channel_offset_value);
746 * Update channel offset combo box given the selected frequency. Return the flags from the given frequency.
749 airpcap_load_channel_offset_cb(airpcap_if_info_t* if_info, GtkWidget* channel_offset_cb, ULONG chan_freq)
751 GList *channel_offset_list = NULL;
753 if (if_info != NULL && if_info->pSupportedChannels != NULL && if_info->numSupportedChannels > 0){
756 for (; i<if_info->numSupportedChannels; i++){
757 if (if_info->pSupportedChannels[i].Frequency == chan_freq){
758 if ((if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_HIGH)){
759 channel_offset_list = g_list_append(channel_offset_list, "-1");
761 channel_offset_list = g_list_append(channel_offset_list, "0");
762 if ((if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_LOW)){
763 channel_offset_list = g_list_append(channel_offset_list, "+1");
765 gtk_combo_set_popdown_strings( GTK_COMBO(channel_offset_cb), channel_offset_list) ;
766 gtk_widget_set_sensitive(channel_offset_cb, g_list_length(channel_offset_list) > 1);
767 g_list_free(channel_offset_list);
768 return if_info->pSupportedChannels[i].Flags;
777 * Takes the keys from the GtkList widget, and add them to the interface list
780 airpcap_add_keys_from_list(GtkWidget *key_ls, airpcap_if_info_t *if_info _U_)
787 PAirpcapKeysCollection KeysCollection;
788 ULONG KeysCollectionSize;
791 UINT keys_in_list = 0;
797 keys_in_list = GTK_CLIST(key_ls)->rows;
800 * Save the encryption keys, if we have any of them
802 KeysCollectionSize = 0;
805 * Calculate the size of the keys collection
807 KeysCollectionSize = sizeof(AirpcapKeysCollection) + keys_in_list * sizeof(AirpcapKey);
810 * Allocate the collection
812 KeysCollection = (PAirpcapKeysCollection)g_malloc(KeysCollectionSize);
815 /* Simple dialog ERROR */
816 simple_dialog(ESD_TYPE_ERROR,ESD_BTN_OK,"%s","Failed memory allocation for KeysCollection!");
821 * Populate the key collection
823 KeysCollection->nKeys = keys_in_list;
825 for(i = 0; i < keys_in_list; i++)
827 /* Retrieve the row infos */
828 gtk_clist_get_text(GTK_CLIST(key_ls),i,0,&row_type);
829 gtk_clist_get_text(GTK_CLIST(key_ls),i,1,&row_key);
830 gtk_clist_get_text(GTK_CLIST(key_ls),i,2,&row_ssid);
832 if(g_ascii_strcasecmp(row_type,AIRPCAP_WEP_KEY_STRING) == 0)
833 KeysCollection->Keys[i].KeyType = AIRPDCAP_KEY_TYPE_WEP;
834 else if(g_ascii_strcasecmp(row_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0)
835 KeysCollection->Keys[i].KeyType = AIRPCAP_KEYTYPE_TKIP;
836 else if(g_ascii_strcasecmp(row_type,AIRPCAP_WPA_BIN_KEY_STRING) == 0)
837 KeysCollection->Keys[i].KeyType = AIRPCAP_KEYTYPE_CCMP;
839 /* Retrieve the Item corresponding to the i-th key */
840 new_key = g_string_new(row_key);
842 KeysCollection->Keys[i].KeyLen = new_key->len / 2;
843 memset(&KeysCollection->Keys[i].KeyData, 0, sizeof(KeysCollection->Keys[i].KeyData));
845 for(j = 0 ; j < new_key->len; j += 2)
847 s[0] = new_key->str[j];
848 s[1] = new_key->str[j+1];
850 KeyByte = (UCHAR)strtol(s, NULL, 16);
851 KeysCollection->Keys[i].KeyData[j / 2] = KeyByte;
856 * Free the old adapter key collection!
858 if(airpcap_if_selected->keysCollection != NULL)
859 g_free(airpcap_if_selected->keysCollection);
862 * Set this collection ad the new one
864 airpcap_if_selected->keysCollection = KeysCollection;
865 airpcap_if_selected->keysCollectionSize = KeysCollectionSize;
871 * Takes the keys from the GtkList widget, and add them to the interface list
874 airpcap_add_keys_to_driver_from_list(GtkWidget *key_ls,airpcap_if_info_t *fake_if_info)
881 PAirpcapKeysCollection KeysCollection;
882 ULONG KeysCollectionSize;
885 UINT keys_in_list = 0;
891 if(fake_if_info == NULL)
894 keys_in_list = GTK_CLIST(key_ls)->rows;
897 * Save the encryption keys, if we have any of them
899 KeysCollectionSize = 0;
902 * Calculate the size of the keys collection
904 KeysCollectionSize = sizeof(AirpcapKeysCollection) + keys_in_list * sizeof(AirpcapKey);
907 * Allocate the collection
909 KeysCollection = (PAirpcapKeysCollection)g_malloc(KeysCollectionSize);
912 /* Simple dialog ERROR */
913 simple_dialog(ESD_TYPE_ERROR,ESD_BTN_OK,"%s","Failed memory allocation for KeysCollection!");
918 * Populate the key collection
920 KeysCollection->nKeys = keys_in_list;
922 for(i = 0; i < keys_in_list; i++)
924 /* Retrieve the row infos */
925 gtk_clist_get_text(GTK_CLIST(key_ls),i,0,&row_type);
926 gtk_clist_get_text(GTK_CLIST(key_ls),i,1,&row_key);
927 gtk_clist_get_text(GTK_CLIST(key_ls),i,2,&row_ssid);
929 if(g_ascii_strcasecmp(row_type,AIRPCAP_WEP_KEY_STRING) == 0)
930 KeysCollection->Keys[i].KeyType = AIRPDCAP_KEY_TYPE_WEP;
931 else if(g_ascii_strcasecmp(row_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0)
932 KeysCollection->Keys[i].KeyType = AIRPDCAP_KEY_TYPE_WPA_PWD;
933 else if(g_ascii_strcasecmp(row_type,AIRPCAP_WPA_BIN_KEY_STRING) == 0)
934 KeysCollection->Keys[i].KeyType = AIRPDCAP_KEY_TYPE_WPA_PMK;
936 /* Retrieve the Item corresponding to the i-th key */
937 new_key = g_string_new(row_key);
939 KeysCollection->Keys[i].KeyLen = new_key->len / 2;
940 memset(&KeysCollection->Keys[i].KeyData, 0, sizeof(KeysCollection->Keys[i].KeyData));
942 /* Key must be saved in adifferent way, depending on its type... */
943 if(KeysCollection->Keys[i].KeyType == AIRPDCAP_KEY_TYPE_WEP)
945 for(j = 0 ; j < new_key->len; j += 2)
947 s[0] = new_key->str[j];
948 s[1] = new_key->str[j+1];
950 KeyByte = (UCHAR)strtol(s, NULL, 16);
951 KeysCollection->Keys[i].KeyData[j / 2] = KeyByte;
954 /* XXX - Save the keys that are not WEP!!! */
958 * Free the old adapter key collection!
960 if(fake_if_info->keysCollection != NULL)
961 g_free(fake_if_info->keysCollection);
964 * Set this collection ad the new one
966 fake_if_info->keysCollection = KeysCollection;
967 fake_if_info->keysCollectionSize = KeysCollectionSize;
972 * This function will take the current keys (widget list), specified for the
973 * current adapter, and save them as default for ALL the others.
976 airpcap_read_and_save_decryption_keys_from_clist(GtkWidget* key_ls, airpcap_if_info_t* info_if, GList* if_list)
982 airpcap_if_info_t* curr_if = NULL;
983 airpcap_if_info_t* fake_info_if = NULL;
984 GList* key_list=NULL;
986 char* tmp_type = NULL;
987 char* tmp_key = NULL;
988 char* tmp_ssid = NULL;
990 decryption_key_t* tmp_dk=NULL;
993 * Save the keys for Wireshark...
996 /* Create a list of keys from the list widget... */
997 n = GTK_CLIST(key_ls)->rows;
999 for(i = 0; i < n; i++)
1001 /* XXX - Create a decryption_key_t struct, and pass a list of those structs!!! */
1002 gtk_clist_get_text(GTK_CLIST(key_ls),i,0,&tmp_type);
1003 gtk_clist_get_text(GTK_CLIST(key_ls),i,1,&tmp_key);
1004 gtk_clist_get_text(GTK_CLIST(key_ls),i,2,&tmp_ssid);
1006 if(g_ascii_strcasecmp(tmp_type,AIRPCAP_WEP_KEY_STRING) == 0)
1008 tmp_dk = (decryption_key_t*)g_malloc(sizeof(decryption_key_t));
1009 tmp_dk->key = g_string_new(tmp_key);
1010 tmp_dk->ssid = NULL;
1011 tmp_dk->type = AIRPDCAP_KEY_TYPE_WEP;
1012 tmp_dk->bits = tmp_dk->key->len * 4;
1013 key_list = g_list_append(key_list,tmp_dk);
1015 else if(g_ascii_strcasecmp(tmp_type,AIRPCAP_WPA_PWD_KEY_STRING) == 0)
1017 tmp_dk = (decryption_key_t*)g_malloc(sizeof(decryption_key_t));
1018 tmp_dk->key = g_string_new(tmp_key);
1019 tmp_dk->ssid = g_byte_array_new();
1020 uri_str_to_bytes(tmp_ssid, tmp_dk->ssid);
1021 tmp_dk->type = AIRPDCAP_KEY_TYPE_WPA_PWD;
1023 key_list = g_list_append(key_list,tmp_dk);
1025 else if(g_ascii_strcasecmp(tmp_type,AIRPCAP_WPA_BIN_KEY_STRING) == 0)
1027 tmp_dk = (decryption_key_t*)g_malloc(sizeof(decryption_key_t));
1028 tmp_dk->key = g_string_new(tmp_key);
1029 tmp_dk->ssid = NULL; /* No SSID in this case */
1030 tmp_dk->type = AIRPDCAP_KEY_TYPE_WPA_PMK;
1032 key_list = g_list_append(key_list,tmp_dk);
1036 r = save_wlan_wireshark_wep_keys(key_list);
1037 /* The key_list has been freed!!! */
1040 * Save the key list for driver.
1042 if( (if_list == NULL) || (info_if == NULL) ) return;
1044 fake_info_if = airpcap_driver_fake_if_info_new();
1046 airpcap_add_keys_to_driver_from_list(key_ls,fake_info_if);
1047 airpcap_save_driver_if_configuration(fake_info_if);
1048 airpcap_if_info_free(fake_info_if);
1050 if_n = g_list_length(if_list);
1052 /* For all the adapters in the list, empty the key list */
1053 for(i = 0; i < if_n; i++)
1055 curr_if = (airpcap_if_info_t*)g_list_nth_data(if_list,i);
1059 /* XXX - Set an empty collection */
1060 airpcap_if_clear_decryption_settings(curr_if);
1062 /* Save to registry */
1063 airpcap_save_selected_if_configuration(curr_if);
1069 * This function will load from the preferences file ALL the
1070 * keys (WEP, WPA and WPA_BIN) and will set them as default for
1071 * each adapter. To do this, it will save the keys in the registry...
1072 * A check will be performed, to make sure that keys found in
1073 * registry and keys found in Wireshark preferences are the same. If not,
1074 * the user will be asked to choose if use all keys (merge them),
1075 * or use Wireshark preferences ones. In the last case, registry keys will
1076 * be overwritten for all the connected AirPcap adapters.
1077 * In the first case, adapters will use their own keys, but those
1078 * keys will not be accessible via Wireshark...
1081 airpcap_check_decryption_keys(GList* if_list)
1085 gint n_adapters_keys = 0;
1086 gint n_driver_keys = 0;
1087 gint n_wireshark_keys = 0;
1088 airpcap_if_info_t* curr_if = NULL;
1090 GList* wireshark_key_list;
1091 GList* driver_key_list;
1092 GList* curr_adapter_key_list;
1094 gboolean equals = TRUE;
1095 gboolean adapters_keys_equals=TRUE;
1098 * If no AirPcap interface is found, return TRUE, so Wireshark
1099 * will use HIS OWN keys.
1104 if_n = g_list_length(if_list);
1106 /* Get Wireshark preferences keys */
1107 wireshark_key_list = get_wireshark_keys();
1108 n_wireshark_keys = g_list_length(wireshark_key_list);
1110 /* Retrieve AirPcap driver's keys */
1111 driver_key_list = get_airpcap_driver_keys();
1112 n_driver_keys = g_list_length(driver_key_list);
1114 equals &= key_lists_are_equal(wireshark_key_list,driver_key_list);
1116 for(i = 0; i < if_n; i++)
1118 curr_if = (airpcap_if_info_t*)g_list_nth_data(if_list,i);
1119 curr_adapter_key_list = get_airpcap_device_keys(curr_if);
1120 n_adapters_keys += g_list_length(curr_adapter_key_list);
1121 adapters_keys_equals &= key_lists_are_equal(wireshark_key_list,curr_adapter_key_list);
1124 if(n_adapters_keys != 0) /* If for some reason at least one specific key has been found */
1125 equals &= adapters_keys_equals; /* */
1127 if(n_driver_keys == 0) /* No keys set in any of the AirPcap adapters... */
1128 return TRUE; /* Use Wireshark keys and set them ad default for airpcap devices */
1134 * This function will load from the preferences file ALL the
1135 * keys (WEP, WPA_PWD and WPA_BIN) and will set them as default for
1136 * each adapter. To do this, it will save the keys in the registry...
1137 * A check will be performed, to make sure that keys found in
1138 * registry and keys found in Wireshark preferences are the same. If not,
1139 * the user will be asked to choose if use all keys (merge them),
1140 * or use Wireshark preferences ones. In the last case, registry keys will
1141 * be overwritten for all the connected AirPcap adapters.
1142 * In the first case, adapters will use their own keys, but those
1143 * keys will not be accessible via Wireshark...
1146 airpcap_load_decryption_keys(GList* if_list)
1150 airpcap_if_info_t* curr_if = NULL;
1152 if(if_list == NULL) return;
1154 if_n = g_list_length(if_list);
1156 for(i = 0; i < if_n; i++)
1158 curr_if = (airpcap_if_info_t*)g_list_nth_data(if_list,i);
1159 load_wlan_driver_wep_keys();
1164 * This function will set the gibven GList of decryption_key_t structures
1165 * as the defoult for both Wireshark and the AirPcap adapters...
1168 airpcap_save_decryption_keys(GList* key_list, GList* adapters_list)
1173 airpcap_if_info_t* curr_if = NULL;
1174 GList* empty_key_list = NULL;
1176 if( (key_list == NULL) || (adapters_list == NULL)) return;
1178 if_n = g_list_length(adapters_list);
1179 key_n = g_list_length(key_list);
1181 /* Set the driver's global list of keys. */
1182 write_wlan_driver_wep_keys_to_registry(key_list);
1184 /* Empty the key list for each interface */
1185 for(i = 0; i < if_n; i++)
1187 curr_if = (airpcap_if_info_t*)g_list_nth_data(adapters_list,i);
1188 write_wlan_wep_keys_to_registry(curr_if,empty_key_list);
1192 * This will set the keys of the current adapter as Wireshark default...
1193 * Now all the adapters have the same keys, so curr_if is ok as any other...
1195 save_wlan_wireshark_wep_keys(key_list);
1199 * This function is used to enable/disable the toolbar widgets
1200 * depending on the type of interface selected... Not the whole
1201 * toolbar must be grayed/enabled ... Only some widgets...
1204 airpcap_enable_toolbar_widgets(GtkWidget* w, gboolean en)
1206 GtkWidget *toolbar_tb,
1221 if_description_lb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_INTERFACE_KEY);
1222 channel_lb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_CHANNEL_LABEL_KEY);
1223 channel_cb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_CHANNEL_KEY);
1224 channel_offset_cb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_CHANNEL_OFFSET_KEY);
1225 channel_offset_lb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_CHANNEL_OFFSET_LABEL_KEY);
1226 fcs_lb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_FCS_FILTER_LABEL_KEY);
1227 fcs_cb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_FCS_FILTER_KEY);
1228 advanced_bt = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_ADVANCED_KEY);
1231 if(if_description_lb != NULL) gtk_widget_set_sensitive(if_description_lb,en);
1232 if(channel_lb != NULL) gtk_widget_set_sensitive(channel_lb,en);
1233 if(channel_cb != NULL) gtk_widget_set_sensitive(channel_cb,en);
1234 if(channel_offset_cb != NULL) gtk_widget_set_sensitive(channel_offset_cb,en);
1235 if(channel_offset_lb != NULL) gtk_widget_set_sensitive(channel_offset_lb,en);
1236 if(fcs_lb != NULL) gtk_widget_set_sensitive(fcs_lb,en);
1237 if(fcs_cb != NULL) gtk_widget_set_sensitive(fcs_cb,en);
1238 if(advanced_bt != NULL) gtk_widget_set_sensitive(advanced_bt,en);
1244 * This function sets up the correct airpcap toolbar that must
1245 * be displayed when no airpcap if is found on the system...
1248 airpcap_set_toolbar_no_if(GtkWidget* w)
1250 GtkWidget *toolbar_tb,
1265 if_description_lb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_INTERFACE_KEY);
1266 channel_lb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_CHANNEL_LABEL_KEY);
1267 channel_cb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_CHANNEL_KEY);
1268 channel_offset_lb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_CHANNEL_OFFSET_LABEL_KEY);
1269 channel_offset_cb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_CHANNEL_OFFSET_KEY);
1270 fcs_lb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_FCS_FILTER_LABEL_KEY);
1271 fcs_cb = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_FCS_FILTER_KEY);
1272 advanced_bt = g_object_get_data(G_OBJECT(toolbar_tb),AIRPCAP_TOOLBAR_ADVANCED_KEY);
1274 if(fcs_cb != NULL) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(fcs_cb)->entry),"");
1275 if(channel_cb != NULL) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(channel_cb)->entry),"");
1276 if(channel_offset_cb != NULL) gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(channel_offset_cb)->entry),"");
1277 if(if_description_lb != NULL) gtk_label_set_text(GTK_LABEL(if_description_lb),"Current Wireless Interface: None");
1279 /*if(if_description_lb != NULL) gtk_widget_set_sensitive(if_description_lb,FALSE);
1280 if(channel_lb != NULL) gtk_widget_set_sensitive(channel_lb,FALSE);
1281 if(channel_cb != NULL) gtk_widget_set_sensitive(channel_cb,FALSE);
1282 if(fcs_lb != NULL) gtk_widget_set_sensitive(fcs_lb,FALSE);
1283 if(fcs_cb != NULL) gtk_widget_set_sensitive(fcs_cb,FALSE);
1284 if(advanced_bt != NULL) gtk_widget_set_sensitive(advanced_bt,FALSE);*/
1287 #endif /* HAVE_AIRPCAP */