owamp/protocol.c
/*
 * Function:        OWPDecodeDataRecord
 *
 * Description:        
 *         This function is used to decode the "packet record" and
 *         place the values in the given OWPDataRec. It returns false if the
 *         timestamp err estimates are invalid values.
 *
 * In Args:        
 *
 * Out Args:        
 *
 * Scope:        
 * Returns:        
 * Side Effect:        
 */
OWPDecodeDataRecord
Description:
This function is used to decode the "packet record" and
place the values in the given OWPDataRec. It returns false if the
timestamp err estimates are invalid values.

In Args.

Out Args.

Side Effect.
OWPDecodeDataRecord Description : This function is used to decode the " packet record " and place the values in the given OWPDataRec . It returns false if the timestamp err estimates are invalid values . In Args . Out Args . Side Effect .
OWPBoolean
_OWPDecodeDataRecord(
        uint32_t    file_version,
        OWPDataRec  *rec,
        char        *buf
        )
{
    memset(rec,0,sizeof(OWPDataRec));
    memcpy(&rec->seq_no,&buf[0],4);
    rec->seq_no = ntohl(rec->seq_no);
    switch(file_version){
        case 0:
        case 2:
            _OWPDecodeTimeStamp(&rec->send,(uint8_t *)&buf[4]);
            if(!_OWPDecodeTimeStampErrEstimate(&rec->send,(uint8_t *)&buf[12])){
                return False;
            }
            _OWPDecodeTimeStamp(&rec->recv,(uint8_t *)&buf[14]);
            if(!_OWPDecodeTimeStampErrEstimate(&rec->recv,(uint8_t *)&buf[22])){
                return False;
            }
            rec->ttl = 255;
            break;
        case 3:
            _OWPDecodeTimeStamp(&rec->send,(uint8_t *)&buf[8]);
            if(!_OWPDecodeTimeStampErrEstimate(&rec->send,(uint8_t *)&buf[4])){
                return False;
            }
            _OWPDecodeTimeStamp(&rec->recv,(uint8_t *)&buf[16]);
            if(!_OWPDecodeTimeStampErrEstimate(&rec->recv,(uint8_t *)&buf[6])){
                return False;
            }
            rec->ttl = buf[24];
            break;
        default:
            return False;
    }
    return True;
}
OWPBoolean _OWPDecodeDataRecord ( uint32_t file_version , OWPDataRec * rec , char * buf ) { memset ( rec , 0 , sizeof ( OWPDataRec ) ) ; memcpy ( & rec -> seq_no , & buf [ 0 ] , 4 ) ; rec -> seq_no = ntohl ( rec -> seq_no ) ; switch ( file_version ) { case 0 : case 2 : _OWPDecodeTimeStamp ( & rec -> send , ( uint8_t * ) & buf [ 4 ] ) ; if ( ! _OWPDecodeTimeStampErrEstimate ( & rec -> send , ( uint8_t * ) & buf [ 12 ] ) ) { return False ; } _OWPDecodeTimeStamp ( & rec -> recv , ( uint8_t * ) & buf [ 14 ] ) ; if ( ! _OWPDecodeTimeStampErrEstimate ( & rec -> recv , ( uint8_t * ) & buf [ 22 ] ) ) { return False ; } rec -> ttl = 255 ; break ; case 3 : _OWPDecodeTimeStamp ( & rec -> send , ( uint8_t * ) & buf [ 8 ] ) ; if ( ! _OWPDecodeTimeStampErrEstimate ( & rec -> send , ( uint8_t * ) & buf [ 4 ] ) ) { return False ; } _OWPDecodeTimeStamp ( & rec -> recv , ( uint8_t * ) & buf [ 16 ] ) ; if ( ! _OWPDecodeTimeStampErrEstimate ( & rec -> recv , ( uint8_t * ) & buf [ 6 ] ) ) { return False ; } rec -> ttl = buf [ 24 ] ; break ; default : return False ; } return True ; }
Function:        OWPDecodeDataRecord
 Description:
         This function is used to decode the "packet record" and
         place the values in the given OWPDataRec.
Function : OWPDecodeDataRecord Description : This function is used to decode the " packet record " and place the values in the given OWPDataRec .
/*
     * Have to memcpy buf because it is not 32bit aligned.
     */