2 * Note: this file originally auto-generated by mib2c using
3 * : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
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 "mirror-mib.h"
10 #include "mirror-nl-glue.h"
15 static oid cogentBytes_oid[] =
16 { 1, 3, 6, 1, 4, 1, 27934, 2, 2, 1 };
17 static oid orionBytes_oid[] =
18 { 1, 3, 6, 1, 4, 1, 27934, 2, 2, 2 };
19 static oid campusBytes_oid[] =
20 { 1, 3, 6, 1, 4, 1, 27934, 2, 2, 3 };
22 DEBUGMSGTL(("mirror_mib", "Initializing\n"));
24 mirror_stats_initialize();
26 netsnmp_register_scalar(netsnmp_create_handler_registration
27 ("cogentBytes", handle_cogentBytes,
28 cogentBytes_oid, OID_LENGTH(cogentBytes_oid),
30 netsnmp_register_scalar(netsnmp_create_handler_registration
31 ("orionBytes", handle_orionBytes,
32 orionBytes_oid, OID_LENGTH(orionBytes_oid),
34 netsnmp_register_scalar(netsnmp_create_handler_registration
35 ("campusBytes", handle_campusBytes,
36 campusBytes_oid, OID_LENGTH(campusBytes_oid),
40 void explode_counter64(uint64_t num, struct counter64 *counter) {
41 counter->low = num & 0xFFFFFFFF;
42 counter->high = (num >> 32) & 0xFFFFFFFF;
46 handle_cogentBytes(netsnmp_mib_handler *handler,
47 netsnmp_handler_registration *reginfo,
48 netsnmp_agent_request_info *reqinfo,
49 netsnmp_request_info *requests)
51 struct counter64 counter;
52 mirror_stats_refresh();
53 explode_counter64(get_class_byte_count(&cogent_class), &counter);
55 switch (reqinfo->mode) {
57 snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER64,
58 (u_char *)&counter, sizeof(counter));
64 return SNMP_ERR_NOERROR;
68 handle_orionBytes(netsnmp_mib_handler *handler,
69 netsnmp_handler_registration *reginfo,
70 netsnmp_agent_request_info *reqinfo,
71 netsnmp_request_info *requests)
73 struct counter64 counter;
74 mirror_stats_refresh();
75 explode_counter64(get_class_byte_count(&orion_class), &counter);
77 switch (reqinfo->mode) {
79 snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER64,
80 (u_char *)&counter, sizeof(counter));
86 return SNMP_ERR_NOERROR;
90 handle_campusBytes(netsnmp_mib_handler *handler,
91 netsnmp_handler_registration *reginfo,
92 netsnmp_agent_request_info *reqinfo,
93 netsnmp_request_info *requests)
95 struct counter64 counter;
96 mirror_stats_refresh();
97 explode_counter64(get_class_byte_count(&campus_class), &counter);
99 switch (reqinfo->mode) {
101 snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER64,
102 (u_char *)&counter, sizeof(counter));
108 return SNMP_ERR_NOERROR;