aprsc/src
Heikki Hannikainen 3d9abf32ed worker: Reduce debug logging 2013-02-23 12:35:22 +02:00
..
debian init scripts: put liveupgrade in help texts 2012-11-01 23:52:53 +02:00
gfx Moved graphics to gfx/ 2012-10-30 21:28:04 +02:00
m4 Really, really check for GNU make 2012-08-18 14:16:06 +00:00
rpm init scripts: put liveupgrade in help texts 2012-11-01 23:52:53 +02:00
tools publish sleeptest.c tool 2013-01-31 14:58:01 +02:00
web Fix new time handling to get uptime right, and convert client 2013-02-21 00:29:29 +02:00
.gitignore gitignore additions 2012-09-30 23:36:32 +00:00
LICENSE mention Heikki in the license, update years 2012-09-18 07:18:43 +00:00
Makefile.in http: Implement gzip transfer-encoding for static files 2013-02-23 10:25:29 +02:00
README.sources Copyright/license markers to messaging.c, and mention it in the source index 2012-09-01 21:24:32 +00:00
VERSION version 1.8.2 2013-02-06 19:14:50 +02:00
ac-hdrs.h.in autoconf: Check for zlib (lib and header) 2013-02-22 12:20:59 +02:00
accept.c Fix new time handling to get uptime right, and convert client 2013-02-21 00:29:29 +02:00
accept.h implemented UDP submit support 2012-08-28 07:05:32 +00:00
acl.c Fixed issue 6: IPv6 ACL matching was broken, fixed by a htonl() 2012-09-22 16:07:24 +03:00
acl.h Implemented ACLs for listening sockets, both IPv4 and IPv6. 2012-06-05 19:53:09 +00:00
aclocal.m4 Handle FreeBSD's i386 machine type, and don't do gmake redirection if make is GNU make 2012-08-19 06:32:29 +00:00
apparmor.aprsc Live upgrade: Fixes for lib and lib64 bind mounts 2012-10-23 19:58:25 +00:00
aprsc.8.in Formatting fixes on aprsc(8) man page. Now also the print version is decent looking. 2012-08-24 21:45:55 +00:00
aprsc.c Fix new time handling to get uptime right, and convert client 2013-02-21 00:29:29 +02:00
aprsc.conf Fix configuration example and document to point out that the 2012-10-17 23:36:25 +03:00
aprsc_munin munin plugin: Pull peer serverIDs to peer traffic graph 2012-11-23 10:16:51 +02:00
cJSON.c
cJSON.h
cellmalloc.c allow testing with 40000 clients 2012-10-11 22:43:32 +03:00
cellmalloc.h HTTP: Implement giving out static files to support AJAX based status view. 2012-06-06 21:35:46 +00:00
cfgfile.c PeerGroup config: Specify remote ServerIDs before IP addresses 2012-11-20 22:15:35 +02:00
cfgfile.h
client_heard.c timekeeping: Use clock_gettime CLOCK_MONOTONIC when available 2013-02-19 18:09:15 +02:00
client_heard.h Slightly optimize the most frequently called function, heard_find() 2012-11-15 22:05:14 +02:00
clientlist.c clientlist: reorder struct fields to remove alignment padding 2012-11-20 22:07:07 +02:00
clientlist.h
config.c config: Validate serverid length to be small enough 2013-02-05 13:47:29 +02:00
config.h timekeeping: Use clock_gettime CLOCK_MONOTONIC when available 2013-02-19 18:09:15 +02:00
configure autoconf: Check for zlib (lib and header) 2013-02-22 12:20:59 +02:00
configure.ac autoconf: Check for zlib (lib and header) 2013-02-22 12:20:59 +02:00
counterdata.c counterdata & uplink: add and fix comments. Remove unused 2012-09-21 01:58:45 +03:00
counterdata.h Free memory allocated by counterdata+status to keep valgrind happy in the end 2012-08-28 21:41:57 +00:00
dupecheck.c timekeeping: Use clock_gettime CLOCK_MONOTONIC when available 2013-02-19 18:09:15 +02:00
dupecheck.h Use eventfd() on Linux to wake up dupecheck when packets are available 2012-11-16 18:23:42 +02:00
errno.c Further connection close message improvements 2012-10-14 03:10:29 +03:00
errno.h Report more thruthful error message for client/uplink quits 2012-10-14 02:31:48 +03:00
filter.c timekeeping: Use clock_gettime CLOCK_MONOTONIC when available 2013-02-19 18:09:15 +02:00
filter.h Added a new messaging module to contain messaging functions. 2012-09-01 09:26:01 +00:00
gai_strerror.c
getnameinfo.c
historydb.c timekeeping: Use clock_gettime CLOCK_MONOTONIC when available 2013-02-19 18:09:15 +02:00
historydb.h live upgrade: Initial dump&reload support for historydb 2012-10-22 12:58:47 +03:00
hlog.c Fix issue 20: Escape unprintable characters when logging packets 2013-02-19 18:02:49 +02:00
hlog.h Fix issue 20: Escape unprintable characters when logging packets 2013-02-19 18:02:49 +02:00
hmalloc.c
hmalloc.h
http.c http: Less debug log from compression 2013-02-23 11:59:33 +02:00
http.h implemented UDP submit support 2012-08-28 07:05:32 +00:00
incoming.c Fix issue 20: Escape unprintable characters when logging packets 2013-02-19 18:02:49 +02:00
incoming.h Parse most data out of 3rd-party packets, add tests. 2013-02-05 13:28:22 +02:00
inet_ntop.c
inet_pton.c
install-sh Maybe slightly working make install + deb pkg building setup 2012-08-18 21:39:51 +00:00
keyhash.c silence compiler warning around a constant 2012-07-30 11:04:20 +00:00
keyhash.h keyhash: add missing function prototype 2012-07-30 08:04:29 +00:00
login.c login: Fix logging of too long username 2013-02-23 12:31:21 +02:00
login.h Live upgrade: fix UDP, pass ibuf/obuf, and filters. 2012-10-19 22:35:37 +03:00
messaging.c Use random() instead of rand() for better randomness. 2012-09-02 21:07:21 +00:00
messaging.h Rework client message generation to messaging_message_client(() 2012-09-01 10:22:37 +00:00
netdb6.h
netlib.c
netlib.h
outgoing.c Classify clients only when they have logged in. Use classification 2013-02-01 07:33:04 +02:00
outgoing.h
parse_aprs.c Fix issue 20: Escape unprintable characters when logging packets 2013-02-19 18:02:49 +02:00
parse_aprs.h Started working on filter-command-in-message support, parse incoming text 2012-09-01 07:58:17 +00:00
parse_qc.c Fix issue 20: Escape unprintable characters when logging packets 2013-02-19 18:02:49 +02:00
parse_qc.h Do not permit logging in with a callsign which has non-alphanumeric 2012-08-27 15:56:25 +00:00
passcode.c
passcode.h
rwlock.c Removed GPL note. 2012-08-05 08:19:33 +00:00
rwlock.h
status.c Fix new time handling to get uptime right, and convert client 2013-02-21 00:29:29 +02:00
status.h Fix new time handling to get uptime right, and convert client 2013-02-21 00:29:29 +02:00
uplink.c timekeeping: Use clock_gettime CLOCK_MONOTONIC when available 2013-02-19 18:09:15 +02:00
uplink.h Fixed UDP received packets accounting 2012-07-30 10:09:06 +00:00
version.c Implemented building and version control information collection 2012-09-18 19:16:40 +03:00
version.h version 1.8.2 2013-02-06 19:14:50 +02:00
version_branch.h Generate version information on every build 2012-08-24 07:58:24 +00:00
worker.c worker: Reduce debug logging 2013-02-23 12:35:22 +02:00
worker.h timekeeping: Use clock_gettime CLOCK_MONOTONIC when available 2013-02-19 18:09:15 +02:00
xpoll.c coverity: xpoll epoll: Check fcntl return value, log error as necessary 2013-02-02 19:40:04 +02:00
xpoll.h xpoll/startup: log on INFO level at startup, which mechanism is used 2012-10-11 01:57:36 +03:00

README.sources

This file attempts to describe the contents of the aprsc
source tree. When adding files, please describe them here. Thanks!

aprsc.c
	Contains a command line parser, the main signal handler, and
	a small main loop, which only calls time() to update a global
	"now" variable (to reduce the amount of system calls). At startup
	it reads the configuration and starts up the accept thread,
	which in turns starts worker threads. It can also trigger
	reconfiguring and log reopening on when signals are received,
	and start a graceful shutdown.

accept.c
	Contains the accept thread, which listens on the configured TCP/UDP
	sockets, accepts (or denies) new connections, and passes them
	to the worker thread with least existing connections. When
	a lot of connections arrive quickly, multiple connections
	are transferred to a worker in a single transaction to reduce
	lock congestion.

worker.c
worker.h
	Contains the body of the worker thread. worker.h defines most
	of the interesting data structures and is a good place to
	start digging.
	
	Worker threads process incoming and outgoing data. There are 1..n
	workers, where N is 1 to 4 (more really doesn't make sense at this
	point, and 1 is probably good too). Incoming data is parsed,
	preprocessed, and passed on to the dupecheck thread which
	marks duplicate packets as such. Dupecheck returns the packets to
	the workers which then pass on them to the right clients.

login.c
	Contains a login_handler() function which is called by the
	worker thread to process an incoming "user" command from
	a new client.

uplink.c
	The uplink management thread takes care of connecting to
	remote upstream servers as needed. It also contains the handlers
	necessary for logging in to a server. After a successful connect()
	the connection is passed to a worker thread, but the login
	handshake incoming data handlers for the login phase can be found
	in uplink.c.

incoming.c
	Contains the incoming_handler() function which is called
	by the worker thread to process incoming APRS-IS data
	line by line. Decodes basic IS packet format and calls
	the Q construct processor and the APRS decoder.

outgoing.c
	Checks which outgoing packets should be sent to each client by
	calling filter functions, and does the actual sending.

filter.c
	APRS-IS filter used by the outgoing packet processing.
	It tells if the packet should be sent out on given client socket,
	depending on the user's preferences.

parse_aprs.c
	A simple APRS parser for aprsc. Translated from Ham::APRS::FAP
	perl module (by OH2KKU). Only needs to get lat/lng out of the
	packet, and classify the type of the packet, other features would
	be unnecessary in this application, and slow down the parser.
	Called by incoming.c.

parse_qc.c
	Parses and possibly generates a new Q construct, or modifies
	an existing one. Called by incoming.c.

messaging.c
	Contains utility functions for processing received APRS text
	messages and generating new messages.

clientlist.c
	Clientlist contains a list of connected clients, along with their
	verification status. It is updated when clients connect or disconnect,
	and lookups are made more often by the Q construct algorithm.
	
	This list is maintained so that the login handler can find duplicate
	verified logins, and that the Q construct handler can lookup
	verified logins without locking and walking the other worker thread's
	client list.

client_heard.c
	The client's heard list contains a list of stations heard by
	a given client. It's used for message routing by the
	message destination callsign.
	
	The module also maintains a list of callsigns which have transmitted
	messages to a given client. The list is used to pass courtesy
	positions to the client.
	
	The heard list is only called by the worker thread operating
	on that client socket, so it shouldn't need any locking at all.

config.c
	Code to read (and reread) configuration using the services
	provided by cfgfile.c. Validates configuration and takes
	it into use. Contains global configuration variables.

http.c
	HTTP server implemented using libevent2. Runs in a single thread,
	event-driven, provides access to the status page and HTTP
	position uploads.

--- Libraries ---

The following source code files have rather clean APIs, are not specific to
to the aprsc project, and are usablein other projects as such.

netlib.c
	A few network socket utility functions.

xpoll.c
	A wrapper for different select/poll/epoll implementations.
	Currently only contains support for poll(). Should maybe
	support select() for ancient systems. The following platform-
	specific APIs would provide improved performance: epoll()
	on Linux 2.6, kqueue on new *BSD, /dev/poll on new Solaris
	releases. Written for the aprsc project by Heikki Hannikainen,
	OH7LZB.

passcode.c
	aprs_passcode() function to calculate the checksum used as the
	"password" int the APRS-IS login command. Released to the
	open source APRS community by Steve Dimse, K4HG, on April 11,
	2000. Obtained from the aprsd sources, which are GPL.

acl.c
	Access list code for limiting server access based on IP address.

hlog.c
	A logging library written by Heikki Hannikainen, OH7LZB,
	for some old project. Supports logging to syslog, stderr,
	and a log file, with configurable log levels and rotation
	(reopen on SIGHUP).
	
hmalloc.c
	malloc/realloc/free/strdup wrappers with error checking.
	Please use these in this project. Written by Hessu, OH7LZB.

cfgfile.c
	A configuration file parser written by Tomi Manninen, OH2BNS,
	originally for the node(1) program in the ax25-utils package.

keyhash.c
	Various attempts at keyhashing.
	Contains algorithms:
	  - FNV-1a
	  - CRC32
	Currently using FNV-1a

rwlock.c
	A schoolbook pthread rwlock implementation for systems
	lacking one (Solaris 2.6 to name one).
	From the book "Programming with POSIX Threads", by
	David R. Butenhof. Appears in modified and GPL'ed form in at
	least the Bacula sources.

inet_ntop.c, inet_pton.c, getnameinfo.c, gai_strerror.c:
	Backup instances of IPv4/IPv6 agnostic resolver library just
	in case the operating system does not have it.
	(From ZMailer by Matti Aarnio, OH2MQK)