summaryrefslogtreecommitdiff
path: root/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocCBATAdminGroup/eocCBATSNMPSettingGroup/eocCBATSNMPSettingGroup.c
blob: e3346218759da30d99a9152bfebcface4c5b0305 (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
/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
 */

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "eocCBATSNMPSettingGroup.h"

/** Initializes the eocCBATSNMPSettingGroup module */
void
init_eocCBATSNMPSettingGroup(void)
{
    static oid eocCBATAdminVarBindings_oid[] = { 1,3,6,1,4,1,17409,2,4,1,4,1 };
    static oid eocCBATAdminSNMPVersion_oid[] = { 1,3,6,1,4,1,17409,2,4,1,4,2 };

  DEBUGMSGTL(("eocCBATSNMPSettingGroup", "Initializing\n"));

    netsnmp_register_scalar(
        netsnmp_create_handler_registration("eocCBATAdminVarBindings", handle_eocCBATAdminVarBindings,
                               eocCBATAdminVarBindings_oid, OID_LENGTH(eocCBATAdminVarBindings_oid),
                               HANDLER_CAN_RONLY
        ));
    netsnmp_register_scalar(
        netsnmp_create_handler_registration("eocCBATAdminSNMPVersion", handle_eocCBATAdminSNMPVersion,
                               eocCBATAdminSNMPVersion_oid, OID_LENGTH(eocCBATAdminSNMPVersion_oid),
                               HANDLER_CAN_RONLY
        ));
}

int
handle_eocCBATAdminVarBindings(netsnmp_mib_handler *handler,
                          netsnmp_handler_registration *reginfo,
                          netsnmp_agent_request_info   *reqinfo,
                          netsnmp_request_info         *requests)
{
    int bind_num = EOCCBATADMIN_VARBINDINGS_MAX_NB;
    /* We are never called for a GETNEXT if it's registered as a
       "instance", as it's "magically" handled for us.  */

    /* a instance handler also only hands us one request at a time, so
       we don't need to loop over a list of requests; we'll only get one. */

    switch (reqinfo->mode)
    {

    case MODE_GET:
        snmp_set_var_typed_value (requests->requestvb, ASN_INTEGER,
                                  (u_char *)&bind_num,
                                  sizeof (bind_num));
        break;


    default:
        /* we should never get here, so this is a really bad error */
        snmp_log (LOG_ERR, "unknown mode (%d) in "
                 "handle_eocCBATAdminVarBindings\n", reqinfo->mode );
        return SNMP_ERR_GENERR;
    }

    return SNMP_ERR_NOERROR;
}
int
handle_eocCBATAdminSNMPVersion(netsnmp_mib_handler *handler,
                          netsnmp_handler_registration *reginfo,
                          netsnmp_agent_request_info   *reqinfo,
                          netsnmp_request_info         *requests)
{
    /* We are never called for a GETNEXT if it's registered as a
       "instance", as it's "magically" handled for us.  */

    /* a instance handler also only hands us one request at a time, so
       we don't need to loop over a list of requests; we'll only get one. */

    admin_cbat_snmp_version_t  snmp_version = ADMIN_CBAT_SNMP_V2;

    switch (reqinfo->mode)
    {
    case MODE_GET:
        snmp_set_var_typed_value (requests->requestvb, ASN_INTEGER,
                                  (u_char *)&snmp_version,
                                  sizeof (snmp_version));
        break;


    default:
        /* we should never get here, so this is a really bad error */
        snmp_log (LOG_ERR, "unknown mode (%d) in "
                  "handle_eocCBATAdminSNMPVersion\n", reqinfo->mode );
        return SNMP_ERR_GENERR;
    }

    return SNMP_ERR_NOERROR;
}