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  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _MODBUS_SERVER_PDU_H
30 #define _MODBUS_SERVER_PDU_H
31 
32 //Dependencies
33 #include "core/net.h"
34 #include "modbus/modbus_server.h"
35 
36 //C++ guard
37 #ifdef __cplusplus
38  extern "C" {
39 #endif
40 
41 //Modbus/TCP server related functions
43 
45  const ModbusReadCoilsReq *request, size_t length);
46 
48  const ModbusReadDiscreteInputsReq *request, size_t length);
49 
51  const ModbusReadHoldingRegsReq *request, size_t length);
52 
54  const ModbusReadInputRegsReq *request, size_t length);
55 
57  const ModbusWriteSingleCoilReq *request, size_t length);
58 
60  const ModbusWriteSingleRegReq *request, size_t length);
61 
63  const ModbusWriteMultipleCoilsReq *request, size_t length);
64 
66  const ModbusWriteMultipleRegsReq *request, size_t length);
67 
69  const ModbusMaskWriteRegReq *request, size_t length);
70 
72  const ModbusReadWriteMultipleRegsReq *request, size_t length);
73 
76 
77 //C++ guard
78 #ifdef __cplusplus
79  }
80 #endif
81 
82 #endif
__start_packed struct @214 ModbusReadDiscreteInputsReq
Read Discrete Inputs request PDU.
error_t modbusServerProcessReadHoldingRegsReq(ModbusClientConnection *connection, const ModbusReadHoldingRegsReq *request, size_t length)
Process Read Holding Registers request.
Modbus/TCP server.
__start_packed struct @228 ModbusMaskWriteRegReq
Mask Write Register request PDU.
TCP/IP stack core.
__start_packed struct @218 ModbusReadInputRegsReq
Read Holding Input request PDU.
error_t modbusServerProcessWriteSingleRegReq(ModbusClientConnection *connection, const ModbusWriteSingleRegReq *request, size_t length)
Process Write Single Register request.
__start_packed struct @230 ModbusReadWriteMultipleRegsReq
Read/Write Multiple Registers request PDU.
error_t modbusServerProcessReadWriteMultipleRegsReq(ModbusClientConnection *connection, const ModbusReadWriteMultipleRegsReq *request, size_t length)
Process Read/Write Multiple Registers request.
ModbusExceptionCode
Modbus exception codes.
Definition: modbus_common.h:97
__start_packed struct @220 ModbusWriteSingleCoilReq
Write Single Coil request PDU.
error_t modbusServerProcessWriteMultipleRegsReq(ModbusClientConnection *connection, const ModbusWriteMultipleRegsReq *request, size_t length)
Process Write Multiple Registers request.
Modbus/TCP client connection.
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.
__start_packed struct @216 ModbusReadHoldingRegsReq
Read Holding Registers request PDU.
uint8_t functionCode
error_t modbusServerFormatExceptionResp(ModbusClientConnection *connection, ModbusFunctionCode functionCode, ModbusExceptionCode exceptionCode)
Format exception response.
ModbusFunctionCode
Modbus functions codes.
Definition: modbus_common.h:69
error_t modbusServerProcessWriteMultipleCoilsReq(ModbusClientConnection *connection, const ModbusWriteMultipleCoilsReq *request, size_t length)
Process Write Multiple Coils request.
__start_packed struct @222 ModbusWriteSingleRegReq
Write Single Register request PDU.
error_t
Error codes.
Definition: error.h:40
error_t modbusServerProcessReadDiscreteInputsReq(ModbusClientConnection *connection, const ModbusReadDiscreteInputsReq *request, size_t length)
Process Read Discrete Inputs request.
error_t modbusServerProcessRequest(ModbusClientConnection *connection)
Process Modbus request.
__start_packed struct @224 ModbusWriteMultipleCoilsReq
Write Multiple Coils request PDU.
uint8_t exceptionCode
__start_packed struct @226 ModbusWriteMultipleRegsReq
Write Multiple Registers request PDU.
error_t modbusServerProcessReadCoilsReq(ModbusClientConnection *connection, const ModbusReadCoilsReq *request, size_t length)
Process Read Coils request.
error_t modbusServerProcessReadInputRegsReq(ModbusClientConnection *connection, const ModbusReadInputRegsReq *request, size_t length)
Process Read Input Registers request.
uint8_t length
Definition: dtls_misc.h:140
__start_packed struct @212 ModbusReadCoilsReq
Read Coils request PDU.