UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / doc / techlogs / 2000 / kes09Jan00
blob3c798041b41d4c4f269666a64fd7530ab955b7ea
1          Technical notes on my code submission of 09 Jan 00
2                         Kern Sibbald
4 General:
5 - I worked on porting apcupsd to Windows under CYGWIN.
6 - Redesigned the Network Information Server protocol
7   to allow the server to send back any amount of information.
8   This was accomplished by terminating each server response
9   with a record having a zero length -- much like when
10   read() gets and EOF.
12 Changes submitted this submission:
13 - Modified configure.in and Makefile.in to check and use
14   the executable extension (necessary for apcnetd.
15 - Used the new network protocol to pass the EVENTS records
16   one at a time rather than in a big block. This simplified
17   the code on the sending and receiving ends.
18 - apcnetd.c and apcserver.c, in general cleaned up the 
19   error handling somewhat and modified to protocol to send
20   a zero length record at the end of every transmission.
21   Also for CYGWIN, I removed the fork() as this seems
22   to cause some problems in inheritance of handles.
23   I also cleaned up the error messages, putting the lengths
24   as compiler defined rather than hard coding them.
25 - apcnetlib.c. There was no change in logic, just a lot of
26   little changes to return proper error statuses. None of
27   the core code really takes advantage of all the statuses
28   returned, but it is there if needed.
29 - apcstatus.c removed some code that will never be used.
30 - upsfetch -- modified the code to use the new protocol.
31   This considerably simplifies the code.
32 - In the distributions/win32 directory, I now have a 
33   skeleton Makefile (it doesn't do installation yet),
34   a correct shutdown program, and functioning apccontrol
35   and apcupsd scripts.
36 - Made a simple UPS icon for apcupsd.exe on Windows machines.
37 - Updated makediff to cope with the win32 directory.
38 - Enhanced the examples/client.c program to work with the
39   new network protocol.  You will notice that it too is much
40   simpler than the old protocol.
41 - Added function prototypes to apc_winipc.h.
42 - Did a lot of cleanup of the manual. All files are now correct
43   HTML (not always easy) except for the upsbible, which still
44   contains a lot of errors from the original author. There were
45   so many that I got tired of correcting them. Most of them
46   are like compiler warning messages, they are harmless, but
47   do not conform to the HTML standard.
50                 Kern's ToDo List
52 To do:
53 - Setuid of network processes to "nobody".
54 - Check time delays in shutdown especially for master/slaves.
55 - Look at Vladimir's code.
56 - Set appropriate permissions on files in /etc/apcupsd during
57   make install.
58 - Finish the rpm spec file.
61 Wish list:
62 - Make an apcupsd terminating event so that 
63   a script gets control and can notify me.
64 - Add remaining time before TIMEOUT to STATUS output.
65 - Add more commands (individual variables) to apcnetd
66 - Accumulate time on batteries and number of transfers
67   to batteries. Perhaps save history in file so that the
68   info can be recovered if apcupsd restarts.
69 - Fix apcupsd so that it respawns the server if it
70   dies (limit number of times). This will avoid the
71   possibility that someone can bring down our apcupsd
72   by connecting via Internet (denial of service attack,
73   or exploit possible buffer overflow).
74 - Make apcaccess use the network code as an option.
75 - Remember date and time when apcupsd started.
76 - Eliminate rest of character command codes using new
77   capabilities code in apcsetup.c (for setup stuff).
78 - Eliminate the rest of the printfs().
79 - Eliminate as many error_aborts as possible in making
80   new events.
81 - Possibly retab new cgi/net server code
82 - Apparently during self test, apcupsd thinks that the
83   power was lost. Distinguish this condition!
84 - Pass second argument to apccontrol indicating if
85   we are master/slave and other info.
86 - STATUS file should be opened with open() rather
87   than fopen(). Some small changes required. 
88 - Expand Last UPS Self Test field in cgi program
89 - Update make clean to remove distributions/*/apccontrol.sh
91 Done:
93 Will not do:
94 - Automatic conversion of old apcupsd.config files
95   to the new format?