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-2019 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 1.9.6
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
error_t modbusServerProcessReadInputRegsReq(ModbusClientConnection *connection, const ModbusReadInputRegsReq *request, size_t length)
Process Read Input Registers request.
uint8_t length
Definition: dtls_misc.h:149
error_t modbusServerProcessWriteSingleRegReq(ModbusClientConnection *connection, const ModbusWriteSingleRegReq *request, size_t length)
Process Write Single Register request.
__start_packed struct @223 ModbusWriteMultipleRegsReq
Write Multiple Registers request PDU.
__start_packed struct @217 ModbusWriteSingleCoilReq
Write Single Coil request PDU.
#define ModbusClientConnection
__start_packed struct @225 ModbusMaskWriteRegReq
Mask Write Register request PDU.
error_t
Error codes.
Definition: error.h:42
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.
__start_packed struct @213 ModbusReadHoldingRegsReq
Read Holding Registers request PDU.
__start_packed struct @209 ModbusReadCoilsReq
Read Coils request PDU.
error_t modbusServerProcessWriteMultipleCoilsReq(ModbusClientConnection *connection, const ModbusWriteMultipleCoilsReq *request, size_t length)
Process Write Multiple Coils request.
__start_packed struct @219 ModbusWriteSingleRegReq
Write Single Register request PDU.
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.
__start_packed struct @221 ModbusWriteMultipleCoilsReq
Write Multiple Coils request PDU.
__start_packed struct @227 ModbusReadWriteMultipleRegsReq
Read/Write Multiple Registers request PDU.
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.
__start_packed struct @211 ModbusReadDiscreteInputsReq
Read Discrete Inputs request PDU.
__start_packed struct @215 ModbusReadInputRegsReq
Read Holding Input request PDU.
error_t modbusServerProcessReadCoilsReq(ModbusClientConnection *connection, const ModbusReadCoilsReq *request, size_t length)
Process Read Coils request.
ModbusFunctionCode
Modbus functions codes.
Definition: modbus_common.h:74
error_t modbusServerProcessRequest(ModbusClientConnection *connection)
Process Modbus request.
error_t modbusServerProcessReadHoldingRegsReq(ModbusClientConnection *connection, const ModbusReadHoldingRegsReq *request, size_t length)
Process Read Holding Registers request.
uint8_t functionCode
TCP/IP stack core.
ModbusExceptionCode
Modbus exception codes.
uint8_t exceptionCode