net-snmp 5.7
netSnmpHostsTable_checkfns.c
00001 /*
00002  * Note: this file originally auto-generated by mib2c using
00003  *        : mib2c.check_values.conf,v 1.5 2003/05/31 00:11:57 hardaker Exp $
00004  */
00005 
00006 /********************************************************************
00007  *                       NOTE   NOTE   NOTE
00008  *   This file is auto-generated and SHOULD NOT BE EDITED by hand.
00009  *   Modify the netSnmpHostsTable_checkfns_local.[ch] files insead so that you
00010  *   can regenerate this one as mib2c improvements are made.
00011  ********************************************************************/
00012 
00013 /*
00014  * standard headers 
00015  */
00016 #include <net-snmp/net-snmp-config.h>
00017 #include <net-snmp/net-snmp-features.h>
00018 #include <net-snmp/net-snmp-includes.h>
00019 #include "netSnmpHostsTable_checkfns.h"
00020 #include "netSnmpHostsTable_checkfns_local.h"
00021 #include "netSnmpHostsTable_enums.h"
00022 
00023 netsnmp_feature_require(check_storage_transition)
00024 
00025 
00033 int
00034 check_netSnmpHostAddressType(int type, long *val, size_t val_len,
00035                              long *old_val, size_t old_val_len)
00036 {
00037 
00038     int             ret;
00039 
00041     if (!val)
00042         return SNMP_ERR_GENERR;
00043 
00045     if (type != ASN_INTEGER)
00046         return SNMP_ERR_WRONGTYPE;
00047 
00049     switch (*val) {
00050     case NETSNMPHOSTADDRESSTYPE_UNKNOWN:
00051     case NETSNMPHOSTADDRESSTYPE_IPV4:
00052     case NETSNMPHOSTADDRESSTYPE_IPV6:
00053     case NETSNMPHOSTADDRESSTYPE_IPV4Z:
00054     case NETSNMPHOSTADDRESSTYPE_IPV6Z:
00055     case NETSNMPHOSTADDRESSTYPE_DNS:
00056         break;
00057 
00059     default:
00060         return SNMP_ERR_INCONSISTENTVALUE;
00061     }
00062     ret = SNMP_ERR_NOERROR;
00063 
00064 
00066     return check_netSnmpHostAddressType_local(type, val, val_len, old_val,
00067                                               old_val_len);
00068 }
00069 
00078 int
00079 check_netSnmpHostAddress(int type, char *val, size_t val_len,
00080                          char *old_val, size_t old_val_len)
00081 {
00082 
00083     int             ret;
00084 
00086     if (!val)
00087         return SNMP_ERR_GENERR;
00088 
00090     if (type != ASN_OCTET_STR)
00091         return SNMP_ERR_WRONGTYPE;
00092 
00094     if (!(val_len >= 0 && val_len <= 255)
00095         ) {
00096         return SNMP_ERR_WRONGVALUE;
00097     }
00098 
00099 
00101     return check_netSnmpHostAddress_local(type, val, val_len, old_val,
00102                                           old_val_len);
00103 }
00104 
00113 int
00114 check_netSnmpHostStorage(int type, long *val, size_t val_len,
00115                          long *old_val, size_t old_val_len)
00116 {
00117 
00118     int             ret;
00119 
00121     if (!val)
00122         return SNMP_ERR_GENERR;
00123 
00125     if (type != ASN_INTEGER)
00126         return SNMP_ERR_WRONGTYPE;
00127 
00129     switch (*val) {
00130     case NETSNMPHOSTSTORAGE_OTHER:
00131     case NETSNMPHOSTSTORAGE_VOLATILE:
00132     case NETSNMPHOSTSTORAGE_NONVOLATILE:
00133     case NETSNMPHOSTSTORAGE_PERMANENT:
00134     case NETSNMPHOSTSTORAGE_READONLY:
00135         break;
00136 
00138     default:
00139         return SNMP_ERR_INCONSISTENTVALUE;
00140     }
00141     ret = SNMP_ERR_NOERROR;
00142 
00143     if (ret =
00144         check_storage_transition((old_val) ? *old_val : SNMP_STORAGE_NONE,
00145                                  *val))
00146         return ret;
00147 
00149     return check_netSnmpHostStorage_local(type, val, val_len, old_val,
00150                                           old_val_len);
00151 }
00152 
00161 int
00162 check_netSnmpHostRowStatus(int type, long *val, size_t val_len,
00163                            long *old_val, size_t old_val_len)
00164 {
00165 
00166     int             ret;
00167 
00169     if (!val)
00170         return SNMP_ERR_GENERR;
00171 
00173     if (type != ASN_INTEGER)
00174         return SNMP_ERR_WRONGTYPE;
00175 
00177     switch (*val) {
00178     case NETSNMPHOSTROWSTATUS_ACTIVE:
00179     case NETSNMPHOSTROWSTATUS_NOTINSERVICE:
00180     case NETSNMPHOSTROWSTATUS_NOTREADY:
00181     case NETSNMPHOSTROWSTATUS_CREATEANDGO:
00182     case NETSNMPHOSTROWSTATUS_CREATEANDWAIT:
00183     case NETSNMPHOSTROWSTATUS_DESTROY:
00184         break;
00185 
00187     default:
00188         return SNMP_ERR_INCONSISTENTVALUE;
00189     }
00190     ret = SNMP_ERR_NOERROR;
00191 
00192     if (ret =
00193         check_rowstatus_transition((old_val) ? *old_val : RS_NONEXISTENT,
00194                                    *val))
00195         return ret;
00196 
00198     return check_netSnmpHostRowStatus_local(type, val, val_len, old_val,
00199                                             old_val_len);
00200 }