SNMP_TRAP_SENDER (FB)

FUNCTION_BLOCK SNMP_TRAP_SENDER

Function block to send SNMP TRAP and INFORM requests.

InOut:

Scope

Name

Type

Initial

Comment

Input

xExecute

BOOL

Starts the request

sHost

STRING(100)

Hostname or IP address of the SNMP agent

sOwnIP

STRING(100)

Hostname or IP address of the SNMP master (the IP of the control)

uiPeerPort

UINT

161

Port of the sender (the control)

uiSendPort

UINT

161

Port of the agent (printer, router etc.)

sEnterprise

STRING((gc_iMaxValueLength - 1))

The OID which generated this TRAP

snmpVarBindings

REFERENCE TO ARRAY [0..(gc_uiMaxSNMPValues - 1)] OF SNMPVarBinding

Variable bindings (OID/Value) to send

iNumberOfVarBindings

INT

Number of variable bindings.

sCommunity

STRING

‚public‘

The community, default: ‚public‘

xClosePeer

BOOL

Rising edge closes the UDP peer.

bGenericTrapType

BYTE

6

Generic trap type, default: 6 (enterprise specific)

bSpecificTrapType

BYTE

0

Specific trap type, default 0

udiTimestamp

UDINT

0

Timestamp, default 0

eTrapType

TrapType

TrapType.V1_Trap

Type of the request (default V1_Trap)

uiTimeout

UINT

1000

Timeout in milliseconds, default: 1000 ms (only for INFORM messages)

bySNMPVersion

SNMPVersion

SNMPVersion.V1

SNMP Version, default: V1

sUserName

STRING

SNMP V3 only: Name of the registered user. Use the function CreateUser to register an user.

sContextName

STRING

‚‘

SNMP V3 only: Context name

msgAuthoritativeEngineID

REFERENCE TO SNMPValue

SNMP V3 only: The authoritative engine Id. If not set, then GVL.g_pEngineId is used. You can discover the engine id via SNMP_GET_REQUEST (see output msgAuthoritativeEngineID) with xRequestReport = TRUE.

Output

xBusy

BOOL

True while busy

xDone

BOOL

True if the call has finished

xError

BOOL

True if an error occured

eError

Error

Error status of the request.

Methods:

Structure: