1 
2 #include "wifi_hal.h"
3 
4 #ifndef _TDLS_H_
5 #define _TDLS_H_
6 
7 typedef enum {
8     WIFI_TDLS_DISABLED = 1,                 /* TDLS is not enabled, default status for all STAs */
9     WIFI_TDLS_ENABLED,                      /* TDLS is enabled, but not yet tried */
10     WIFI_TDLS_ESTABLISHED,                  /* Direct link is established */
11     WIFI_TDLS_ESTABLISHED_OFF_CHANNEL,      /* Direct link is established using MCC */
12     WIFI_TDLS_DROPPED,                      /* Direct link was established,
13                                              * but is temporarily dropped now */
14     WIFI_TDLS_FAILED                        /* TDLS permanent failed. Inform error to upper layer
15                                              * and go back to WIFI_TDLS_DISABLED */
16 } wifi_tdls_state;
17 
18 typedef enum {
19     WIFI_TDLS_SUCCESS,                              /* Success */
20     WIFI_TDLS_UNSPECIFIED           = -1,           /* Unspecified reason */
21     WIFI_TDLS_NOT_SUPPORTED         = -2,           /* Remote side doesn't support TDLS */
22     WIFI_TDLS_UNSUPPORTED_BAND      = -3,           /* Remote side doesn't support this band */
23     WIFI_TDLS_NOT_BENEFICIAL        = -4,           /* Going to AP is better than going direct */
24     WIFI_TDLS_DROPPED_BY_REMOTE     = -5            /* Remote side doesn't want it anymore */
25 } wifi_tdls_reason;
26 
27 typedef struct {
28     int channel;                        /* channel hint, in channel number (NOT frequency ) */
29     int global_operating_class;         /* operating class to use */
30     int max_latency_ms;                 /* max latency that can be tolerated by apps */
31     int min_bandwidth_kbps;             /* bandwidth required by apps, in kilo bits per second */
32 } wifi_tdls_params;
33 
34 typedef struct {
35     int channel;
36     int global_operating_class;
37     wifi_tdls_state state;
38     wifi_tdls_reason reason;
39 } wifi_tdls_status;
40 
41 typedef struct {
42     int max_concurrent_tdls_session_num;      /* Maximum TDLS session number can be supported by the
43                                               * Firmware and hardware*/
44     int is_global_tdls_supported;            /* 1 -- support,  0 -- not support */
45     int is_per_mac_tdls_supported;           /* 1 -- support,  0 -- not support */
46     int is_off_channel_tdls_supported;       /* 1 -- support,  0 -- not support */
47 } wifi_tdls_capabilities;
48 
49 typedef struct {
50     /* on_tdls_state_changed - reports state of TDLS link to framework
51      * Report this event when the state of TDLS link changes */
52     void (*on_tdls_state_changed)(mac_addr addr, wifi_tdls_status status);
53 } wifi_tdls_handler;
54 
55 
56 /* wifi_enable_tdls - enables TDLS-auto mode for a specific route
57  *
58  * params specifies hints, which provide more information about
59  * why TDLS is being sought. The firmware should do its best to
60  * honor the hints before downgrading regular AP link
61  * If upper layer has no specific values, this should be NULL
62  *
63  * handler is used to inform the upper layer about the status change and the corresponding reason
64  */
65 wifi_error wifi_enable_tdls(wifi_interface_handle iface, mac_addr addr,
66         wifi_tdls_params *params, wifi_tdls_handler handler);
67 
68 /* wifi_disable_tdls - disables TDLS-auto mode for a specific route
69  *
70  * This terminates any existing TDLS with addr device, and frees the
71  * device resources to make TDLS connections on new routes.
72  *
73  * DON'T fire any more events on 'handler' specified in earlier call to
74  * wifi_enable_tdls after this action.
75  */
76 wifi_error wifi_disable_tdls(wifi_interface_handle iface, mac_addr addr);
77 
78 /* wifi_get_tdls_status - allows getting the status of TDLS for a specific route */
79 wifi_error wifi_get_tdls_status(wifi_interface_handle iface, mac_addr addr,
80         wifi_tdls_status *status);
81 
82 /* return the current HW + Firmware combination's TDLS capabilities */
83 wifi_error wifi_get_tdls_capabilities(wifi_interface_handle iface,
84         wifi_tdls_capabilities *capabilities);
85 #endif
86