summaryrefslogtreecommitdiff
path: root/qcwcn/wifi_hal/nan_cert.h
blob: 85b7073e75037b68bc5377b5c0350697f55573fa (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.

 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials provided
 *       with the distribution.
 *     * Neither the name of The Linux Foundation nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.

 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef __NAN_CERT_H__
#define __NAN_CERT_H__


#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

#ifndef PACKED
#define PACKED  __attribute__((packed))
#endif
#define NAN_CERT_VERSION                        5
#define NAN_MAX_DEBUG_MESSAGE_DATA_LEN          100
#define NAN_MAX_ALLOWED_DW_AWAKE_INTERVAL       16

typedef struct {
    /* NAN master rank being advertised by DE */
    u64 master_rank;
    /* NAN master preference being advertised by DE */
    u8 master_pref;
    /* random value being advertised by DE */
    u8 random_factor;
    /* hop_count from anchor master */
    u8 hop_count;
    u32 beacon_transmit_time;
    /* NDP channel Frequency */
    u32 ndp_channel_freq;
} NanStaParameter;

/* NAN Data Path Supported Band */
typedef enum {
    NAN_DATA_PATH_SUPPORTED_BAND_2G = 1,
    NAN_DATA_PATH_SUPPORTED_BAND_5G = 2,
    NAN_DATA_PATH_SUPPORT_DUAL_BAND = 3
} NdpSupportedBand;

/* NAN Responder mode policy */
typedef enum {
    NAN_DATA_RESPONDER_MODE_AUTO    = 0,
    NAN_DATA_RESPONDER_MODE_ACCEPT  = 1,
    NAN_DATA_RESPONDER_MODE_REJECT  = 2,
    NAN_DATA_RESPONDER_MODE_COUNTER = 3,
    NAN_DATA_RESPONDER_MODE_COUNTER_NO_CHANNEL_CHANGE = 4
} NanDataResponderMode;

/* NAN Data Path M4 response type */
typedef enum {
    NAN_DATA_PATH_M4_RESPONSE_ACCEPT = 1,
    NAN_DATA_PATH_M4_RESPONSE_REJECT = 2,
    NAN_DATA_PATH_M4_RESPONSE_BADMIC = 3
} NdpM4ResponseType;

/* NAN NMF Security Clear type */
typedef enum {
    NAN_NMF_CLEAR_DISABLE = 0,
    NAN_NMF_CLEAR_ENABLE = 1
} NanNmfClearConfig;

/* NAN Schedule type */
typedef enum {
    NAN_SCHED_VALID = 0,
    NAN_SCHED_INVALID_BAD_FA = 1,
    NAN_SCHED_INVALID_BAD_NDC = 2,
    NAN_SCHED_INVALID_BAD_IMMU = 3
} NanSchedType;

/* NAN device type */
typedef enum {
    NAN_DEVICE_TYPE_TEST_BED = 1,
    NAN_DEVICE_TYPE_DUT = 2
} NanDeviceType;

/* NAN NDPE absent or present */
typedef enum {
    NAN_NDPE_ATTR_PRESENT = 0,
    NAN_NDPE_ATTR_ABSENT = 1
} NanNdpeAttrType;

/* NAN NDP absent or present */
typedef enum {
    NAN_NDP_ATTR_ABSENT = 0,
    NAN_NDP_ATTR_PRESENT = 1
} NanNdpAttrType;

 /*
  * Definitions of debug subcommand type for the
  * generic debug command.
  */
typedef enum {
    NAN_TEST_MODE_CMD_NAN_AVAILABILITY = 1,
    NAN_TEST_MODE_CMD_NDP_INCLUDE_IMMUTABLE = 2,
    NAN_TEST_MODE_CMD_NDP_AVOID_CHANNEL = 3,
    NAN_TEST_MODE_CMD_NAN_SUPPORTED_BANDS = 4,
    NAN_TEST_MODE_CMD_AUTO_RESPONDER_MODE = 5,
    NAN_TEST_MODE_CMD_M4_RESPONSE_TYPE = 6,
    NAN_TEST_MODE_CMD_NAN_SCHED_TYPE = 7,
    NAN_TEST_MODE_CMD_NAN_NMF_CLEAR_CONFIG = 8,
    NAN_TEST_MODE_CMD_NAN_SCHED_UPDATE_ULW_NOTIFY = 9,
    NAN_TEST_MODE_CMD_NAN_SCHED_UPDATE_NDL_NEGOTIATE = 10,
    NAN_TEST_MODE_CMD_NAN_SCHED_UPDATE_NDL_NOTIFY = 11,
    NAN_TEST_MODE_CMD_NAN_AVAILABILITY_MAP_ORDER = 12,
    NAN_TEST_MODE_CMD_CONFIG_QOS = 13,
    NAN_TEST_MODE_CMD_DEVICE_TYPE = 14,
    NAN_TEST_MODE_CMD_DISABLE_NDPE = 15,
    NAN_TEST_MODE_CMD_ENABLE_NDP = 16,
} NanDebugModeCmd;

/*
 * This debug command carries any one command type
 * followed by corresponding command data content
 * as indicated below.
 *
 * command: NAN_TEST_MODE_CMD_NAN_AVAILABILITY
 * content: NAN Avaiability attribute blob
 *
 * command: NAN_TEST_MODE_CMD_NDP_INCLUDE_IMMUTABLE
 * content: u32 value (0 - Ignore 1 - Include immuatable,
 *                     2 - Don't include immutable)
 *
 * command: NAN_TEST_MODE_CMD_NDP_AVOID_CHANNEL
 * content: u32 channel_frequency; (0 - Ignore)
 *
 * command: NAN_TEST_MODE_CMD_NAN_SUPPORTED_BANDS
 * content: u32 supported_bands; (0 . Ignore, 1 . 2g,
 *                                2 . 5g, 3 . 2g & 5g)
 *
 * command: NAN_TEST_MODE_CMD_AUTO_RESPONDER_MODE
 * content: u32 auto_resp_mode; (0 . Auto, 1 . Accept,
 *                               2 . Reject, 3 . Counter)
 *
 * command: NAN_TEST_MODE_CMD_M4_RESPONSE_TYPE
 * content: u32 m4_response_type; (0.Ignore, 1.Accept,
 *                                 2.Reject, 3.BadMic)
 *
 * command: NAN_TEST_MODE_CMD_NAN_SCHED_TYPE
 * content: u32 invalid_nan_schedule; (0. Valid sched,
 *                                     1.Invalid Sched bad FA,
 *                                     2.Invalid schedbad NDC,
 *                                     3.Invalid sched bad Immutable)
 *
 * command: NAN_TEST_MODE_CMD_NAN_NMF_CLEAR_CONFIG
 * content: u32 nmf_security_config_val;(0:NAN_NMF_CLEAR_DISABLE,
 *                                       1:NAN_NMF_CLEAR_ENABLE)
 *
 * command: NAN_TEST_MODE_CMD_NAN_SCHED_UPDATE_ULW_NOTIFY
 * content: u32 channel_availability;(0/1)
 *
 * command: NAN_TEST_MODE_CMD_NAN_SCHED_UPDATE_NDL_NEGOTIATE
 * content: responder_nmi_mac (Responder NMI Mac Address)
 *
 * command: NAN_TEST_MODE_CMD_NAN_SCHED_UPDATE_NDL_NOTIFY
 * content: NONE
 *
 * command: NAN_TEST_MODE_CMD_NAN_AVAILABILITY_MAP_ORDER
 * content: u32 map_order_val; (0/1)
 *
 */
typedef struct PACKED {
    /*
     * To indicate the debug command type.
     */
    u32 cmd;
    /*
     * To hold the data for the above command
     * type.
     */
    u8 debug_cmd_data[NAN_MAX_DEBUG_MESSAGE_DATA_LEN];
} NanDebugParams;

/*
   Function to get the sta_parameter expected by Sigma
   as per CAPI spec.
*/
wifi_error nan_get_sta_parameter(transaction_id id,
                                 wifi_interface_handle iface,
                                 NanStaParameter* msg);

wifi_error nan_debug_command_config(transaction_id id,
                                   wifi_interface_handle iface,
                                   NanDebugParams msg,
                                   int debug_msg_length);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __NAN_CERT_H__ */