Folus Wen 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
..
ARPCPeek.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
ARPCPrint.1.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
ARPCPrint.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
ARPCWrite.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
CMakeLists.txt 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
EthernetHeader.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
FirmwareMessage.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
HomePlugHeader.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
HomePlugHeader1.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
MMECode.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
MMEMode.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
MMEName.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
MMEPeek.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
MMEShow.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
MMESize.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
Makefile 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
QualcommHeader.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
QualcommHeader1.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
UnwantedMessage.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
homeplug.h 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
hpav 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
hpav.1 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
hpav.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
hpavd.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
mme 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
mme.1 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
mme.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
mme.h 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
mme.mak 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
mme.sh 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
qualcomm.h 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
readmessage.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren
sendmessage.c 30b6e0f5d6 [Improve][Modularization][Module_4g] vor 2 Jahren

readmessage.c

/*====================================================================*
*
* Copyright (c) 2013 Qualcomm Atheros, Inc.
*
* All rights reserved.
*
*====================================================================*/

/*====================================================================*
*
* ssize_t readmessage (struct channel const * channel, struct message * message, uint8_t MMV, uint16_t MMTYPE);
*
* plc.h
*
* wait for a QCA vendor specific message of given MMV and MMTYPE;
* discard unwanted messages until the desired message arrives or
* the channel timeout expires; return packet length on success,
* 0 on timeout or -1 on error;
*
* see sendmessage for the send counterpart to this function;
*
* a well designed UnwantedMessage function is critical here;
*
* Contributor(s):
* Charles Maier
* Nathaniel Houghton
*
*--------------------------------------------------------------------*/

#ifndef READMESSAGE_SOURCE
#define READMESSAGE_SOURCE

#include
#include
#include

#include "../tools/error.h"
#include "../tools/timer.h"
#include "../plc/plc.h"

ssize_t readmessage (struct channel const * channel, struct message * message, uint8_t MMV, uint16_t MMTYPE)

{
struct timeval ts;
struct timeval tc;
ssize_t length;
if (gettimeofday (& ts, NULL) == - 1)
{
error (1, errno, CANT_START_TIMER);
}
while ((length = readpacket (channel, message, sizeof (* message))) >= 0)
{
if (! UnwantedMessage (message, length, MMV, MMTYPE))
{
return (length);
}
if (gettimeofday (& tc, NULL) == - 1)
{
error (1, errno, CANT_RESET_TIMER);
}
if (channel->timeout < 0)
{
continue;
}
if (channel->timeout > MILLISECONDS (ts, tc))
{
continue;
}
return (0);
}
return (- 1);
}

#endif