summaryrefslogtreecommitdiff
path: root/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.c
blob: a29360d7e1d04956eef1f34dbc3d55e0263cb25f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.check_values_local.conf,v 5.1 2003/05/30 23:53:15 hardaker Exp $
 */

/*
 * standard headers 
 */
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include "netSnmpHostsTable_checkfns.h"
#include "netSnmpHostsTable_enums.h"

/** Decides if an incoming value for the netSnmpHostAddressType mib node is legal, from a local implementation specific viewpoint.
 *  @param type    The incoming data type.
 *  @param val     The value to be checked.
 *  @param val_len The length of data stored in val (in bytes).
 *  @param old_val
 *  @param old_val_len
 *  @return 0 if the incoming value is legal, an SNMP error code otherwise.
 */
int
check_netSnmpHostAddressType_local(int type, long *val, size_t val_len,
                                   long *old_val, size_t old_val_len)
{

    /** XXX: you may want to check aspects of the new value that
       were not covered by the automatic checks by the parent function. */

    /** XXX: you make want to check that the requested change from
        the old value to the new value is legal (ie, the transistion
        from one value to another is legal */

    if (*val != NETSNMPHOSTADDRESSTYPE_IPV4)
        return SNMP_ERR_WRONGVALUE;

    /** if everything looks ok, return SNMP_ERR_NOERROR */
    return SNMP_ERR_NOERROR;
}

/** Decides if an incoming value for the netSnmpHostAddress mib node is legal, from a local implementation specific viewpoint.
 *  @param type    The incoming data type.
 *  @param val     The value to be checked.
 *  @param val_len The length of data stored in val (in bytes).
 *  @param old_val
 *  @param old_val_len
 *  @return 0 if the incoming value is legal, an SNMP error code otherwise.
 */
int
check_netSnmpHostAddress_local(int type, char *val, size_t val_len,
                               char *old_val, size_t old_val_len)
{

    /** XXX: you may want to check aspects of the new value that
       were not covered by the automatic checks by the parent function. */

    /** XXX: you make want to check that the requested change from
        the old value to the new value is legal (ie, the transistion
        from one value to another is legal */

    if (val_len != 4)
        return SNMP_ERR_WRONGVALUE;

    /** if everything looks ok, return SNMP_ERR_NOERROR */
    return SNMP_ERR_NOERROR;
}

/** Decides if an incoming value for the netSnmpHostStorage mib node is legal, from a local implementation specific viewpoint.
 *  @param type    The incoming data type.
 *  @param val     The value to be checked.
 *  @param val_len The length of data stored in val (in bytes).
 *  @param old_val
 *  @param old_val_len
 *  @return 0 if the incoming value is legal, an SNMP error code otherwise.
 */
int
check_netSnmpHostStorage_local(int type, long *val, size_t val_len,
                               long *old_val, size_t old_val_len)
{

    /** XXX: you may want to check aspects of the new value that
       were not covered by the automatic checks by the parent function. */

    /** XXX: you make want to check that the requested change from
        the old value to the new value is legal (ie, the transistion
        from one value to another is legal */

    if (*val != ST_NONVOLATILE)
        return SNMP_ERR_WRONGVALUE;

    /** if everything looks ok, return SNMP_ERR_NOERROR */
    return SNMP_ERR_NOERROR;
}

/** Decides if an incoming value for the netSnmpHostRowStatus mib node is legal, from a local implementation specific viewpoint.
 *  @param type    The incoming data type.
 *  @param val     The value to be checked.
 *  @param val_len The length of data stored in val (in bytes).
 *  @param old_val
 *  @param old_val_len
 *  @return 0 if the incoming value is legal, an SNMP error code otherwise.
 */
int
check_netSnmpHostRowStatus_local(int type, long *val, size_t val_len,
                                 long *old_val, size_t old_val_len)
{

    /** XXX: you may want to check aspects of the new value that
       were not covered by the automatic checks by the parent function. */

    /** XXX: you make want to check that the requested change from
        the old value to the new value is legal (ie, the transistion
        from one value to another is legal */

    /** if everything looks ok, return SNMP_ERR_NOERROR */
    return SNMP_ERR_NOERROR;
}