mibtcp.c
来自「VxWorks操作系统下的SNMP协议以及MIB协议的实现源码,并且实现了HP标」· C语言 代码 · 共 82 行
C
82 行
#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"
#include "Mib2Func.h"
//0x2b,6,1,2,1,6,x
int TcpGetVar(VARLIST *pVar)
{
U32 u32Index;
U32 u32GetFirstIndex;
U32 u32GetIndex;
MibFuncPara para;
switch(pVar->oid[6])
{
case 1://TcpRtoAlgorithm:
case 2://TcpRtoMin
case 3://TcpRtoMax
case 4://TcpMaxConn
case 5://TcpActiveOpens
case 6://TcpPassiveOpens
case 7://TcpAttemptFails
case 8://TcpEstabResets
case 9://TcpCurrEstab
case 10://TcpInSegs
case 11://TcpOutSegs
case 12://TcpRetransSegs
case 14://TcpInErrs
case 15://TcpOutRsts
u32Index = pVar->oid[6];
u32GetFirstIndex = g_MFIndex.TCP.Get.RtoAlgorithm_____ps32GetValue;
u32GetIndex = u32GetFirstIndex + u32Index - 1;
pVar->type = TAG_INTERGER;
break;
case 13://TcpConnTable:
if(pVar->oid[7] == 1)
{
u32Index = pVar->oid[8];
u32GetFirstIndex = g_MFIndex.TCP.Get.ConnState________ps32GetValue;
u32GetIndex = u32GetFirstIndex + u32Index - 1;
switch(pVar->oid[8])
{
case 1://TcpConnState
case 3://TcpConnLocalPort
case 5://TcpConnRemPort
pVar->type = TAG_INTERGER;
break;
case 2://TcpConnLocalAddress
case 4://TcpConnRemAddress
pVar->type = TAG_OCTET;
break;
default:
return ERROR;
}
}
break;
default:
return ERROR;
}
if (OK != Mib2GetOne(u32GetIndex, ¶))
{
return ERROR;
}
return Mib2Get(pVar, ¶);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?