Permalink
Browse files

resource compile changes

  • Loading branch information...
1 parent 16dd4b2 commit 9b32eee45a8588615b190b79c0dea54c7bea86d1 @jselbie committed Jan 24, 2012
View
@@ -3,7 +3,6 @@ nbproject/
*.o
*.gch
*.a
-*.txtcode
callgrind.out.*
stunclient
View
@@ -3,24 +3,18 @@ include ../common.inc
PROJECT_TARGET := stunclient
PROJECT_OBJS := clientmain.o
-PROJECT_INTERMEDIATES := usage.txtcode usagelite.txtcode
-INCLUDES := $(BOOST_INCLUDE) -I../common -I../stuncore -I../networkutils
+INCLUDES := $(BOOST_INCLUDE) -I../common -I../stuncore -I../networkutils -I../resources
LIB_PATH := -L../common -L../stuncore -L../networkutils
LIBS := -lnetworkutils -lstuncore -lcommon -lcrypto
all: $(PROJECT_TARGET)
clean:
- rm -f $(PROJECT_OBJS) $(PROJECT_TARGET) $(PROJECT_INTERMEDIATES)
+ rm -f $(PROJECT_OBJS) $(PROJECT_TARGET)
$(PROJECT_TARGET): $(PROJECT_OBJS)
$(LINK.cpp) -o $@ $^ $(LIB_PATH) $(LIBS)
-clientmain.cpp: usage.txtcode usagelite.txtcode
-
-
-%.txtcode: %.txt
- sh ../server/makecodefile.sh $< $@ $(*)_text
View
@@ -28,9 +28,9 @@
#include "oshelper.h"
#include "prettyprint.h"
-// unusual to include usage.cpp and usagelite.cpp here, but these are auto-generated resource file
-#include "usage.txtcode"
-#include "usagelite.txtcode"
+// These files are in ../resources
+#include "stunclient.txtcode"
+#include "stunclient_lite.txtcode"
struct ClientCmdLineArgs
@@ -74,7 +74,7 @@ void DumpConfig(StunClientLogicConfig& config, ClientSocketConfig& socketConfig)
void PrintUsage(bool fSummaryUsage)
{
size_t width = GetConsoleWidth();
- const char* psz = fSummaryUsage ? usagelite_text : usage_text;
+ const char* psz = fSummaryUsage ? stunclient_lite_text : stunclient_text;
// save some margin space
if (width > 2)
View
@@ -1,44 +0,0 @@
-Usage: stunclient [OPTIONS] server [port]
-Perform a binding test with a remote STUN server and optionally perform a full behavior test
-
-Parameters:
- "server" is the IP address or FQDN of the remote server to befrom the binding tests with. It is the only required paramter
-
- "port" is an optional paramter that can follow the server paramter. The default is 3478 for UDP and TCP.
-
-
-Available options:
- --localaddr = INTERFACE OR IPADDRESS
- The value for this option may the name of an interface (such as "eth0" or "lo"). Or it may be one of the available IP addresses assigned to a network interface present on the host (such as "128.23.45.67"). The interface chosen will be the preferred address for sending and receiving responses with the remote server. The default is to let the system decide which address to send on and to listen on all addresses (INADDR_ANY).
-
- --localport=PORTNUM
- PORTNUM is a value between 1 to 65535. This is the UDP or TCP port that the primary and alternate interfaces listen on as the primary port for binding requests. If not specified, a randomly avaialbe port chosed by the system is used.
-
- --mode=MODE
- Where MODE is either "basic" or "full". "basic" mode is the default and indicates that the client should perform a STUN binding test only. "full" mode indicates that the client should attempt to diagnose NAT behavior and filtering methodologies if the server supports this mode. The NAT filtering test is only supported for UDP.
-
- --family=IPVERSION
- IPVERSION is either "4" or "6" to specify the usage of IPV4 or IPV6. If not specified, the default value is "4".
-
- --protocol=PROTO
- PROTO is either "udp" or "tcp". "udp" is the default if this parameter is not specified
-
- --verbosity=LOGLEVEL
- Sets the verbosity of the logging level. 0 is the default (minimal output and logging). 1 shows slightly more. 2 and higher shows even more.
-
- --help
- Prints this help page
-
-Examples:
-
-stunclient stunserver.org 3478
- Performs a simple binding test request with the server listening at "stunserver.org"
-
-stunclient --mode full --localport 9999 12.34.56.78
- Performs a full set of UDP NAT behavior tests from local port 9999 to the server listening at IP Address 12.34.56.78 (port 3478)
-
-stunclient --protocol tcp stun.selbie.com
- Performs a simple binding test using TCP to server listening on the default port of 3478 at stun.selbie.com
-
-
-
View
@@ -12,12 +12,17 @@ include ../common.inc
pandoc -s -w man -o $@ $^
-all: stunserver.txtcode README stunclient.txtcode stunserver.1 stunclient.1
+all:
+ @echo "specify one of the following make options: textres manpages README or clean"
-README: readme.src
+textres: stunserver.txtcode stunserver_lite.txtcode stunclient.txtcode stunclient_lite.txtcode
+
+manpages: stunserver.1 stunclient.1
+
+README:
../stuntestcode --pp < readme.src > README
clean:
- rm -f *.txtcode *.txt README *.1
+ rm -f *.txtcode README *.1
View
@@ -0,0 +1,135 @@
+StunServer version 1.1.0
+January 22, 2012
+---------------------------------------------------------
+
+
+Features:
+
+ Compliant with the latest RFCs including 5389, 5769, and 5780. Also includes
+ backwards compatibility for RFC 3489.
+
+ Supports both UDP and TCP on both IPv4 and IPv6.
+
+ Client test app provided.
+
+ Stun server can operate in "full" mode as well as "basic" mode. Basic mode
+ configures the server to listen on one port and respond to STUN binding
+ requests. Full mode configures the service to listen on two different IP
+ address interfaces (if available) and provide NAT behavior and filtering
+ detection support for clients.
+
+ Open source Apache license. See LICENSE file fore more details.
+---------------------------------------------------------
+
+
+Known issues:
+
+ TLS mode has yet to be implemented.
+
+ Server does not honor the stun padding attribute. If someone really wants
+ this support, let me know and I will consider adding it.
+
+ By default, the stun server operates in an open mode without performing
+ authentication. All the code for authentication, challenge-response, message
+ hashing, and message integrity attributes are fully coded. HMAC/SHA1/MD5
+ hashing code for generating and validating the message integrity attribute
+ has been implemented and tested. However, the code for validating a username
+ or looking up a password is outside the scope of this release. Instead,
+ hooks are provided for implementors to write their own code to validate a
+ username, fetch a password, and allow/deny a request. Details of writing
+ your own authentication provider code are described in the file
+ "server/sampleauthprovider.h".
+
+ Dependency checking is not implemented in the Makefile. So if you need to
+ recompile, I recommend "make clean" from the root to preceed any subsequent
+ "make" call.
+
+ If you run an instance of stunserver locally, you may observe that
+ "stunclient localhost" may not successfully work. This is because the server
+ is not listening on the loopback adapter when running in full mode. The
+ workaround is to specify the actual IP address that the server is listening
+ on. Type "ifconfig" to discover your IP address (e.g. 10.11.12.13) followed
+ by "stunclient 10.11.12.13"
+---------------------------------------------------------
+
+
+Testing:
+
+ Fedora 15 with gcc/g++ 4.6.0
+ Ubuntu 11 with gcc/g++ 4.5.2
+ Amazon AWS with gcc/g++ 4.4
+ MacOS Snow Leopard (will not compile on earlier versions without updating to
+ a newer version of gcc/g++)
+
+ Parsing code has been fuzz tested with zzuf. http://caca.zoy.org/wiki/zzuf
+---------------------------------------------------------
+
+
+Prerequisites before compiling and running.
+
+ perl. Just have any old version installed. It is needed for one particular
+ build script.
+
+ Boost header files. (Actual boost runtime not required) www.boost.org (sudo
+ yum install boost-devel)
+
+ OpenSSL development files and runtime. www.boost.org (sudo yum install
+ openssl-devel)
+
+ pthreads header and libs (I haven't seen a distribution where this wasn't
+ already installed)
+---------------------------------------------------------
+
+
+Compiling and running
+
+ Got Boost and OpenSSL taken care of as described above? Good. Just type
+ "make". There will be three resulting binaries in the root of the source
+ code package produced.
+
+ stuntestcode - This is the unit test code. I highly recommend you run this
+ program first. When run, you'll see a series of lines being printed in
+ regards to different code paths being tested. If you see any line that ends
+ in "FAIL", we likely have a bug. Please contact me immediately if you see
+ this.
+
+ stunserver - this is the server binary. Run "./stunserver --help" for
+ details on running this program. Running this program without any command
+ line arguments defaults to listening on port 3478 on all adapters.
+
+ stunclient - this is the client test binary. Run "./stunclient --help" for
+ details on running this program. Example: "./stunclient stun.selbie.com"
+---------------------------------------------------------
+
+
+Firewall
+
+ Don't forget to configure your firewall to allow traffic for the local ports
+ the stunserver will be listening on!
+
+---------------------------------------------------------
+
+
+Feature roadmap (the features I want to implement in a subsequent release)
+
+ Host a full server across two separate machines (such that two ip addresses
+ on a single machine will not be required for full mode).
+
+ Cleanup Makefile and add "configure" and autotools support
+
+ Finish Windows port and able to run as a Windows service
+
+ Scale across more than one CPU (for multi-core and multi-proc machines). The
+ threading code has already been written, just needs some finish work.
+
+ TLS support
+
+---------------------------------------------------------
+
+
+Contact the author
+
+ John Selbie
+ john@selbie.com
+
+
View
@@ -0,0 +1,129 @@
+.TH STUNCLIENT 1 "" "January 22, 2012" "User Manual"
+.SH NAME
+.PP
+stunclient - command line app for the STUN protocol
+.SH SYNOPSIS
+.PP
+\f[B]stunclient\f[] [OPTIONS] server [port]
+.SH DESCRIPTION
+.PP
+stunclient attempts to discover the local host's own external IP
+address, obtain a port mapping, and optionally discover properties
+of the Network Address Translator (NAT) between the host and the
+the server.
+.SH OPTIONS
+.PP
+The following options are supported.
+.PP
+\f[CR]
+ --mode\ MODE
+ --localaddr\ INTERFACE
+ --localport\ PORTNUMBER
+ --family\ IPVERSION
+ --protocol\ PROTO
+ --verbosity\ LOGLEVEL
+ --help
+\f[]
+.PP
+Details of each option and paramters are as follows.
+.PP
+\f[B]server\f[]
+.PP
+The \f[B]server\f[] parameter is the IP address or FQDN of the
+remote server to befrom the binding tests with.
+It is the only required parameter.
+.PP
+ * * * * *
+.PP
+\f[B]port\f[]
+.PP
+The \f[B]port\f[] parameter is an optional parameter that can
+follow the server parameter.
+The default is 3478 for UDP and TCP.
+.PP
+ * * * * *
+.PP
+\f[B]\[em]mode\f[] MODE
+.PP
+Where MODE is either \[lq]basic\[rq] or \[lq]full\[rq].
+\[lq]basic\[rq] mode is the default and indicates that the client
+should perform a STUN binding test only.
+\[lq]full\[rq] mode indicates that the client should attempt to
+diagnose NAT behavior and filtering methodologies if the server
+supports this mode.
+The NAT filtering test is only supported for UDP.
+.PP
+ * * * * *
+.PP
+\f[B]\[em]localaddr\f[] INTERFACE or IPADDRESS
+.PP
+The value for this option may the name of an interface (such as
+\[lq]eth0\[rq] or \[lq]lo\[rq]).
+Or it may be one of the available IP addresses assigned to a
+network interface present on the host (such as
+\[lq]128.23.45.67\[rq]).
+The interface chosen will be the preferred address for sending and
+receiving responses with the remote server.
+The default is to let the system decide which address to send on
+and to listen for responses on all addresses (INADDR_ANY).
+.PP
+ * * * * *
+.PP
+\f[B]\[em]localport\f[] PORTNUM
+.PP
+PORTNUM is a value between 1 to 65535.
+This is the UDP or TCP port that the primary and alternate
+interfaces listen on as the primary port for binding requests.
+If not specified, a randomly available port chosen by the system is
+used.
+.PP
+ * * * * *
+.PP
+\f[B]\[em]family\f[] IPVERSION
+.PP
+IPVERSION is either \[lq]4\[rq] or \[lq]6\[rq] to specify the usage
+of IPV4 or IPV6.
+If not specified, the default value is \[lq]4\[rq].
+.PP
+ * * * * *
+.PP
+\f[B]\[em]protocol\f[] PROTO
+.PP
+PROTO is either \[lq]udp\[rq] or \[lq]tcp\[rq].
+\[lq]udp\[rq] is the default if this parameter is not specified
+.PP
+ * * * * *
+.PP
+\f[B]\[em]verbosity\f[] LOGLEVEL
+.PP
+Sets the verbosity of the logging level.
+0 is the default (minimal output and logging).
+1 shows slightly more.
+2 and higher shows even more.
+.PP
+ * * * * *
+.PP
+\f[B]\[em]help\f[] Prints this help page
+.SH EXAMPLES
+.TP
+.B stunclient stunserver.org 3478
+Performs a simple binding test request with the server listening at
+\[lq]stunserver.org\[rq]
+.RS
+.RE
+.TP
+.B stunclient \[em]mode full \[em]localport 9999 12.34.56.78
+Performs a full set of UDP NAT behavior tests from local port 9999
+to the server listening at IP Address 12.34.56.78 (port 3478)
+.RS
+.RE
+.TP
+.B stunclient \[em]protocol tcp stun.selbie.com
+Performs a simple binding test using TCP to server listening on the
+default port of 3478 at stun.selbie.com
+.RS
+.RE
+.SH AUTHOR
+.PP
+john selbie (jselbie\@gmail.com)
+
View
@@ -79,6 +79,7 @@ ____
**--protocol** PROTO
PROTO is either "udp" or "tcp". "udp" is the default if this parameter is not specified
+
____
**--verbosity** LOGLEVEL
Oops, something went wrong.

0 comments on commit 9b32eee

Please sign in to comment.