1 2 #include "wifi_hal.h" 3 4 #ifndef _TDLS_H_ 5 #define _TDLS_H_ 6 7 typedef enum { 8 WIFI_TDLS_DISABLED, /* TDLS is not enabled, or is disabled now */ 9 WIFI_TDLS_ENABLED, /* TDLS is enabled, but not yet tried */ 10 WIFI_TDLS_TRYING, /* Direct link is being attempted (optional) */ 11 WIFI_TDLS_ESTABLISHED, /* Direct link is established */ 12 WIFI_TDLS_ESTABLISHED_OFF_CHANNEL, /* Direct link is established using MCC */ 13 WIFI_TDLS_DROPPED, /* Direct link was established, but is now dropped */ 14 WIFI_TDLS_FAILED /* Direct link failed */ 15 } wifi_tdls_state; 16 17 typedef enum { 18 WIFI_TDLS_SUCCESS, /* Success */ 19 WIFI_TDLS_UNSPECIFIED = -1, /* Unspecified reason */ 20 WIFI_TDLS_NOT_SUPPORTED = -2, /* Remote side doesn't support TDLS */ 21 WIFI_TDLS_UNSUPPORTED_BAND = -3, /* Remote side doesn't support this band */ 22 WIFI_TDLS_NOT_BENEFICIAL = -4, /* Going to AP is better than going direct */ 23 WIFI_TDLS_DROPPED_BY_REMOTE = -5 /* Remote side doesn't want it anymore */ 24 } wifi_tdls_reason; 25 26 typedef struct { 27 int channel; /* channel hint, in channel number (NOT frequency ) */ 28 int global_operating_class; /* operating class to use */ 29 int max_latency_ms; /* max latency that can be tolerated by apps */ 30 int min_bandwidth_kbps; /* bandwidth required by apps, in kilo bits per second */ 31 } wifi_tdls_params; 32 33 typedef struct { 34 int channel; 35 int global_operating_class; 36 wifi_tdls_state state; 37 wifi_tdls_reason reason; 38 } wifi_tdls_status; 39 40 typedef struct { 41 /* on_tdls_state_changed - reports state to TDLS link 42 * Report this event when the state of TDLS link changes */ 43 void (*on_tdls_state_changed)(mac_addr addr, wifi_tdls_status status); 44 } wifi_tdls_handler; 45 46 47 /* wifi_enable_tdls - enables TDLS-auto mode for a specific route 48 * 49 * params specifies hints, which provide more information about 50 * why TDLS is being sought. The firmware should do its best to 51 * honor the hints before downgrading regular AP link 52 * 53 * On successful completion, must fire on_tdls_state_changed event 54 * to indicate the status of TDLS operation. 55 */ 56 wifi_error wifi_enable_tdls(wifi_interface_handle iface, mac_addr addr, 57 wifi_tdls_params params, wifi_tdls_handler handler); 58 59 /* wifi_disable_tdls - disables TDLS-auto mode for a specific route 60 * 61 * This terminates any existing TDLS with addr device, and frees the 62 * device resources to make TDLS connections on new routes. 63 * 64 * DON'T fire any more events on 'handler' specified in earlier call to 65 * wifi_enable_tdls after this action. 66 */ 67 wifi_error wifi_disable_tdls(wifi_interface_handle iface, mac_addr addr); 68 69 /* wifi_get_tdls_status - allows getting the status of TDLS for a specific route */ 70 wifi_error wifi_get_tdls_status(wifi_interface_handle iface, mac_addr addr, 71 wifi_tdls_status *status); 72 73 #endif