Updates to snmp
[public/mirror.git] / cscMIB.c
1 /*
2  * Note: this file originally auto-generated by mib2c using
3  *        : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
4  */
5
6 #include <net-snmp/net-snmp-config.h>
7 #include <net-snmp/net-snmp-includes.h>
8 #include <net-snmp/agent/net-snmp-agent-includes.h>
9 #include "cscMIB.h"
10 #include "mib-tc-stats.h"
11
12 /** Initializes the cscMIB module */
13 void
14 init_cscMIB(void)
15 {
16     static oid      cogentBytes_oid[] =
17         { 1, 3, 6, 1, 4, 1, 27934, 2, 2, 1 };
18     static oid      orionBytes_oid[] =
19         { 1, 3, 6, 1, 4, 1, 27934, 2, 2, 2 };
20     static oid      campusBytes_oid[] =
21         { 1, 3, 6, 1, 4, 1, 27934, 2, 2, 3 };
22
23     DEBUGMSGTL(("cscMIB", "Initializing\n"));
24
25     netsnmp_register_scalar(netsnmp_create_handler_registration
26                             ("cogentBytes", handle_cogentBytes,
27                              cogentBytes_oid, OID_LENGTH(cogentBytes_oid),
28                              HANDLER_CAN_RONLY));
29     netsnmp_register_scalar(netsnmp_create_handler_registration
30                             ("orionBytes", handle_orionBytes,
31                              orionBytes_oid, OID_LENGTH(orionBytes_oid),
32                              HANDLER_CAN_RONLY));
33     netsnmp_register_scalar(netsnmp_create_handler_registration
34                             ("campusBytes", handle_campusBytes,
35                              campusBytes_oid, OID_LENGTH(campusBytes_oid),
36                              HANDLER_CAN_RONLY));
37 }
38
39 int
40 handle_cogentBytes(netsnmp_mib_handler *handler,
41                    netsnmp_handler_registration *reginfo,
42                    netsnmp_agent_request_info *reqinfo,
43                    netsnmp_request_info *requests)
44 {
45     uint64_t bytes;
46     mirror_stats_refresh();
47     bytes = get_class_byte_count(&cogent_class);
48
49     switch (reqinfo->mode) {
50         case MODE_GET:
51             snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER64,
52                     (u_char *)&bytes, sizeof(bytes));
53             break;
54         default:
55             die("unknown mode");
56     }
57
58     return SNMP_ERR_NOERROR;
59 }
60
61 int
62 handle_orionBytes(netsnmp_mib_handler *handler,
63                   netsnmp_handler_registration *reginfo,
64                   netsnmp_agent_request_info *reqinfo,
65                   netsnmp_request_info *requests)
66 {
67     uint64_t bytes;
68     mirror_stats_refresh();
69     bytes = get_class_byte_count(&orion_class);
70
71     switch (reqinfo->mode) {
72         case MODE_GET:
73             snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER64,
74                     (u_char *)&bytes, sizeof(bytes));
75             break;
76         default:
77             die("unknown mode");
78     }
79
80     return SNMP_ERR_NOERROR;
81 }
82
83 int
84 handle_campusBytes(netsnmp_mib_handler *handler,
85                    netsnmp_handler_registration *reginfo,
86                    netsnmp_agent_request_info *reqinfo,
87                    netsnmp_request_info *requests)
88 {
89     uint64_t bytes;
90     mirror_stats_refresh();
91     bytes = get_class_byte_count(&campus_class);
92
93     switch (reqinfo->mode) {
94         case MODE_GET:
95             snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER64,
96                     (u_char *)&bytes, sizeof(bytes));
97             break;
98         default:
99             die("unknown mode");
100     }
101
102     return SNMP_ERR_NOERROR;
103 }