Ejemplo n.º 1
0
/*
 * Change channel of Airpcap Adapter
 */
static gboolean
airpcap_update_frequency_and_offset(airpcap_if_info_t* if_info)
{
    gchar ebuf[AIRPCAP_ERRBUF_SIZE];
    PAirpcapHandle ad;
    gboolean return_value = FALSE;

    if (if_info != NULL){
        ad = airpcap_if_open(if_info->name, ebuf);

        if(ad != NULL) {
            return_value = airpcap_if_set_device_channel_ex(ad,if_info->channelInfo);
            airpcap_if_close(ad);
        }
    }

    return return_value;
}
/*
 * Callback for the wrong crc combo
 */
static void
airpcap_toolbar_fcs_filter_combo_cb(GtkWidget *fcs_filter_cb, gpointer user_data _U_)
{
    PAirpcapHandle ad;
    gchar ebuf[AIRPCAP_ERRBUF_SIZE];
    gchar *fcs_filter_str;

    if (fcs_filter_cb != NULL && !block_toolbar_signals && (airpcap_if_active != NULL)) {
        fcs_filter_str = gtk_combo_box_get_active_text(GTK_COMBO_BOX(fcs_filter_cb));
        ad = airpcap_if_open(airpcap_if_active->name, ebuf);

        if (fcs_filter_str && (g_ascii_strcasecmp("", fcs_filter_str)) && ad) {
            airpcap_if_selected->CrcValidationOn = airpcap_get_validation_type(fcs_filter_str);
            airpcap_if_selected->saved = FALSE;
	    airpcap_if_set_fcs_validation(ad,airpcap_if_active->CrcValidationOn);
	    /* Save configuration */
	    airpcap_if_store_cur_config_as_adapter_default(ad);
	    airpcap_if_close(ad);
        }
        g_free(fcs_filter_str);
    }
}