PREV TOC HOME INDEX NEXT


ipm_GetSessionInfo( )


Termination Events | Cautions | Errors | Example | See Also

Name: int ipm_GetSessionInfo(nDeviceHandle, *pSessionInfo, usMode)
Inputs:

int nDeviceHandle

  • IP Media device handle

IPM_SESSION_INFO *pSessionInfo

  • pointer to session info structure

unsigned short usMode

  • async or sync mode setting
Returns:

0 on success

-1 on failure

Includes:

srllib.h

ipmlib.h

Category:

Media Session

Mode:

asynchronous or synchronous

Platform:

DM/IP, HMP

Description

The ipm_GetSessionInfo( ) function retrieves QoS and RTCP statistics for media session, if one is in progress, otherwise it retrieves statistics for the previous session.

Note: This function is not supported on Intel® NetStructure™ IPT Series boards.

A new firmware session is initiated by calling ipm_StartMedia( ). In this scenario, data returned by ipm_GetSessionInfo( ) will be for the current session. ipm_Stop( ) terminates the session. Between firmware sessions, that is, after ipm_Stop( ) and before ipm_StartMedia( ) is called, the data returned by ipm_GetSessionInfo( ) is for the previous firmware session.

Parameter

Description

nDeviceHandle handle of the IP Media device
pSessionInfo pointer to structure that contains Quality of Service (QoS) information about the previous IP session; see IPM_SESSION_INFO for details.
usMode operation mode. Set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution.

Termination Events

IPMEV_GET_SESSION_INFO
indicates successful completion, that is, the structure containing session statistics was filled in. Use SRL functions to retrieve IPM_SESSION_INFO structure fields.
IPMEV_ERROR
indicates the function failed.

Cautions

Errors

If the function returns -1 to indicate failure, call ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to return one of the following errors:

EIPM_BADPARM
Invalid parameter
EIPM_INTERNAL
Internal error
EIPM_INV_MODE
Invalid mode
EIPM_INV_STATE
Invalid state. Initial command did not complete before another function call was made.
EIPM_SYSTEM
System error

Example

#include <stdio.h>
#include <srllib.h>
#include <ipmlib.h> 
typedef long int(*HDLR)(unsigned long);
void CheckEvent(); 
void main()
{
    int nDeviceHandle;
    // Register event handler function with srl
    sr_enbhdlr( EV_ANYDEV ,EV_ANYEVT ,(HDLR)CheckEvent);
    /*
    .
    .
    Main Processing
    .
    .
    .
    */
    /*
    Get the current session information for IP device handle, nDeviceHandle.
    ASSUMPTION: nDeviceHandle was obtained from a prior call to ipm_Open().
    Also, ipm_StartMedia() was successfully called
    sometime earlier.
    */
    if(ipm_GetSessionInfo(nDeviceHandle, NULL, EV_ASYNC) == -1)
    {
        printf("ipm_GetSessionInfo failed for device name = %s with error = %d\n",
            ATDV_NAMEP(nDeviceHandle), ATDV_LASTERR(nDeviceHandle));
        /*
        .
        .
        Perform Error Processing
        .
        */
    }
    /*
    .
    . Continue processing
    .
    */
} 
void CheckEvent()
{
    unsigned int i;
    IPM_SESSION_INFO* pIPSessionInfo;
    int nDeviceID = sr_getevtdev();
    int nEventType = sr_getevttype();
    void* pVoid = sr_getevtdatap();
    switch(nEventType)
    {
        /*
        .
        .
        . Other events
        .
        .
        */
        /* Expected reply to ipm_GetSessionInfo */
    case IPMEV_GET_SESSION_INFO:
        pIPSessionInfo = (IPM_SESSION_INFO*)pVoid;
        printf("Received IPMEV_GET_SESSION_INFO for device = %s\n",
            ATDV_NAMEP(nDeviceID));
        printf("RtcpInfo.unLocalSR_TimeStamp=%d\n",
            pIPSessionInfo->RtcpInfo.unLocalSR_TimeStamp);
        printf("RtcpInfo.unLocalSR_TxPackets=%d\n",
            pIPSessionInfo->RtcpInfo.unLocalSR_TxPackets);
        printf("RtcpInfo.unLocalSR_TxOctets=%d\n",
            pIPSessionInfo->RtcpInfo.unLocalSR_TxOctets);
        printf("RtcpInfo.unLocalSR_SendIndication=%d\n",
            pIPSessionInfo->RtcpInfo.unLocalSR_SendIndication);
        printf("RtcpInfo.unLocalRR_FractionLost=%d\n",
            pIPSessionInfo->RtcpInfo.unLocalRR_FractionLost);
        printf("RtcpInfo.unLocalRR_CumulativeLost=%d\n",
            pIPSessionInfo->RtcpInfo.unLocalRR_CumulativeLost);
        printf("RtcpInfo.unLocalRR_SeqNumber=%d\n",
            pIPSessionInfo->RtcpInfo.unLocalRR_SeqNumber);
        printf("RtcpInfo.unLocalRR_ValidInfo=%d\n",
            pIPSessionInfo->RtcpInfo.unLocalRR_ValidInfo);
        printf("RtcpInfo.unRemoteSR_TimeStamp=%d\n",
            pIPSessionInfo->RtcpInfo.unRemoteSR_TimeStamp);
        printf("RtcpInfo.unRemoteSR_TxPackets=%d\n",
            pIPSessionInfo->RtcpInfo.unRemoteSR_TxPackets);
        printf("RtcpInfo.unRemoteSR_TxOctets=%d\n",
            pIPSessionInfo->RtcpInfo.unRemoteSR_TxOctets);
        printf("RtcpInfo.unRemoteSR_SendIndication=%d\n",
            pIPSessionInfo->RtcpInfo.unRemoteSR_SendIndication);
        printf("RtcpInfo.unRemoteRR_FractionLost=%d\n",
            pIPSessionInfo->RtcpInfo.unRemoteRR_FractionLost);
        printf("RtcpInfo.unRemoteRR_CumulativeLost=%d\n",
            pIPSessionInfo->RtcpInfo.unRemoteRR_CumulativeLost);
        printf("RtcpInfo.unRemoteRR_SeqNumber=%d\n",
            pIPSessionInfo->RtcpInfo.unRemoteRR_SeqNumber);
        printf("RtcpInfo.unRemoteRR_ValidInfo=%d\n",
            pIPSessionInfo->RtcpInfo.unRemoteRR_ValidInfo); 
        for(i = 0; i< pIPSessionInfo->unQoSInfoCount; ++i)
        {
            printf("Session QOS Type=%d\n",
                pIPSessionInfo->QoSInfo[i].eQoSType);
            printf("Session QOS Data=%d\n",
                pIPSessionInfo->QoSInfo[i].unData);
        }
        break;
    default:
        printf("Received unknown event = %d for device = %s\n",
            nEventType, ATDV_NAMEP(nDeviceID));
        break;
    }
} 

See Also


PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

Copyright 2002, Intel Corporation
All rights reserved
This page generated November, 2002