UdpTransportWord文档格式.docx
- 文档编号:17977729
- 上传时间:2022-12-12
- 格式:DOCX
- 页数:20
- 大小:18.98KB
UdpTransportWord文档格式.docx
《UdpTransportWord文档格式.docx》由会员分享,可在线阅读,更多相关《UdpTransportWord文档格式.docx(20页珍藏版)》请在冰豆网上搜索。
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
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- UdpTransport
![提示](https://static.bdocx.com/images/bang_tan.gif)