using System; using ln.snmp.types; using System.Net; using System.Collections.Generic; namespace ln.snmp.endpoint { public class SnmpV2Endpoint : SnmpV1Endpoint { public override SnmpVersion SnmpVersion => SnmpVersion.V2c; public SnmpV2Endpoint(SNMPEngine snmpEngine, IPEndPoint remoteEndpoint) : base(snmpEngine, remoteEndpoint) { CommunityString = "public"; } public SnmpV2Endpoint(SNMPEngine snmpEngine, IPEndPoint remoteEndpoint, OctetString communityString) : base(snmpEngine, remoteEndpoint, communityString) { } public SnmpV2Endpoint(SNMPEngine snmpEngine, IPEndPoint remoteEndpoint, String communityString) : base(snmpEngine, remoteEndpoint, communityString) { } public override PDU DispatchRequest(PDU pdu) { SnmpV2Message request = new SnmpV2Message(); request.snmpCommunity = CommunityString; request.snmpPDU = pdu; SnmpV2Message response = EnqueueRequest(request) as SnmpV2Message; return response.snmpPDU; } } }