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

📄 sipcommonmib.c

📁 非常不错的网管开发包
💻 C
📖 第 1 页 / 共 3 页
字号:
    	    size_t  *length,    	    int     exact,    	    size_t  *var_len,    	    WriteMethod **write_method){  /* variables we may use later */  static long long_ret;  static unsigned char string[SPRINT_MAX_LEN];  static oid objid[MAX_OID_LEN];  static struct counter64 c64;  int index, sipPort;  index = header_sip_table(vp,name,length,exact,var_len,write_method, 16);  if (index == MATCH_FAILED )    return 0;  sipPort = TrapAgent_GetStackPortFromIndex((void *)trapAgent, index);  if (sipPort == 0)      return 0;  // todo:  This is a 2 index table.  We will deal with it later.  return 0;}unsigned char *var_sipSummaryStatsTable (struct variable *vp,    	    oid     *name,    	    size_t  *length,    	    int     exact,    	    size_t  *var_len,    	    WriteMethod **write_method){  /* variables we may use later */  static long long_ret;  static unsigned char string[SPRINT_MAX_LEN];  static oid objid[MAX_OID_LEN];  static struct counter64 c64;  int index, sipPort;  index = header_sip_table(vp,name,length,exact,var_len,write_method, 16);  if (index == MATCH_FAILED )    return 0;  sipPort = TrapAgent_GetStackPortFromIndex((void *)trapAgent, index);  if (sipPort == 0)      return 0;  if (requestSipCounter(vp->magic, &long_ret, sipPort) != voSuccess) {      return 0;  }  return (unsigned char *) &long_ret;}unsigned char *var_sipMethodStatsTable (struct variable *vp,    	    oid     *name,    	    size_t  *length,    	    int     exact,    	    size_t  *var_len,    	    WriteMethod **write_method){  /* variables we may use later */  static long long_ret;  static unsigned char string[SPRINT_MAX_LEN];  static oid objid[MAX_OID_LEN];  static struct counter64 c64;  int index, sipPort;  index = header_sip_table(vp,name,length,exact,var_len,write_method, 16);  if (index == MATCH_FAILED )    return 0;  sipPort = TrapAgent_GetStackPortFromIndex((void *)trapAgent, index);  if (sipPort == 0)      return 0;  if (requestSipCounter(vp->magic, &long_ret, sipPort) != voSuccess) {      return 0;  }  return (unsigned char *) &long_ret;}unsigned char *var_sipStatusCodesTable (struct variable *vp,    	    oid     *name,    	    size_t  *length,    	    int     exact,    	    size_t  *var_len,    	    WriteMethod **write_method){  /* variables we may use later */  static long long_ret;  static unsigned char string[SPRINT_MAX_LEN];  static oid objid[MAX_OID_LEN];  static struct counter64 c64;  int index, sipPort;  index = header_sip_table(vp,name,length,exact,var_len,write_method, 16);  if (index == MATCH_FAILED )    return 0;  sipPort = TrapAgent_GetStackPortFromIndex((void *)trapAgent, index);  if (sipPort == 0)      return 0;  if (requestSipCounter(vp->magic, &long_ret, sipPort) != voSuccess) {      return 0;  }  return (unsigned char *) &long_ret;}unsigned char *var_sipCurrentTransTable (struct variable *vp,    	    oid     *name,    	    size_t  *length,    	    int     exact,    	    size_t  *var_len,    	    WriteMethod **write_method){  /* variables we may use later */  static long long_ret;  static unsigned char string[SPRINT_MAX_LEN];  static oid objid[MAX_OID_LEN];  static struct counter64 c64;  int index, sipPort;  index = header_sip_table(vp,name,length,exact,var_len,write_method, 16);  if (index == MATCH_FAILED )    return 0;  sipPort = TrapAgent_GetStackPortFromIndex((void *)trapAgent, index);  if (sipPort == 0)      return 0;  // todo:  This is not implemented in the sip stack.  We will deal with it later.  return 0;}unsigned char *var_sipTransactionTable (struct variable *vp,    	    oid     *name,    	    size_t  *length,    	    int     exact,    	    size_t  *var_len,    	    WriteMethod **write_method){  /* variables we may use later */  static long long_ret;  static unsigned char string[SPRINT_MAX_LEN];  static oid objid[MAX_OID_LEN];  static struct counter64 c64;  int index, sipPort;  index = header_sip_table(vp,name,length,exact,var_len,write_method, 16);  if (index == MATCH_FAILED )    return 0;  sipPort = TrapAgent_GetStackPortFromIndex((void *)trapAgent, index);  if (sipPort == 0)      return 0;  // todo:  This is a 2 index table, and it relates to the  // table above.  We will deal with it later.  return 0;}/*********************************************//*         End Vovida defined tables         *//*********************************************//* * var_sipOtherStatsTable(): *   Handle this table separately from the scalar value case. *   The workings of this are basically the same as for var_sipCommonMIB above. */unsigned char *var_sipOtherStatsTable(struct variable *vp,    	    oid     *name,    	    size_t  *length,    	    int     exact,    	    size_t  *var_len,    	    WriteMethod **write_method){  /* variables we may use later */  static long long_ret;  static unsigned char string[SPRINT_MAX_LEN];  static oid objid[MAX_OID_LEN];  static struct counter64 c64;  /*    * This assumes that the table is a 'simple' table.   *	See the implementation documentation for the meaning of this.   *	You will need to provide the correct value for the TABLE_SIZE parameter   *   * If this table does not meet the requirements for a simple table,   *	you will need to provide the replacement code yourself.   *	Mib2c is not smart enough to write this for you.   *    Again, see the implementation documentation for what is required.   */  if (header_simple_table(vp,name,length,exact,var_len,write_method, TABLE_SIZE)                                                == MATCH_FAILED )    return 0;  /*    * this is where we do the value assignments for the mib results.   */  switch(vp->magic) {      case sipNumUnsupportedUris:                long_ret = 0;        return (unsigned char *) &long_ret;    default:      ERROR_MSG("");  }  return 0;}intwrite_sipServiceAdminStatus(int      action,            u_char   *var_val,            u_char   var_val_type,            size_t   var_val_len,            u_char   *statP,            oid      *name,            size_t   name_len){  static long *long_ret;  int size;  switch ( action ) {        case RESERVE1:          if (var_val_type != ASN_INTEGER){              fprintf(stderr, "write to sipServiceAdminStatus not ASN_INTEGER\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(long_ret)){              fprintf(stderr,"write to sipServiceAdminStatus: bad length\n");              return SNMP_ERR_WRONGLENGTH;          }          break;        case RESERVE2:          size = var_val_len;          long_ret = (long *) var_val;          break;        case FREE:             /* Release any resources that have been allocated */          break;        case ACTION:             /* The variable has been stored in long_ret for             you to use, and you have just been asked to do something with             it.  Note that anything done here must be reversable in the UNDO case */          break;        case UNDO:             /* Back out any changes made in the ACTION case */          break;        case COMMIT:             /* Things are working well, so it's now safe to make the change             permanently.  Make sure that anything done here can't fail! */          break;  }  return SNMP_ERR_NOERROR;}intwrite_sipOrganization(int      action,            u_char   *var_val,            u_char   var_val_type,            size_t   var_val_len,            u_char   *statP,            oid      *name,            size_t   name_len){  static unsigned char string[SPRINT_MAX_LEN];  int size;  switch ( action ) {        case RESERVE1:          if (var_val_type != ASN_OCTET_STR){              fprintf(stderr, "write to sipOrganization not ASN_OCTET_STR\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(string)){              fprintf(stderr,"write to sipOrganization: bad length\n");              return SNMP_ERR_WRONGLENGTH;          }          break;        case RESERVE2:          size = var_val_len;//          string = (char *) var_val;          break;        case FREE:             /* Release any resources that have been allocated */          break;        case ACTION:             /* The variable has been stored in string for             you to use, and you have just been asked to do something with             it.  Note that anything done here must be reversable in the UNDO case */          break;        case UNDO:             /* Back out any changes made in the ACTION case */          break;        case COMMIT:             /* Things are working well, so it's now safe to make the change             permanently.  Make sure that anything done here can't fail! */          break;  }  return SNMP_ERR_NOERROR;}intwrite_sipInviteTimeout(int      action,            u_char   *var_val,            u_char   var_val_type,            size_t   var_val_len,            u_char   *statP,            oid      *name,            size_t   name_len){  static long *long_ret;  int size;  switch ( action ) {        case RESERVE1:          if (var_val_type != ASN_GAUGE){              fprintf(stderr, "write to sipInviteTimeout not ASN_GAUGE\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(long_ret)){              fprintf(stderr,"write to sipInviteTimeout: bad length\n");              return SNMP_ERR_WRONGLENGTH;          }          break;        case RESERVE2:          size = var_val_len;          long_ret = (long *) var_val;          break;        case FREE:             /* Release any resources that have been allocated */          break;        case ACTION:             /* The variable has been stored in long_ret for             you to use, and you have just been asked to do something with             it.  Note that anything done here must be reversable in the UNDO case */          break;        case UNDO:             /* Back out any changes made in the ACTION case */          break;        case COMMIT:             /* Things are working well, so it's now safe to make the change             permanently.  Make sure that anything done here can't fail! */          break;  }  return SNMP_ERR_NOERROR;}intwrite_sipHideOperation(int      action,            u_char   *var_val,            u_char   var_val_type,            size_t   var_val_len,            u_char   *statP,            oid      *name,            size_t   name_len){  static long *long_ret;  int size;  switch ( action ) {        case RESERVE1:          if (var_val_type != ASN_INTEGER){              fprintf(stderr, "write to sipHideOperation not ASN_INTEGER\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(long_ret)){              fprintf(stderr,"write to sipHideOperation: bad length\n");              return SNMP_ERR_WRONGLENGTH;          }          break;        case RESERVE2:          size = var_val_len;          long_ret = (long *) var_val;          break;        case FREE:             /* Release any resources that have been allocated */          break;        case ACTION:             /* The variable has been stored in long_ret for             you to use, and you have just been asked to do something with             it.  Note that anything done here must be reversable in the UNDO case */          break;        case UNDO:             /* Back out any changes made in the ACTION case */          break;        case COMMIT:             /* Things are working well, so it's now safe to make the change             permanently.  Make sure that anything done here can't fail! */          break;  }  return SNMP_ERR_NOERROR;

⌨️ 快捷键说明

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