lin
2025-08-21 57113df3a0e2be01232281fad9a5f2c060567981
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef __MAIN_H__
#define __MAIN_H__
 
#define LOG_TAG  "SKW_WiFiHAL"
#include <log/log.h>
 
#include "wifi_hal.h"
 
#define OUI_GOOGLE     0x001A11
#define SKW_NR_IFACE   8
 
#define skw_nla_for_each_nested(pos, nla, rem) \
   for (pos = (nlattr *)nla_data(nla), rem = nla_len(nla); \
        nla_ok(pos, rem); \
        pos = (nlattr *)nla_next(pos, &(rem)))
 
typedef struct {
   int  iface_idx;                                // id to use when talking to driver
   int  wdev_idx;                                 // id to use when talking to driver
   wifi_handle hal_handle;                        // handle to wifi data
   char name[IFNAMSIZ+1];                         // interface name + trailing null
} interface_info;
 
typedef struct {
   struct nl_sock *nl_hal;                        // command socket object
   struct nl_sock *nl_event;                      // event socket object
   int family_nl80211;                            // family id for 80211 driver
 
   bool exit;                                     // Indication to exit since cleanup has started
   int exit_socks[2];                             // sockets used to implement wifi_cleanup
   wifi_cleaned_up_handler cleaned_up_handler;
 
   bool in_event_loop;                             // Indicates that event loop is active
 
   pthread_mutex_t cb_lock;                        // mutex for the event_cb access
 
   int num_cmd;                                    // number of commands
   int alloc_cmd;                                  // number of commands allocated
 
   int nr_interfaces;
   interface_info interfaces[SKW_NR_IFACE];
   wifi_interface_handle interface_handle[SKW_NR_IFACE];
 
   int max_num_interfaces;                         // max number of interfaces
 
   // add other details
} hal_info;
 
static inline hal_info *getHalInfo(wifi_interface_handle handle)
{
    return (hal_info *)(((interface_info *)handle)->hal_handle);
}
#endif