InformRequest Event

Fired when an InformRequest packet is received.

Syntax

ANSI (Cross Platform)
virtual int FireInformRequest(SNMPTrapMgrInformRequestEventParams *e);
typedef struct {
int RequestId;
int SNMPVersion;
const char *Community;
const char *User;
int SecurityLevel;
const char *SourceAddress;
int SourcePort;
int ErrorIndex;
int ErrorStatus;
const char *ErrorDescription;
int Respond; int reserved; } SNMPTrapMgrInformRequestEventParams; Unicode (Windows) virtual INT FireInformRequest(SNMPTrapMgrInformRequestEventParams *e);
typedef struct {
INT RequestId;
INT SNMPVersion;
LPCWSTR Community;
LPCWSTR User;
INT SecurityLevel;
LPCWSTR SourceAddress;
INT SourcePort;
INT ErrorIndex;
INT ErrorStatus;
LPCWSTR ErrorDescription;
BOOL Respond; INT reserved; } SNMPTrapMgrInformRequestEventParams;
- (void)onInformRequest:(int)requestId :(int)SNMPVersion :(NSString*)community :(NSString*)user :(int)securityLevel :(NSString*)sourceAddress :(int)sourcePort :(int*)errorIndex :(int*)errorStatus :(NSString*)errorDescription :(int*)respond;
#define EID_SNMPTRAPMGR_INFORMREQUEST 9

virtual INT IPWORKSSNMP_CALL FireInformRequest(INT &iRequestId, INT &iSNMPVersion, LPSTR &lpszCommunity, LPSTR &lpszUser, INT &iSecurityLevel, LPSTR &lpszSourceAddress, INT &iSourcePort, INT &iErrorIndex, INT &iErrorStatus, LPSTR &lpszErrorDescription, BOOL &bRespond);

Remarks

For SNMPv3, the User parameter shows the user that was supplied with the packet. This parameter MUST be used together with the SecurityLevel parameter which shows the level of security in the message.

The SecurityLevel parameter shows whether the request has been authenticated. If SecurityLevel is 0, the request has NOT been authenticated (i.e. the packet signature has not been verified). For an authenticated, non encrypted request, SecurityLevel is 1. For an authenticated and encrypted request, SecurityLevel is 2.

The user in an InformRequest packet (SNMPv3) must be a valid user in the internal authentication cache (see the AddUser method and the CheckEngine event for more information). If not, the request is rejected, and a BadPacket event is fired before InformRequest is fired.

The list of variables in the SNMP packet, including optional values and types, is provided through the Objects collection. Each object is of type snmpobject. This type describes the ObjId, ObjType, and ObjValue of each SNMP object. These variables must be copied to another location before the event has completed executing, or they may be overridden by other events.

The SourceAddress and SourcePort parameters show the address and port of the sender as reported by the TCP/IP stack.

The MessageId parameter identifies the received request.

For SNMPv3, the User parameter shows the user that was supplied with the packet. This parameter MUST be used together with the SecurityLevel parameter which shows the level of security in the message.

The SecurityLevel parameter shows whether the request has been authenticated. If SecurityLevel is 0, the request has NOT been authenticated (i.e. the packet signature has not been verified). For an authenticated, non encrypted request, SecurityLevel is 1. For an authenticated and encrypted request, SecurityLevel is 2.

To send a response, the Respond parameter must be set to true. By default, this value is false, which means no response will be sent. The ErrorStatus parameter may also be set to a valid SNMP status code (the default value is 0, which represents no error).

The following is a list of valid SNMP status code values:

0 (noError) No error.
1 (tooBig) The response cannot fit in a single SNMP message.
2 (noSuchName) Variable does not exist.
3 (badValue) Invalid value or syntax.
4 (readOnly) Variable is read-only.
5 (genError) Other error (SNMPv1).
6 (noAccess) Access denied.
7 (wrongType) Wrong object type.
8 (wrongLength) Wrong length.
9 (wrongEncoding) Wrong encoding.
10 (wrongValue) Wrong value.
11 (noCreation) No creation.
12 (inconsistentValue) Inconsistent value.
13 (resourceUnavailable) Resource unavailable.
14 (commitFailed) Commit failed.
15 (undoFailed) Undo failed.
16 (authorizationError) Authorization error.
17 (notWritable) Variable is not writable.
18 (inconsistentName) Inconsistent name.

The ErrorIndex parameter indicates the index of the first variable (object) that caused an error. The default value is 0.

Variable indexes start with 0. ErrorIndex has no meaning when ErrorStatus is 0 (no error).

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks SNMP 2020 C++ Edition - Version 20.0 [Build 8202]