(no subject)
"Ramachandrappa, Nataraju Karidasarahalli" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <A13FA4B2F7631E4B854D1AAA03078449033B1000@bgeexc04.asiapacific.cpqcorp.net> |
Hello Dave, Thank you for early response. I had given the following command. snmpget -c demo -t 60 localhost 1.3.6.1.4.1.11.255.1.2.1.0 Now instead of calling three times, some times it gets called 2 times and somes times it gets called only one time. Please find attached the source code. This mail is with respect to below mentioned details. If I start the developed agent and gave the following snmpget command > snmpget -c demo localhost 1.3.6.1.4.1.11.255.1.2.1.0. that particular > handler gets called 3 times. > > Why it is getting called 3 times. The only thing that springs to mind is the request being repeated because the response took too long to return. What happens if you try snmpget -c demo -t 60 localhost 1.3.6.1.4.1.11.255.1.2.1.0 ? If that still invokes the handler three times, then if you post the actual code, I'll have a look to see if I can reproduce the problem.
hpSTBMIBScalar.c
(application/octet-stream, 60.7 KB)
/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.scalar.conf,v 1.8 2004/10/14 12:57:34 dts12 Exp $
*/
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "hpSTBMIBScalar.h"
// Variables for the hpSTBAgent
char *strValue;
int validatescalar = 0;
int intValue = 0;
double megabyte = 1024 *1024 ;
char messageLog[1024];
/** Initializes the hpSTBMIBScalar module */
void
init_hpSTBMIBScalar(void)
{
static oid stbVendor_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 1, 1 };
static oid stbModel_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 1, 2 };
static oid stbSerialNumber_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 1, 3 };
static oid stbMACAddress_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 1, 4 };
static oid stbHWIdentification_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 1, 5 };
static oid stbSoftwareVersion_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 1, 6 };
static oid stbHWTechLevel_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 1, 7 };
static oid stbCurrentCPUUsage_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 2, 1 };
static oid stbCurrentMemoryUsage_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 2, 2 };
static oid stbTotalMemory_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 2, 3 };
static oid stbHostname_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 1 };
static oid stbIPAddressType_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 2 };
static oid stbIPAddress_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 3 };
static oid stbNetMaskAddressType_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 4 };
static oid stbNetMask_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 5 };
static oid stbGatewayIPType_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 6 };
static oid stbGatewayIP_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 7 };
static oid stbDomainName_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 8 };
static oid stbTimeServerIPAddressType_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 10 };
static oid stbTimeServerIPAddress_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 11 };
static oid stbDHCPEnabled_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 12 };
static oid stbTrapInitiator_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 5, 4 };
static oid stbPVREnabled_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 6, 1 };
static oid stbPVRTotalStorageCapacity_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 6, 2 };
static oid stbPVRFreeStorageCapacity_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 6, 3 };
static oid stbBrowser_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 7, 1 };
static oid stbBrowserVersion_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 7, 2 };
static oid stbBrowserHomePage_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 7, 3 };
static oid stbProxyIPAddressType_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 7, 4 };
static oid stbProxyIPAddress_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 7, 5 };
static oid stbProxyPort_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 7, 6 };
static oid stbRAMCache_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 7, 7 };
static oid stbChannelWatchedEnabled_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 9 };
static oid stbStreamingSessionQoSReportEnabled_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 10 };
static oid stbLocalTime_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 11 };
static oid stbEventMinTimeInterval_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 12 };
DEBUGMSGTL(("hpSTBMIBScalar", "Initializing\n"));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbVendor", handle_stbVendor, stbVendor_oid,
OID_LENGTH(stbVendor_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbModel", handle_stbModel, stbModel_oid,
OID_LENGTH(stbModel_oid), HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbSerialNumber", handle_stbSerialNumber,
stbSerialNumber_oid,
OID_LENGTH(stbSerialNumber_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbMACAddress", handle_stbMACAddress,
stbMACAddress_oid,
OID_LENGTH(stbMACAddress_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbHWIdentification",
handle_stbHWIdentification,
stbHWIdentification_oid,
OID_LENGTH(stbHWIdentification_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbSoftwareVersion",
handle_stbSoftwareVersion,
stbSoftwareVersion_oid,
OID_LENGTH(stbSoftwareVersion_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbHWTechLevel", handle_stbHWTechLevel,
stbHWTechLevel_oid,
OID_LENGTH(stbHWTechLevel_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbCurrentCPUUsage",
handle_stbCurrentCPUUsage,
stbCurrentCPUUsage_oid,
OID_LENGTH(stbCurrentCPUUsage_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbCurrentMemoryUsage",
handle_stbCurrentMemoryUsage,
stbCurrentMemoryUsage_oid,
OID_LENGTH(stbCurrentMemoryUsage_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbTotalMemory", handle_stbTotalMemory,
stbTotalMemory_oid,
OID_LENGTH(stbTotalMemory_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbHostname", handle_stbHostname,
stbHostname_oid, OID_LENGTH(stbHostname_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbIPAddressType", handle_stbIPAddressType,
stbIPAddressType_oid,
OID_LENGTH(stbIPAddressType_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbIPAddress", handle_stbIPAddress,
stbIPAddress_oid,
OID_LENGTH(stbIPAddress_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbNetMaskAddressType",
handle_stbNetMaskAddressType,
stbNetMaskAddressType_oid,
OID_LENGTH(stbNetMaskAddressType_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbNetMask", handle_stbNetMask,
stbNetMask_oid, OID_LENGTH(stbNetMask_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbGatewayIPType", handle_stbGatewayIPType,
stbGatewayIPType_oid,
OID_LENGTH(stbGatewayIPType_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbGatewayIP", handle_stbGatewayIP,
stbGatewayIP_oid,
OID_LENGTH(stbGatewayIP_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbDomainName", handle_stbDomainName,
stbDomainName_oid,
OID_LENGTH(stbDomainName_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbTimeServerIPAddressType",
handle_stbTimeServerIPAddressType,
stbTimeServerIPAddressType_oid,
OID_LENGTH(stbTimeServerIPAddressType_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbTimeServerIPAddress",
handle_stbTimeServerIPAddress,
stbTimeServerIPAddress_oid,
OID_LENGTH(stbTimeServerIPAddress_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbDHCPEnabled", handle_stbDHCPEnabled,
stbDHCPEnabled_oid,
OID_LENGTH(stbDHCPEnabled_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbTrapInitiator", handle_stbTrapInitiator,
stbTrapInitiator_oid,
OID_LENGTH(stbTrapInitiator_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbPVREnabled", handle_stbPVREnabled,
stbPVREnabled_oid,
OID_LENGTH(stbPVREnabled_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbPVRTotalStorageCapacity",
handle_stbPVRTotalStorageCapacity,
stbPVRTotalStorageCapacity_oid,
OID_LENGTH(stbPVRTotalStorageCapacity_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbPVRFreeStorageCapacity",
handle_stbPVRFreeStorageCapacity,
stbPVRFreeStorageCapacity_oid,
OID_LENGTH(stbPVRFreeStorageCapacity_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbBrowser", handle_stbBrowser,
stbBrowser_oid, OID_LENGTH(stbBrowser_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbBrowserVersion", handle_stbBrowserVersion,
stbBrowserVersion_oid,
OID_LENGTH(stbBrowserVersion_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbBrowserHomePage",
handle_stbBrowserHomePage,
stbBrowserHomePage_oid,
OID_LENGTH(stbBrowserHomePage_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbProxyIPAddressType",
handle_stbProxyIPAddressType,
stbProxyIPAddressType_oid,
OID_LENGTH(stbProxyIPAddressType_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbProxyIPAddress", handle_stbProxyIPAddress,
stbProxyIPAddress_oid,
OID_LENGTH(stbProxyIPAddress_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbProxyPort", handle_stbProxyPort,
stbProxyPort_oid,
OID_LENGTH(stbProxyPort_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbRAMCache", handle_stbRAMCache,
stbRAMCache_oid, OID_LENGTH(stbRAMCache_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbChannelWatchedEnabled",
handle_stbChannelWatchedEnabled,
stbChannelWatchedEnabled_oid,
OID_LENGTH(stbChannelWatchedEnabled_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbStreamingSessionQoSReportEnabled",
handle_stbStreamingSessionQoSReportEnabled,
stbStreamingSessionQoSReportEnabled_oid,
OID_LENGTH
(stbStreamingSessionQoSReportEnabled_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbLocalTime", handle_stbLocalTime,
stbLocalTime_oid,
OID_LENGTH(stbLocalTime_oid),
HANDLER_CAN_RONLY));
netsnmp_register_scalar(netsnmp_create_handler_registration
("stbEventMinTimeInterval",
handle_stbEventMinTimeInterval,
stbEventMinTimeInterval_oid,
OID_LENGTH(stbEventMinTimeInterval_oid),
HANDLER_CAN_RONLY));
}
int
handle_stbVendor(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbVendor");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbVendor from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbVendor\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbModel(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbModel");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbModel from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbModel is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbModel\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbSerialNumber(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbSerialNumber");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbSerialNumber from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbSerialNumber is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbSerialNumber\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbMACAddress(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbMACAddress");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbMACAddress from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbMACAddress is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbMACAddress\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbHWIdentification(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbHWIdentification");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbHWIdentification from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbHWIdentification is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbHWIdentification\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbSoftwareVersion(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbSoftwareVersion");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbSoftwareVersion from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbSoftwareVersion is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbSoftwareVersion\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbHWTechLevel(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbHWTechLevel");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbHWTechLevel from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbHWTechLevel is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbHWTechLevel\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbCurrentCPUUsage(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
int cpuuser=0;
cpuutil = cpu_stats();
total = (cpuutil.user + cpuutil.system + cpuutil.idle + cpuutil.iowait)/100.0;
intValue = cpuutil.user /total;
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of CurrentCPUUsage is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbCurrentCPUUsage\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbCurrentMemoryUsage(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
double totalram,freeram,usedram;
sysinfo(&si);
totalram = si.totalram / megabyte;
freeram = si.freeram /megabyte;
usedram = totalram - freeram;
intValue = usedram * 1024;
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of CurrentMemoryUsage is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbCurrentMemoryUsage\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbTotalMemory(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
sysinfo(&si);
// intValue = si.totalram / megabyte;
intValue = si.totalram / 1024;
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
sprintf(messageLog,"%s %d","Log: Value of Current Total Memory is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbTotalMemory\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbHostname(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbHostname");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbHostname from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbHostname is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbHostname\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbIPAddressType(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbIPAddressType");
if (intValue == 0)
{
Log("ERROR: Failed to read stbIPAddressType from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbIPAddressType is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbIPAddressType\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbIPAddress(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbIPAddress");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbIPAddress from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbIPAddress is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbIPAddress\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbNetMaskAddressType(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbNetMaskAddressType");
if (intValue == 0)
{
Log("ERROR: Failed to read stbNetMaskAddressType from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbNetMaskAddressType is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbNetMaskAddressType\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbNetMask(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbNetMask");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbNetMask from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbNetMask is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbNetMask\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbGatewayIPType(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbGatewayIPType");
if (intValue == 0)
{
Log("ERROR: Failed to read stbGatewayIPType from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbGatewayIPType is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbGatewayIPType\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbGatewayIP(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbGatewayIP");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbGatewayIP from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbGatewayIP is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbGatewayIP\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbDomainName(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbDomainName");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbDomainName from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbDomainName is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbDomainName\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbTimeServerIPAddressType(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbTimeServerIPAddressType");
if (intValue == 0)
{
Log("ERROR: Failed to read stbTimeServerIPAddressType from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbTimeServerIPAddressType is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbTimeServerIPAddressType\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbTimeServerIPAddress(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbTimeServerIPAddress");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbTimeServerIPAddress from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbTimeServerIPAddress is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbTimeServerIPAddress\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbDHCPEnabled(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbDHCPEnabled");
if (intValue == 0)
{
Log("ERROR: Failed to read stbDHCPEnabled from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbDHCPEnabled is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbDHCPEnabled\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbTrapInitiator(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbTrapInitiator");
if (intValue == 0)
{
Log("ERROR: Failed to read stbTrapInitiator from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbTrapInitiator is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbTrapInitiator\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbPVREnabled(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbPVREnabled");
if (intValue == 0)
{
Log("ERROR: Failed to read stbPVREnabled from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbPVREnabled is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbPVREnabled\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbPVRTotalStorageCapacity(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbPVRTotalStorageCapacity");
if (intValue == 0)
{
Log("ERROR: Failed to read stbPVRTotalStorageCapacity from conf File. " );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbPVRTotalStorageCapacity is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbPVRTotalStorageCapacity\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbPVRFreeStorageCapacity(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbPVRFreeStorageCapacity");
if (intValue == 0)
{
Log("ERROR: Failed to read stbPVRFreeStorageCapacity from conf File. " );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbPVRFreeStorageCapacity is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbPVRFreeStorageCapacity\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbBrowser(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbBrowser");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbBrowser from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbBrowser is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbBrowser\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbBrowserVersion(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbBrowserVersion");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbBrowserVersion from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbBrowserVersion is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbBrowserVersion\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbBrowserHomePage(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbBrowserHomePage");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbBrowserHomePage from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbBrowserHomePage is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbBrowserHomePage\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbProxyIPAddressType(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbProxyIPAddressType");
if (intValue == 0)
{
Log("ERROR: Failed to read stbProxyIPAddressType from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbProxyIPAddressType is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbProxyIPAddressType\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbProxyIPAddress(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
strValue = GetMibStrValue("stbProxyIPAddress");
validatescalar = strcmp(strValue,"INVALID");
if (validatescalar == 0)
{
Log("ERROR: Unable to read stbProxyIPAddress from conf file.");
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbProxyIPAddress is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbProxyIPAddress\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbProxyPort(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbProxyPort");
if (intValue == 0)
{
Log("ERROR: Failed to read stbProxyPort from conf File. " );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbProxyPort is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbProxyPort\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbRAMCache(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbRAMCache");
if (intValue == 0)
{
Log("ERROR: Failed to read stbRAMCache from conf File. " );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbRAMCache is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbRAMCache\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbChannelWatchedEnabled(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbChannelWatchedEnabled");
if (intValue == 0)
{
Log("ERROR: Failed to read stbChannelWatchedEnabled from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbChannelWatchedEnabled is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbChannelWatchedEnabled\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbStreamingSessionQoSReportEnabled(netsnmp_mib_handler *handler,
netsnmp_handler_registration
*reginfo,
netsnmp_agent_request_info
*reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbStreamingSessionQoSReportEnabled");
if (intValue == 0)
{
Log("ERROR: Failed to read stbStreamingSessionQoSReportEnabled from conf File." );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbStreamingSessionQoSReportEnabled is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbStreamingSessionQoSReportEnabled\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbLocalTime(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
//strValue = GetMibStrValue("stbLocalTime");
//validatescalar = strcmp(strValue,"INVALID");
strValue = getLocalTime();
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
(u_char *) strValue , strlen(strValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %s","Log: Value of stbLocalTime is sent as ",strValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_stbLocalTime\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
int
handle_stbEventMinTimeInterval(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* 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.
*/
intValue = GetMibIntValue("stbEventMinTimeInterval");
if (intValue == 0)
{
Log("ERROR: Failed to read stbEventMinTimeInterval from conf File. " );
}
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
(u_char *) & intValue , sizeof(intValue) );
// Log the Message
strcpy(messageLog,"");
sprintf(messageLog,"%s %d","Log: Value of stbEventMinTimeInterval is sent as ",intValue);
Log(messageLog);
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR,
"unknown mode (%d) in handle_stbEventMinTimeInterval\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}