The SNMPTrapMgr class provides a UDP-based listening point for SNMP traps.
ipworkssnmp_snmptrapmgr_open(); ipworkssnmp_snmptrapmgr_close($res); ipworkssnmp_snmptrapmgr_register_callback($res, $id, $function); ipworkssnmp_snmptrapmgr_get_last_error($res); ipworkssnmp_snmptrapmgr_get_last_error_code($res); ipworkssnmp_snmptrapmgr_set($res, $id, $index, $value); ipworkssnmp_snmptrapmgr_get($res, $id, $index); ipworkssnmp_snmptrapmgr_do_addengine($res, $engineid, $engineboots, $enginetime); ipworkssnmp_snmptrapmgr_do_adduser($res, $user, $engineid, $authenticationprotocol, $authenticationpassword, $encryptionalgorithm, $encryptionpassword); ipworkssnmp_snmptrapmgr_do_clearcache($res); ipworkssnmp_snmptrapmgr_do_config($res, $configurationstring); ipworkssnmp_snmptrapmgr_do_doevents($res); ipworkssnmp_snmptrapmgr_do_hashpasswords($res); ipworkssnmp_snmptrapmgr_do_removeengine($res, $engineid); ipworkssnmp_snmptrapmgr_do_removeuser($res, $user, $engineid); ipworkssnmp_snmptrapmgr_do_reset($res); ipworkssnmp_snmptrapmgr_do_showcache($res); ipworkssnmp_snmptrapmgr_do_value($res, $oid);
The SNMPTrapMgr class provides a UDP-based listening point for SNMP traps and informs as specified by the SNMP RFCs. The class supports v1, v2c, and v3 traps.
The class provides both encoding/decoding and transport capabilities, making the task of developing a custom SNMP Trap manager as simple as setting a few key properties and handling a few events. SNMP data, such as for instance SNMP object id-s (OID-s) are exchanged as text strings, thus further simplifying the task of handling them.
The class is activated/deactivated by setting the Active property. This property enables or disables sending and receiving.
SNMP OIDs, types, and values are provided in the Objects collection of SNMP objects for both sent and received packets.
SNMPv3 USM security passwords are requested through the GetUserPassword event, and event parameters such as User and SecurityLevel provide information about the security attributes of received requests, and enable granular decision capability about what to provide and what not to provide.
The AddUser, RemoveUser, ShowCache, ClearCache, AddEngine, and RemoveEngine methods are used to manage an internal authentication cache. This internal cache can be used as an alternative to the GetUserPassword event, automatically checking the cache against the security parameters provided in the request signature.
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
|AcceptData||Enables or disables data reception.|
|Active||Enables or disables sending and receiving of SNMP packets.|
|LocalEngineId||The Engine Id (for SNMPv3).|
|LocalHost||The name of the local host or user-assigned IP interface through which connections are initiated or accepted.|
|LocalPort||The port in the local host where the class is bound to.|
|ObjCount||The number of records in the Obj arrays.|
|ObjType||The current object's type.|
|ObjId||The current object's id which is encoded as a string of numbers separated by periods.|
|ObjTypeString||A string representation of the current object's ObjectType .|
|ObjValue||The current object's value.|
|RequestId||The request-id to mark outgoing packets with.|
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
|AddEngine||Adds the engine specified by EngineId to the internal authentication cache.|
|AddUser||Adds a user for the engine specified by EngineId to the internal authentication cache.|
|ClearCache||Clears the internal authentication database.|
|Config||Sets or retrieves a configuration setting.|
|DoEvents||Processes events from the internal message queue.|
|HashPasswords||Hashes all passwords in the cache.|
|RemoveEngine||Removes the engine specified by EngineId from the internal authentication cache.|
|RemoveUser||Removes the user specified by User of the engine specified by EngineId from the internal authentication cache.|
|Reset||Clears the object arrays.|
|ShowCache||Lists all entries in the internal user and engine database.|
|Value||Returns the value corresponding to an OID.|
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
|BadPacket||Fired for erroneous and/or malformed messages.|
|CacheEntry||Shows engines and users in the internal cache.|
|CheckEngine||Fired to check engine parameters (timeliness, etc.).|
|DiscoveryRequest||Fired when an SNMPv3 discovery packet is received.|
|Error||Information about errors during data delivery.|
|GetUserPassword||Retrieves a password associated with a user.|
|GetUserSecurityLevel||Sets the security level for an incoming packet.|
|HashPassword||Fired before and after a password is hashed.|
|InformRequest||Fired when an InformRequest packet is received.|
|PacketTrace||Fired for every packet sent or received.|
|Trap||Fired when a SNMP trap packet is received.|
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
|AuthenticationKey||The key to use for authentication.|
|CompatibilityMode||Whether to operate the class in a specific compatibility mode.|
|ContextEngineId||Sets the context engine id of the SNMP entity.|
|ContextName||Sets the context name of the SNMP entity.|
|EncryptionKey||The key to use for encryption.|
|ForceLocalPort||Forces the class to bind to a specific port.|
|ShowCacheForUser||Shows the cache entry for a single user.|
|SourceAddress||The source address of the received packet.|
|SourcePort||The source port of the received packet.|
|TimeWindow||The time window used for SNMPv3 timeliness checking (authentication).|
|CaptureIPPacketInfo||Used to capture the packet information.|
|DestinationAddress||Used to get the destination address from the packet information.|
|DontFragment||Used to set the Don't Fragment flag of outgoing packets.|
|LocalHost||The name of the local host through which connections are initiated or accepted.|
|LocalPort||The port in the local host where the class binds.|
|MaxPacketSize||The maximum length of the packets that can be received.|
|QOSDSCPValue||Used to specify an arbitrary QOS/DSCP setting (optional).|
|QOSTrafficType||Used to specify QOS/DSCP settings (optional).|
|ShareLocalPort||If set to True, allows more than one instance of the class to be active on the same local port.|
|SourceIPAddress||Used to set the source IP address used when sending a packet.|
|SourceMacAddress||Used to set the source MAC address used when sending a packet.|
|UseConnection||Determines whether to use a connected socket.|
|UseIPv6||Whether or not to use IPv6.|
|AbsoluteTimeout||Determines whether timeouts are inactivity timeouts or absolute timeouts.|
|FirewallData||Used to send extra data to the firewall.|
|InBufferSize||The size in bytes of the incoming queue of the socket.|
|OutBufferSize||The size in bytes of the outgoing queue of the socket.|
|BuildInfo||Information about the product's build.|
|CodePage||The system code page used for Unicode to Multibyte translations.|
|LicenseInfo||Information about the current license.|
|ProcessIdleEvents||Whether the class uses its internal event loop to process events when the main thread is idle.|
|SelectWaitMillis||The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.|
|UseInternalSecurityAPI||Tells the class whether or not to use the system security libraries or an internal implementation.|