⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xgcpmsgstattable.c

📁 非常不错的网管开发包
💻 C
字号:
/* minimal include directives */#include "xgcpMsgStatTable.h"/*  * xgcpMsgStatTable_variables_oid: *   this is the top level oid that we want to register under.  This *   is essentially a prefix, with the suffix appearing in the *   variable below. */oid xgcpMsgStatTable_variables_oid[] = { 1,3,6,1,4,1,5738,3,90,1,7 };/*  * variable2 xgcpMsgStatTable_variables: *   this variable defines function callbacks and type return information  *   for the xgcpMsgStatTable mib section  */#define   xgcpSuccessTxMessages  5#define   xgcpSuccessRxMessages  6#define   xgcpFailTxMessages    7#define   xgcpFailRxMessages    8struct variable2 xgcpMsgStatTable_variables[] = {/*  magic number        , variable type , ro/rw , callback fn  , L, oidsuffix */  { xgcpSuccessTxMessages, ASN_COUNTER   , RONLY , var_xgcpMsgStatTable, 1, { 4 } },  { xgcpSuccessRxMessages, ASN_COUNTER   , RONLY , var_xgcpMsgStatTable, 1, { 5 } },  { xgcpFailTxMessages  , ASN_COUNTER   , RONLY , var_xgcpMsgStatTable, 1, { 6 } },  { xgcpFailRxMessages  , ASN_COUNTER   , RONLY , var_xgcpMsgStatTable, 1, { 7 } },};/*    (L = length of the oidsuffix) *//* * init_xgcpMsgStatTable(): *   Initialization routine.  This is called when the agent starts up. *   At a minimum, registration of your variables should take place here. */void init_xgcpMsgStatTable(void) {  /* register ourselves with the agent to handle our mib tree */  REGISTER_MIB("xgcpMsgStatTable", xgcpMsgStatTable_variables, variable2,               xgcpMsgStatTable_variables_oid);}/* * var_xgcpMsgStatTable(): *   This function is called every time the agent gets a request for *   a scalar variable that might be found within your mib section *   registered above.  It is up to you to do the right thing and *   return the correct value. *     You should also correct the value of "var_len" if necessary. * *   Please see the documentation for more information about writing *   module extensions, and check out the examples in the examples *   and mibII directories. */unsigned char *var_xgcpMsgStatTable(struct variable *vp,                 oid     *name,                 size_t  *length,                 int     exact,                 size_t  *var_len,                 WriteMethod **write_method){  static long long_ret;  static unsigned char string[SPRINT_MAX_LEN];  static oid objid[MAX_OID_LEN];  static struct counter64 c64;    int index, mgcpPort;  index = header_xgcp_table(vp,name,length,exact,var_len,write_method, 13);  if( index == MATCH_FAILED )    return NULL;  mgcpPort = TrapAgent_GetStackPortFromIndex((void *)trapAgent, index);  if (mgcpPort == 0)     return NULL;        /*  * this is where we do the value assignments for the mib results.  */  switch(vp->magic) {    case xgcpSuccessTxMessages:        if (requestXgcpCounter(vp->magic, &long_ret, mgcpPort) != voSuccess) {            return NULL;        }                        return (unsigned char *) &long_ret;    case xgcpSuccessRxMessages:    if (requestXgcpCounter(vp->magic, &long_ret, mgcpPort) != voSuccess) {            return NULL;        }                        return (unsigned char *) &long_ret;    case xgcpFailTxMessages:    if (requestXgcpCounter(vp->magic, &long_ret, mgcpPort) != voSuccess) {            return NULL;        }                        return (unsigned char *) &long_ret;    case xgcpFailRxMessages:    if (requestXgcpCounter(vp->magic, &long_ret, mgcpPort) != voSuccess) {            return NULL;        }                        return (unsigned char *) &long_ret;    default:      ERROR_MSG("");  }  return NULL;                            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -