modbus_server_pdu.c File Reference

Modbus PDU processing. More...

Go to the source code of this file.

Macros

#define TRACE_LEVEL   MODBUS_TRACE_LEVEL
 

Functions

error_t modbusServerProcessRequest (ModbusClientConnection *connection)
 Process Modbus request. More...
 
error_t modbusServerProcessReadCoilsReq (ModbusClientConnection *connection, const ModbusReadCoilsReq *request, size_t length)
 Process Read Coils request. More...
 
error_t modbusServerProcessReadDiscreteInputsReq (ModbusClientConnection *connection, const ModbusReadDiscreteInputsReq *request, size_t length)
 Process Read Discrete Inputs request. More...
 
error_t modbusServerProcessReadHoldingRegsReq (ModbusClientConnection *connection, const ModbusReadHoldingRegsReq *request, size_t length)
 Process Read Holding Registers request. More...
 
error_t modbusServerProcessReadInputRegsReq (ModbusClientConnection *connection, const ModbusReadInputRegsReq *request, size_t length)
 Process Read Input Registers request. More...
 
error_t modbusServerProcessWriteSingleCoilReq (ModbusClientConnection *connection, const ModbusWriteSingleCoilReq *request, size_t length)
 Process Write Single Coil request. More...
 
error_t modbusServerProcessWriteSingleRegReq (ModbusClientConnection *connection, const ModbusWriteSingleRegReq *request, size_t length)
 Process Write Single Register request. More...
 
error_t modbusServerProcessWriteMultipleCoilsReq (ModbusClientConnection *connection, const ModbusWriteMultipleCoilsReq *request, size_t length)
 Process Write Multiple Coils request. More...
 
error_t modbusServerProcessWriteMultipleRegsReq (ModbusClientConnection *connection, const ModbusWriteMultipleRegsReq *request, size_t length)
 Process Write Multiple Registers request. More...
 
error_t modbusServerProcessMaskWriteRegReq (ModbusClientConnection *connection, const ModbusMaskWriteRegReq *request, size_t length)
 Process Mask Write Register request. More...
 
error_t modbusServerProcessReadWriteMultipleRegsReq (ModbusClientConnection *connection, const ModbusReadWriteMultipleRegsReq *request, size_t length)
 Process Read/Write Multiple Registers request. More...
 
error_t modbusServerFormatExceptionResp (ModbusClientConnection *connection, ModbusFunctionCode functionCode, ModbusExceptionCode exceptionCode)
 Format exception response. More...
 

Detailed Description

Modbus PDU processing.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file modbus_server_pdu.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   MODBUS_TRACE_LEVEL

Definition at line 30 of file modbus_server_pdu.c.

Function Documentation

◆ modbusServerFormatExceptionResp()

error_t modbusServerFormatExceptionResp ( ModbusClientConnection connection,
ModbusFunctionCode  functionCode,
ModbusExceptionCode  exceptionCode 
)

Format exception response.

Parameters
[in]connectionPointer to the client connection
[in]functionCodeFunction code of the request
[in]exceptionCodeException code
Returns
Exception code

Definition at line 1038 of file modbus_server_pdu.c.

◆ modbusServerProcessMaskWriteRegReq()

error_t modbusServerProcessMaskWriteRegReq ( ModbusClientConnection connection,
const ModbusMaskWriteRegReq request,
size_t  length 
)

Process Mask Write Register request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 853 of file modbus_server_pdu.c.

◆ modbusServerProcessReadCoilsReq()

error_t modbusServerProcessReadCoilsReq ( ModbusClientConnection connection,
const ModbusReadCoilsReq request,
size_t  length 
)

Process Read Coils request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 218 of file modbus_server_pdu.c.

◆ modbusServerProcessReadDiscreteInputsReq()

error_t modbusServerProcessReadDiscreteInputsReq ( ModbusClientConnection connection,
const ModbusReadDiscreteInputsReq request,
size_t  length 
)

Process Read Discrete Inputs request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 306 of file modbus_server_pdu.c.

◆ modbusServerProcessReadHoldingRegsReq()

error_t modbusServerProcessReadHoldingRegsReq ( ModbusClientConnection connection,
const ModbusReadHoldingRegsReq request,
size_t  length 
)

Process Read Holding Registers request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 394 of file modbus_server_pdu.c.

◆ modbusServerProcessReadInputRegsReq()

error_t modbusServerProcessReadInputRegsReq ( ModbusClientConnection connection,
const ModbusReadInputRegsReq request,
size_t  length 
)

Process Read Input Registers request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 467 of file modbus_server_pdu.c.

◆ modbusServerProcessReadWriteMultipleRegsReq()

error_t modbusServerProcessReadWriteMultipleRegsReq ( ModbusClientConnection connection,
const ModbusReadWriteMultipleRegsReq request,
size_t  length 
)

Process Read/Write Multiple Registers request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 926 of file modbus_server_pdu.c.

◆ modbusServerProcessRequest()

error_t modbusServerProcessRequest ( ModbusClientConnection connection)

Process Modbus request.

Parameters
[in]connectionPointer to the client connection
Returns
Error code

Definition at line 49 of file modbus_server_pdu.c.

◆ modbusServerProcessWriteMultipleCoilsReq()

error_t modbusServerProcessWriteMultipleCoilsReq ( ModbusClientConnection connection,
const ModbusWriteMultipleCoilsReq request,
size_t  length 
)

Process Write Multiple Coils request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 669 of file modbus_server_pdu.c.

◆ modbusServerProcessWriteMultipleRegsReq()

error_t modbusServerProcessWriteMultipleRegsReq ( ModbusClientConnection connection,
const ModbusWriteMultipleRegsReq request,
size_t  length 
)

Process Write Multiple Registers request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 761 of file modbus_server_pdu.c.

◆ modbusServerProcessWriteSingleCoilReq()

error_t modbusServerProcessWriteSingleCoilReq ( ModbusClientConnection connection,
const ModbusWriteSingleCoilReq request,
size_t  length 
)

Process Write Single Coil request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 540 of file modbus_server_pdu.c.

◆ modbusServerProcessWriteSingleRegReq()

error_t modbusServerProcessWriteSingleRegReq ( ModbusClientConnection connection,
const ModbusWriteSingleRegReq request,
size_t  length 
)

Process Write Single Register request.

Parameters
[in]connectionPointer to the client connection
[in]requestPointer to the request PDU
[in]lengthLength of the request PDU, in bytes
Returns
Error code

Definition at line 612 of file modbus_server_pdu.c.