Skip to content
Browse files

Rename slave to server and master to client

  • Loading branch information...
1 parent 754235c commit 3593d5ad5408fb14607e9ad59f3f6f860c755f37 @stephane committed Jul 20, 2010
View
14 .gitignore
@@ -27,11 +27,11 @@ modbus.h
*.lo
stamp-h1
*.o
-tests/bandwidth-master
-tests/bandwidth-slave-many-up
-tests/bandwidth-slave-one
-tests/random-test-master
-tests/random-test-slave
-tests/unit-test-master
-tests/unit-test-slave
+tests/bandwidth-client
+tests/bandwidth-server-many-up
+tests/bandwidth-server-one
+tests/random-test-client
+tests/random-test-server
+tests/unit-test-client
+tests/unit-test-server
tests/version
View
42 tests/Makefile.am
@@ -1,38 +1,38 @@
EXTRA_DIST = README
noinst_PROGRAMS = \
- random-test-slave \
- random-test-master \
- unit-test-slave \
- unit-test-master \
- bandwidth-slave-one \
- bandwidth-slave-many-up \
- bandwidth-master \
+ random-test-server \
+ random-test-client \
+ unit-test-server \
+ unit-test-client \
+ bandwidth-server-one \
+ bandwidth-server-many-up \
+ bandwidth-client \
version
common_ldflags = \
$(top_builddir)/src/libmodbus.la
-random_test_slave_SOURCES = random-test-slave.c
-random_test_slave_LDADD = $(common_ldflags)
+random_test_server_SOURCES = random-test-server.c
+random_test_server_LDADD = $(common_ldflags)
-random_test_master_SOURCES = random-test-master.c
-random_test_master_LDADD = $(common_ldflags)
+random_test_client_SOURCES = random-test-client.c
+random_test_client_LDADD = $(common_ldflags)
-unit_test_slave_SOURCES = unit-test-slave.c unit-test.h
-unit_test_slave_LDADD = $(common_ldflags)
+unit_test_server_SOURCES = unit-test-server.c unit-test.h
+unit_test_server_LDADD = $(common_ldflags)
-unit_test_master_SOURCES = unit-test-master.c unit-test.h
-unit_test_master_LDADD = $(common_ldflags)
+unit_test_client_SOURCES = unit-test-client.c unit-test.h
+unit_test_client_LDADD = $(common_ldflags)
-bandwidth_slave_one_SOURCES = bandwidth-slave-one.c
-bandwidth_slave_one_LDADD = $(common_ldflags)
+bandwidth_server_one_SOURCES = bandwidth-server-one.c
+bandwidth_server_one_LDADD = $(common_ldflags)
-bandwidth_slave_many_up_SOURCES = bandwidth-slave-many-up.c
-bandwidth_slave_many_up_LDADD = $(common_ldflags)
+bandwidth_server_many_up_SOURCES = bandwidth-server-many-up.c
+bandwidth_server_many_up_LDADD = $(common_ldflags)
-bandwidth_master_SOURCES = bandwidth-master.c
-bandwidth_master_LDADD = $(common_ldflags)
+bandwidth_client_SOURCES = bandwidth-client.c
+bandwidth_client_LDADD = $(common_ldflags)
version_SOURCES = version.c
version_LDADD = $(common_ldflags)
View
32 tests/README
@@ -2,37 +2,37 @@ Compilation
-----------
After installation, you can use pkg-config to compile these tests.
-For example, to compile random-test-slave run:
+For example, to compile random-test-server run:
-gcc random-test-slave.c -o random-test-slave `pkg-config --libs --cflags libmodbus`
+gcc random-test-server.c -o random-test-server `pkg-config --libs --cflags libmodbus`
-random-test-slave
+random-test-server
-----------------
-It's necessary to launch this server before run random-test-master. By
+It's necessary to launch this server before run random-test-client. By
default, it receives and responses to Modbus query on the localhost
and port 1502.
-random-test-master
+random-test-client
------------------
This programm sends many different queries to a large range of
-addresses and values to test the communication between the master and
-the slave.
+addresses and values to test the communication between the client and
+the server.
-unit-test-slave
-unit-test-master
+unit-test-server
+unit-test-client
----------------
By default, this program sends some queries with the values defined in
unit-test.h and checks the responses. These programs are useful to
test the protocol implementation.
-bandwidth-slave-one
-bandwidth-slave-many-up
-bandwidth-master
+bandwidth-server-one
+bandwidth-server-many-up
+bandwidth-client
-----------------------
It returns some very useful informations about the performance of
-transfert rate between the slave and the master.
+transfert rate between the server and the client.
-- bandwidth-slave-one: it can handles only one connection with a master.
-- bandwidth-slave-many-up: it opens a connection each time a new master asks
- for, but the number of connection is limited. The same slave process handles
+- bandwidth-server-one: it can handles only one connection with a client.
+- bandwidth-server-many-up: it opens a connection each time a new client asks
+ for, but the number of connection is limited. The same server process handles
all the connections.
View
0 tests/bandwidth-master.c → tests/bandwidth-client.c
File renamed without changes.
View
18 tests/bandwidth-slave-many-up.c → tests/bandwidth-server-many-up.c
@@ -27,12 +27,12 @@
#define NB_CONNECTION 5
modbus_t *ctx = NULL;
-int slave_socket;
+int server_socket;
modbus_mapping_t *mb_mapping;
static void close_sigint(int dummy)
{
- close(slave_socket);
+ close(server_socket);
modbus_free(ctx);
modbus_mapping_free(mb_mapping);
@@ -60,22 +60,22 @@ int main(void)
return -1;
}
- slave_socket = modbus_listen(ctx, NB_CONNECTION);
+ server_socket = modbus_listen(ctx, NB_CONNECTION);
signal(SIGINT, close_sigint);
/* Clear the reference set of socket */
FD_ZERO(&refset);
- /* Add the slave socket */
- FD_SET(slave_socket, &refset);
+ /* Add the server socket */
+ FD_SET(server_socket, &refset);
/* Keep track of the max file descriptor */
- fdmax = slave_socket;
+ fdmax = server_socket;
for (;;) {
rdset = refset;
if (select(fdmax+1, &rdset, NULL, NULL, NULL) == -1) {
- perror("Slave select() failure.");
+ perror("Server select() failure.");
close_sigint(1);
}
@@ -84,7 +84,7 @@ int main(void)
for (master_socket = 0; master_socket <= fdmax; master_socket++) {
if (FD_ISSET(master_socket, &rdset)) {
- if (master_socket == slave_socket) {
+ if (master_socket == server_socket) {
/* A client is asking a new connection */
socklen_t addrlen;
struct sockaddr_in clientaddr;
@@ -93,7 +93,7 @@ int main(void)
/* Handle new connections */
addrlen = sizeof(clientaddr);
memset(&clientaddr, 0, sizeof(clientaddr));
- newfd = accept(slave_socket, (struct sockaddr *)&clientaddr, &addrlen);
+ newfd = accept(server_socket, (struct sockaddr *)&clientaddr, &addrlen);
if (newfd == -1) {
perror("Server accept() error");
} else {
View
0 tests/bandwidth-slave-one.c → tests/bandwidth-server-one.c
File renamed without changes.
View
0 tests/random-test-master.c → tests/random-test-client.c
File renamed without changes.
View
0 tests/random-test-slave.c → tests/random-test-server.c
File renamed without changes.
View
0 tests/unit-test-master.c → tests/unit-test-client.c
File renamed without changes.
View
0 tests/unit-test-slave.c → tests/unit-test-server.c
File renamed without changes.

0 comments on commit 3593d5a

Please sign in to comment.
Something went wrong with that request. Please try again.