Macros | Functions | Variables
modbus-tcp.c File Reference
#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"
Include dependency graph for modbus-tcp.c:

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_tmodbus_new_tcp (const char *ip, int port)
 
modbus_tmodbus_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
 

Macro Definition Documentation

#define MSG_NOSIGNAL   0

Definition at line 57 of file modbus-tcp.c.

Function Documentation

static int _modbus_set_slave ( modbus_t ctx,
int  slave 
)
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 int _modbus_tcp_connect ( modbus_t ctx)
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 int _modbus_tcp_pi_connect ( modbus_t ctx)
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 int _modbus_tcp_set_ipv4_options ( int  s)
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.

Variable Documentation

const modbus_backend_t _modbus_tcp_backend
Initial value:
= {
}
int _modbus_tcp_build_response_basis(sft_t *sft, uint8_t *rsp)
Definition: modbus-tcp.c:137
int _modbus_tcp_prepare_response_tid(const uint8_t *req, int *req_length)
Definition: modbus-tcp.c:160
#define MODBUS_TCP_MAX_ADU_LENGTH
Definition: modbus-tcp.h:41
ssize_t _modbus_tcp_recv(modbus_t *ctx, uint8_t *rsp, int rsp_length)
Definition: modbus-tcp.c:185
int _modbus_tcp_check_integrity(modbus_t *ctx, uint8_t *msg, const int msg_length)
Definition: modbus-tcp.c:189
int _modbus_tcp_flush(modbus_t *ctx)
Definition: modbus-tcp.c:349
int _modbus_tcp_send_msg_pre(uint8_t *req, int req_length)
Definition: modbus-tcp.c:165
static int _modbus_set_slave(modbus_t *ctx, int slave)
Definition: modbus-tcp.c:81
int _modbus_tcp_pre_check_confirmation(modbus_t *ctx, const uint8_t *req, const uint8_t *rsp, int rsp_length)
Definition: modbus-tcp.c:194
int _modbus_tcp_filter_request(modbus_t *ctx, int slave)
Definition: modbus-tcp.c:588
#define _MODBUS_TCP_HEADER_LENGTH
ssize_t _modbus_tcp_send(modbus_t *ctx, const uint8_t *req, int req_length)
Definition: modbus-tcp.c:176
static int _modbus_tcp_connect(modbus_t *ctx)
Definition: modbus-tcp.c:242
#define _MODBUS_TCP_CHECKSUM_LENGTH
void _modbus_tcp_close(modbus_t *ctx)
Definition: modbus-tcp.c:343
int _modbus_tcp_select(modbus_t *ctx, fd_set *rfds, struct timeval *tv, int length_to_read)
Definition: modbus-tcp.c:564
int _modbus_tcp_build_request_basis(modbus_t *ctx, int function, int addr, int nb, uint8_t *req)
Definition: modbus-tcp.c:99

Definition at line 593 of file modbus-tcp.c.

const modbus_backend_t _modbus_tcp_pi_backend
Initial value:
= {
}
int _modbus_tcp_build_response_basis(sft_t *sft, uint8_t *rsp)
Definition: modbus-tcp.c:137
int _modbus_tcp_prepare_response_tid(const uint8_t *req, int *req_length)
Definition: modbus-tcp.c:160
#define MODBUS_TCP_MAX_ADU_LENGTH
Definition: modbus-tcp.h:41
ssize_t _modbus_tcp_recv(modbus_t *ctx, uint8_t *rsp, int rsp_length)
Definition: modbus-tcp.c:185
int _modbus_tcp_check_integrity(modbus_t *ctx, uint8_t *msg, const int msg_length)
Definition: modbus-tcp.c:189
int _modbus_tcp_flush(modbus_t *ctx)
Definition: modbus-tcp.c:349
int _modbus_tcp_send_msg_pre(uint8_t *req, int req_length)
Definition: modbus-tcp.c:165
static int _modbus_tcp_pi_connect(modbus_t *ctx)
Definition: modbus-tcp.c:283
static int _modbus_set_slave(modbus_t *ctx, int slave)
Definition: modbus-tcp.c:81
int _modbus_tcp_pre_check_confirmation(modbus_t *ctx, const uint8_t *req, const uint8_t *rsp, int rsp_length)
Definition: modbus-tcp.c:194
int _modbus_tcp_filter_request(modbus_t *ctx, int slave)
Definition: modbus-tcp.c:588
#define _MODBUS_TCP_HEADER_LENGTH
ssize_t _modbus_tcp_send(modbus_t *ctx, const uint8_t *req, int req_length)
Definition: modbus-tcp.c:176
#define _MODBUS_TCP_CHECKSUM_LENGTH
void _modbus_tcp_close(modbus_t *ctx)
Definition: modbus-tcp.c:343
int _modbus_tcp_select(modbus_t *ctx, fd_set *rfds, struct timeval *tv, int length_to_read)
Definition: modbus-tcp.c:564
int _modbus_tcp_build_request_basis(modbus_t *ctx, int function, int addr, int nb, uint8_t *req)
Definition: modbus-tcp.c:99

Definition at line 615 of file modbus-tcp.c.



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