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/. */
6 * Abstraction on top of the network support from libnetutils that we
7 * use to set up network connections.
10 #ifndef WifiHotspotUtils_h
11 #define WifiHotspotUtils_h
13 // Forward declaration.
16 class WifiHotspotUtils
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
,
26 int32_t do_wifi_hostapd_get_stations();
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); \
41 MOZ_CRASH("Symbol not found in shared library : " #name); \
44 #endif // WifiHotspotUtils_h