modbus_server_pdu.h
Go to the documentation of this file.
1 /**
2  * @file modbus_server_pdu.h
3  * @brief Modbus PDU processing
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _MODBUS_SERVER_PDU_H
32 #define _MODBUS_SERVER_PDU_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "modbus/modbus_server.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //Modbus/TCP server related functions
45 
47  const ModbusReadCoilsReq *request, size_t length);
48 
50  const ModbusReadDiscreteInputsReq *request, size_t length);
51 
53  const ModbusReadHoldingRegsReq *request, size_t length);
54 
56  const ModbusReadInputRegsReq *request, size_t length);
57 
59  const ModbusWriteSingleCoilReq *request, size_t length);
60 
62  const ModbusWriteSingleRegReq *request, size_t length);
63 
65  const ModbusWriteMultipleCoilsReq *request, size_t length);
66 
68  const ModbusWriteMultipleRegsReq *request, size_t length);
69 
71  const ModbusMaskWriteRegReq *request, size_t length);
72 
74  const ModbusReadWriteMultipleRegsReq *request, size_t length);
75 
78 
79 //C++ guard
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif
ModbusWriteSingleCoilReq
error_t modbusServerProcessReadInputRegsReq(ModbusClientConnection *connection, const ModbusReadInputRegsReq *request, size_t length)
Process Read Input Registers request.
error_t modbusServerProcessWriteSingleRegReq(ModbusClientConnection *connection, const ModbusWriteSingleRegReq *request, size_t length)
Process Write Single Register request.
ModbusWriteMultipleRegsReq
#define ModbusClientConnection
ModbusMaskWriteRegReq
ModbusWriteSingleRegReq
error_t
Error codes.
Definition: error.h:43
ModbusWriteMultipleCoilsReq
error_t modbusServerProcessWriteSingleCoilReq(ModbusClientConnection *connection, const ModbusWriteSingleCoilReq *request, size_t length)
Process Write Single Coil request.
error_t modbusServerProcessMaskWriteRegReq(ModbusClientConnection *connection, const ModbusMaskWriteRegReq *request, size_t length)
Process Mask Write Register request.
Modbus/TCP server.
error_t modbusServerProcessWriteMultipleCoilsReq(ModbusClientConnection *connection, const ModbusWriteMultipleCoilsReq *request, size_t length)
Process Write Multiple Coils request.
error_t modbusServerProcessWriteMultipleRegsReq(ModbusClientConnection *connection, const ModbusWriteMultipleRegsReq *request, size_t length)
Process Write Multiple Registers request.
error_t modbusServerProcessReadWriteMultipleRegsReq(ModbusClientConnection *connection, const ModbusReadWriteMultipleRegsReq *request, size_t length)
Process Read/Write Multiple Registers request.
uint8_t length
Definition: tcp.h:368
error_t modbusServerProcessReadDiscreteInputsReq(ModbusClientConnection *connection, const ModbusReadDiscreteInputsReq *request, size_t length)
Process Read Discrete Inputs request.
error_t modbusServerFormatExceptionResp(ModbusClientConnection *connection, ModbusFunctionCode functionCode, ModbusExceptionCode exceptionCode)
Format exception response.
error_t modbusServerProcessReadCoilsReq(ModbusClientConnection *connection, const ModbusReadCoilsReq *request, size_t length)
Process Read Coils request.
ModbusFunctionCode
Modbus functions codes.
Definition: modbus_common.h:75
ModbusReadCoilsReq
ModbusReadInputRegsReq
ModbusReadDiscreteInputsReq
error_t modbusServerProcessRequest(ModbusClientConnection *connection)
Process Modbus request.
error_t modbusServerProcessReadHoldingRegsReq(ModbusClientConnection *connection, const ModbusReadHoldingRegsReq *request, size_t length)
Process Read Holding Registers request.
ModbusReadWriteMultipleRegsReq
TCP/IP stack core.
ModbusExceptionCode
Modbus exception codes.
ModbusReadHoldingRegsReq
uint8_t exceptionCode