| 1 |
/* |
| 2 |
* Note: this file originally auto-generated by mib2c using |
| 3 |
* : mib2c.check_values.conf,v 1.5 2003/05/31 00:11:57 hardaker Exp $ |
| 4 |
*/ |
| 5 |
|
| 6 |
/******************************************************************** |
| 7 |
* NOTE NOTE NOTE |
| 8 |
* This file is auto-generated and SHOULD NOT BE EDITED by hand. |
| 9 |
* Modify the netSnmpHostsTable_checkfns_local.[ch] files insead so that you |
| 10 |
* can regenerate this one as mib2c improvements are made. |
| 11 |
********************************************************************/ |
| 12 |
|
| 13 |
/* |
| 14 |
* standard headers |
| 15 |
*/ |
| 16 |
#include <net-snmp/net-snmp-config.h> |
| 17 |
#include <net-snmp/net-snmp-features.h> |
| 18 |
#include <net-snmp/net-snmp-includes.h> |
| 19 |
#include "netSnmpHostsTable_checkfns.h" |
| 20 |
#include "netSnmpHostsTable_checkfns_local.h" |
| 21 |
#include "netSnmpHostsTable_enums.h" |
| 22 |
|
| 23 |
netsnmp_feature_require(check_storage_transition); |
| 24 |
|
| 25 |
/** Decides if an incoming value for the netSnmpHostAddressType mib node is legal. |
| 26 |
* @param type The incoming data type. |
| 27 |
* @param val The value to be checked. |
| 28 |
* @param val_len The length of data stored in val (in bytes). |
| 29 |
* @param old_val |
| 30 |
* @param old_val_len |
| 31 |
* @return 0 if the incoming value is legal, an SNMP error code otherwise. |
| 32 |
*/ |
| 33 |
int |
| 34 |
check_netSnmpHostAddressType(int type, long *val, size_t val_len, |
| 35 |
long *old_val, size_t old_val_len) |
| 36 |
{ |
| 37 |
/** Check to see that we were called legally */ |
| 38 |
if (!val) |
| 39 |
return SNMP_ERR_GENERR; |
| 40 |
|
| 41 |
/** Check the incoming type for correctness */ |
| 42 |
if (type != ASN_INTEGER) |
| 43 |
return SNMP_ERR_WRONGTYPE; |
| 44 |
|
| 45 |
/** Check the enums. Legal values will continue, others return error. */ |
| 46 |
switch (*val) { |
| 47 |
case NETSNMPHOSTADDRESSTYPE_UNKNOWN: |
| 48 |
case NETSNMPHOSTADDRESSTYPE_IPV4: |
| 49 |
case NETSNMPHOSTADDRESSTYPE_IPV6: |
| 50 |
case NETSNMPHOSTADDRESSTYPE_IPV4Z: |
| 51 |
case NETSNMPHOSTADDRESSTYPE_IPV6Z: |
| 52 |
case NETSNMPHOSTADDRESSTYPE_DNS: |
| 53 |
break; |
| 54 |
|
| 55 |
/** not a legal enum value. return an error */ |
| 56 |
default: |
| 57 |
return SNMP_ERR_INCONSISTENTVALUE; |
| 58 |
} |
| 59 |
|
| 60 |
/** looks ok, call the local version of the same function. */ |
| 61 |
return check_netSnmpHostAddressType_local(type, val, val_len, old_val, |
| 62 |
old_val_len); |
| 63 |
} |
| 64 |
|
| 65 |
/** Decides if an incoming value for the netSnmpHostAddress mib node is legal. |
| 66 |
* @param type The incoming data type. |
| 67 |
* @param val The value to be checked. |
| 68 |
* @param val_len The length of data stored in val (in bytes). |
| 69 |
* @param old_val |
| 70 |
* @param old_val_len |
| 71 |
* @return 0 if the incoming value is legal, an SNMP error code otherwise. |
| 72 |
*/ |
| 73 |
int |
| 74 |
check_netSnmpHostAddress(int type, char *val, size_t val_len, |
| 75 |
char *old_val, size_t old_val_len) |
| 76 |
{ |
| 77 |
/** Check to see that we were called legally */ |
| 78 |
if (!val) |
| 79 |
return SNMP_ERR_GENERR; |
| 80 |
|
| 81 |
/** Check the incoming type for correctness */ |
| 82 |
if (type != ASN_OCTET_STR) |
| 83 |
return SNMP_ERR_WRONGTYPE; |
| 84 |
|
| 85 |
/** Check the ranges of the passed value for legality */ |
| 86 |
if (val_len > 255) |
| 87 |
return SNMP_ERR_WRONGVALUE; |
| 88 |
|
| 89 |
/** looks ok, call the local version of the same function. */ |
| 90 |
return check_netSnmpHostAddress_local(type, val, val_len, old_val, |
| 91 |
old_val_len); |
| 92 |
} |
| 93 |
|
| 94 |
/** Decides if an incoming value for the netSnmpHostStorage mib node is legal. |
| 95 |
* @param type The incoming data type. |
| 96 |
* @param val The value to be checked. |
| 97 |
* @param val_len The length of data stored in val (in bytes). |
| 98 |
* @param old_val |
| 99 |
* @param old_val_len |
| 100 |
* @return 0 if the incoming value is legal, an SNMP error code otherwise. |
| 101 |
*/ |
| 102 |
int |
| 103 |
check_netSnmpHostStorage(int type, long *val, size_t val_len, |
| 104 |
long *old_val, size_t old_val_len) |
| 105 |
{ |
| 106 |
|
| 107 |
int ret; |
| 108 |
|
| 109 |
/** Check to see that we were called legally */ |
| 110 |
if (!val) |
| 111 |
return SNMP_ERR_GENERR; |
| 112 |
|
| 113 |
/** Check the incoming type for correctness */ |
| 114 |
if (type != ASN_INTEGER) |
| 115 |
return SNMP_ERR_WRONGTYPE; |
| 116 |
|
| 117 |
/** Check the enums. Legal values will continue, others return error. */ |
| 118 |
switch (*val) { |
| 119 |
case NETSNMPHOSTSTORAGE_OTHER: |
| 120 |
case NETSNMPHOSTSTORAGE_VOLATILE: |
| 121 |
case NETSNMPHOSTSTORAGE_NONVOLATILE: |
| 122 |
case NETSNMPHOSTSTORAGE_PERMANENT: |
| 123 |
case NETSNMPHOSTSTORAGE_READONLY: |
| 124 |
break; |
| 125 |
|
| 126 |
/** not a legal enum value. return an error */ |
| 127 |
default: |
| 128 |
return SNMP_ERR_INCONSISTENTVALUE; |
| 129 |
} |
| 130 |
|
| 131 |
ret = check_storage_transition((old_val) ? *old_val : SNMP_STORAGE_NONE, |
| 132 |
*val); |
| 133 |
if (ret) |
| 134 |
return ret; |
| 135 |
|
| 136 |
/** looks ok, call the local version of the same function. */ |
| 137 |
return check_netSnmpHostStorage_local(type, val, val_len, old_val, |
| 138 |
old_val_len); |
| 139 |
} |
| 140 |
|
| 141 |
/** Decides if an incoming value for the netSnmpHostRowStatus mib node is legal. |
| 142 |
* @param type The incoming data type. |
| 143 |
* @param val The value to be checked. |
| 144 |
* @param val_len The length of data stored in val (in bytes). |
| 145 |
* @param old_val |
| 146 |
* @param old_val_len |
| 147 |
* @return 0 if the incoming value is legal, an SNMP error code otherwise. |
| 148 |
*/ |
| 149 |
int |
| 150 |
check_netSnmpHostRowStatus(int type, long *val, size_t val_len, |
| 151 |
long *old_val, size_t old_val_len) |
| 152 |
{ |
| 153 |
|
| 154 |
int ret; |
| 155 |
|
| 156 |
/** Check to see that we were called legally */ |
| 157 |
if (!val) |
| 158 |
return SNMP_ERR_GENERR; |
| 159 |
|
| 160 |
/** Check the incoming type for correctness */ |
| 161 |
if (type != ASN_INTEGER) |
| 162 |
return SNMP_ERR_WRONGTYPE; |
| 163 |
|
| 164 |
/** Check the enums. Legal values will continue, others return error. */ |
| 165 |
switch (*val) { |
| 166 |
case NETSNMPHOSTROWSTATUS_ACTIVE: |
| 167 |
case NETSNMPHOSTROWSTATUS_NOTINSERVICE: |
| 168 |
case NETSNMPHOSTROWSTATUS_NOTREADY: |
| 169 |
case NETSNMPHOSTROWSTATUS_CREATEANDGO: |
| 170 |
case NETSNMPHOSTROWSTATUS_CREATEANDWAIT: |
| 171 |
case NETSNMPHOSTROWSTATUS_DESTROY: |
| 172 |
break; |
| 173 |
|
| 174 |
/** not a legal enum value. return an error */ |
| 175 |
default: |
| 176 |
return SNMP_ERR_INCONSISTENTVALUE; |
| 177 |
} |
| 178 |
|
| 179 |
ret = check_rowstatus_transition((old_val) ? *old_val : RS_NONEXISTENT, |
| 180 |
*val); |
| 181 |
if (ret) |
| 182 |
return ret; |
| 183 |
|
| 184 |
/** looks ok, call the local version of the same function. */ |
| 185 |
return check_netSnmpHostRowStatus_local(type, val, val_len, old_val, |
| 186 |
old_val_len); |
| 187 |
} |