public SendV3Trap ( IpAddress receiver, int receiverPort, byte engineId, Int32 senderEngineBoots, Int32 senderEngineTime, string senderUserName, UInt32 senderUpTime, Oid trapObjectID, VbCollection varList ) : void | ||
receiver | IpAddress | Trap receiver IP address |
receiverPort | int | Trap receiver UDP port number |
engineId | byte | Sender SNMP engineId |
senderEngineBoots | Int32 | Sender SNMP engine boots |
senderEngineTime | Int32 | Sender SNMP engine time |
senderUserName | string | Security (user) name |
senderUpTime | UInt32 | Sender upTime |
trapObjectID | Oid | Trap object ID |
varList | VbCollection | Variable binding list |
리턴 | void |
/// <summary> /// Send SNMP Trap notification /// </summary> /// <remarks> /// Helper function to allow for seamless sending of SNMP notifications for all protocol versions. /// /// packet parameter should be appropriately formatted SNMP notification in SnmpV1TrapPacket, /// SnmpV2Packet or SnmpV3Packet class cast as SnmpPacket class. /// /// Function will determine which version of the notification is to be used by checking the type /// of the packet parameter and call appropriate TrapAgent member function to send it. /// </remarks> /// <param name="packet">SNMP trap packet</param> /// <param name="peer">Manager (receiver) IP address</param> /// <param name="port">Manager (receiver) UDP port number</param> public static void SendTrap(SnmpPacket packet, IpAddress peer, int port) { TrapAgent agent = new TrapAgent(); if (packet is SnmpV1TrapPacket) { agent.SendV1Trap((SnmpV1TrapPacket)packet, peer, port); } else if (packet is SnmpV2Packet) { agent.SendV2Trap((SnmpV2Packet)packet, peer, port); } else if (packet is SnmpV3Packet) { agent.SendV3Trap((SnmpV3Packet)packet, peer, port); } else { throw new SnmpException("Invalid SNMP packet type."); } }
/// <summary> /// Send SNMP Trap notification /// </summary> /// <remarks> /// Helper function to allow for seamless sending of SNMP notifications for all protocol versions. /// /// packet parameter should be appropriately formatted SNMP notification in SnmpV1TrapPacket, /// SnmpV2Packet or SnmpV3Packet class cast as SnmpPacket class. /// /// Function will determine which version of the notification is to be used by checking the type /// of the packet parameter and call appropriate TrapAgent member function to send it. /// </remarks> /// <param name="packet">SNMP trap packet</param> /// <param name="peer">Manager (receiver) IP address</param> /// <param name="port">Manager (receiver) UDP port number</param> public static void SendTrap(SnmpPacket packet, IpAddress peer, int port) { TrapAgent agent = new TrapAgent(); if (packet is SnmpV1TrapPacket) agent.SendV1Trap((SnmpV1TrapPacket)packet, peer, port); else if (packet is SnmpV2Packet) agent.SendV2Trap((SnmpV2Packet)packet, peer, port); else if (packet is SnmpV3Packet) agent.SendV3Trap((SnmpV3Packet)packet, peer, port); else throw new SnmpException("Invalid SNMP packet type."); }