1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
1) Synopsis
-----------
wavemon is a wireless device monitoring application that allows you to watch
signal and noise levels, packet statistics, device configuration and network
parameters of your wireless network hardware. It *should* work (though with
varying features) with all devices supported by the Linux wireless kernel
extensions by Jean Tourrilhes.
See the man page for an in-depth description of operation and configuration.
2) Where to obtain
------------------
You can always find the latest version at:
http://eden-feed.erg.abdn.ac.uk/wavemon
Please check this page for updates and for further information.
wavemon is distributed under the GPLv3, refer to the file COPYING.
3) How to build
---------------
wavemon uses autoconf, so that in most cases you can simply run
./configure
make
sudo make install
to build and install the package. Type 'make uninstall' if not happy.
Refer to the file INSTALL for generic installation instructions.
To grant users access to restricted networking operations (e.g. reading WEP
keys or performing scan operations), use additionally
sudo make install-suid-root
If you have changed some of the autoconf files or use a git version, run
./config/bootstrap
(requires a recent installation of 'autotools').
3) Bugs?
--------
Send bug reports, comments, and suggestions to <gerrit@erg.abdn.ac.uk>.
s="cm"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <modbus.h>
int main(void)
{
int socket;
modbus_t *ctx;
modbus_mapping_t *mb_mapping;
ctx = modbus_new_tcp("127.0.0.1", 1502);
/* modbus_set_debug(ctx, TRUE); */
mb_mapping = modbus_mapping_new(500, 500, 500, 500);
if (mb_mapping == NULL) {
fprintf(stderr, "Failed to allocate the mapping: %s\n",
modbus_strerror(errno));
modbus_free(ctx);
return -1;
}
socket = modbus_tcp_listen(ctx, 1);
modbus_tcp_accept(ctx, &socket);
for (;;) {
uint8_t query[MODBUS_TCP_MAX_ADU_LENGTH];
int rc;
rc = modbus_receive(ctx, query);
if (rc != -1) {
/* rc is the query size */
modbus_reply(ctx, query, rc, mb_mapping);
} else {
/* Connection closed by the client or error */
break;
}
}
printf("Quit the loop: %s\n", modbus_strerror(errno));
modbus_mapping_free(mb_mapping);
modbus_close(ctx);
modbus_free(ctx);
return 0;
}
|