I am creating and sending an SNMP packet manually using pcap.net, the reason for this is that I need to be able to change the sender details of the SNMP packet to one other than the application hosts NIC and which wouldn't be possible with the library unless I somehow intercepted the outgoing packet and changed the details on the fly. My issue is that I can send out my packet and receive it using pcap.net as well but I need a way to decode the BER encoded packet, can I directly decode a received packet without using the rest of the library? If so what function could I call so I can read the oid values directly from a recieved packet?
When you first asked this question I read it but could not provide much insight.
What #SNMP offers are the two set of functions below,
MessageFactory.ParseMessage
, a few functions that parse raw bytes to ISnmpMessage
.ISnmpMessage.ToBytes
, a method that generates raw bytes.If you can write adapters to bridge #SNMP and Pcap.NET, you should be able to achieve what you want.
Next time, make sure you avoid C# tag, as yes you might be down voted due to that.
References:
http://help.sharpsnmp.com/html/M_Lextm_SharpSnmpLib_Messaging_ISnmpMessage_ToBytes.htm