📄 mibprn.c
字号:
#include "VxWorks.h"
#include "sockLib.h"
#include "inetLib.h"
#include "taskLib.h"
#include "stdioLib.h"
#include "strLib.h"
#include "ioLib.h"
#include "fioLib.h"
#include "snmp.h"
int PrinterGetVar(VARLIST *vartemp)
{
long temp;
char *buf;
int cbNeeded,cbUsed;
switch(vartemp->oid[6])
{ //{0x2b.6.1.2.1.43.X}
case 5://prtgeneral
{
if(vartemp->oid[7] == 1 && vartemp->oid[8] == 1)//prtGeneralTable
{ //(0x2b.6.1.2.1.43.5.1.1.x.0)
switch(vartemp->oid[9])
{
case 1://prtGeneralConfigChanges
case 2://prtGeneralCurrentLocalization
case 3://prtGeneralReset
case 6://prtInputDefaultIndex
case 7://prtOutputDefaultIndex
case 8://prtMarkerDefaultIndex
case 9://prtMediaPathDefaultIndex
case 10://prtConsoleLocalization
case 11://prtConsoleNumberOfDisplayLines
case 12://prtConsoleNumberOfDisplayChars
case 13://prtConsoleDisable
if(ERROR == get_tempint(&temp))
return ERROR;
vartemp->type = TAG_INTERGER;
break;
case 4://prtGeneralCurrentOperator
case 5://prtGeneralServicePerson
default:
return ERROR;
}
}
//if([7]==1&&[8]==2)prtStorageRefTable
//if([7]==1&&[8]==3)prtDeviceRefTable
else
return ERROR;
break;
}//prtGeneral包括三个分支
case 6://prtcover
if(vartemp->oid[7] == 1 && vartemp->oid[8] == 1)
{
switch(vartemp->oid[9])
{
case 1://prtCoverIndex
case 3://prtCoverStatus
if(ERROR == get_tempint(&temp))
return ERROR;
vartemp->type = TAG_INTERGER;
break;
case 2://prtCoverDescription
default:
return ERROR;
}
}
else
return ERROR;
break;
case 7://prtlocalization
if(vartemp->oid[7] == 1 && vartemp->oid[8] == 1)
{
switch(vartemp->oid[9])
{
case 1://prtLocalizationIndex
case 4://prtLocalizationCharacterSet
if(ERROR == get_tempint(&temp))
return ERROR;
vartemp->type = TAG_INTERGER;
break;
case 2://prtLocalizationLanguage
case 3://prtLocalizationCountry
cbNeeded = 0;
if(3 == get_tempstring(NULL,&cbNeeded,&cbUsed))
buf = snmpMalloc(cbNeeded);
if(buf != NULL)
if(ERROR == get_tempstring(buf,&cbNeeded,&cbUsed))
{
snmpFree(buf);
return ERROR;
}
vartemp->type = TAG_OCTET;
vartemp->value_len = cbUsed;
vartemp->value = buf;
return OK;
default:
return ERROR;
}
}
else
return ERROR;
break;
case 8://prtinput
if(vartemp->oid[7] == 1 && vartemp->oid[8] == 1)
{
switch(vartemp->oid[9])
{
case 1://prtInputIndex
case 2://prtInputType
case 3://prtInputDimUnit
case 4://prtInputMediaDimFeedDirDeclared
case 5://prtInputMediaDimXFeedDirDeclared
case 6://prtInputMediaDimFeedDirChosen
case 7://prtInputMediaDimXFeedDirChosen
case 8://prtInputCapacityUnit
case 9://prtInputMaxCapacity
case 10://prtInputCurrentLevel
case 11://prtInputStatus
case 19://prtInputSecurity
case 20://prtInputMediaWeight
case 23://prtInputMediaFormParts
if(ERROR == get_tempint(&temp))
return ERROR;
vartemp->type = TAG_INTERGER;
break;
case 12://prtInputMediaName
case 13://prtInputName
case 14://prtInputVendorName
case 15://prtInputModel
case 16://prtInputVersion
case 17://prtInputSerialNumber
case 18://prtInputDescription
case 21://prtInputMediaType
case 22://prtInputMediaColor
cbNeeded = 0;
if(3 == get_tempstring(NULL,&cbNeeded,&cbUsed))
buf = snmpMalloc(cbNeeded);
if(buf != NULL)
if(ERROR == get_tempstring(buf,&cbNeeded,&cbUsed))
{
snmpFree(buf);
return ERROR;
}
vartemp->type = TAG_OCTET;
vartemp->value_len = cbUsed;
vartemp->value = buf;
return OK;
default:
return ERROR;
}
}
else
return ERROR;
break;
case 9://prtoutput
if(vartemp->oid[7] == 1 && vartemp->oid[8] == 1)
{
switch(vartemp->oid[9])
{
case 1://prtOutputIndex
case 2://prtOutputType
case 3://prtOutputCapacityUnit
case 4://prtOutputMaxCapacity
case 5://prtOutputRemainingCapacity
case 6://prtOutputStatus
case 13://prtOutputSecurity
case 14://prtOutputDimUnit
case 15://prtOutputMaxDimFeedDir
case 16://prtOutputMaxDimXFeedDir
case 17://prtOutputMinDimFeedDir
case 18://prtOutputMinDimXFeedDir
case 19://prtOutputStackingOrder
case 20://prtOutputPageDeliveryOrientation
case 21://prtOutputBursting
case 22://prtOutputDecollating
case 23://prtOutputPageCollated
case 24://prtOutputOffsetStacking
if(ERROR == get_tempint(&temp))
return ERROR;
vartemp->type = TAG_INTERGER;
break;
case 7://prtOutputName
case 8://prtOutputVendorName
case 9://prtOutputModel
case 10://prtOutputVersion
case 11://prtOutputSerialNumber
case 12://prtOutputDescription
cbNeeded = 0;
if(3 == get_tempstring(NULL,&cbNeeded,&cbUsed))
buf = snmpMalloc(cbNeeded);
if(buf != NULL)
if(ERROR == get_tempstring(buf,&cbNeeded,&cbUsed))
{
snmpFree(buf);
return ERROR;
}
vartemp->type = TAG_OCTET;
vartemp->value_len = cbUsed;
vartemp->value = buf;
return OK;
default:
return ERROR;
}
}
else
return ERROR;
break;
case 10://PRTMARKER:
case 11://PRTMARKERSUPPLIES:
case 12://PRTMARKERCOLORANT:
case 13://PRTMEDIAPATH:
case 14://PRTCHANNEL:
case 15://PRTINTERPRETER:
case 16://PRTCONSOLEDISPLAYBUFFER:
case 17://PRTCONSOLELIGHTS:
case 18://PRTALERT:
case 2://PRTMIBCONFORMANCE:
default:
return ERROR;
}
vartemp->value_len = getLongSize(temp);
temp = (temp << ((4 - vartemp->value_len)<<3));
vartemp->value = snmpMalloc(vartemp->value_len);
memcpy(vartemp->value,&temp,vartemp->value_len);
return OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -