| 1125 | } |
| 1126 | |
| 1127 | size_t buildEnhancedProbeResponse( |
| 1128 | uint8_t *buffer, const String &ssid, const String &targetMAC, uint8_t channel, const RSNInfo &rsn, |
| 1129 | bool isHidden |
| 1130 | ) { |
| 1131 | uint8_t pos = 0; |
| 1132 | buffer[pos++] = 0x50; |
| 1133 | buffer[pos++] = 0x00; |
| 1134 | buffer[pos++] = 0x00; |
| 1135 | buffer[pos++] = 0x00; |
| 1136 | sscanf( |
| 1137 | targetMAC.c_str(), |
| 1138 | "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", |
| 1139 | &buffer[pos], |
| 1140 | &buffer[pos + 1], |
| 1141 | &buffer[pos + 2], |
| 1142 | &buffer[pos + 3], |
| 1143 | &buffer[pos + 4], |
| 1144 | &buffer[pos + 5] |
| 1145 | ); |
| 1146 | pos += 6; |
| 1147 | memcpy(&buffer[pos], currentBSSID, 6); |
| 1148 | pos += 6; |
| 1149 | memcpy(&buffer[pos], currentBSSID, 6); |
| 1150 | pos += 6; |
| 1151 | buffer[pos++] = 0x00; |
| 1152 | buffer[pos++] = 0x00; |
| 1153 | for (int i = 0; i < 8; i++) buffer[pos++] = 0x00; |
| 1154 | buffer[pos++] = 0x64; |
| 1155 | buffer[pos++] = 0x00; |
| 1156 | if (rsn.akmSuite > 0 || rsn.pairwiseCipher > 0) { |
| 1157 | buffer[pos++] = 0x31; |
| 1158 | buffer[pos++] = 0x04; |
| 1159 | } else { |
| 1160 | buffer[pos++] = 0x21; |
| 1161 | buffer[pos++] = 0x04; |
| 1162 | } |
| 1163 | buffer[pos++] = 0x00; |
| 1164 | buffer[pos++] = isHidden ? 0x00 : (uint8_t)ssid.length(); |
| 1165 | if (!isHidden && ssid.length() > 0 && ssid != "*HIDDEN*" && ssid != "*WILDCARD*") { |
| 1166 | memcpy(&buffer[pos], ssid.c_str(), ssid.length()); |
| 1167 | pos += ssid.length(); |
| 1168 | } |
| 1169 | buffer[pos++] = 0x01; |
| 1170 | buffer[pos++] = sizeof(probe_rates); |
| 1171 | memcpy_P(&buffer[pos], probe_rates, sizeof(probe_rates)); |
| 1172 | pos += sizeof(probe_rates); |
| 1173 | buffer[pos++] = 0x03; |
| 1174 | buffer[pos++] = 0x01; |
| 1175 | buffer[pos++] = channel; |
| 1176 | buffer[pos++] = 0x05; |
| 1177 | buffer[pos++] = 0x04; |
| 1178 | buffer[pos++] = 0x00; |
| 1179 | buffer[pos++] = 0x01; |
| 1180 | buffer[pos++] = 0x00; |
| 1181 | buffer[pos++] = 0x00; |
| 1182 | buffer[pos++] = 0x2a; |
| 1183 | buffer[pos++] = 0x01; |
| 1184 | buffer[pos++] = 0x00; |
no outgoing calls
no test coverage detected