2 * Frequency conversion utility definitions
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 2007 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef __FREQUENCY_UTILS_H__
26 #define __FREQUENCY_UTILS_H__
29 * Frequency and channel conversion utilities.
33 * Given a center frequency in MHz, return a channel number.
34 * @param freq Frequency in MHz.
35 * @return The equivalent channel or -1 if no match is found.
38 ieee80211_mhz_to_chan(guint freq);
41 * Given a channel number and a band type, return a center frequency.
42 * @param chan Channel number
43 * @param is_bg TRUE if the channel is a b/g channel, FALSE otherwise.
44 * @return The equivalent frequency or 0 if no match is found.
47 ieee80211_chan_to_mhz(gint chan, gboolean is_bg);
50 * Given a frequency in MHz, return a string representation.
51 * @param freq Frequench in MHz.
52 * @return A string showing the frequency, channel number, and type. The string must be freed with g_free() after use.
55 ieee80211_mhz_to_str(guint freq);
57 /* Should this be "(freq < 4920)", or something else? */
58 #define FREQ_IS_BG(freq) (freq <= 2484)
66 * indent-tabs-mode: nil
69 * ex: set shiftwidth=4 tabstop=8 expandtab:
70 * :indentSize=4:tabSize=8:noTabs=true:
73 #endif /* __FREQUENCY_UTILS_H__ */