original files of m241
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
/* m2IcmpLib.c - MIB-II ICMP-group API for SNMP Agents */
|
||||
|
||||
/* Copyright 1984 - 2005 Wind River Systems, Inc. */
|
||||
#include "copyright_wrs.h"
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01l,18aug10,h_x Fix WIND00226752
|
||||
01k,28mar08,zhr Migrated to IPNET
|
||||
01j,12jan05,vvv osdep.h cleanup
|
||||
01i,06nov03,rlm Ran batch header update for header re-org.
|
||||
01h,08sep03,vvv merged from ACCORDION_BASE6_MERGE_BASELINE
|
||||
01g,16may02,ant integration into Clarinet
|
||||
01f,26oct01,spm isolated virtual stack data structures (SPR #71092)
|
||||
01e,29mar01,spm merged changes from version 01d of tor2_0.open_stack
|
||||
branch (wpwr VOB, base 01c) for unified code base
|
||||
01d,25oct00,ham doc: cleanup for vxWorks AE 1.0.
|
||||
01c,25jan95,jdi doc cleanup.
|
||||
01b,11nov94,rhp edited man pages
|
||||
01a,08dec93,jag written
|
||||
*/
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library provides MIB-II services for the ICMP group. It provides routines
|
||||
to initialize the group, and to access the group scalar variables. For a
|
||||
broader description of MIB-II services, see the manual entry for m2Lib.
|
||||
|
||||
To use this feature, include the following component:
|
||||
INCLUDE_MIB2_ICMP
|
||||
|
||||
USING THIS LIBRARY
|
||||
This library can be initialized and deleted by calling the routines
|
||||
m2IcmpInit() and m2IcmpDelete() respectively, if only the ICMP group's services
|
||||
are needed. If full MIB-II support is used, this group and all other
|
||||
groups can be initialized and deleted by calling m2Init() and
|
||||
m2Delete().
|
||||
|
||||
The group scalar variables are accessed by calling
|
||||
m2IcmpGroupInfoGet() as follows:
|
||||
.CS
|
||||
M2_ICMP icmpVars;
|
||||
|
||||
if (m2IcmpGroupInfoGet (&icmpVars) == OK)
|
||||
/@ values in icmpVars are valid @/
|
||||
.CE
|
||||
|
||||
INCLUDE FILES: m2Lib.h
|
||||
|
||||
SEE ALSO:
|
||||
m2Lib, m2IfLib, m2IpLib, m2TcpLib, m2SysLib
|
||||
*/
|
||||
|
||||
/* includes */
|
||||
|
||||
#include <m2Lib.h>
|
||||
#include "errnoLib.h"
|
||||
#include "vwModNum.h"
|
||||
#include "in.h"
|
||||
#include <ipcom_mib2_api.h>
|
||||
#include <ipcom_type.h>
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* m2IcmpInit - initialize MIB-II ICMP-group access
|
||||
*
|
||||
* This routine allocates the resources needed to allow access to the MIB-II
|
||||
* ICMP-group variables. This routine must be called before any ICMP variables
|
||||
* can be accessed.
|
||||
*
|
||||
* RETURNS: OK, always.
|
||||
*
|
||||
* SEE ALSO: m2IcmpGroupInfoGet(), m2IcmpDelete()
|
||||
*/
|
||||
STATUS m2IcmpInit (void)
|
||||
{
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* m2IcmpGroupInfoGet - get the MIB-II ICMP-group global variables
|
||||
*
|
||||
* This routine fills in the ICMP structure at <pIcmpInfo> with the
|
||||
* MIB-II ICMP scalar variables.
|
||||
*
|
||||
* RETURNS: OK, or ERROR if the input parameter <pIcmpInfo> is invalid.
|
||||
*
|
||||
* ERRNO:
|
||||
* S_m2Lib_INVALID_PARAMETER
|
||||
*
|
||||
* SEE ALSO: m2IcmpInit(), m2IcmpDelete()
|
||||
*/
|
||||
STATUS m2IcmpGroupInfoGet
|
||||
(
|
||||
M2_ICMP * pIcmpInfo /* pointer to the ICMP group structure */
|
||||
)
|
||||
{
|
||||
#ifdef IPCOM_USE_INET
|
||||
Ipcom_mib2_icmp_group icmpGroup;
|
||||
|
||||
if (ipcom_mib2_get_icmp_group (&icmpGroup) == -1)
|
||||
{
|
||||
return (ERROR);
|
||||
}
|
||||
/* Validate Pointer to ICMP structure */
|
||||
|
||||
if (pIcmpInfo == NULL)
|
||||
{
|
||||
errnoSet (S_m2Lib_INVALID_PARAMETER);
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
/* Add the counts of all the packet types Sent and Received */
|
||||
|
||||
pIcmpInfo->icmpInMsgs = icmpGroup.icmpInMsgs;
|
||||
pIcmpInfo->icmpOutMsgs = icmpGroup.icmpOutMsgs;
|
||||
|
||||
/* Add to the Input count the ICMP packets received in error */
|
||||
|
||||
pIcmpInfo->icmpInErrors = icmpGroup.icmpInErrors;
|
||||
|
||||
pIcmpInfo->icmpInDestUnreachs = icmpGroup.icmpInDestUnreachs;
|
||||
pIcmpInfo->icmpInTimeExcds = icmpGroup.icmpInTimeExcds;
|
||||
pIcmpInfo->icmpInParmProbs = icmpGroup.icmpInParmProbs;
|
||||
pIcmpInfo->icmpInSrcQuenchs = icmpGroup.icmpInSrcQuenchs;
|
||||
pIcmpInfo->icmpInRedirects = icmpGroup.icmpInRedirects;
|
||||
pIcmpInfo->icmpInEchos = icmpGroup.icmpInEchos;
|
||||
pIcmpInfo->icmpInEchoReps = icmpGroup.icmpInEchoReps;
|
||||
pIcmpInfo->icmpInTimestamps = icmpGroup.icmpInTimestamps;
|
||||
pIcmpInfo->icmpInTimestampReps = icmpGroup.icmpInTimestampReps;
|
||||
pIcmpInfo->icmpInAddrMasks = icmpGroup.icmpInAddrMasks;
|
||||
pIcmpInfo->icmpInAddrMaskReps = icmpGroup.icmpInAddrMaskReps;
|
||||
|
||||
pIcmpInfo->icmpOutErrors = icmpGroup.icmpOutErrors;
|
||||
pIcmpInfo->icmpOutDestUnreachs = icmpGroup.icmpOutDestUnreachs;
|
||||
pIcmpInfo->icmpOutTimeExcds = icmpGroup.icmpOutTimeExcds;
|
||||
pIcmpInfo->icmpOutParmProbs = icmpGroup.icmpOutParmProbs;
|
||||
pIcmpInfo->icmpOutSrcQuenchs = icmpGroup.icmpOutSrcQuenchs;
|
||||
pIcmpInfo->icmpOutRedirects = icmpGroup.icmpOutRedirects;
|
||||
pIcmpInfo->icmpOutEchos = icmpGroup.icmpOutEchos;
|
||||
pIcmpInfo->icmpOutEchoReps = icmpGroup.icmpOutEchoReps;
|
||||
pIcmpInfo->icmpOutTimestamps = icmpGroup.icmpOutTimestamps;
|
||||
pIcmpInfo->icmpOutTimestampReps = icmpGroup.icmpOutTimestampReps;
|
||||
pIcmpInfo->icmpOutAddrMasks = icmpGroup.icmpOutAddrMasks;
|
||||
pIcmpInfo->icmpOutAddrMaskReps = icmpGroup.icmpOutAddrMaskReps;
|
||||
#endif
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* m2IcmpDelete - delete all resources used to access the ICMP group
|
||||
*
|
||||
* This routine frees all the resources allocated at the time the ICMP group was
|
||||
* initialized. The ICMP group should not be accessed after this routine has
|
||||
* been called.
|
||||
*
|
||||
* RETURNS: OK, always.
|
||||
*
|
||||
* SEE ALSO: m2IcmpInit(), m2IcmpGroupInfoGet()
|
||||
*/
|
||||
STATUS m2IcmpDelete (void)
|
||||
{
|
||||
return (OK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user