Include config.h in preparation of moving the definition
[metze/wireshark/wip.git] / epan / frequency-utils.h
1 /* frequency-utils.h
2  * Frequency conversion utility definitions
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 2007 Gerald Combs
9  *
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.
14  *
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.
19  *
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.
23  */
24
25 #ifndef __FREQUENCY_UTILS_H__
26 #define __FREQUENCY_UTILS_H__
27
28 /** @file
29  * Frequency and channel conversion utilities.
30  */
31
32 /**
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.
36  */
37 gint
38 ieee80211_mhz_to_chan(guint freq);
39
40 /**
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.
45  */
46 guint
47 ieee80211_chan_to_mhz(gint chan, gboolean is_bg);
48
49 /**
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.
53  */
54 gchar*
55 ieee80211_mhz_to_str(guint freq);
56
57 /* Should this be "(freq < 4920)", or something else? */
58 #define FREQ_IS_BG(freq) (freq <= 2484)
59
60 /*
61  * Editor modelines
62  *
63  * Local Variables:
64  * c-basic-offset: 4
65  * tab-width: 8
66  * indent-tabs-mode: nil
67  * End:
68  *
69  * ex: set shiftwidth=4 tabstop=8 expandtab:
70  * :indentSize=4:tabSize=8:noTabs=true:
71  */
72
73 #endif /* __FREQUENCY_UTILS_H__ */
74