2 * Copyright © Stéphane Raimbault <stephane.raimbault@gmail.com>
4 * SPDX-License-Identifier: LGPL-2.1-or-later
14 #if defined(_WIN32) && !defined(__CYGWIN__)
15 /* Win32 with MinGW, supplement to <errno.h> */
17 #if !defined(ECONNRESET)
18 #define ECONNRESET WSAECONNRESET
20 #if !defined(ECONNREFUSED)
21 #define ECONNREFUSED WSAECONNREFUSED
23 #if !defined(ETIMEDOUT)
24 #define ETIMEDOUT WSAETIMEDOUT
26 #if !defined(ENOPROTOOPT)
27 #define ENOPROTOOPT WSAENOPROTOOPT
29 #if !defined(EINPROGRESS)
30 #define EINPROGRESS WSAEINPROGRESS
34 #define MODBUS_TCP_DEFAULT_PORT 502
35 #define MODBUS_TCP_SLAVE 0xFF
37 /* Modbus_Application_Protocol_V1_1b.pdf Chapter 4 Section 1 Page 5
38 * TCP MODBUS ADU = 253 bytes + MBAP (7 bytes) = 260 bytes
40 #define MODBUS_TCP_MAX_ADU_LENGTH 260
42 MODBUS_API modbus_t
*modbus_new_tcp(const char *ip_address
, int port
);
43 MODBUS_API
int modbus_tcp_listen(modbus_t
*ctx
, int nb_connection
);
44 MODBUS_API
int modbus_tcp_accept(modbus_t
*ctx
, int *s
);
46 MODBUS_API modbus_t
*modbus_new_tcp_pi(const char *node
, const char *service
);
47 MODBUS_API
int modbus_tcp_pi_listen(modbus_t
*ctx
, int nb_connection
);
48 MODBUS_API
int modbus_tcp_pi_accept(modbus_t
*ctx
, int *s
);
52 #endif /* MODBUS_TCP_H */