SNMPTCPAgent Class
Properties Methods Events Configuration Settings Errors
The SNMPTCPAgent class is used to implement TCP-based SNMP Agent Applications.
Syntax
IPWorksSNMPSNMPTCPAgent
IPWorksSNMPSNMPTCPAgentSwift
Remarks
The SNMPTCPAgent class implements a TCP-based standard SNMP Agent as specified in the SNMP RFCs. The class supports SNMP v1, v2c, and v3.
The class provides both encoding/decoding and transport capabilities, making the task of developing a custom SNMP agent as simple as setting a few key properties and handling a few events. SNMP data such as 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.
The class operates asynchronously. Requests are received through events such as GetRequest, GetBulkRequest, GetNextRequest, etc. and the corresponding responses are automatically sent when the events return. Traps are sent through the SendTrap method.
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 SendSecureTrap method is used to send authenticated (secure) SNMPv3 traps.
The AddUser, RemoveUser, ShowCache, and ClearCache 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.
SNMP OIDs, types, and values are provided in the Objects collection of SNMP objects for both sent and received packets.
Other packet information is provided through corresponding event parameters, such as Community, or RequestId.
Property List
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 of the SNMP Agent. |
- 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 listens. |
- objCount | The number of records in the Obj arrays. |
- objType:(int)objIndex | The current object's type. |
- objId:(int)objIndex | The current object's id which is encoded as a string of numbers separated by periods. |
- objTypeString:(int)objIndex | A string representation of the current object's ObjectType . |
- objValue:(int)objIndex | The current object's value. |
- requestId | The request-id to mark outgoing packets with. |
- SNMPVersion | Version of SNMP used for outgoing requests (traps). |
- SSLAcceptServerCertEncoded | The certificate (PEM/base64 encoded). |
- SSLAuthenticateClients | If true, the server asks the client(s) for a certificate. |
- SSLCertEncoded | The certificate (PEM/base64 encoded). |
- SSLCertStore | The name of the certificate store for the client certificate. |
- SSLCertStorePassword | If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store. |
- SSLCertStoreType | The type of certificate store for this certificate. |
- SSLCertSubject | The subject of the certificate used for client authentication. |
- SSLEnabled | Whether TLS/SSL is enabled. |
- SSLServerCertEncoded | The certificate (PEM/base64 encoded). |
- sysUpTime | Time passed since the agent was initialized (in hundredths of a second). |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
- addUser | Adds a user 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. |
- removeUser | Removes the user specified by User from the internal authentication cache. |
- reset | Clears the object arrays. |
- sendResponse | Sends a response packet to a Get, Get-Next, Get-Bulk, or Set request. |
- sendSecureResponse | Sends an authenticated and/or encrypted SNMPv3 response. |
- sendSecureTrap | Sends an authenticated and/or encrypted SNMPv3 trap. |
- sendTrap | Sends an SNMP Trap. |
- showCache | Lists all entries in the internal user authentication cache. |
- value | Returns the value corresponding to an OID. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
- onBadPacket | Fired for erroneous and/or malformed messages. |
- onCacheEntry | Shows in the internal cache. |
- onConnected | Fired immediately after a connection completes (or fails). |
- onConnectionStatus | TBD. |
- onDisconnected | TBD. |
- onDiscoveryRequest | Fired when an SNMPv3 discovery packet is received. |
- onError | Information about errors during data delivery. |
- onGetBulkRequest | Fired when a GetBulkRequest packet is received. |
- onGetNextRequest | Fired when a GetNextRequest packet is received. |
- onGetRequest | Fired when a GetRequest packet is received. |
- onGetUserPassword | Retrieves a password associated with a user. |
- onGetUserSecurityLevel | Sets the security level for an incoming packet. |
- onHashPassword | Fired before and after a password is hashed. |
- onPacketTrace | Fired for every packet sent or received. |
- onReadyToSend | Fired when the class is ready to send data. |
- onReport | Fired when a Report packet is received. |
- onSetRequest | Fired when a SetRequest packet is received. |
- onSSLClientAuthentication | Fired when the client presents its credentials to the server. |
- onSSLServerAuthentication | Fires when connecting to the server. |
- onSSLStatus | Shows the progress of the secure connection. |
Configuration Settings
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. |
DecryptLogPackets | Whether to decrypt logged packets. |
EncryptionKey | The key to use for encryption. |
ForceLocalPort | Forces the class to bind to a specific port. |
MsgMaxSize | The maximum supported message size. |
RespondFromDestIP | Whether to respond from the IP address that the request was sent to. |
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). |
TrapAgentAddress | The address of the object generating the trap. |
TrapCommunity | The value of the Community parameter for SNMP traps. |
TrapEnterprise | The type of the object generating the trap. |
TrapPort | The port where SNMP traps are sent. |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the class whether or not to automatically detect and use firewall system settings, if available. |
FirewallHost | Name or IP address of firewall (optional). |
FirewallPassword | Password to be used if authentication is to be used when connecting through the firewall. |
FirewallPort | The TCP port for the FirewallHost;. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
Linger | When set to True, connections are terminated gracefully. |
LingerTime | Time in seconds to have the connection linger. |
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. |
MaxLineLength | The maximum amount of data to accumulate when no EOL is found. |
MaxTransferRate | The transfer rate limit in bytes per second. |
ProxyExceptionsList | A semicolon separated list of hosts and IPs to bypass when using a proxy. |
TCPKeepAlive | Determines whether or not the keep alive socket option is enabled. |
TcpNoDelay | Whether or not to delay when sending packets. |
UseIPv6 | Whether to use IPv6. |
LogSSLPackets | Controls whether SSL packets are logged when using the internal security API. |
OpenSSLCADir | The path to a directory containing CA certificates. |
OpenSSLCAFile | Name of the file containing the list of CA's trusted by your application. |
OpenSSLCipherList | A string that controls the ciphers to be used by SSL. |
OpenSSLPrngSeedData | The data to seed the pseudo random number generator (PRNG). |
ReuseSSLSession | Determines if the SSL session is reused. |
SSLCACertFilePaths | The paths to CA certificate files on Unix/Linux. |
SSLCACerts | A newline separated list of CA certificate to use during SSL client authentication. |
SSLCheckCRL | Whether to check the Certificate Revocation List for the server certificate. |
SSLCipherStrength | The minimum cipher strength used for bulk encryption. |
SSLEnabledCipherSuites | The cipher suite to be used in an SSL negotiation. |
SSLEnabledProtocols | Used to enable/disable the supported security protocols. |
SSLEnableRenegotiation | Whether the renegotiation_info SSL extension is supported. |
SSLIncludeCertChain | Whether the entire certificate chain is included in the SSLServerAuthentication event. |
SSLNegotiatedCipher | Returns the negotiated ciphersuite. |
SSLNegotiatedCipherStrength | Returns the negotiated ciphersuite strength. |
SSLNegotiatedCipherSuite | Returns the negotiated ciphersuite. |
SSLNegotiatedKeyExchange | Returns the negotiated key exchange algorithm. |
SSLNegotiatedKeyExchangeStrength | Returns the negotiated key exchange algorithm strength. |
SSLNegotiatedVersion | Returns the negotiated protocol version. |
SSLProvider | The name of the security provider to use. |
SSLSecurityFlags | Flags that control certificate verification. |
SSLServerCACerts | A newline separated list of CA certificate to use during SSL server certificate validation. |
TLS12SignatureAlgorithms | Defines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True. |
TLS12SupportedGroups | The supported groups for ECC. |
TLS13KeyShareGroups | The groups for which to pregenerate key shares. |
TLS13SignatureAlgorithms | The allowed certificate signature algorithms. |
TLS13SupportedGroups | The supported groups for (EC)DHE key exchange. |
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. |