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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __FREQUENCY_UTILS_H__
26 #define __FREQUENCY_UTILS_H__
28 #include "ws_symbol_export.h"
31 * Frequency and channel conversion utilities.
35 * Given a center frequency in MHz, return a channel number.
36 * @param freq Frequency in MHz.
37 * @return The equivalent channel or -1 if no match is found.
41 ieee80211_mhz_to_chan(guint freq
);
44 * Given a channel number and a band type, return a center frequency.
45 * @param chan Channel number
46 * @param is_bg TRUE if the channel is a b/g channel, FALSE otherwise.
47 * @return The equivalent frequency or 0 if no match is found.
51 ieee80211_chan_to_mhz(gint chan
, gboolean is_bg
);
54 * Given a frequency in MHz, return a string representation.
55 * @param freq Frequench in MHz.
56 * @return A string showing the frequency, channel number, and type. The string must be freed with g_free() after use.
60 ieee80211_mhz_to_str(guint freq
);
62 /* Should this be "(freq < 4920)", or something else? */
63 #define FREQ_IS_BG(freq) (freq <= 2484)
71 * indent-tabs-mode: nil
74 * ex: set shiftwidth=4 tabstop=8 expandtab:
75 * :indentSize=4:tabSize=8:noTabs=true:
78 #endif /* __FREQUENCY_UTILS_H__ */