sipreg.c

来自「非常不错的网管开发包」· C语言 代码 · 共 858 行 · 第 1/2 页

C
858
字号
{  static long *long_ret;  int size;  switch ( action ) {        case RESERVE1:          if (var_val_type != ASN_GAUGE){              fprintf(stderr, "write to sipRegContactDfltExpiryDuration not ASN_GAUGE\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(long_ret)){              fprintf(stderr,"write to sipRegContactDfltExpiryDuration: 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_sipRegContactDfltExpiryDate(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 sipRegContactDfltExpiryDate not ASN_OCTET_STR\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(string)){              fprintf(stderr,"write to sipRegContactDfltExpiryDate: 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_sipRegMaxContactExpiryDate(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 sipRegMaxContactExpiryDate not ASN_GAUGE\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(long_ret)){              fprintf(stderr,"write to sipRegMaxContactExpiryDate: 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_sipRegRespHasContacts(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 sipRegRespHasContacts not ASN_INTEGER\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(long_ret)){              fprintf(stderr,"write to sipRegRespHasContacts: 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_sipUserUri(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 sipUserUri not ASN_OCTET_STR\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(string)){              fprintf(stderr,"write to sipUserUri: 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_sipUserPassword(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 sipUserPassword not ASN_OCTET_STR\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(string)){              fprintf(stderr,"write to sipUserPassword: 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_sipUserTableRowStatus(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 sipUserTableRowStatus not ASN_INTEGER\n");              return SNMP_ERR_WRONGTYPE;          }          if (var_val_len > sizeof(long_ret)){              fprintf(stderr,"write to sipUserTableRowStatus: 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 + =
减小字号Ctrl + -
显示快捷键?