UdpTransportWord文档格式.docx

上传人:b****6 文档编号:17977729 上传时间:2022-12-12 格式:DOCX 页数:20 大小:18.98KB
下载 相关 举报
UdpTransportWord文档格式.docx_第1页
第1页 / 共20页
UdpTransportWord文档格式.docx_第2页
第2页 / 共20页
UdpTransportWord文档格式.docx_第3页
第3页 / 共20页
UdpTransportWord文档格式.docx_第4页
第4页 / 共20页
UdpTransportWord文档格式.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

UdpTransportWord文档格式.docx

《UdpTransportWord文档格式.docx》由会员分享,可在线阅读,更多相关《UdpTransportWord文档格式.docx(20页珍藏版)》请在冰豆网上搜索。

UdpTransportWord文档格式.docx

protectedSocket_socket;

//Constructor.InitializesandbindstheSocketclass

//参数:

//useV6:

//SettotrueifyouwishtoinitializethetransportforIPv6

publicUdpTransport(booluseV6);

//Isclassbusy.Thispropertyistruewhenclassisservicinganotherrequest,

//falseifreadytoprocessanewrequest.

publicboolIsBusy{get;

}

//FlagusedtodetermineifclassisusingIPversion6(true)orIPversion

//4(false)

publicboolIsIPv6{get;

//Closenetworksocket

publicvoidClose();

//Disposeoftheclass.

publicvoidDispose();

//Initializeclasssocket

//ShouldsocketbeinitializedforIPv6(true)ofIPv4(false)

protectedvoidinitSocket(booluseV6);

//MakesyncrequestusingIP/UDPwithrequesttimeoutsandretries.

//peer:

//SNMPagentIPaddress

//port:

//SNMPagentportnumber

//buffer:

//Datatosendtotheagent

//bufferLength:

//Datalengthinthebuffer

//timeout:

//Timeoutinmilliseconds

//retries:

//Maximumnumberofretries.0=makeasinglerequestwithnoretryattempts

//返回结果:

//Bytearrayreturnedbytheagent.Nullonerror

//异常:

//SnmpSharpNet.SnmpException:

//Thrownonrequesttimedout.SnmpException.ErrorCodeissettoSnmpException.RequestTimedOut

//constant.

//ThrownwhenIPv4addressispassedtothev6socketorviceversa

publicbyte[]Request(IPAddresspeer,intport,byte[]buffer,intbufferLength,inttimeout,intretries);

}

SnmpVersion

//SNMPVersionnumberenumeration

publicenumSnmpVersion

//SNMPversion1

Ver1=0,

//SNMPversion2c

Ver2=1,

//SNMPversion3

Ver3=3,

Pdu

usingSystem.Collections;

usingSystem.Collections.Generic;

usingSystem.Reflection;

//SNMPProtocolDataUnit

//备注:

//SNMPPDUclassthatisthebasesforallSNMPrequestsandreplies.Itis

//capableofprocessingSNMPv1GET,GET-NEXT,REPLYandSNMPv2GET,GET-NEXT,

//GET-BULK,REPLY,V2TRAP,INFORMandREPORTPDUs.Pdupdu=newPdu();

pdu.Type

//=PduType.Get;

pdu.VbList.AddVb("

1.3.6.1.2.1.1.1.0"

);

1.3.6.1.2.1.1.2.0"

//Bydefault,PduclassinitializestheRequestId(uniqueidentifierofeach

//SNMPrequestmadebythemanager)witharandomvalue.Usercanforceanew,

//randomrequestidgenerationatthetimepacketisencodingbychangingRequestId

//to0.IfyouwishtosetaspecificRequestId,youcandoitthisway:

Pdu

//pdu=newPdu();

pdu.Type=PduType.GetNext;

pdu.RequestId=11;

//Seta

//customrequestidpdu.VbList.AddVb("

1.3.6.1.2.1.1"

Pdutypeswithspecial

//optionsarenotificationPDUs,V2TRAPandINFORM,andGet-Bulkrequests.

//Get-Bulkrequestisavailableinversion2cand3oftheSNMP.Twospecial

//optionscanbesetfortheserequests,NonRepeatersandMaxRepetitions.NonRepeaters

//isavaluetellingtheagenthowmanyOIDsintheVbListaretobetreated

//asasingleGetNextrequest.MaxRepeaterstellstheagenthowmanyvariable

//bindingstoreturninasinglePduforeachrequestedOid.

publicclassPdu:

AsnType,ICloneable,IEnumerable<

Vb>

IEnumerable

//Errorindexvalue.

//PointstotheVbsequencethatcausedtheerror.IfnotVbthecauseofthe

//error,orifthereisnoerror,thisvalueis0.

protectedInteger32_errorIndex;

//Errorstatusvalue.

