CID 69145 - Argument cannot be negative in unit-test-server
[libmodbus.git] / src / modbus-tcp-private.h
blob55edf26f43052b93477404f22488ef1f18fd3b2d
1 /*
2 * Copyright © 2001-2011 Stéphane Raimbault <stephane.raimbault@gmail.com>
4 * SPDX-License-Identifier: LGPL-2.1+
5 */
7 #ifndef MODBUS_TCP_PRIVATE_H
8 #define MODBUS_TCP_PRIVATE_H
10 #define _MODBUS_TCP_HEADER_LENGTH 7
11 #define _MODBUS_TCP_PRESET_REQ_LENGTH 12
12 #define _MODBUS_TCP_PRESET_RSP_LENGTH 8
14 #define _MODBUS_TCP_CHECKSUM_LENGTH 0
16 /* In both structures, the transaction ID must be placed on first position
17 to have a quick access not dependant of the TCP backend */
18 typedef struct _modbus_tcp {
19 /* Extract from MODBUS Messaging on TCP/IP Implementation Guide V1.0b
20 (page 23/46):
21 The transaction identifier is used to associate the future response
22 with the request. This identifier is unique on each TCP connection. */
23 uint16_t t_id;
24 /* TCP port */
25 int port;
26 /* IP address */
27 char ip[16];
28 } modbus_tcp_t;
30 #define _MODBUS_TCP_PI_NODE_LENGTH 1025
31 #define _MODBUS_TCP_PI_SERVICE_LENGTH 32
33 typedef struct _modbus_tcp_pi {
34 /* Transaction ID */
35 uint16_t t_id;
36 /* TCP port */
37 int port;
38 /* Node */
39 char node[_MODBUS_TCP_PI_NODE_LENGTH];
40 /* Service */
41 char service[_MODBUS_TCP_PI_SERVICE_LENGTH];
42 } modbus_tcp_pi_t;
44 #endif /* MODBUS_TCP_PRIVATE_H */