Commit Graph

135 Commits

Author SHA1 Message Date
Daniel O'Connor
ea9993dc91 Fix detection on OSX and make detection smarter.
- Fix lsif() on OSX.
- Make lsif() smarter and avoid non-broadcast and no AF_INET addresses.
- Don't run multiple interface detectors, run one at a time until one works.
- Factor out HAVE_IFADDRS_H code into a separate function into lsif.c with the other interface detection routines.
- Prefer HAVE_IFADDRS_H (random bias..)
2012-06-08 16:36:33 +09:30
Daniel O'Connor
8882515d03 Fix compilation on OSX.
- /proc/net/route is Linux only.
- lsif() will work anywhere SIOCGIFCONF is defined.
- Abstract namespace UNIX domain sockets are Linux only.
- Rework code to reduce indent levels.
2012-05-28 15:00:54 +09:30
Andrew Bettison
bea9188cd5 Fix another manifest leak
Add manifest alloc/free debug logging to help, 'debug.manifests' option
2012-05-25 17:01:56 +09:30
Andrew Bettison
0ec3feaa29 Expunge setReason()
Replace with WHY() or WHYF() everywhere

Improve logMessage() to handle file/line/function printing internally

Mainly so that log messages from manifest alloc/free in rhizome_bundle.c
can make it into the Android log
2012-05-24 17:11:55 +09:30
Andrew Bettison
2f6f642a02 Improve log pathname trimming 2012-05-23 18:04:10 +09:30
Andrew Bettison
1af9125392 All rhizome database keys are uppercase hex
FILES.id, MANIFESTS.id, FILEMANIFESTS.fileid, FILEMANIFESTS.manifestid
Named constants for hex and binary ID sizes
2012-05-23 16:04:00 +09:30
gardners
29bb86d9e7 first cut at supressing rhizome activity during calls. 2012-05-22 13:05:29 +09:30
gardners
e3a61f7614 improved WHY() macros to not show build path in messages. 2012-05-22 09:54:10 +09:30
gardners
e44294ea66 implemented server_probe(int *pid) that used monitor interface
to probe server status.  Also returns PID if running (Linux only).
2012-05-21 20:45:07 +09:30
Jeremy Lakeman
9adaf0bd8f Only repeat an audio payload once 2012-05-21 14:14:24 +09:30
gardners
27daf02f81 added peer announcment to monitor interface. 2012-05-21 12:47:54 +09:30
gardners
3ea6d4f324 monitor interface announces new peers. 2012-05-21 12:47:53 +09:30
Daniel O'Connor
990a8f3057 Add support for srtuct ucred on BSD.
This requires building with _GNU_SOURCE to get access to struct ucred on Linux. Previously the test failed on every platform except glibc <2.8 or so.

