snmpAgentUsersGet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All NX devices

Firmware version:

1.60.00


This function will read out a user from the list of USM users for the publishing agent, previously set by the snmpUserSet function.

Foreign entities must be able to identify themselves with these users to be able to access published variables on an USM SNMPv3 enabled RTCU device.

 

Input:

None

 

Output:

Readonly : snmpUser

USM user with read permissions.

 

Writable : snmpUser

USM user with read and write permissions.

 

 

Returns: INT

1

- Success.

0

- This function is not supported.

-2

- Invalid input parameter.

-12

- General error.

 

Declaration

FUNCTION snmpAgentUsersGet : INT;
VAR_INPUT
  readonly : ACCESS snmpUser;
  writable : ACCESS snmpUser;
END_VAR;

 

Example:

INCLUDE rtcu.inc

 
FUNCTION authToStr : STRING;
VAR_INPUT

  auth : SINT;
END_VAR;
  CASE auth OF
    _SNMP_USM_MD5 : authToStr := "MD5";
    _SNMP_USM_SHA : authToStr := "SHA";
  ELSE
    authToStr := "Unknown???";
  END_CASE;
END_FUNCTION
 
FUNCTION encToStr : STRING;
VAR_INPUT
  enc : SINT;
END_VAR;
  CASE enc OF
    _SNMP_USM_AES : encToStr := "AES";
    _SNMP_USM_DES : encToStr := "DES";
  ELSE
    encToStr := "Unknown???";
  END_CASE;
END_FUNCTION
 
FUNCTION levelToStr : STRING;
VAR_INPUT
  level : SINT;
END_VAR;
  CASE level OF
    _SNMP_SEC_NONE : levelToStr := "None";
    _SNMP_SEC_AUTH : levelToStr := "AuthOnly";
    _SNMP_SEC_ENC  : levelToStr := "Auth+Enc";
  ELSE
    levelToStr := "Unknown???";
  END_CASE;
END_FUNCTION
 
PROGRAM test;
VAR
  rc     : INT;
  rouser : snmpUser;
  rwuser : snmpUser;
END_VAR
rc := snmpAgentUsersGet(readonly:=rouser, writable:=rwuser);
DebugFmt(message:="snmpAgentUsersGet (rc=\1)", v1:=rc);
DebugMsg(message:="-----------------------------------------");
DebugMsg(message:="Read-Only user:");
DebugMsg(message:="-----------USM user profile--------------");
DebugMsg(message:="Username is  : "+rouser.username);
DebugMsg(message:="Auth is      : "+authToStr(auth:=rouser.authentication));
DebugMsg(message:="Auth pass is : "+rouser.password);
DebugMsg(message:="Enc is       : "+encToStr(enc:=rouser.encryption));
DebugMsg(message:="Cryptkey is  : "+rouser.cryptkey);
DebugMsg(message:="Sec level is : "+levelToStr(level:=rouser.level));
DebugMsg(message:="-----------------------------------------");
DebugMsg(message:="");
DebugMsg(message:="Read-Write capable user:");
DebugMsg(message:="-----------USM user profile--------------");
DebugMsg(message:="Username is  : "+rwuser.username);
DebugMsg(message:="Auth is      : "+authToStr(auth:=rwuser.authentication));
DebugMsg(message:="Auth pass is : "+rwuser.password);
DebugMsg(message:="Enc is       : "+encToStr(enc:=rwuser.encryption));
DebugMsg(message:="Cryptkey is  : "+rwuser.cryptkey);
DebugMsg(message:="Sec level is : "+levelToStr(level:=rwuser.level));
DebugMsg(message:="-----------------------------------------");
END_PROGRAM;