From 133b70c2dc57213d8c3891b0d6c925f73419b555 Mon Sep 17 00:00:00 2001 From: Håkon Nessjøen Date: Sun, 1 May 2011 14:30:36 +0200 Subject: Added manual pages and added license text to all .h and .c files. --- Makefile | 9 ++++++++- config.h | 18 ++++++++++++++++++ console.h | 18 ++++++++++++++++++ devices.h | 18 ++++++++++++++++++ docs/macping.1 | 41 +++++++++++++++++++++++++++++++++++++++++ docs/mactelnet.1 | 42 ++++++++++++++++++++++++++++++++++++++++++ docs/mactelnetd.1 | 32 ++++++++++++++++++++++++++++++++ docs/mndp.1 | 22 ++++++++++++++++++++++ mactelnet.h | 19 +++++++++++++++++++ udp.c | 18 ++++++++++++++++++ udp.h | 18 ++++++++++++++++++ users.h | 18 ++++++++++++++++++ 12 files changed, 272 insertions(+), 1 deletion(-) create mode 100644 docs/macping.1 create mode 100644 docs/mactelnet.1 create mode 100644 docs/mactelnetd.1 create mode 100644 docs/mndp.1 diff --git a/Makefile b/Makefile index 7c49c58..9d8c1f1 100644 --- a/Makefile +++ b/Makefile @@ -16,17 +16,24 @@ strip-all: mndp macping mactelnet mactelnetd strip -s mactelnet strip -s mactelnetd -install: all strip-all +install: all strip-all install-docs + mkdir -p $(DESTDIR)/usr/bin cp mndp $(DESTDIR)/usr/bin/ cp macping $(DESTDIR)/usr/bin/ cp mactelnet $(DESTDIR)/usr/bin/ + mkdir -p $(DESTDIR)/usr/sbin cp mactelnetd $(DESTDIR)/usr/sbin/ + mkdir -p $(DESTDIR)/etc cp config/mactelnetd.users $(DESTDIR)/etc/ # Ubuntu upstart script # cp config/mactelnetd.init /etc/init/ chown root $(DESTDIR)/etc/mactelnetd.users chmod 600 $(DESTDIR)/etc/mactelnetd.users +install-docs: + mkdir -p $(DESTDIR)/usr/share/man/man1/ + cp docs/*.1 $(DESTDIR)/usr/share/man/man1/ + udp.o: udp.c udp.h ${CC} -Wall ${CCFLAGS} -c udp.c diff --git a/config.h b/config.h index cab40be..9009b54 100644 --- a/config.h +++ b/config.h @@ -1,3 +1,21 @@ +/* + Mac-Telnet - Connect to RouterOS routers via MAC address + Copyright (C) 2010, Håkon Nessjøen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #ifndef _CONFIG_H #define _CONFIG_H 1 diff --git a/console.h b/console.h index 3fcca2c..d2427cd 100644 --- a/console.h +++ b/console.h @@ -1,3 +1,21 @@ +/* + Mac-Telnet - Connect to RouterOS routers via MAC address + Copyright (C) 2010, Håkon Nessjøen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ extern int get_terminal_size(unsigned short *width, unsigned short *height); extern int raw_term(); extern int reset_term(); diff --git a/devices.h b/devices.h index 821db3c..2e85acf 100644 --- a/devices.h +++ b/devices.h @@ -1,3 +1,21 @@ +/* + Mac-Telnet - Connect to RouterOS routers via MAC address + Copyright (C) 2010, Håkon Nessjøen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ extern int get_device_index(int sockfd, char *deviceName); extern int get_device_mac(const int sockfd, const char *deviceName, unsigned char *mac); extern int get_device_ip(const int sockfd, const char *deviceName, struct sockaddr_in *ip); diff --git a/docs/macping.1 b/docs/macping.1 new file mode 100644 index 0000000..aea01e5 --- /dev/null +++ b/docs/macping.1 @@ -0,0 +1,41 @@ +.TH MACPING 1 "February 27, 2011" +.SH NAME +macping \- A tool for pinging other RouterOS or mactelnetd devices +.SH SYNOPSIS +.B mactelnet +.RI [ options ] " " < MAC-Address | hostname > +.SH DESCRIPTION +This tool enables you to ping other RouterOS or MAC-Telnetd enabled +devices. You can ping either a hostname or a MAC address. +If specified, the hostname (identity) will be looked up via MNDP discovery. +.SH OPTIONS +These programs follow the usual GNU command line syntax. +A summary of options is included below. +.TP +.B \-f +Fast mode, do not wait before sending next ping request. The next ping will be sent immediately when the last ping is received. This cannot be used with +.B -c 0 +\. +.TP +.B \-s +Specify the amount of bytes to send in each ping packet, up to ~1400 bytes. +.TP +.B \-c +Number of packets to send before exiting. A value of +.B 0 +means unlimited packets and the tool must be exited with Control + C. +.TP +.B \-h +Show summary of options. +.TP +.B \-v +Show version of program. +.SH SEE ALSO +.BR mndp (1), +.BR mactelnet (1), +.BR mactelnetd (1). +.SH AUTHOR +macping was written by Håkon Nessjøen . +.PP +This manual page was written by Håkon Nessjøen , +for the Debian project (and may be used by others). diff --git a/docs/mactelnet.1 b/docs/mactelnet.1 new file mode 100644 index 0000000..7ca091e --- /dev/null +++ b/docs/mactelnet.1 @@ -0,0 +1,42 @@ +.TH MACTELNET 1 "February 27, 2011" +.SH NAME +mactelnet \- A tool for telneting via MAC addresses +.SH SYNOPSIS +.B mactelnet +.RI [ options ] " " < MAC-Address | hostname > +.SH DESCRIPTION +This tool enables you to telnet other RouterOS or MAC-Telnetd enabled +devices. You can connect to either a hostname or a MAC address. +If specified, the hostname (identity) will be looked up via MNDP discovery. +.SH OPTIONS +These programs follow the usual GNU command line syntax. +A summary of options is included below. +.TP +.B \-n +Do not use broadcast packets. A tad less insecure but requires root privileges. +This means that ethernet packets will have the specified mac-address as the packet +destination, instead of using the ethernet broadcast address. +.TP +.B \-t +Amount of seconds to wait for a response on each interface. If you have several network interfaces, this is the timeout value per interface. +.TP +.B \-u +Specify username. Without this option, you will need to enter the username in a interactive prompt. +.TP +.B \-p +Specify password. Without this option, you will need to enter the password in a interactive prompt. +.TP +.B \-h +Show summary of options. +.TP +.B \-v +Show version of program. +.SH SEE ALSO +.BR mndp (1), +.BR mactelnetd (1), +.BR macping (1). +.SH AUTHOR +mactelnet was written by Håkon Nessjøen . +.PP +This manual page was written by Håkon Nessjøen , +for the Debian project (and may be used by others). diff --git a/docs/mactelnetd.1 b/docs/mactelnetd.1 new file mode 100644 index 0000000..b4fd298 --- /dev/null +++ b/docs/mactelnetd.1 @@ -0,0 +1,32 @@ +.TH MACTELNETD 1 "February 27, 2011" +.SH NAME +mactelnetd \- Telnet daemon for MAC-address connections +.SH SYNOPSIS +.B mactelnetd +.RI [ options ] +.SH DESCRIPTION +This daemon listens for telnet connections from Mikrotik RouterOS devices or mactelnet clients +on the same physical network. It also announces it's hostname via the MNDP protocol every minute. +.SH OPTIONS +These programs follow the usual GNU command line syntax. +A summary of options is included below. +.TP +.B \-n +Do not use broadcast packets. A tad less insecure. +This means that ethernet packets will have the mac-address of the client as the packet +destination, instead of using the ethernet broadcast address. +.TP +.B \-h +Show summary of options. +.TP +.B \-v +Show version of program. +.SH SEE ALSO +.BR mndp (1), +.BR mactelnet (1), +.BR macping (1). +.SH AUTHOR +mactelnetd was written by Håkon Nessjøen . +.PP +This manual page was written by Håkon Nessjøen , +for the Debian project (and may be used by others). diff --git a/docs/mndp.1 b/docs/mndp.1 new file mode 100644 index 0000000..ad3d412 --- /dev/null +++ b/docs/mndp.1 @@ -0,0 +1,22 @@ +.TH MNDP 1 "February 27, 2011" +.SH NAME +mndp \- A tool for discovering other RouterOS or mactelnetd devices +.SH SYNOPSIS +.B mndp +.SH DESCRIPTION +This tool enables you to discover RouterOS or MAC-Telnetd enabled +devices. It will display the MAC-address software version, and uptime of +every device or machine it discovers. +.PP +To exit this application, use +.B Control + C +\. +.SH SEE ALSO +.BR mactelnet (1), +.BR macping (1), +.BR mactelnetd (1). +.SH AUTHOR +mndp was written by Håkon Nessjøen . +.PP +This manual page was written by Håkon Nessjøen , +for the Debian project (and may be used by others). diff --git a/mactelnet.h b/mactelnet.h index f9ac1b9..34fa605 100644 --- a/mactelnet.h +++ b/mactelnet.h @@ -1 +1,20 @@ +/* + Mac-Telnet - Connect to RouterOS routers via MAC address + Copyright (C) 2010, Håkon Nessjøen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + #define CONNECT_TIMEOUT 2 diff --git a/udp.c b/udp.c index 4029943..a2968cc 100644 --- a/udp.c +++ b/udp.c @@ -1,3 +1,21 @@ +/* + Mac-Telnet - Connect to RouterOS routers via MAC address + Copyright (C) 2010, Håkon Nessjøen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #include #include #include diff --git a/udp.h b/udp.h index 79cf3a2..b415e16 100644 --- a/udp.h +++ b/udp.h @@ -1,3 +1,21 @@ +/* + Mac-Telnet - Connect to RouterOS routers via MAC address + Copyright (C) 2010, Håkon Nessjøen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #ifndef _UDP_H #define _UDP_H 1 extern int send_custom_udp(const int socket, const int ifindex, const unsigned char *sourcemac, const unsigned char *destmac, const struct in_addr *sourceip, const int sourceport, const struct in_addr *destip, const int destport, const unsigned char *data, const int datalen); diff --git a/users.h b/users.h index 1ab5e17..a23076a 100644 --- a/users.h +++ b/users.h @@ -1,3 +1,21 @@ +/* + Mac-Telnet - Connect to RouterOS routers via MAC address + Copyright (C) 2010, Håkon Nessjøen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #ifndef _USERS_H #define _USERS_H 1 -- cgit v1.2.3