CreateAccessRule (Method)

Overview

Type:

Method

Available as of:

V1.1.0.0

Description

The method CreateAccessRule is used to create a new rule for the access control of the server.

The successful creation of a rule leads to the activation of the configured access rules in the function block, even if they had been deactivated using the method ActivateAccessControl() before.

NOTE: By activating the access rules, existing connections are verified. Connections that do not match an access rule are closed.

If the function block is not enabled, the plausibility verification of the addresses in the rule configuration cannot be performed. This means that a rule valid at the time of creation can subsequently be recognized as invalid when the function block is enabled.

Interface

Inputs / Outputs

Data type

Description

i_stRuleConfig

ST_AccessRule

Specifies the configuration parameter for the rule to be created.

q_sResultMsg

STRING[80]

Provides additional diagnostic and status information as a text message.

Return Value

Data type

Description

ET_Result

The return value indicates the result of the method.

If the value is ET_Result.Ok, the execution of the method was completed successfully.

Troubleshooting

If the return value of the method is not Ok, verify the value of the output q_sResultMsg. It provides detailed information about the detected error.

Return value

Possible cause

Solution

ET_Result.IpAddressInvalid

The format of the values for sIpAddressFirst or sIpAddressLast is invalid.

  • Verify whether the value of sIpAddressFirst complies with the format ‘n.n.n.n’.

  • Verify whether the value of sIpAddressLast is a null string or complies with the format ‘n.n.n.n’.

ET_Result.IpAddressInvalid

The combination of the values of sIpAddressFirst and sIpAddressLast is not plausible.

Verify whether the value of sIpAddressFirst is less than or equal to the value of sIpAddressLast.

ET_Result.RuleConfigMemoryAddressInvalid

One of the combinations of the values uiStartAddress, uiOffset, and uiLength is not plausible.

Verify whether the memory areas addressed by the parameters uiStartAddress, uiOffset, and uiLength are supported by the server.

ET_Result.RuleAlreadyExists

A rule with the same values for sIpAddressFirst and sIpAddressLast is already available.

Execute the method CreateAccessRule() once per rule. Use an initialization procedure for creating the access rules which is executed only once.

ET_Result.NoMoreRules

The maximum number of rules is configured.

  • Execute the method RemoveAccessRule() to remove a rule that is no longer required before creating a new access rule.

  • Try to combine several rules into a single access rule. Use groups instead of single clients, for example.