]> Kevux Git Server - fll/commit
Progress: controller program, add exit support.
authorKevin Day <thekevinday@gmail.com>
Tue, 20 Apr 2021 23:16:45 +0000 (18:16 -0500)
committerKevin Day <thekevinday@gmail.com>
Tue, 20 Apr 2021 23:29:18 +0000 (18:29 -0500)
commit4c56593f06200607d52ef183517a764277306c5b
tree74f074c156726de29ad899b6373e4136a2f1e6ba
parentec8f7b14fd0b0e22f21434d0178c88c590a9280d
Progress: controller program, add exit support.

This implements the initial work needed to get exit files working.

A new thread is added to handle both "entry" and "exit" to free up the "rule" thread and allow for the "exit" to start will the "rule" thread exists.

The thread enabled process is now more complex given that there needs to be stages so that "exit" threads can work while "entry" or "control" operations begin terminating.
Add several helper functions to help simplify the detection.

Add an "alert" lock to send/receive alerts.
This is a more general purpose lock that tells something waiting on the alert to wake up and see if anything you care about changed.

The file loading now needs to be aware of "optional" files, namely the exit files.
If the named exit file does not exist, then do not care as it is not required (unlike entry and rule files).

Many of the read and write locks are now timed so that they can check to see if the controller is enabled or not.

While working on this I noticed some oversights and things that I did not previously consider.
I need to follow this up with a redesign in the entry/exit rule handling.

Instead of "rule", I should have the rule actions like "start" and "stop".

There needs to be support for default behaviors, such as allow for "stop" to not have a parameter and to correctly find and terminate a service.

There needs to be consideration on dependencies when exiting, perhaps there needs to be an exit-specific dependency management.
21 files changed:
level_3/controller/c/controller.c
level_3/controller/c/controller.h
level_3/controller/c/private-common.c
level_3/controller/c/private-common.h
level_3/controller/c/private-controller.c
level_3/controller/c/private-controller.h
level_3/controller/c/private-entry.c
level_3/controller/c/private-entry.h
level_3/controller/c/private-rule.c
level_3/controller/c/private-rule.h
level_3/controller/c/private-thread.c
level_3/controller/c/private-thread.h
level_3/controller/data/settings/example/exits/serial.exit [new file with mode: 0644]
level_3/controller/data/settings/example/exits/sshd.exit [new file with mode: 0644]
level_3/controller/data/settings/example/rules/serial/s_1.rule
level_3/controller/data/settings/example/rules/serial/s_2.rule
level_3/controller/data/settings/example/rules/serial/s_3.rule
level_3/controller/data/settings/example/rules/serial/s_4.rule
level_3/controller/data/settings/example/rules/serial/s_5.rule
level_3/controller/data/settings/example/rules/serial/s_6.rule
level_3/controller/data/settings/example/rules/service/sshd.rule