//SeeSnmpSharpNet.SnmpConstantsclassfordefinitionoferrorvalues.Ifno

//errorisencountered,thisvalueissetto0.

protectedInteger32_errorStatus;

//Requestidvalue.

//Integer32valuethatuniquelyrepresentsthisrequest.Usedtomatchrequests

//andreplies.

protectedInteger32_requestId;

//SNMPv2trapsecondVbisthetrapobjectID.

//ThisvariableshouldbesettothetrapOIDandwillbeinsertedintothe

//encodedpacket.

protectedOid_trapObjectID;

//SNMPv2trapfirstVbisthetraptimestamp.TocreateanSNMPv2TRAPpacket,

//setthetimestampvalueinthisvariable

protectedTimeTicks_trapTimeStamp;

//Variablebindingcollection

protectedVbCollection_vbs;

//Constructor.

//InitializesallvaluestoNULLandPDUtypetoGET

publicPdu();

//Constructor

//pdu:

//Pduclasstouseassourceofinformationtoinitilizethisclass.

//Initializeclassfromthepassedpduclass.

publicPdu(Pdupdu);

//pduType:

//Pdutype.ForavailablevaluesseeSnmpSharpNet.PduType

//CreatePduofspecifictype.

publicPdu(PduTypepduType);

//vbs:

//VarBindlisttoinitializetheinternalVbListto.

//SetstheVarBindlisttotheClonecopyofthesuppliedlist.

publicPdu(VbCollectionvbs);

//VarBindlist

//type:

//PDUtype

//requestId:

//Requestid

//InitializesPDUclasswithsuppliedvalues.

publicPdu(VbCollectionvbs,PduTypetype,intrequestId);

//ErrorIndexPduvalue

//SnmpSharpNet.SnmpInvalidPduTypeException:

//ThrownwhenpropertyisaccessforGetBulkPdu

//ErrorindexpointstotheVbListentrythatErrorStatuserrorcoderefers

//to.ValidforallPdutypesexceptGetBulkrequests.

publicintErrorIndex{get;

set;

//ErrorStatusPduvalue

//StoreserrorstatusreturnedbytheSNMPagent.Value0representsnoerror.

//ValidforallPdutypesexceptGetBulkrequests.

publicintErrorStatus{get;

//TellsSNMPAgenthowmanyVBstoincludeinasinglerequest.Onlyvalid

//onGETBULKrequests.

//ThrownwhenPDUtypeisnotGET-BULK

publicintMaxRepetitions{get;

//Get/SetGET-BULKNonRepeatersvalue

//NonrepeatersvariabletellstheSNMPAgenthowmanyGETNEXTlikevariables

//toretrieve(singleVbreturnedperrequest)beforeMaxRepetitionsvalue

//takesaffect.Ifyouwishtoretrieveasmanyvaluesasyoucaninasingle

//request,setthisvalueto0.

publicintNonRepeaters{get;

//SNMPpacketrequestidthatissenttotheSNMPagent.SETthisvaluebefore

//makingSNMPrequests.

publicintRequestId{get;

//GetTRAPObjectIDclassfromSNMPv2TRAPandINFORMPDUs

//ThrownwhenpropertyisaccessforaPduofatypeotherthenV2TRAP,INFORM

//orRESPONSE

publicOidTrapObjectID{get;

//GetTRAPTimeStampclassfromSNMPv2TRAPandINFORMPDUs

publicTimeTicksTrapSysUpTime{get;

//GetorSETthePDUtype.AvailabletypesareGET,GETNEXT,SET,GETBULK.

//PDUtypesaredefinedinPduclass.

publicPduTypeType{get;

//ReturnthenumberofVBentriesintheVarBindlist

publicintVbCount{get;

publicVbCollectionVbList{get;

//IndexedaccesstoVarBindcollectionofthePdu.

//index:

//IndexpositionoftheVarBindentry

//VarBindentryatthespecifiedindex

//System.IndexOutOfRangeException:

//Thrownwhenindexisoutsidetheboundsofthecollection

publicVbthis[intindex]{get;

//AccessvariablebindingsusingVbOidvalue

//oid:

//RequiredOidvalue

//VariablebindingwiththeOidmatchingtheparameter,otherwisenull

publicVbthis[Oidoid]{get;

//AccessvariablebindingsusingVbOidvalueinthestringformat

//Oidvalueinstringrepresentation

publicVbthis[stringoid]{get;

//Clonethisobject

//CopyofthisobjectcastastypeSystem.Object

publicoverrideobjectClone();

//DecodeBERencodedPdu

//BERencodedbuffer

//offset:

//Theoffsetbytetobegindecoding

//Bufferpositionafterthedecodedvalue

//System.OverflowException:

//Thrownwhenheaderpointstomor

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 生产经营管理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1