#include <stdio.h>#include <stdlib.h>#include <string.h>#include <errno.h>#include <unistd.h>#include <signal.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/ioctl.h>#include <netinet/in.h>#include <netinet/ip.h>#include <netinet/tcp.h>#include <arpa/inet.h>#include <poll.h>#include <netdb.h>#include "libmodbus/modbus-private.h"#include "libmodbus/modbus-tcp.h"#include "libmodbus/modbus-tcp-private.h"
Go to the source code of this file.
Macros | |
| #define | MSG_NOSIGNAL 0 |
Functions | |
| static int | _modbus_set_slave (modbus_t *ctx, int slave) |
| int | _modbus_tcp_build_request_basis (modbus_t *ctx, int function, int addr, int nb, uint8_t *req) |
| int | _modbus_tcp_build_response_basis (sft_t *sft, uint8_t *rsp) |
| int | _modbus_tcp_check_integrity (modbus_t *ctx, uint8_t *msg, const int msg_length) |
| void | _modbus_tcp_close (modbus_t *ctx) |
| static int | _modbus_tcp_connect (modbus_t *ctx) |
| int | _modbus_tcp_filter_request (modbus_t *ctx, int slave) |
| int | _modbus_tcp_flush (modbus_t *ctx) |
| static int | _modbus_tcp_pi_connect (modbus_t *ctx) |
| int | _modbus_tcp_pre_check_confirmation (modbus_t *ctx, const uint8_t *req, const uint8_t *rsp, int rsp_length) |
| int | _modbus_tcp_prepare_response_tid (const uint8_t *req, int *req_length) |
| ssize_t | _modbus_tcp_recv (modbus_t *ctx, uint8_t *rsp, int rsp_length) |
| int | _modbus_tcp_select (modbus_t *ctx, fd_set *rfds, struct timeval *tv, int length_to_read) |
| ssize_t | _modbus_tcp_send (modbus_t *ctx, const uint8_t *req, int req_length) |
| int | _modbus_tcp_send_msg_pre (uint8_t *req, int req_length) |
| static int | _modbus_tcp_set_ipv4_options (int s) |
| modbus_t * | modbus_new_tcp (const char *ip, int port) |
| modbus_t * | modbus_new_tcp_pi (const char *node, const char *service) |
| int | modbus_tcp_accept (modbus_t *ctx, int *socket) |
| int | modbus_tcp_listen (modbus_t *ctx, int nb_connection) |
| int | modbus_tcp_pi_accept (modbus_t *ctx, int *socket) |
| int | modbus_tcp_pi_listen (modbus_t *ctx, int nb_connection) |
Variables | |
| const modbus_backend_t | _modbus_tcp_backend |
| const modbus_backend_t | _modbus_tcp_pi_backend |
| #define MSG_NOSIGNAL 0 |
Definition at line 57 of file modbus-tcp.c.
|
static |
Definition at line 81 of file modbus-tcp.c.
| int _modbus_tcp_build_request_basis | ( | modbus_t * | ctx, |
| int | function, | ||
| int | addr, | ||
| int | nb, | ||
| uint8_t * | req | ||
| ) |
Definition at line 99 of file modbus-tcp.c.
| int _modbus_tcp_build_response_basis | ( | sft_t * | sft, |
| uint8_t * | rsp | ||
| ) |
Definition at line 137 of file modbus-tcp.c.
| int _modbus_tcp_check_integrity | ( | modbus_t * | ctx, |
| uint8_t * | msg, | ||
| const int | msg_length | ||
| ) |
Definition at line 189 of file modbus-tcp.c.
| void _modbus_tcp_close | ( | modbus_t * | ctx | ) |
Definition at line 343 of file modbus-tcp.c.
|
static |
Definition at line 242 of file modbus-tcp.c.
| int _modbus_tcp_filter_request | ( | modbus_t * | ctx, |
| int | slave | ||
| ) |
Definition at line 588 of file modbus-tcp.c.
| int _modbus_tcp_flush | ( | modbus_t * | ctx | ) |
Definition at line 349 of file modbus-tcp.c.
|
static |
Definition at line 283 of file modbus-tcp.c.
| int _modbus_tcp_pre_check_confirmation | ( | modbus_t * | ctx, |
| const uint8_t * | req, | ||
| const uint8_t * | rsp, | ||
| int | rsp_length | ||
| ) |
Definition at line 194 of file modbus-tcp.c.
| int _modbus_tcp_prepare_response_tid | ( | const uint8_t * | req, |
| int * | req_length | ||
| ) |
Definition at line 160 of file modbus-tcp.c.
| ssize_t _modbus_tcp_recv | ( | modbus_t * | ctx, |
| uint8_t * | rsp, | ||
| int | rsp_length | ||
| ) |
Definition at line 185 of file modbus-tcp.c.
| int _modbus_tcp_select | ( | modbus_t * | ctx, |
| fd_set * | rfds, | ||
| struct timeval * | tv, | ||
| int | length_to_read | ||
| ) |
Definition at line 564 of file modbus-tcp.c.
| ssize_t _modbus_tcp_send | ( | modbus_t * | ctx, |
| const uint8_t * | req, | ||
| int | req_length | ||
| ) |
Definition at line 176 of file modbus-tcp.c.
| int _modbus_tcp_send_msg_pre | ( | uint8_t * | req, |
| int | req_length | ||
| ) |
Definition at line 165 of file modbus-tcp.c.
|
static |
Cygwin defines IPTOS_LOWDELAY but can't handle that flag so it's necessary to workaround that problem.
Definition at line 210 of file modbus-tcp.c.
| modbus_t* modbus_new_tcp | ( | const char * | ip, |
| int | port | ||
| ) |
Definition at line 636 of file modbus-tcp.c.
| modbus_t* modbus_new_tcp_pi | ( | const char * | node, |
| const char * | service | ||
| ) |
Definition at line 689 of file modbus-tcp.c.
| int modbus_tcp_accept | ( | modbus_t * | ctx, |
| int * | socket | ||
| ) |
Definition at line 524 of file modbus-tcp.c.
| int modbus_tcp_listen | ( | modbus_t * | ctx, |
| int | nb_connection | ||
| ) |
Definition at line 387 of file modbus-tcp.c.
| int modbus_tcp_pi_accept | ( | modbus_t * | ctx, |
| int * | socket | ||
| ) |
Definition at line 545 of file modbus-tcp.c.
| int modbus_tcp_pi_listen | ( | modbus_t * | ctx, |
| int | nb_connection | ||
| ) |
Definition at line 430 of file modbus-tcp.c.
| const modbus_backend_t _modbus_tcp_backend |
Definition at line 593 of file modbus-tcp.c.
| const modbus_backend_t _modbus_tcp_pi_backend |
Definition at line 615 of file modbus-tcp.c.