Lines Matching defs:msg

382 static int32_t CmdSocketFinishHandler(struct nl_msg *msg, void *arg)
390 static int32_t CmdSocketAckHandler(struct nl_msg *msg, void *arg)
455 int32_t NetlinkSendCmdSync(struct nl_msg *msg, const RespHandler handler, void *data)
484 rc = nl_send_auto(g_wifiHalInfo.cmdSock, msg);
566 static int32_t FamilyIdHandler(struct nl_msg *msg, void *arg)
574 hdr = nlmsg_data(nlmsg_hdr(msg));
594 struct nl_msg *msg = NULL;
602 msg = nlmsg_alloc();
603 if (msg == NULL) {
608 if (!genlmsg_put(msg, 0, 0, familyId, 0, 0, CTRL_CMD_GETFAMILY, 0) ||
609 nla_put_string(msg, CTRL_ATTR_FAMILY_NAME, family)) {
610 HILOG_ERROR(LOG_CORE, "%s: put msg failed", __FUNCTION__);
611 nlmsg_free(msg);
615 ret = NetlinkSendCmdSync(msg, FamilyIdHandler, &familyData);
619 nlmsg_free(msg);
823 static int32_t ParserIsSupportCombo(struct nl_msg *msg, void *arg)
826 struct genlmsghdr *hdr = nlmsg_data(nlmsg_hdr(msg));
863 static int32_t ParserSupportComboInfo(struct nl_msg *msg, void *arg)
867 struct genlmsghdr *hdr = nlmsg_data(nlmsg_hdr(msg));
976 static int32_t ParserValidFreq(struct nl_msg *msg, void *arg)
979 struct genlmsghdr *hdr = nlmsg_data(nlmsg_hdr(msg));
1099 struct nl_msg *msg = NULL;
1115 msg = nlmsg_alloc();
1116 if (msg == NULL) {
1121 genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, NLM_F_DUMP, NL80211_CMD_GET_WIPHY, 0);
1122 nla_put_flag(msg, NL80211_ATTR_SPLIT_WIPHY_DUMP);
1123 nla_put_u32(msg, NL80211_ATTR_IFINDEX, ifaceId);
1124 ret = NetlinkSendCmdSync(msg, ParserIsSupportCombo, isSupportCombo);
1128 nlmsg_free(msg);
1136 struct nl_msg *msg = NULL;
1152 msg = nlmsg_alloc();
1153 if (msg == NULL) {
1157 genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, NLM_F_DUMP, NL80211_CMD_GET_WIPHY, 0);
1158 nla_put_flag(msg, NL80211_ATTR_SPLIT_WIPHY_DUMP);
1159 nla_put_u32(msg, NL80211_ATTR_IFINDEX, ifaceId);
1160 ret = NetlinkSendCmdSync(msg, ParserSupportComboInfo, comboInfo);
1164 nlmsg_free(msg);
1209 static int32_t ParserChipId(struct nl_msg *msg, void *arg)
1211 struct genlmsghdr *hdr = nlmsg_data(nlmsg_hdr(msg));
1283 struct nl_msg *msg = NULL;
1302 msg = nlmsg_alloc();
1303 if (msg == NULL) {
1308 genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, NLM_F_DUMP, NL80211_CMD_GET_WIPHY, 0);
1309 nla_put_flag(msg, NL80211_ATTR_SPLIT_WIPHY_DUMP);
1310 nla_put_u32(msg, NL80211_ATTR_IFINDEX, ifaceId);
1314 nlmsg_free(msg);
1319 ret = NetlinkSendCmdSync(msg, ParserValidFreq, result);
1323 nlmsg_free(msg);
1330 struct nl_msg *msg = NULL;
1339 msg = nlmsg_alloc();
1340 if (msg == NULL) {
1345 genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_SET_WIPHY, 0);
1346 nla_put_u32(msg, NL80211_ATTR_IFINDEX, ifaceId);
1347 nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_SETTING, NL80211_TX_POWER_LIMITED);
1348 nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, 100 * power);
1349 ret = NetlinkSendCmdSync(msg, NULL, NULL);
1355 nlmsg_free(msg);
1372 struct nl_msg *msg = NULL;
1381 msg = nlmsg_alloc();
1382 if (msg == NULL) {
1387 genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_VENDOR, 0);
1388 nla_put_u32(msg, NL80211_ATTR_IFINDEX, ifaceId);
1389 nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, VENDOR_ID);
1390 nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, WIFI_SUBCMD_SET_COUNTRY_CODE);
1391 data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA);
1394 nlmsg_free(msg);
1397 if (nla_put(msg, WIFI_ATTRIBUTE_COUNTRY, len, code) != RET_CODE_SUCCESS) {
1399 nlmsg_free(msg);
1402 nla_nest_end(msg, data);
1404 ret = NetlinkSendCmdSync(msg, NULL, NULL);
1408 nlmsg_free(msg);
1416 struct nl_msg *msg = nlmsg_alloc();
1419 if (msg == NULL) {
1425 nlmsg_free(msg);
1428 genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_VENDOR, 0);
1429 nla_put_u32(msg, NL80211_ATTR_IFINDEX, ifaceId);
1430 nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, VENDOR_ID);
1431 nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, WIFI_SUBCMD_SET_RANDOM_MAC_OUI);
1432 data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA);
1435 nlmsg_free(msg);
1438 if (nla_put(msg, WIFI_ATTRIBUTE_RANDOM_MAC_OUI, len, scanMac) !=RET_CODE_SUCCESS) {
1440 nlmsg_free(msg);
1443 nla_nest_end(msg, data);
1444 ret = NetlinkSendCmdSync(msg, NULL, NULL);
1448 nlmsg_free(msg);
1454 struct nl_msg *msg = NULL;
1469 msg = nlmsg_alloc();
1470 if (msg == NULL) {
1475 genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, NLM_F_DUMP, NL80211_CMD_GET_WIPHY, 0);
1476 nla_put_flag(msg, NL80211_ATTR_SPLIT_WIPHY_DUMP);
1477 nla_put_u32(msg, NL80211_ATTR_IFINDEX, ifaceId);
1479 ret = NetlinkSendCmdSync(msg, ParserChipId, chipId);
1483 nlmsg_free(msg);
1520 static int32_t NetDeviceInfoHandler(struct nl_msg *msg, void *arg)
1528 hdr = nlmsg_data(nlmsg_hdr(msg));
1551 struct nl_msg *msg = nlmsg_alloc();
1554 if (msg == NULL) {
1559 genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_GET_INTERFACE, 0);
1560 nla_put_u32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(info->ifName));
1562 ret = NetlinkSendCmdSync(msg, NetDeviceInfoHandler, info);
1566 nlmsg_free(msg);
1604 static int32_t CmdScanPutSsidsMsg(struct nl_msg *msg, const WifiScan *scan, const WiphyInfo *wiphyInfo)
1610 nest = nla_nest_start(msg, NL80211_ATTR_SCAN_SSIDS);
1617 if (nla_put(msg, attrtype, 0, NULL) != RET_CODE_SUCCESS) {
1632 if (nla_put(msg, attrtype, scan->ssids[i].ssidLen, scan->ssids[i].ssid) != RET_CODE_SUCCESS) {
1637 nla_nest_end(msg, nest);
1643 static int32_t CmdScanPutFreqsMsg(struct nl_msg *msg, const WifiScan *scan)
1649 nest = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQUENCIES);
1655 nla_put_u32(msg, i + 1, scan->freqs[i]);
1657 nla_nest_end(msg, nest);
1662 static int32_t CmdScanPutMsg(const char *ifName, struct nl_msg *msg, const WifiScan *scan)
1680 if (CmdScanPutSsidsMsg(msg, scan, &wiphyInfo) != RET_CODE_SUCCESS) {
1684 if (CmdScanPutFreqsMsg(msg, scan) != RET_CODE_SUCCESS) {
1689 if (nla_put(msg, NL80211_ATTR_IE, scan->extraIesLen, scan->extraIes) != RET_CODE_SUCCESS) {
1696 if (nla_put(msg, NL80211_ATTR_MAC, ETH_ADDR_LEN, scan->bssid) != RET_CODE_SUCCESS) {
1708 struct nl_msg *msg = NULL;
1716 msg = nlmsg_alloc();
1717 if (msg == NULL) {
1722 genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_TRIGGER_SCAN, 0);
1723 nla_put_u32(msg, NL80211_ATTR_IFINDEX, ifaceId);
1725 ret = CmdScanPutMsg(ifName, msg, scan);
1727 HILOG_ERROR(LOG_CORE, "%s: put msg failed", __FUNCTION__);
1730 ret = NetlinkSendCmdSync(msg, NULL, NULL);
1735 nlmsg_free(msg);
2147 struct nl_msg **msg, struct nl_msg **keyMsg)
2154 *msg = nlmsg_alloc();
2155 if (*msg == NULL) {
2163 nlmsg_free(*msg);
2169 static int32_t InstallParam(struct nl_msg *msg, struct nl_msg *keyMsg)
2172 if (msg == NULL || keyMsg == NULL) {
2184 return NetlinkSendCmdSync(msg, NULL, NULL);
2187 static void FreeMsg(struct nl_msg *msg, struct nl_msg *keyMsg)
2189 if (msg != NULL) {
2190 nlmsg_free(msg);
2207 struct nl_msg *msg = NULL;
2209 ret = InitInstallWlanParam(ifName, interfaceId, &msg, &keyMsg);
2214 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_NEW_KEY, 0)) {
2217 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, interfaceId) != RET_CODE_SUCCESS) {
2228 if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, param->addr) != RET_CODE_SUCCESS) {
2236 if (nla_put_nested(msg, NL80211_ATTR_KEY, keyMsg) != RET_CODE_SUCCESS) {
2240 ret = InstallParam(msg, keyMsg);
2247 FreeMsg(msg, keyMsg);
2415 static int32_t StationInfoHandler(struct nl_msg *msg, void *arg)
2435 hdr = nlmsg_data(nlmsg_hdr(msg));
2459 struct nl_msg *msg = NULL;
2467 msg = nlmsg_alloc();
2468 if (msg == NULL) {
2473 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_GET_STATION, 0)) {
2477 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, ifaceId) != RET_CODE_SUCCESS) {
2481 if (nla_put(msg, NL80211_ATTR_MAC, ETH_ADDR_LEN, mac) != RET_CODE_SUCCESS) {
2486 ret = NetlinkSendCmdSync(msg, StationInfoHandler, info);
2491 nlmsg_free(msg);
2512 static int32_t GetWiphyInfoHandler(struct nl_msg *msg, void *arg)
2514 struct genlmsghdr *hdr = nlmsg_data(nlmsg_hdr(msg));
2561 struct nl_msg *msg = NULL;
2568 msg = nlmsg_alloc();
2569 if (msg == NULL) {
2574 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_GET_WIPHY, 0)) {
2578 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, wiphyIndex) != RET_CODE_SUCCESS) {
2582 ret = NetlinkSendCmdSync(msg, GetWiphyInfoHandler, wiphyInfo);
2587 nlmsg_free(msg);
2591 static int32_t GetWiphyIndexHandler(struct nl_msg *msg, void *arg)
2593 struct genlmsghdr *hdr = nlmsg_data(nlmsg_hdr(msg));
2612 struct nl_msg *msg = NULL;
2625 msg = nlmsg_alloc();
2626 if (msg == NULL) {
2631 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, NLM_F_DUMP, NL80211_CMD_GET_WIPHY, 0)) {
2635 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, interfaceId) != RET_CODE_SUCCESS) {
2639 ret = NetlinkSendCmdSync(msg, GetWiphyIndexHandler, wiphyIndex);
2644 nlmsg_free(msg);
2648 static int32_t ProcessMatchSsidToMsg(struct nl_msg *msg, const WiphyInfo *wiphyInfo, const WifiPnoSettings *pnoSettings)
2654 nestedMatchSsid = nla_nest_start(msg, NL80211_ATTR_SCHED_SCAN_MATCH);
2663 nest = nla_nest_start(msg, i);
2668 if (nla_put(msg, NL80211_SCHED_SCAN_MATCH_ATTR_SSID, pnoSettings->pnoNetworks[i].ssid.ssidLen,
2673 nla_put_u32(msg, NL80211_SCHED_SCAN_MATCH_ATTR_RSSI, pnoSettings->min5gRssi);
2674 nla_nest_end(msg, nest);
2677 nla_nest_end(msg, nestedMatchSsid);
2694 static int32_t SsidToMsg(struct nl_msg *msg, struct DListHead *scanSsids)
2706 nestedSsid = nla_nest_start(msg, NL80211_ATTR_SCAN_SSIDS);
2713 if (nla_put(msg, index, ssidListNode->ssidInfo.ssidLen, ssidListNode->ssidInfo.ssid) != RET_CODE_SUCCESS) {
2720 nla_nest_end(msg, nestedSsid);
2726 static int32_t ProcessSsidToMsg(struct nl_msg *msg, const WiphyInfo *wiphyInfo, const WifiPnoSettings *pnoSettings)
2758 return SsidToMsg(msg, &scanSsids);
2761 static int32_t ProcessScanPlanToMsg(struct nl_msg *msg, const WiphyInfo *wiphyInfo, const WifiPnoSettings *pnoSettings)
2772 nestedPlan = nla_nest_start(msg, NL80211_ATTR_SCHED_SCAN_PLANS);
2777 plan = nla_nest_start(msg, SCHED_SCAN_PLANS_ATTR_INDEX1);
2778 nla_put_u32(msg, NL80211_SCHED_SCAN_PLAN_INTERVAL, pnoSettings->scanIntervalMs);
2779 nla_put_u32(msg, NL80211_SCHED_SCAN_PLAN_ITERATIONS, pnoSettings->scanIterations);
2780 nla_nest_end(msg, plan);
2781 plan = nla_nest_start(msg, SCHED_SCAN_PLANS_ATTR_INDEX2);
2782 nla_put_u32(msg, NL80211_SCHED_SCAN_PLAN_INTERVAL, pnoSettings->scanIntervalMs * SLOW_SCAN_INTERVAL_MULTIPLIER);
2783 nla_nest_end(msg, plan);
2784 nla_nest_end(msg, nestedPlan);
2786 nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, pnoSettings->scanIntervalMs * MS_PER_SECOND);
2832 static int32_t ProcessFreqToMsg(struct nl_msg *msg, const WifiPnoSettings *pnoSettings)
2850 nestedFreq = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQUENCIES);
2857 nla_put_s32(msg, index, freqListNode->freq);
2860 nla_nest_end(msg, nestedFreq);
2866 static int32_t ProcessReqflagsToMsg(struct nl_msg *msg, const WiphyInfo *wiphyInfo, const WifiPnoSettings *pnoSettings)
2875 if (nla_put(msg, NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST, sizeof(rssiAdjust), &rssiAdjust) != RET_CODE_SUCCESS) {
2887 nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, scanFlag);
2892 static int32_t ConvertSetsToNetlinkmsg(struct nl_msg *msg, const char *ifName, const WifiPnoSettings *pnoSettings)
2909 if (ProcessMatchSsidToMsg(msg, &wiphyInfo, pnoSettings) != RET_CODE_SUCCESS ||
2910 ProcessSsidToMsg(msg, &wiphyInfo, pnoSettings) != RET_CODE_SUCCESS ||
2911 ProcessScanPlanToMsg(msg, &wiphyInfo, pnoSettings) != RET_CODE_SUCCESS ||
2912 ProcessReqflagsToMsg(msg, &wiphyInfo, pnoSettings) != RET_CODE_SUCCESS ||
2913 ProcessFreqToMsg(msg, pnoSettings) != RET_CODE_SUCCESS) {
2924 struct nl_msg *msg = NULL;
2932 msg = nlmsg_alloc();
2933 if (msg == NULL) {
2939 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, NLM_F_ACK, NL80211_CMD_START_SCHED_SCAN, 0)) {
2943 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, interfaceId) != RET_CODE_SUCCESS) {
2947 if (ConvertSetsToNetlinkmsg(msg, ifName, pnoSettings) != RET_CODE_SUCCESS) {
2951 ret = NetlinkSendCmdSync(msg, NULL, NULL);
2956 nlmsg_free(msg);
2965 struct nl_msg *msg = NULL;
2973 msg = nlmsg_alloc();
2974 if (msg == NULL) {
2980 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, NLM_F_ACK, NL80211_CMD_STOP_SCHED_SCAN, 0)) {
2984 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, interfaceId) != RET_CODE_SUCCESS) {
2988 ret = NetlinkSendCmdSync(msg, NULL, NULL);
2993 nlmsg_free(msg);
2998 static int32_t GetAssociatedInfoHandler(struct nl_msg *msg, void *arg)
3001 struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
3037 struct nl_msg *msg = NULL;
3046 msg = nlmsg_alloc();
3047 if (msg == NULL) {
3053 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, NLM_F_DUMP, NL80211_CMD_GET_SCAN, 0)) {
3057 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, interfaceId) != RET_CODE_SUCCESS) {
3061 ret = NetlinkSendCmdSync(msg, GetAssociatedInfoHandler, associatedInfo);
3066 nlmsg_free(msg);
3121 static int32_t SignalInfoHandler(struct nl_msg *msg, void *arg)
3123 struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
3197 struct nl_msg *msg = NULL;
3217 msg = nlmsg_alloc();
3218 if (msg == NULL) {
3223 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_GET_STATION, 0)) {
3227 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, interfaceId) != RET_CODE_SUCCESS) {
3231 if (nla_put(msg, NL80211_ATTR_MAC, ETH_ADDR_LEN, associatedInfo.associatedBssid) != RET_CODE_SUCCESS) {
3235 ret = NetlinkSendCmdSync(msg, SignalInfoHandler, signalResult);
3240 nlmsg_free(msg);
3278 static int32_t WifiSendActionFrameHandler(struct nl_msg *msg, void *arg)
3281 struct genlmsghdr *hdr = nlmsg_data(nlmsg_hdr(msg));
3299 struct nl_msg *msg = NULL;
3310 msg = nlmsg_alloc();
3311 if (msg == NULL) {
3316 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_FRAME, 0)) {
3320 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, interfaceId) != RET_CODE_SUCCESS) {
3324 if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) != RET_CODE_SUCCESS) {
3329 nla_put_flag(msg, NL80211_ATTR_OFFCHANNEL_TX_OK) != RET_CODE_SUCCESS) {
3333 if (nla_put(msg, NL80211_ATTR_FRAME, frameDataLen, frameData) != RET_CODE_SUCCESS) {
3338 ret = NetlinkSendCmdSync(msg, WifiSendActionFrameHandler, NULL);
3343 nlmsg_free(msg);
3350 struct nl_msg *msg = NULL;
3361 msg = nlmsg_alloc();
3362 if (msg == NULL) {
3367 if (!genlmsg_put(msg, 0, 0, g_wifiHalInfo.familyId, 0, 0, NL80211_CMD_REGISTER_FRAME, 0)) {
3371 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, interfaceId) != RET_CODE_SUCCESS) {
3375 if (nla_put(msg, NL80211_ATTR_FRAME_MATCH, matchLen, match) != RET_CODE_SUCCESS) {
3383 ret = nl_send_auto(g_wifiHalInfo.ctrlSock, msg);
3390 nlmsg_free(msg);
3526 HILOG_ERROR(LOG_CORE, "Failed to send msg to kernel.");
3535 HILOG_ERROR(LOG_CORE, "Failed to send msg to kernel.");