コード例 #1
0
ファイル: ByeReport.cpp プロジェクト: John-Chan/sipXtapi
/**
 *
 * Method Name:  ParseByeReport
 *
 *
 * Inputs:   unsigned char *puchReportBuffer - Buffer containing the Bye Report
 *
 * Outputs:  None
 *
 * Returns:  unsigned long
 *
 * Description: Extracts the contents of an Bye report using the buffer
 *              passed in by the caller.
 *
 * Usage Notes: The header of the RTCP Report shall be parsed by delegating
 *              to the base class.
 *
 *
 */
unsigned long CByeReport::ParseByeReport(unsigned char *puchReportBuffer)
{

    unsigned char    *puchPayloadBuffer = puchReportBuffer;

    // Check whether the RTCP Header has been correctly
    //   formed (Version, etc...).
    if(!ParseRTCPHeader(puchReportBuffer))
        return(GetReportLength());

    // Good header.  Let's bump the payload pointer and continue.
    puchPayloadBuffer += GetHeaderLength();


    // Let's store the CSRCs from the Bye Report
    unsigned long ulCSRCCount = GetReportCount() ? GetReportCount() - 1 : 0;

    SetCSRC((ssrc_t *)puchPayloadBuffer, ulCSRCCount, TRUE);
    puchPayloadBuffer += (sizeof(ssrc_t) * ulCSRCCount);

    // Let's determine whether there is an optional Reason field associated
    // with this Bye Report.  We can surmise this through comparing the
    // packet length to what we've already processed

    if(puchPayloadBuffer - puchReportBuffer < (long)GetReportLength())
    {
        uint32_t ulReasonLength = (uint32_t)*puchPayloadBuffer++;
        SetReason(puchPayloadBuffer, ulReasonLength);
        puchPayloadBuffer += ulReasonLength;

    }

    // Let's process any padding that might be present to align the
    // payload on a 32 bit boundary.
    if(GetPadding())
        puchPayloadBuffer += ExtractPadding(puchPayloadBuffer);

    return(puchPayloadBuffer - puchReportBuffer);

}
コード例 #2
0
ファイル: SenderReport.cpp プロジェクト: Konnekt/lib-sipx
/**
 *
 * Method Name:  ParseSenderReport
 *
 *
 * Inputs:   unsigned char *puchReportBuffer
 *                               - Buffer containing the Sender Report
 *
 * Outputs:  None
 *
 * Returns:  unsigned long
 *
 * Description: Extracts the contents of an Sender report using the buffer
 *              passed in by the caller.  The Sender Report object shall store
 *              the content and length of data fields extracted from the Sender
 *              Report.  The timestamps identifying the time of SR report
 *              reception shall obtained and sent with the SR Send timestamp to
 *              the associated Receiver Report through the SetLastRcvdSRTime()
 *              method of the ISetReceiverStatistics interface.
 *
 * Usage Notes: The header of the RTCP Report shall be parsed by delegating to
 *              the base class.
 *
 *
 */
unsigned long CSenderReport::ParseSenderReport(unsigned char *puchReportBuffer)
{

    unsigned char   *puchPayloadBuffer = puchReportBuffer;

    // Check whether the RTCP Header has been correctly
    //  formed (Version, etc...).
    if(!ParseRTCPHeader(puchReportBuffer))
        return(GetReportLength());

    // Good header.  Let's bump the payload pointer and continue.
    puchPayloadBuffer += GetHeaderLength();

    // Let's extract the NTP and RTP timestamps from the Sender Report
    puchPayloadBuffer += ExtractTimestamps((unsigned long *)puchPayloadBuffer);

    // Let's extract the Sender Statistics
    puchPayloadBuffer += ExtractSenderStats((unsigned long*)puchPayloadBuffer);

    return(puchPayloadBuffer - puchReportBuffer);

}