PREV TOC HOME INDEX NEXT


ipm_Ping( )


Termination Events | Cautions | Errors | Example | See Also

Name: int ipm_Ping(nDeviceHandle, *pPingParameter, *pPingInfo, usMode)
Inputs:

int nDeviceHandle

  • board device handle

PIPM_PING_PARM *pPingParameter

  • pointer to an array of ping parameter structures

IPM_PING_INFO *pPingInfo

  • pointer to ping info structure

unsigned short usMode

  • async or sync mode setting
Returns: 0 on success -1 on failure
Includes: srllib.h ipmlib.h
Category:

System Control

Mode:

asynchronous or synchronous

Platform:

IPT

Description

The ipm_Ping( ) function generates a "ping" message to a remote IP address from an Ethernet interface. Typically used for testing and debugging, applications send a ping message and expect a response to be returned. The "ping" functionality operates on a per-board basis.

Note: This function is not supported on Intel® NetStructure™ DM/IP Series boards or on the Host Media Processing (HMP) software.

Parameter

Description

nDeviceHandle handle of the board device ipmBx, where x is the unique logical board number
*pPingParameter pointer to an array of ping parameter structures; see IPM_PING_PARM for details.
pPingInfo pointer to structure that is filled with ping results upon successful return; see IPM_PING_INFO for details.
usMode operation mode. Set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution.

Termination Events

IPMEV_PING
indicates successful completion, that is, ping response information was returned. Use SRL functions to retrieve IPM_PING_INFO structure fields.
IPMEV_ERROR
indicates the function failed.

Cautions

You must specify both a remote and a local IP address in the IPM_PING_PARM structure or this function will fail.

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_FWERROR
Firmware error

Example

#include <stdio.h>
#include <srllib.h>
#include <ipmlib.h> 
void CheckEvent();
typedef long int(*HDLR)(unsigned long); 
void main()
{
    int nDeviceHandle;
    // Register event handler function with srl
    sr_enbhdlr( EV_ANYDEV ,EV_ANYEVT ,(HDLR)CheckEvent);
    /*
    .
    .
    Main Processing
    .
    .
    .
    */
    /*
    ASSUMPTION: A valid nDeviceHandle was obtained from prior
    call to ipm_Open() for a board device.
    */
    IPM_PING_PARM PingParameter;
    strcpy(PingParameter.cRemoteIPAddress, "192.168.1.16");
    strcpy(PingParameter.cLocalIPAddress, "192.168.1.16");
    if(ipm_Ping(nDeviceHandle, &PingParameter, NULL, EV_ASYNC)==-1)
    {
        printf("ipm_Ping failed for device name %s with error = %d\n",
            ATDV_NAMEP(nDeviceHandle), ATDV_LASTERR(nDeviceHandle));
            /*
            .
            .
            Perform Error Processing
            .
            .
        */
    }
    /*
    .
    .
    . continue
    .
    */
} 
void CheckEvent()
{
    int nEventType = sr_getevttype();
    int nDeviceID = sr_getevtdev();
    void* pVoid = sr_getevtdatap();
    IPM_PING_INFO* pPingInfo;
    switch(nEventType)
    {
    /*
    .
    . Other events
    .
        */
        /* Expected reply to ipm_GetQoSAlarmStatus */
    case IPMEV_PING:
        pPingInfo = (IPM_PING_INFO*)pVoid;
        printf("Received IPMEV_PING for device = %s\n",
            ATDV_NAMEP(nDeviceID));
        break;
    default:
        printf("Received unknown event = %d for device = %s\n",
            nEventType, ATDV_NAMEP(nDeviceID));
        break;
    }
} 

See Also

None.


PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

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