modbus-tcp.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2001-2010 Stéphane Raimbault <stephane.raimbault@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef _MODBUS_TCP_H_
20 #define _MODBUS_TCP_H_
21 
22 #include "libmodbus/modbus.h"
23 
25 
26 #if defined(_WIN32) && !defined(__CYGWIN__)
27 /* Win32 with MinGW, supplement to <errno.h> */
28 #include <winsock2.h>
29 #define ECONNRESET WSAECONNRESET
30 #define ECONNREFUSED WSAECONNREFUSED
31 #define ETIMEDOUT WSAETIMEDOUT
32 #define ENOPROTOOPT WSAENOPROTOOPT
33 #endif
34 
35 #define MODBUS_TCP_DEFAULT_PORT 502
36 #define MODBUS_TCP_SLAVE 0xFF
37 
38 /* Modbus_Application_Protocol_V1_1b.pdf Chapter 4 Section 1 Page 5
39  * TCP MODBUS ADU = 253 bytes + MBAP (7 bytes) = 260 bytes
40  */
41 #define MODBUS_TCP_MAX_ADU_LENGTH 260
42 
43 modbus_t* modbus_new_tcp(const char *ip_address, int port);
44 int modbus_tcp_listen(modbus_t *ctx, int nb_connection);
45 int modbus_tcp_accept(modbus_t *ctx, int *socket);
46 
47 modbus_t* modbus_new_tcp_pi(const char *node, const char *service);
48 int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection);
49 int modbus_tcp_pi_accept(modbus_t *ctx, int *socket);
50 
52 
53 #endif /* _MODBUS_TCP_H_ */
#define MODBUS_BEGIN_DECLS
Definition: modbus.h:41
int modbus_tcp_accept(modbus_t *ctx, int *socket)
Definition: modbus-tcp.c:524
int modbus_tcp_pi_accept(modbus_t *ctx, int *socket)
Definition: modbus-tcp.c:545
int modbus_tcp_listen(modbus_t *ctx, int nb_connection)
Definition: modbus-tcp.c:387
modbus_t * ctx
int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection)
Definition: modbus-tcp.c:430
modbus_t * modbus_new_tcp_pi(const char *node, const char *service)
Definition: modbus-tcp.c:689
#define MODBUS_END_DECLS
Definition: modbus.h:42
modbus_t * modbus_new_tcp(const char *ip_address, int port)
Definition: modbus-tcp.c:636


libmodbus
Author(s):
autogenerated on Sat Nov 21 2020 03:17:32