aboutsummaryrefslogtreecommitdiffstats
path: root/caputils/ws80211_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'caputils/ws80211_utils.h')
-rw-r--r--caputils/ws80211_utils.h86
1 files changed, 80 insertions, 6 deletions
diff --git a/caputils/ws80211_utils.h b/caputils/ws80211_utils.h
index 7fcdc4477b..9586cb797f 100644
--- a/caputils/ws80211_utils.h
+++ b/caputils/ws80211_utils.h
@@ -23,6 +23,10 @@
#ifndef __WS80211_UTILS_H__
#define __WS80211_UTILS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
enum ws80211_channel_type {
WS80211_CHAN_NO_HT,
WS80211_CHAN_HT20,
@@ -35,28 +39,98 @@ enum ws80211_channel_type {
#define CHAN_HT40MINUS "HT40-"
#define CHAN_HT40PLUS "HT40+"
+/* XXX This doesn't match AirpcapValidationType. Should it? */
+enum ws80211_fcs_validation {
+ WS80211_FCS_ALL,
+ WS80211_FCS_VALID,
+ WS80211_FCS_INVALID
+};
+
struct ws80211_interface
{
char *ifname;
gboolean can_set_freq;
- GArray *frequencies;
+ gboolean can_check_fcs;
+ GArray *frequencies; /* Array of guint32? */
int channel_types; /* Union for all bands */
- int cap_monitor;
+ int cap_monitor;
};
struct ws80211_iface_info {
- int current_freq;
+ int current_freq;
enum ws80211_channel_type current_chan_type;
+ enum ws80211_fcs_validation current_fcs_validation;
};
-
+/** Initialize the 802.11 environment.
+ * On Linux this initializes an nl80211_state struct.
+ * On Windows this checks the AirPcap status. It does *not* load the
+ * AirPcap DLL. That happens when the program starts.
+ *
+ * @return 0 on success, an error value on failure.
+ */
int ws80211_init(void);
+
+/** Build a list of 802.11 interfaces.
+ *
+ * @return A GArray of pointers to struct ws80211_interface on success, NULL on failure.
+ */
+/* XXX Should we make this an array of structs instead of an array of struct pointers?
+ * It'd save a bit of mallocing and freeing. */
GArray* ws80211_find_interfaces(void);
+
int ws80211_get_iface_info(const char *name, struct ws80211_iface_info *iface_info);
+
+/** Free an interface list.
+ *
+ * @param interfaces A list of interfaces created with ws80211_find_interfaces().
+ */
void ws80211_free_interfaces(GArray *interfaces);
+
+/** Convert a frequency to a channel number
+ *
+ * @param freq Frequency in MHz.
+ * @return The 802.11 channel number matching the provided frequency.
+ */
int ws80211_frequency_to_channel(int freq);
+
+/** Set the frequency and channel width for an interface.
+ *
+ * @param name The interface name.
+ * @param freq The frequency in MHz.
+ * @param chan_type
+ * @return Zero on success, nonzero on failure.
+ */
int ws80211_set_freq(const char *name, int freq, int chan_type);
-int ws80211_str_to_chan_type(const gchar *s);
-const gchar *ws80211_chan_type_to_str(int type);
+
+int ws80211_str_to_chan_type(const gchar *s); /* GTK+ only? */
+const gchar *ws80211_chan_type_to_str(int type); /* GTK+ only? */
+
+/** Check to see if we have FCS filtering.
+ *
+ * @return TRUE if FCS filtering is supported on this platform.
+ */
+gboolean ws80211_has_fcs_filter(void);
+
+/** Set the FCS validation behavior for an interface.
+ *
+ * @param name The interface name.
+ * @param fcs_validation The desired validation behavior.
+ * @return Zero on success, nonzero on failure.
+ */
+int ws80211_set_fcs_validation(const char *name, enum ws80211_fcs_validation fcs_validation);
+
+
+/** Get the path to a helper application.
+ * Return the path to a separate 802.11 helper application, e.g.
+ * the AirPcap control panel or the GNOME Network Manager.
+ *
+ * @return The path to the helper on success, NULL on failure.
+ */
+const char *ws80211_get_helper_path(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
#endif /* __WS80211_UTILS_H__ */