1
2This file attempts to describe the contents of the aprsc
3source tree. When adding files, please describe them here. Thanks!
4
5aprsc.c
6 Contains a command line parser, the main signal handler, and
7 a small main loop, which only calls time() to update a global
8 "now" variable (to reduce the amount of system calls). At startup
9 it reads the configuration and starts up the accept thread,
10 which in turns starts worker threads. It can also trigger
11 reconfiguring and log reopening on when signals are received,
12 and start a graceful shutdown.
13
14accept.c
15 Contains the accept thread, which listens on the configured TCP/UDP
16 sockets, accepts (or denies) new connections, and passes them
17 to the worker thread with least existing connections. When
18 a lot of connections arrive quickly, multiple connections
19 are transferred to a worker in a single transaction to reduce
20 lock congestion.
21
22worker.c
23worker.h
24 Contains the body of the worker thread. worker.h defines most
25 of the interesting data structures and is a good place to
26 start digging.
27
28 Worker threads process incoming and outgoing data. There are 1..n
29 workers, where N is 1 to 4 (more really doesn't make sense at this
30 point, and 1 is probably good too). Incoming data is parsed,
31 preprocessed, and passed on to the dupecheck thread which
32 marks duplicate packets as such. Dupecheck returns the packets to
33 the workers which then pass on them to the right clients.
34
35login.c
36 Contains a login_handler() function which is called by the
37 worker thread to process an incoming "user" command from
38 a new client.
39
40uplink.c
41 The uplink management thread takes care of connecting to
42 remote upstream servers as needed. It also contains the handlers
43 necessary for logging in to a server. After a successful connect()
44 the connection is passed to a worker thread, but the login
45 handshake incoming data handlers for the login phase can be found
46 in uplink.c.
47
48incoming.c
49 Contains the incoming_handler() function which is called
50 by the worker thread to process incoming APRS-IS data
51 line by line. Decodes basic IS packet format and calls
52 the Q construct processor and the APRS decoder.
53
54outgoing.c
55 Checks which outgoing packets should be sent to each client by
56 calling filter functions, and does the actual sending.
57
58filter.c
59 APRS-IS filter used by the outgoing packet processing.
60 It tells if the packet should be sent out on given client socket,
61 depending on the user's preferences.
62
63parse_aprs.c
64 A simple APRS parser for aprsc. Translated from Ham::APRS::FAP
65 perl module (by OH2KKU). Only needs to get lat/lng out of the
66 packet, and classify the type of the packet, other features would
67 be unnecessary in this application, and slow down the parser.
68 Called by incoming.c.
69
70parse_qc.c
71 Parses and possibly generates a new Q construct, or modifies
72 an existing one. Called by incoming.c.
73
74messaging.c
75 Contains utility functions for processing received APRS text
76 messages and generating new messages.
77
78clientlist.c
79 Clientlist contains a list of connected clients, along with their
80 verification status. It is updated when clients connect or disconnect,
81 and lookups are made more often by the Q construct algorithm.
82
83 This list is maintained so that the login handler can find duplicate
84 verified logins, and that the Q construct handler can lookup
85 verified logins without locking and walking the other worker thread's
86 client list.
87
88client_heard.c
89 The client's heard list contains a list of stations heard by
90 a given client. It's used for message routing by the
91 message destination callsign.
92
93 The module also maintains a list of callsigns which have transmitted
94 messages to a given client. The list is used to pass courtesy
95 positions to the client.
96
97 The heard list is only called by the worker thread operating
98 on that client socket, so it shouldn't need any locking at all.
99
100config.c
101 Code to read (and reread) configuration using the services
102 provided by cfgfile.c. Validates configuration and takes
103 it into use. Contains global configuration variables.
104
105http.c
106 HTTP server implemented using libevent2. Runs in a single thread,
107 event-driven, provides access to the status page and HTTP
108 position uploads.
109
110--- Libraries ---
111
112The following source code files have rather clean APIs, are not specific to
113to the aprsc project, and are usablein other projects as such.
114
115netlib.c
116 A few network socket utility functions.
117
118xpoll.c
119 A wrapper for different select/poll/epoll implementations.
120 Currently only contains support for poll(). Should maybe
121 support select() for ancient systems. The following platform-
122 specific APIs would provide improved performance: epoll()
123 on Linux 2.6, kqueue on new *BSD, /dev/poll on new Solaris
124 releases. Written for the aprsc project by Heikki Hannikainen,
125 OH7LZB.
126
127passcode.c
128 aprs_passcode() function to calculate the checksum used as the
129 "password" int the APRS-IS login command. Released to the
130 open source APRS community by Steve Dimse, K4HG, on April 11,
131 2000. Obtained from the aprsd sources, which are GPL.
132
133acl.c
134 Access list code for limiting server access based on IP address.
135
136hlog.c
137 A logging library written by Heikki Hannikainen, OH7LZB,
138 for some old project. Supports logging to syslog, stderr,
139 and a log file, with configurable log levels and rotation
140 (reopen on SIGHUP).
141
142hmalloc.c
143 malloc/realloc/free/strdup wrappers with error checking.
144 Please use these in this project. Written by Hessu, OH7LZB.
145
146cfgfile.c
147 A configuration file parser written by Tomi Manninen, OH2BNS,
148 originally for the node(1) program in the ax25-utils package.
149
150keyhash.c
151 Various attempts at keyhashing.
152 Contains algorithms:
153 - FNV-1a
154 - CRC32
155 Currently using FNV-1a
156
157rwlock.c
158 A schoolbook pthread rwlock implementation for systems
159 lacking one (Solaris 2.6 to name one).
160 From the book "Programming with POSIX Threads", by
161 David R. Butenhof. Appears in modified and GPL'ed form in at
162 least the Bacula sources.
163
164inet_ntop.c, inet_pton.c, getnameinfo.c, gai_strerror.c:
165 Backup instances of IPv4/IPv6 agnostic resolver library just
166 in case the operating system does not have it.
167 (From ZMailer by Matti Aarnio, OH2MQK)
168