/*====================================================================* Copyright (c) 2013,2021 Qualcomm Technologies, Inc. All Rights Reserved. Confidential and Proprietary - Qualcomm Technologies, Inc. ****************************************************************** 2013 Qualcomm Atheros, Inc. *--------------------------------------------------------------------*/ /*====================================================================* * * int vs_host_action_response (struct plc * plc); * * slac.h * *--------------------------------------------------------------------*/ #include #include #include "../plc/plc.h" #include "../tools/error.h" #include "../tools/memory.h" signed vs_host_action_response(struct plc * plc) { struct channel * channel = (struct channel *) (plc->channel); struct message * message = (struct message *) (plc->message); #ifndef __GNUC__ #pragma pack (push,1) #endif struct __packed vs_host_action_ind { struct ethernet_hdr ethernet; struct qualcomm_hdr qualcomm; uint8_t MACTION; uint8_t MAJOR_VERSION; uint8_t MINOR_VERSION; uint8_t session_id; uint16_t outstanding_retries; uint16_t retrytimer_in10ms; }; struct __packed vs_host_action_rsp { struct ethernet_hdr ethernet; struct qualcomm_hdr qualcomm; uint8_t MSTATUS; uint8_t MAJOR_VERSION; uint8_t MINOR_VERSION; uint8_t MACTION; uint8_t session_id; uint16_t outstanding_retries; } * response = (struct vs_host_action_rsp *) (message); #ifndef __GNUC__ #pragma pack (pop) #endif struct vs_host_action_ind indication; memcpy(&indication, message, sizeof(struct vs_host_action_ind)); memset (message, 0, sizeof (* message)); memcpy(channel->peer, indication.ethernet.OSA, sizeof(channel->peer)); response->MAJOR_VERSION = indication.MAJOR_VERSION; response->MINOR_VERSION = indication.MINOR_VERSION; response->MACTION = indication.MACTION; response->session_id = indication.session_id; response->outstanding_retries = indication.outstanding_retries; EthernetHeader (& response->ethernet, channel->peer, channel->host, channel->type); QualcommHeader (& response->qualcomm, 0, (VS_HOST_ACTION | MMTYPE_RSP)); plc->packetsize = (ETHER_MIN_LEN - ETHER_CRC_LEN); if (SendMME (plc) <= 0) { error (PLC_EXIT (plc), errno, CHANNEL_CANTSEND); return (-1); } return (0); }