Building with _GNU_SOURCE causes TRUE to be defined so we can't use this as a variable anymore, and MIN/MAX so don't define our own.
2012-05-21 12:22:50 +09:30
Daniel O'Connor
354258c395 Rename timeout to dnatimeout as it conflicts with ncurses (which is dumb but we can't change ncurses) 2012-05-21 12:20:05 +09:30
Andrew Bettison
b739bfd572 Add catv() function 2012-05-21 00:08:31 +09:30
Andrew Bettison
189ecee4b9 Clean up over-use of WHY() in overlay_mdp.c 2012-05-20 16:06:32 +09:30
gardners
e870c35422 Added very crude multi-hop route determination. 2012-05-17 17:08:59 +09:30
gardners
d2949f1b05 Made VoMP audio packet stuffing limit configurable and larger
so that we can test preemptive audio retransmission before we
implement any codecs.
2012-05-16 11:52:22 +09:30
gardners
0eafc34970 BK encoding and decoding complete, but untested. 2012-05-15 20:04:41 +09:30
Andrew Bettison
f90b21ec78 Implement rhizome config options
rhizome.datastore_path - if not set, reverts to serval instance path
rhizome.enable - if not set, defaults to true
2012-05-15 12:56:10 +09:30
Andrew Bettison
7087afc404 Refactor main() into main.c
Now dna.c only contains code for the old command line
2012-05-15 11:09:21 +09:30
Andrew Bettison
d11258cefc Overhaul debug flags
Config debug flags are now represented as individual items, eg:
   servald config set debug.verbose yes
   servald config set debug.rhizome yes
instead of aggregated, eg:
   servald config set debug verbose,rhizome  <-- no longer works

Added a debug flag "debug.all" that can be set and cleared, over which
individual flag sets/clears take priority.

Slimmed down dna.c by moving some globals and functions to the files where they
are used.

Default command line (help message) is now the new style, not the deprecated
style.
2012-05-14 18:37:32 +09:30
Andrew Bettison
b02e9b9ac4 Overhaul rhizome datastore path code
Create datastore directory and all parent dirs if it does not exist
More robust error checking and buffer overflow protection
New mkdirs() and mkdirsn() functions
2012-05-14 18:37:32 +09:30
gardners
67e6c7ae2a fixed 10 pounds of potatoes in 5 pound sack (FUBAR) bug. 2012-05-14 16:24:58 +09:30
gardners
f0b72955d1 preparation for nacks for retransmission. 2012-05-14 15:44:36 +09:30
Andrew Bettison
e746557a08 Fix bug in overlay_gettime_ms()
The sequence start time was only getting set in overlay_interface_init(), which
was not always called, or was called after overlay_gettime_ms() had already
been used.

Added FATALF(), FATAL() and FATAL_perror() macros.

Removed a bunch of debug statements no longer needed in monitor.c and server.c.
2012-05-11 10:38:46 +09:30
gardners
7b82ccbd7b work on bypass-audio.
CALLSTATUS monitor message has gained a field, thus changing
API for java side.
2012-05-11 08:14:00 +09:30
Andrew Bettison
022e3289dd Quieten new compile warnings 2012-05-10 18:29:00 +09:30
Andrew Bettison
881576212c Fix all trivial compiler warnings 2012-05-10 18:08:59 +09:30
gardners
850d7b42d7 reworked shortcircuit audio code. 2012-05-10 16:58:57 +09:30
Andrew Bettison
b15e5cfee7 Improve debugging/logging macros
Replace 'WHYRETNULL();' statements with 'return WHYNULL();'
Introduce DEBUG(), DEBUGF(), DEBUG_perror() and D macros
Add logMessage() and vlogMessage() functions
Implement setReason() using vlogMessage()
2012-05-10 12:53:57 +09:30
gardners
8d2792ce74 substantial work towards playing audio on IDEOS/G1 type MSM chipset
android phones directly from C to dramatically reduce latency.
2012-05-10 03:47:18 +09:30
Andrew Bettison
d96d8ff8d6 Move signal handling to server.c
Improve diagnostic messages from signal handler

For some reason, signal handler was not being set in server process when called
from main()
2012-05-09 19:06:44 +09:30
Andrew Bettison
68cfa6218c Minor fix to WHY_perror() macro 2012-05-08 17:48:16 +09:30
Andrew Bettison
836f8332e8 Replace perror() with WHY_perror()
Puts more diagnostics to Android log
2012-05-08 14:53:34 +09:30
gardners
596b20b5e8 interactive servald monitor cli command implemented. 2012-05-08 14:41:21 +09:30
Andrew Bettison
391e8d7056 Fix broken stopfile logic
'start' command removes stopfile just before starting
'stop' command removes stopfile after stopping
2012-05-08 12:53:59 +09:30
Andrew Bettison
329189ec8c Fix bodgy server start/stop logic
Rename pidfile 'serval.pid' to 'servald.pid'
Rename stopfile 'doshutdown' to 'servald.stop'
Reinstate checking of stopfile on signals and in main loops
Correct delay loops in 'start' and 'stop' commands
Move some code from commandline.c to server.c
2012-05-08 12:19:52 +09:30
Andrew Bettison
acc5e48f4f Terminate server process if serval.pid clobbered 2012-05-08 11:23:43 +09:30
Andrew Bettison
09f8434a21 Improve "start" command
Add "start exec <exec path>" variants for background mode
Add background startup wait logic, so that pid can be reported to caller
2012-05-07 19:14:52 +09:30
Andrew Bettison
cbc367b1f5 Rewrite server start/status/stop commands
Now correctly probes for server process existence using kill(pid, 0)
Status command does not dump config (use "config get" instead)
Output uses JNI cli output fields
Stop command uses 5 Hz wakeup, not busy wait while server exits
2012-05-07 13:49:38 +09:30
gardners
7b520e7a49 fixed various bugs with priorty dispatch of voice traffic.
some debug tweaking etc.
2012-05-07 08:31:53 +09:30
gardners
ad78627fb6 added PCM codec entry. 2012-05-06 21:12:31 +09:30
gardners
6bc8f5643f better handling of disconnections by monitor clients. 2012-05-04 03:58:34 +09:30
gardners
4f09ccebdc further work towards working monitor interface.
sending DTMF works now, and DTMF packets are received back.
2012-05-04 03:44:41 +09:30
gardners
98ea86bde0 added new /proc/net/route method to find interfaces on android
(would you believe that using ifconfig to READ about interfaces
requires ROOT on android).
should also help for interfaces with multiple addresses.
2012-05-03 22:46:00 +09:30
Andrew Bettison
eab6dafcc7 Make commandline.c error messages appear on Android log 2012-05-03 14:50:14 +09:30
gardners
25f81aeaaf fixed bug with cancelling calls due to lack of listeners.
worked around poll() with accept() unix domain socket linux bug.
generally hooked in the unix domain stream socket interface for
monitoring calls (and later rhizome).
2012-05-03 03:37:03 +09:30
gardners
eb8ffeb71f progress towards monitor interface for following calls. 2012-05-03 03:00:34 +09:30
gardners
d637f31ab7 work towards stream unix domain socket to allow Android/Java
monitoring of call status and rhizome bundle arrivals.
2012-05-03 02:31:12 +09:30