/*====================================================================*
*
* signed HostActionIndicate (struct int6k * int6k);
*
* int6k.h
*
* This test plugin requests come action from a local host using a
* VS_HST_ACTION indication message; the message must be sent to a
* host, not a device; it can be used to verify that your host
* application correctly responds to device requests;
*
* this function is provided so that you can emulate a device boot
* sequence by prompting a listening host to download firmware; it
* has no practical purpose other than development and test;
*
* See the Atheros HomePlug AV Firmware Technical Reference Manual
* for more information;
*
* This software and documentation is the property of Atheros
* Corporation, Ocala, Florida. It is provided 'as is' without
* expressed or implied warranty of any kind to anyone for any
* reason. Atheros assumes no responsibility or liability for
* errors or omissions in the software or documentation and
* reserves the right to make changes without notification.
*
* Atheros customers may modify and distribute the software
* without obligation to Atheros. Since use of this software
* is optional, users shall bear sole responsibility and
* liability for any consequences of it's use.
*
*. Atheros Powerline Toolkit for HomePlug AV;
*: Published 2007 by Intellon Corp. ALL RIGHTS RESERVED;
*; For demonstration; Not for production use;
*
* Contributor(s):
* Charles Maier <charles.maier@atheros.com>
*
*--------------------------------------------------------------------*/
#ifndef HOSTACTIONINDICATE_SOURCE
#define HOSTACTIONINDICATE_SOURCE
#include <stdint.h>
#include <memory.h>
#include "../int6k/int6k.h"
#include "../tools/error.h"
#include "../tools/memory.h"
signed HostActionIndicate (struct int6k * int6k)
{
struct channel * channel = (struct channel *)(int6k->channel);
struct message * message = (struct message *)(int6k->message);
#ifndef __GNUC__
#pragma pack (push,1)
#endif
struct __packed vs_hst_action_ind
{
struct header_eth ethernet;
struct header_int intellon;
uint8_t HST_ACTION_REQ;
}
* indicate = (struct vs_hst_action_ind *) (message);
struct __packed vs_hst_action_rsp
{
struct header_eth ethernet;
struct header_int intellon;
uint8_t MSTATUS;
}
* response = (struct vs_hst_action_rsp *) (message);
#ifndef __GNUC__
#pragma pack (pop)
#endif
Request (int6k, "Start Host Action");
memset (message, 0, sizeof (struct message));
EthernetHeader (&message->ethernet, channel->peer, channel->host);
IntellonHeader (&message->intellon, (VS_HST_ACTION | MMTYPE_IND));
int6k->packetsize = ETHER_MIN_LEN;
indicate->HST_ACTION_REQ = int6k->hostaction;
if (SendMME (int6k) <= 0)
{
error ((int6k->flags & INT6K_BAILOUT), ECANCELED, INT6K_CANTSEND);
return (-1);
}
while (ReadMME (int6k, (VS_HST_ACTION | MMTYPE_RSP)) > 0)
{
if (response->MSTATUS)
{
Failure (int6k, INT6K_WONTDOIT);
continue;
}
Confirm (int6k, "Start.");
}
return (0);
}
#endif