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

📄 sipcommon.c

📁 非常不错的网管开发包
💻 C
📖 第 1 页 / 共 3 页
字号:
    	    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.   */#define TABLE_SIZE 0 //todo. fix later  if (header_simple_table(vp,name,length,exact,var_len,write_method, TABLE_SIZE)                                                == MATCH_FAILED )    return NULL;  /*    * this is where we do the value assignments for the mib results.   */  switch(vp->magic) {    case sipTransTo :                *string = 0;        *var_len = strlen(string);        return (unsigned char *) string;    case sipTransFrom :                *string = 0;        *var_len = strlen(string);        return (unsigned char *) string;    case sipTransCallId :                *string = 0;        *var_len = strlen(string);        return (unsigned char *) string;    case sipTransCSeq :                long_ret = 0;        return (unsigned char *) &long_ret;    case sipTransState :                long_ret = 0;        return (unsigned char *) &long_ret;    case sipTransOutstandingBranches :                long_ret = 0;        return (unsigned char *) &long_ret;    case sipTransExpiry :                *string = 0;        *var_len = strlen(string);        return (unsigned char *) string;    case sipTransCallingPartyContentType :                *string = 0;        *var_len = strlen(string);        return (unsigned char *) string;    case sipTransCalledPartyContentType :                *string = 0;        *var_len = strlen(string);        return (unsigned char *) string;  case sipNumUnsupportedUris :        long_ret = 0;        return (unsigned char *) &long_ret;    default:      ERROR_MSG("");  }  return NULL;}/* * var_sipPortTable(): *   Handle this table separately from the scalar value case. *   The workings of this are basically the same as for var_sipCommon above. */unsigned char *var_sipPortTable(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 NULL;  /*    * this is where we do the value assignments for the mib results.   */  switch(vp->magic) {    case sipTransport :                long_ret = 0;        return (unsigned char *) &long_ret;    case sipPortStatus :                long_ret = 0;        return (unsigned char *) &long_ret;    default:      ERROR_MSG("");  }  return NULL;}/* * var_sipUriSupportedTable *   Handle this table separately from the scalar value case. *   The workings of this are basically the same as for var_sipCommon above. */unsigned char *var_sipUriSupportedTable(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 NULL;  /*    * this is where we do the value assignments for the mib results.   */  switch(vp->magic) {    case sipUriSupported :                *string = 0;        *var_len = strlen(string);        return (unsigned char *) string;    default:      ERROR_MSG("");  }  return NULL;}/* * var_sipFtrSupportedTable *   Handle this table separately from the scalar value case. *   The workings of this are basically the same as for var_sipCommon above. */unsigned char *var_sipFtrSupportedTable(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 NULL;  /*    * this is where we do the value assignments for the mib results.   */  switch(vp->magic) {    case sipFtrSupported :                *string = 0;        *var_len = strlen(string);        return (unsigned char *) string;    default:      ERROR_MSG("");  }  return NULL;}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_sipTransport(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 sipTransport not ASN_INTEGER\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(long_ret)){              fprintf(stderr,"write to sipTransport: bad length\n");

⌨️ 快捷键说明

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