Commit Graph

33 Commits

Author SHA1 Message Date
Jeremy Lakeman
32dd9f7b15 Move msp_proxy state from a global to the stack 2016-05-10 12:05:49 +09:30
Jeremy Lakeman
76be37a04e Add API for msp from within the daemon 2016-05-09 11:10:50 +09:30
Andrew Bettison
52106b5026 Move DEBUGF() from "log.h" to "debug.h"
Include "debug.h" in lots of places (not all)
New macro IDEBUGF() for indirect debug flag, used in HTTP server
2015-07-13 18:24:04 +09:30
Andrew Bettison
7d9a5faa4e Move if(config.debug.xxx) tests into DEBUGF()
Original DEBUG() and DEBUGF() macros renamed to _DEBUG() and _DEBUGF()
New DEBUG() and DEBUGF() macros, first argument is flagname
New DEBUGF2(foo, bar, ...) macro does if(config.debug.foo||config.debug.bar) test
Replace almost all config.debug.xxx references to IF_DEBUG(xxx)
2015-07-13 16:00:05 +09:30
Jeremy Lakeman
2ec63b371a Build the array of console commands by using linkage tricks 2014-08-22 10:36:52 +09:30
Andrew Bettison
7e1fbe8c76 Refactor to fix some OS-X compile warnings
Fixes two minor bugs that escaped notice until now
2014-08-14 17:39:44 +09:30
Andrew Bettison
d436705e64 Fix conflict on UNUSED() macro from OpenJDK 7
The OpenJDK 7 recently introduced the UNUSED() macro in their jni_md.h
header file, which is included from <jni.h>.  This causes a
compile-error if "constants.h", which defines our own UNUSED() macro, is
included as well as <jni.h>.

The OpenJDK UNUSED() macro is unsuitable for our own use, because it
prefixes the unused identifier with "UNUSED_" whereas we depend on the
parameter name remaining unchanged.

I have reported this as a Request for Enhancement with Oracle Java,
asking them to remove the UNUSED() macro, since it is not used by any
JNI or Java extension header files.  Review ID: JI-9013689.

In the meantime, constants.h now undefines UNUSED before defining it, so
including <jni.h> before "constants.h" will avoid a compile error.
2014-07-23 11:55:55 +09:30
Jeremy Lakeman
9f6ace518a Test that msp listen --service_name shuts down 2014-06-23 14:23:30 +09:30
Jeremy Lakeman
77dc7fc14c Disable and remove pthreads to support compiling with clang 2014-06-11 20:32:16 +09:30
Andrew Bettison
757e6c62ab Merge network simulator into development 2014-05-26 15:52:40 +09:30
Andrew Bettison
21f51965c1 Overhaul Makefile and header files
Make .o files in separate subdirectories for servald and library
Factor struct __sourceloc and __WHENCE__ from "log.h" into "whence.h"
Factor sid_t etc from "serval.h" into "serval_types.h"
Factor rhizome_bid_t etc from "rhizome.h" into "rhizome_types.h"
Do not include "serval.h" in library sources
Add log_stderr.c and logMessage.c for stand-alone executables
2014-05-26 15:36:26 +09:30
Jeremy Lakeman
61bab9d6d6 Squelch msp logging output 2014-05-26 13:57:25 +09:30
Jeremy Lakeman
506b6ed57c Call msp handler on a timer to prevent stalling 2014-05-22 14:22:17 +09:30
Jeremy Lakeman
c0c5412931 Add support for STOPping a connection before shutdown 2014-05-21 17:17:07 +09:30
Jeremy Lakeman
998a40938b Be more careful setting alarm times 2014-05-21 11:51:23 +09:30
Andrew Bettison
42d4ed0d43 Improve MSP documentation
Rename "Mesh Streaming Protocol" to "Mesh Stream Protocol"
2014-05-19 17:26:54 +09:30
Jeremy Lakeman
5f9ffefcfc Watch mdp socket on new tunnelled connections 2014-05-15 16:38:22 +09:30
Andrew Bettison
12a0ca4e8f Improve MSP API
Replace struct msp_sock * with typedef MSP_SOCKET
Add new 'flags' arg to msp_socket(), unused for now
msp_send() returns ssize_t number of bytes sent; -1 for error
MSP handler returns size_t; number of bytes consumed
Add MSP_MESSAGE_SIZE definition
Rename msp_set_remote() -> msp_connect()
Rename msp_get_local_adr() -> msp_get_local()
Rename msp_get_remote_adr() -> msp_get_remote()
msp_set_local() takes (const struct *) arg2
msp_connect() takes (const struct *) arg2
void msp_set_local(), msp_connect(), msp_listen(), msp_set_handler()
2014-05-15 16:24:59 +09:30
Jeremy Lakeman
bb39bb871a Only unwatch if we were watching 2014-05-09 15:13:13 +09:30
Jeremy Lakeman
672104bdd8 Create extensible service discovery protocol, with initial basic implementation 2014-05-09 11:21:18 +09:30
Andrew Bettison
1f49ee47ae Add missing copyright messages 2014-04-07 14:39:21 +09:30
Jeremy Lakeman
b8971e51f4 Refactor socket helper functions to take socket_address struct 2014-02-20 14:44:38 +10:30
Jeremy Lakeman
e0c2d59ab5 Shutdown local tcp connection when remote msp connection has shutdown 2014-01-10 15:37:00 +10:30
Jeremy Lakeman
d7206e10d7 Ensure MSP sockets are processed for incoming tcp connections 2014-01-10 12:56:41 +10:30
Jeremy Lakeman
f085ffec50 Add SIGINT handler to cleanup mdp sockets 2014-01-09 15:06:35 +10:30
Jeremy Lakeman
dbb65228e6 Deal with errors when binding sockets 2014-01-09 15:06:35 +10:30
Jeremy Lakeman
48dce9a575 Add tcp forwarding on the listen end of an MSP connection 2014-01-09 15:06:35 +10:30
Jeremy Lakeman
99e08d1516 Add command to support forwarding TCP connections to an MSP service 2014-01-09 15:06:35 +10:30
Jeremy Lakeman
e09387b27d Refactor stdio handling 2014-01-09 15:06:34 +10:30
Jeremy Lakeman
df6af96455 Test connection keep alive and timeouts 2014-01-09 15:01:37 +10:30
Jeremy Lakeman
741442c54c Pipe file contents across msp connection 2014-01-09 15:01:37 +10:30
Jeremy Lakeman
3a533187b7 Improve msp failure handling 2014-01-09 15:01:37 +10:30
Jeremy Lakeman
db7f68afd7 Initial msp library implementation with connection state tracking 2014-01-09 15:01:37 +10:30