Name

cyg_modbus_acm_add — Add client address to Access Control Mechanism pool

Synopsis

#include <cyg/modbus.h>

Cyg_ErrNo cyg_modbus_acm_add(cyg_handle_t server, cyg_modbus_acm_pool ptype, const struct sockaddr *ipaddr, socklen_t addrlen);

Description

Depending on the CYGPKG_MODBUS and user application configuration, the ModbusTCP transport layer may provide support for an Access Control Mechanism (ACM) based on client (remote host) network addresses. This function allows addresses to be registered, so that subsequent connections from the remote host will be allowed.

The ptype defines which of the ModbusTCP ACM pools the supplied client address will be registered with:

  • MODBUS_CONNPOOL_PRI

    The priority pool is for addresses for which the server should never close the socket connection.

  • MODBUS_CONNPOOL_NONPRI

    The non-priority pool is for addresses where the server may close the socket connection.

Currently the ipaddr can describe either a AF_INET (for IPv4) or AF_INET6 (for IPv6) family address, with addrlen being the size of the relevant address family.

Return value

A standard Cyg_ErrNo error code is returned, with ENOERR indicating success. If the ModbusTCP ACM is not provided by the attached transport layer then ENOENT is returned. The error EIO indicates a failure to communicate with the server control thread. The transport specific implementation may return further error indications as appropriate.