Bumping manifests a=b2g-bump
[gecko.git] / dom / wifi / WifiHotspotUtils.h
blob8f77c430fa7c65a870f303b020debb1f8e2a3e9f
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /**
6 * Abstraction on top of the network support from libnetutils that we
7 * use to set up network connections.
8 */
10 #ifndef WifiHotspotUtils_h
11 #define WifiHotspotUtils_h
13 // Forward declaration.
14 struct wpa_ctrl;
16 class WifiHotspotUtils
18 public:
19 static void* GetSharedLibrary();
21 int32_t do_wifi_connect_to_hostapd();
22 int32_t do_wifi_close_hostapd_connection();
23 int32_t do_wifi_hostapd_command(const char *command,
24 char *reply,
25 size_t *reply_len);
26 int32_t do_wifi_hostapd_get_stations();
28 private:
29 struct wpa_ctrl * openConnection(const char *ifname);
30 int32_t sendCommand(struct wpa_ctrl *ctrl, const char *cmd,
31 char *reply, size_t *reply_len);
34 // Defines a function type with the right arguments and return type.
35 #define DEFINE_DLFUNC(name, ret, args...) typedef ret (*FUNC##name)(args);
37 // Set up a dlsymed function ready to use.
38 #define USE_DLFUNC(name) \
39 FUNC##name name = (FUNC##name) dlsym(GetSharedLibrary(), #name); \
40 if (!name) { \
41 MOZ_CRASH("Symbol not found in shared library : " #name); \
44 #endif // WifiHotspotUtils_h