PREV TOC HOME INDEX NEXT


7.4 Using QoS Alarms

The following steps are an overview of how to use QoS alarms in your application. For details, refer to the specific API and data structure descriptions:

  1. Call ipm_GetQoSThreshold( ) to retrieve the current settings of QoS parameters.
  2. Set up the IPM_QOS_THRESHOLD_INFO structure with desired values for QoS parameter settings.
  3. Call ipm_SetQoSThreshold( ) to set the desired QoS parameters. This function may be called at any time by an application, including while a session is in progress.
  4. Call ipm_EnableEvents( ) to start QoS parameter monitoring.
  5. When a QoS alarm has been triggered, an IPMEV_QOS_ALARM event is sent by the system.
  6. Use standard runtime library API functions to query the IPMEV_QOS_ALARM_DATA structure to retrieve more details about the alarms which have been triggered.
  7. Call ipm_DisableEvents( ) to stop QoS parameter monitoring.

The following pseudocode illustrates how you might use QoS alarms in an application.

#include <stdio.h>
#include <srllib.h>
#include <ipmlib.h>
typedef long int(*HDLR)(unsigned long);
void CheckEvent(); 
/* % Packet Loss */
Time_Interval = 1000;           /* 1 second                           */
Debounce_On = 20000;            /* 20 seconds                         */
Debounce_Off = 45000;           /* 45 seconds                         */
Fault_Threshold = 6;            /* 2 lost 30 msec packets per second. */
Percent_Success_Threshold = 10; /* 10 seconds (in 20 seconds)         */
Percent_Fail_Threshold = 30;    /* 30 seconds (in 45 seconds)         */ 
/* Jitter */
Time_Interval = 100;             /* 100 msec                          */
Debounce_On = 20000;             /* 20 seconds                        */
Debounce_Off = 45000;            /* 45 seconds                        */
Fault_Threshold = 360;           /* 1.5 30 msec G711 packet jitter per second. (unscaled) */
Percent_Success_Threshold = 100; /* 10 seconds (in 20 seconds)        */
Percent_Fail_Threshold = 300;    /* 30 seconds (in 45 seconds)        */ 
void main()
{
    int nDeviceHandle;
    eIPM_EVENT myEvents[3] ={EVT_ROUNDTRIPLATENCY, EVT_LOSTPACKETS, EVT_JITTER};
    // Register event handler function with srl
    sr_enbhdlr( EV_ANYDEV ,EV_ANYEVT ,(HDLR)CheckEvent);
    /*
    .
    Main Processing
    .
    */ 
    /*
    Need to enable three events for IP device handle, nDeviceHandle.
    ASSUMPTION: A valid nDeviceHandle was obtained from prior call to ipm_Open().
    */
    if(ipm_EnableEvents(nDeviceHandle, myEvents, 3, EV_SYNC) == -1)
    {
        printf("ipm_EnableEvents failed for device name %s with error = %d\n",
            ATDV_NAMEP(nDeviceHandle), ATDV_LASTERR(nDeviceHandle));
            /*
            .
            Perform Error Processing
            .
            */
    }
    /*
    .
    Continue Processing
    .
    */
} 
void CheckEvent()
{
    int nEventType = sr_getevttype();
    int nDeviceID = sr_getevtdev();
    switch(nEventType)
    {
    /*
    .
    . List of expected events
    .
    */
        /* When alarm occurs you get this event. */ 
    case IPMEV_QOS_ALARM:
        {
            printf("Received IPMEV_QOS_ALARM for device = %s\n",
                ATDV_NAMEP(nDeviceID));
            IPM_QOS_ALARM_DATA * l_pAlarm = (IPM_QOS_ALARM_DATA*)l_pVoid;
            switch(l_pAlarm->eQoSType)
            {
            case QOSTYPE_ROUNDTRIPLATENCY:
                printf("QOSTYPE_ROUNDTRIPLATENCY=%d\n", l_pAlarm->eAlarmState);
                break;
            case QOSTYPE_JITTER:
                printf("QOSTYPE_JITTER=%d\n", l_pAlarm->eAlarmState);
                break;
            case QOSTYPE_LOSTPACKETS:
                printf("QOSTYPE_LOSTPACKETS=%d\n", l_pAlarm->eAlarmState);
                break;
            }
            break;
        } 
    default:
        printf("Received unknown event = %d for device = %s\n",
            nEventType, ATDV_NAMEP(nDeviceID));
        break; 
    }
}
 

PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

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