/*
* Copyright (c) 2019 Clementine Computing LLC.
*
* This file is part of PopuFare.
*
* PopuFare is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PopuFare is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with PopuFare. If not, see .
*
*/
#ifndef _COMMON_CFG
#define _COMMON_CFG
//-----------------------------------------------------------------
//------------------------ OPERATIONAL THRESHOLDS AND MAGIC STRINGS
//-----------------------------------------------------------------
#define MOTION_THRESHOLD (0.5f) //we're moving if our velocity exceeds 0.5 m/sec
#define ROLLOVER_TIME_WINDOW (10 * 60) //We count a stop as an option to roll over to if we're within +/- ROLLOVER_TIME_WINDOW seconds
#define ROLLOVER_DISTANCE (60.0f) //We count a stop as an option to roll over to if we are also within ROLLOVER_DISTANCE meters of its GPS location
#define MIN_SATS_FOR_TIME (3) //We are willing to set the system clock if we have at least this many GPS satellites in view
#define MAX_GPS_CLOCK_DRIFT (10) // We insist in setting the system clock if it has drifted from GPS time by more than
//MAX_GPS_CLOCK_DRIFT seconds (provided we have at least MIN_SATS_FOR_TIME satellites in view).
#define GPS_DATE_CENTURY (2000) // For fuck's sake, NMEA GPS dates are not Y2K compliant and use only two digits. We
//must assume a century, we'll assume it is the 21st century.
#define GPS_STALE_THRESHOLD (5) //If we go five seconds without a GPS update we consider our GPS signal kaput.
#define CLEAR_GPS_ON_STALE //Define this if we want to clear all GPS values when we make a valid --> stale transition.
#define ROLLOVER_FORWARD_ONLY //Define this if you want to prevent rollover to a lesser or equal paddle stop
#define ROLLOVER_TO_FURTHEST_STOP // Define this if you want the rollover keep hunting after the first match to
//find the LAST stop in the paddle which meets the time and location criteria.
//this is desirable if you have a route change where a bus arrives at a stop as
//one route and turns into another at that stop and you want this corner case to
//board all riders with the rules for the route the bus will LEAVE the stop as.
#define ACCEPT_STR "ACCEPT"
#define REJECT_STR "REJECT"
#define PASSBACK_STR "PASSBACK"
// This makes the passdb module reject a card offhand (but not put it in the billing log)
//if there is no driver logged in. This will also cause the driver's console to beep a reject beep
//which will serve as a reminder to log in...
//#define REJECT_IF_NO_DRIVER
// This define makes the passdb module's rule engine enter a debugging mode for the NEXT call of a rule which
//asserted scheme_error during its last execution. This debugging mode generates quite verbose debug information (pages)
//tracing every action taken by the scheme interpreter, and which order they occurred in, such that we on the server side
//can see immediately where the bug is in a rule that is crashing in the field.
#define TRACE_NEXT_CALL_OF_FAILED_RULE
// This define makes the passdb module's rule engine take the debugging output from the rule call under trace and write it
//in a file called "/tmp/RULE-NAME.trace" (replacing any previous contents) which will un-clog the diagnostic log with
//unsolicited traces, but it will require us to log in remotely to the bus in question and snag its trace dropfiles over the
//reverse-phone-home mechanism.
#define TRACE_RULE_CALL_TO_FILE
#define MAGIC_DRIVER_NAME "AdminMode" //A magic string that appears as the driver name for the driver login that goes to admin mode
#define MACIC_DRIVER_MENU "admin" //The name of the menu to go to when this driver logs in
#define PASSENGER_MESSAGE_DURATION (5) //How long to leave passenger messages up on the PIU display line 2
#define PIU_DEVICE_ID "rider_ui" //Device ID returned in the "/?:" line from the PIU
#define DIU_DEVICE_ID "driver_ui" //Device ID returned in the "/?:" line from the DIU
#define ACCUM_SECONDS (1) //Number of seconds to wait for an EOL from a serial port
//before declaring the line ended (see notes on open_rs232_device()
//in common_defs.h for more details).
#define DEVICE_TEST_TRIES (3) //How many times to try asking what a connected device is...
#define DEVICE_TEST_TIMEOUT (5000) //How long to wait for a device ID line (in milliseconds) after sending a "\r" for each try
#define MAX_EQUIPNUM (9999) //What is the largest allowable equipment number...
//#define BEEP_WITH_MAGSTRIPE_READER
#ifdef BEEP_WITH_MAGSTRIPE_READER
//These are used for the beeping that the driver user interface performs:
#define PIU_ACK_BEEP(fd) if((fd)>=0){write(fd, "/m:7A\r", 6);}
#define PIU_ERROR_BEEP(fd) if((fd)>=0){write(fd, "/m:5A\r", 6); usleep(500000); write(fd, "/m:5A\r", 6);}
#define PIU_CRITICAL_BEEP(fd) if((fd)>=0){write(fd, "/m:5A\r", 6); usleep(500000); write(fd, "/m:5A\r", 6);write(fd, "/m:5A\r", 6); usleep(500000); write(fd, "/m:5A\r", 6);write(fd, "/m:5A\r", 6); usleep(500000); write(fd, "/m:5A\r", 6);write(fd, "/m:5A\r", 6); usleep(500000); write(fd, "/m:5A\r", 6);write(fd, "/m:5A\r", 6); usleep(500000); write(fd, "/m:5A\r", 6);}
//These are used for the beeping that the driver user interface performs:
#define DIU_BUTTON_BEEP(fd) if((fd)>=0){beep((fd), 440, 25);}
#define DIU_ACK_BEEP(fd) if((fd)>=0){}
#define DIU_ERROR_BEEP(fd) if((fd)>=0){}
#define DIU_CRITICAL_BEEP(fd) if((fd)>=0){}
#else
//These are used for the beeping that the driver user interface performs:
#define DIU_BUTTON_BEEP(fd) if((fd)>=0){beep((fd), 0xA50, 25);}
#define DIU_ACK_BEEP(fd) if((fd)>=0){beep((fd), 0xA50, 75);}
#define DIU_ERROR_BEEP(fd) if((fd)>=0){beep((fd), 0xDC0, 250); beep((fd), 0, 50); beep((fd), 0xDC0, 250);}
#define DIU_CRITICAL_BEEP(fd) if((fd)>=0){beep((fd), 0xDC0, 1000); beep((fd), 0, 50); beep((fd), 0xDC0, 1000);}
#endif
//This is the threshold of time between duplicate driver notifies before which the beep will be supressed
//(so that bulk-accepting 15 interline fares won't result in an enormous string of accept beeps for instance)
#define DUP_USEC_BEEP_THRESHOLD (500000) // 5/10th of a second
//This is the maximum number of times we'll be willing to
//catch a SIGINT, SIGTERM, or IPC message exit request before forcing an exit
#define MAX_POLITE_EXIT_REQUESTS (2)
#define APB_ROW_EXPIRE (30 * 60) //Expire a passback entry in 30 minutes if it is still in the cache
#define APB_DIST_EXPIRE (100.0f) //Expire the whole passback cache if the bus has moved at least APB_DIST_EXPIRE meters since the last accept
#define POLL_TIMEOUT (1000) //How many milliseconds to wait each time through the poll loop of each module
#define DEFAULT_CONNECT_RETRY (60) //How many seconds to wait before attempting to reconnect to a forwarded port
#define DEFAULT_BILL_SYNC_RETRY (1 * 60) //How many seconds before reinitiating data transfer to billing server for any given log entry
#define DEFAULT_PASS_SYNC_RETRY (2 * 60) //How many seconds before re-querying the buspass server for updates
#define AVLS_MOTION_INTERVAL (2 * 60) //How often to send AVLS chirps when in motion (in seconds) (default, see config)
#define AVLS_STILL_INTERVAL (60 * 60) //How often to send AVLS chirps when still (in seconds) (default, see config)
#define HUB_RETRY_TIME (3) //Number of seconds between connection retries if the IPC hub cannot be found.
#define PADDLE_REQ_TIMEOUT (15) //How long to wait for a paddle request to time out.
#define ALPHA_MAX ((unsigned) 255) //Alpha value representing 100% opaque
#define ALPHA_DRK ((unsigned) 192) //Alpha value for dark blendovers
#define ALPHA_LGT ((unsigned) 128) //Alpha value for light blendovers
#define SHADOW_OFFSET_UP (5) //How many pixels to offset the shadow under a unpressed button.
#define SHADOW_OFFSET_DOWN (2) //How many pixels to offset the shadow under a pressed button.
#define TS_CALIB_HOLD_TIME (15) //How long the user has to hold down the touchscreen to initiate a calibration
#define SHELLCALL_VAR_ESC ('~') //What character brackets variable expansion in shellcall actions
//-----------------------------------------------------------------
//------------------------ CONFIGURATION FLAGS
//-----------------------------------------------------------------
//if USE_WATCHDOG_ALARM is defined, the individual modules will
//use a SIGALRM handler as a watchdog timer.
#define USE_WATCHDOG_ALARM
//Define ALLOW_CREDENTIAL_COLLISIONS if you want to allow duplicate credential entries to exist.
//This essentially states that you belive file corruption to be less of a risk than administrator error
//when dealing with the active pass table.
#define ALLOW_CREDENTIAL_COLLISIONS
//Define ALLOW_WILDCARD_MAGSTRIPE_TRACK if you'd like to allow the pass database to contain magstripe credentials
//with a special track number of zero which will match data on ANY track (only after trying each track against a
//track-specific match, to reduce the likelyhood of unintended collisions). See comments in the magstripe lookup
//function smart_find_mag() that lives in passdb/rules.c for a more detailed description.
#define ALLOW_WILDCARD_MAGSTRIPE_TRACK
//Define SCRUB_MAGSTRIPE_TRACK[123] if you want to ignore (not look up and not log)
//the specified tracks if they appear to contain the type of field delimiter specified by the banking
//standards for credit or debit cards. The T[123]_SCRUB_LIST macros contain the list of characters that
//will trigger the system to ignore the data on that track when the corresponding SCRUB_ macro is defined.
#define SCRUB_MAGSTRIPE_TRACK1
#define T1_SCRUB_LIST ("^")
#define SCRUB_MAGSTRIPE_TRACK2
#define T2_SCRUB_LIST ("=")
//In practice, there is little (that I know of) reason to scrub track 3, so we don't waste the CPU cycles.
//#define SCRUB_MAGSTRIPE_TRACK3
//#define T3_SCRUB_LIST ("")
#ifdef USE_WATCHDOG_ALARM
//How many seconds can a module go without running through its main
//loop (and resetting its watchdog) before it kills itself
#define MODULE_WATCHDOG_VALUE (60)
#endif
// Uncomment this definition if you want to directly write to the frame buffer rather than
//having the UI engine batch changes and present them synchronously when present_framebuffer() is called.
// This method saves the RAM taken by a shadow frame buffer at the expense of some perceived display
//flicker as the framebuffer will often contain (and display) partially drawn widgets for a frame while the
//UI engine is busy drawing the rest of them. This method is also slower for read-modify-write type framebuffer
//operations since the framebuffer is marked non-cacheable so that the DMA controller that scans the framebuffer
//will always see changes that occur.
//#define FRAMEBUFFER_NO_SOFTWARE_BACKBUFFER
#ifndef FRAMEBUFFER_NO_SOFTWARE_BACKBUFFER
#define FRAMEBUFFER_SOFTWARE_BACKBUFFER
#endif
//#define USE_REMOTE_UI
#ifdef USE_REMOTE_UI
#define FB_SHADOW_TMP "/tmp/fb_shadow.tmp"
#define FB_SHADOW_FILE "/tmp/fb_shadow"
#endif
// Uncomment this if you want the application to return the video framebuffer's colormap
//to the state it was in then the application launched (If we need to be compatible with other
//3rd party framebuffer applications that expect a standard VGA palette for instance) after it exits.
// Mostly, we are going to run another instance of ourselves, or one of the showmessage programs
//so there is no harm in keeping the palette the way we like it and it prevents flicker and user
//confusion. So, yeah, really, don't uncomment FRAMEBUFFER_RESTORE_PALETTE unless you really mean it.
//#define FRAMEBUFFER_RESTORE_PALETTE
//--------------------------------
// When ZFLUSH_SLOW_BUT_SAFE is set, after retrieving a compressed bulk update
//the flush process goes and calls msync() (or emulates it on jffs2) for each
//individual record, in order. This makes sure that a powerdown mid-write will
//preserve everything that has been extracted up to that time. On the other hand,
//that may not be optimal behavior (if we get half way through a compressed flush,
//and then reboot and have to finish uncompressed, it'll take for ever...)
//
// The alternative is ZFLUSH_ONE_SHOT which applies all of the changes without
//forcing a sync, and then writes the file in one big chunk once its done.
//#define ZFLUSH_SLOW_BUT_SAFE
//By default, if we don't pick the "slow but safe" option, we go for the one shot option because:
// A) The file system journal SHOULD pick up the slack.
// B) The one-shot write provides the filesystem with a good defragment and erase-block coalesce opportunity (for jffs-ish filesystem)
// C) The super-caps should hold the viper up longer than it actually takes to do the file system write except under dire conditions, then see condition A.
#ifndef ZFLUSH_SLOW_BUT_SAFE
#define ZFLUSH_ONE_SHOT
#endif
//Do a little idiot-proofing on this config value since it could result in strange/data-losing behavior
//if both values are defined at once.
#ifdef ZFLUSH_SLOW_BUT_SAFE
#ifdef ZFLUSH_ONE_SHOT
#error "Cannot have both ZFLUSH_ONE_SHOT and ZFLUSH_SLOW_BUT_SAFE defined at once!"
#endif
#endif
//If COMMHUB_O_NONBLOCK is defined, the IPC hub will maintain all of its clients in
//nonblocking mode and cut anybody loose who doesn't respond.
#define COMMHUB_O_NONBLOCK
//If TOUCHSCREEN_QUIET is defined we request the touchscreen not send data between making a UI change and flushing it to
//the display... This can reduce latency on a heavily loaded system at the expense of stability (it becomes easy to miss
//a pen up event). Don't define this unless you really mean it...
//#define TOUCHSCREEN_QUIET
//These constraints are useful because on buses that have extremely funky or barely-sufficent power, they can fill
//their billing logs (and thus the modem pipe, bandwidth limit, and database tables) with rapid-fire updates on how
//crappy their input power is. I have seen busses that complain about this for hours on end, so this limits the damage
//done by those buses until somebody can go fix their wiring...
//how many DIU error messages to accept before rate-limiting
#define DIU_ERROR_BURST_LIMIT (5)
//number of seconds before allowing another DIU error message to be logged
//after exhausting the number allotted by DIU_ERROR_BURST_LIMIT
#define DIU_ERROR_RATE_LIMIT (120)
//----------------------------------------------------------------
//------------------------ PATH NAMES OF SPECIAL FILES AND DEVICES
//----------------------------------------------------------------
//IPC hub related stuff
#define COMMHUB_ADDRESS "/tmp/commhub"
//Configuration File Paths
#ifdef TARGET_DEVEL_DESKTOP
#define CONFIG_FILE_PATH "./"
#else
#define CONFIG_FILE_PATH "/mnt/data2/config/"
#endif
//Database File Paths
#ifdef TARGET_DEVEL_DESKTOP
#define DATABASE_FILE_PATH "./"
#else
#define DATABASE_FILE_PATH "/mnt/data2/database/"
#endif
//Executable File Paths
#ifdef TARGET_DEVEL_DESKTOP
#define EXECUTABLE_FILE_PATH "./"
#else
#define EXECUTABLE_FILE_PATH "/mnt/data2/bin/"
#endif
//Local database files
#define BILLING_FILE (DATABASE_FILE_PATH "billing.mem")
#define PASSES_FILE (DATABASE_FILE_PATH "passes.mem")
//Local configuration files
#define DRIVER_MENU_FILE (CONFIG_FILE_PATH "menu.xml")
#define DRIVERS_FILE (CONFIG_FILE_PATH "drivers.txt")
#define SCHEME_INIT_FILE (CONFIG_FILE_PATH "init.scm")
#define RULES_FILE (CONFIG_FILE_PATH "rules.scm")
#define EQUIPNUM_FILE (CONFIG_FILE_PATH "equipnum.txt")
#define EQUIPNUM_TEMPFILE (CONFIG_FILE_PATH "equipnum.tmp")
#define RFID_PATTERN_FILE (CONFIG_FILE_PATH "rfid_patterns.txt")
#define TOUCHSCREEN_CALIB_FILE (CONFIG_FILE_PATH "touchscreen_calib.txt")
#define AVLS_CONFIG_FILE (CONFIG_FILE_PATH "avls_freq.txt")
#define SERVER_LIST_FILE (CONFIG_FILE_PATH "server/server_list")
#define SERVER_DESC_FILE (CONFIG_FILE_PATH "server/server_desc")
//Network status notification files
#define TUNNEL_DROPFILE "/tmp/tunnel-is-up"
#define GPRS_DROPFILE "/tmp/network-is-up"
//Serial port mapping
#ifdef TARGET_DEVEL_DESKTOP
//TARGET_DEVEL_DESKTOP is an x86 Linux box w/ a multiport serial board
//#define CONSOLE_PORT "/dev/tty81a"
//#define DRIVER_UI_PORT "/dev/tty81b"
//#define PASSENGER_UI_PORT "/dev/tty81c"
//#define MODEM_PORT "/dev/tty81d"
#define CONSOLE_PORT "/dev/ttyCONSOLE"
//#define DRIVER_UI_PORT "/dev/ttyDIU"
#define DRIVER_UI_PORT "/tmp/ttyDIU"
#define PASSENGER_UI_PORT "/dev/ttyPIU"
#define MODEM_PORT "/dev/ttyGPRS"
#else
//The real target is an ARM Linux box with real serial ports at the expected locations
#define CONSOLE_PORT "/dev/ttyS0"
#define DRIVER_UI_PORT "/dev/ttyS1"
#define PASSENGER_UI_PORT "/dev/ttyS2"
#define MODEM_PORT "/dev/ttyS3"
#endif
//Network protocol ports
#define PASS_SERVER_IP "127.0.0.1"
#define PASS_SERVER_PORT (7277)
#define BILL_SERVER_IP "127.0.0.1"
#define BILL_SERVER_PORT (2455)
#define AVLS_SERVER_IP "127.0.0.1"
#define AVLS_SERVER_PORT (2857)
#define HELLO_SERVER_IP "127.0.0.1"
#define HELLO_SERVER_PORT (3556)
//Framebuffer location:
#define CONFIG_FRAMEBUFFER_PATH "/dev/fb0"
//----------------------------------------------------------------
//------------------------ DATA SIZE CONFIGURATION VALUES
//----------------------------------------------------------------
// This is the size of the buffer used to read lines from sockets and serial ports.
//reads longer than this will either be truncated, or trigger an exit-with-error
//Any sadistic bastard who writes config file lines longer than 1KB (that would be
//half a screen-full to the character on a standard 80x25 text screen!) deserves some
//rude truncation.
#define LINE_BUFFER_SIZE (1024)
//This is the hardware page size for the mmap()'d data files:
#define MEMORY_PAGE_SIZE (4096)
//This is the maximum size of a command line that can be assembled by the driver UI menu system using the action.
#define SHELLCALL_BUFFER_SIZE (2048)
//This defines the expected size of the pass database and its RAM based index tables:
//#define NUM_STORED_PASSES (131072) //A nice round number that multiplies by sizeof(rider_record) to a page boundary
//#define STORED_PASS_HASH (131101) //A prime number larger than NUM_STORED_PASSES
#define NUM_STORED_PASSES (262144) //A nice round number that multiplies by sizeof(rider_record) to a page boundary
#define STORED_PASS_HASH (262147) //A prime number larger than NUM_STORED_PASSES
//#define NUM_STORED_PASSES (1048576) //A nice round number that multiplies by sizeof(rider_record) to a page boundary
//#define STORED_PASS_HASH (1048583) //A prime number larger than NUM_STORED_PASSES
//This defines the expected size of the billing cache:
#define NUM_BILLING_ENTRIES (2048) //A nice round number that multiplies by sizeof(billing_record)
//to be an integer number of MMU pages (for the benefit of efficient and
//transaction safe msync() calls.
// Thresholds for high-water-mark warnings on the billing log. These cause the system to warn the driver
//when there are fewer than X free entries in the billing log file. A prolonged time without connectiviry to
//the billing log server where rows can be offloaded from the local cache to the main database is usually the
//underlying cause of this condition. The goal here is to issue frequent and annoying warnings to the driver
//when the situation has gotten dangeriously bad such that they will call dispatch and the bus will be serviced.
//
#define BILLING_HIGH_THRESHOLD (NUM_BILLING_ENTRIES / 2) //Warn the driver at the half-way mark
#define BILLING_CRITICAL_THRESHOLD (NUM_BILLING_ENTRIES / 4) //at 3/4 full, start really bitching about it
#define BILLING_HIGH_FREQUENCY (60 * 15) //Warn every fifteen minutes after the half-way mark
#define BILLING_CRITICAL_FREQUENCY (60 * 5) //Warn every 5 minutes at the 3/4 mark
#define REJECT_DIAG_DEBUG_THRESHOLD (BILLING_HIGH_THRESHOLD) //Reject diagnostic debug messages when log space is more than half full
#define REJECT_DIAG_WARN_THRESHOLD (BILLING_CRITICAL_THRESHOLD) //Reject diagnostic warning messages when log space is more than 3/4 full
#define REJECT_DIAG_ERROR_THRESHOLD (BILLING_CRITICAL_THRESHOLD) //Reject diagnostic critical messages when log space is more than 3/4 full
//This defines the size of the anti-passback-cache
#define APB_CACHE_SIZE (128)
//This defines the maximum number of stops in a paddle
#define MAX_PADDLE_SIZE (1024)
// This constant defines how deep down the rabbit hole of nested XML tags we will allow our parser to traverse when reading
//a menu.xml file defining the behavior of the driver facing user interface. This is NOT how deep the user-facing menu tree
//can become. That is not clearly defined yet, and since it may not be predictable until after the XML tree is parsed, it
//very well may need to be a runtime value that is dynamically allocated after the UI engine analizes the contents of the XML
//tree. Alternately, if memory is not too tight, a double-the-reasonable-max type engineering tolerance estimate could produce
//a statically allocated menu execution tree and thus reduce memory fragmentation and heap thrash.
#define MENU_STACK_DEPTH (32)
// This is the size of the buffer used to load the menu.xml file. It doesn't have to fit the whole file,
//it just determines how many times we have to go back to the "disk" to fetch and parse the whole file.
//4K seems like a reasonable block size.
#define XML_CHUNK_SIZE (4096)
// This is the maximum length of actuall DIU display messages
#define DIU_MESSAGE_CHARS (80)
// This is how many lines to maintain
#define DIU_MESSAGE_LINES (25)
// This is the number of Raw->site:id mapping schemes supported for RFID decoding
#define NUM_RFID_PATTERNS (64)
//----------------------------------------------------------------
//------------------------ SYSTEM SUPERVISOR CONFIGURATION VALUES
//----------------------------------------------------------------
//The superviser checks for this module to be alive and preferentially
//routes error messages there if it is present and alive, otherwise
//they get routed to syslog.
#define SUPERVISOR_SPECIAL_BILLDB "billdb"
//The maximum number of modules that may be monitored by the supervisor
#define SUPERVISOR_MAX_MODULES (32)
// If a spawned process lasts less than SUPERVISOR_RESPAWN_DELAY_THRESHOLD
//seconds, we want to delay SUPERVISOR_RESPAWN_RATE_LIMIT seconds to avoid driving
//load too high by thrashing a process that is doomed to fail.
#define SUPERVISOR_RESPAWN_DELAY_THRESHOLD (15)
#define SUPERVISOR_RESPAWN_RATE_LIMIT (30)
// The supervisor process will refrain from spawning ANYTHING within
//SUPERVISOR_GLOBAL_SPAWN_RATE_LIMIT seconds of the last spawn to prevent
//thrashing the system and driving load too high by trying to start everything
//all at once.
#define SUPERVISOR_GLOBAL_SPAWN_RATE_LIMIT (1)
// These are some useful general math widgets so we don't keep repeating
//ourselves, and if we (god forbid) need to adjust the number of microseconds in
//a second due to the evil decree of some mad scientist...
#define SEC_TO_USEC(x) ((x) * 1000000)
#define USEC_TO_SEC(x) ((x) / 1000000)
// The supervisor process will sent a message to MAILBOX_PING every
//SUPERVISOR_PING_INTERVAL microseconds. If any module fails to respond
//by SUPERVISOR_PING_WARN_TIME microseconds a warning message will be generated
//and if a module failes to respond within SUPERVISOR_PING_TERM_TIME the process
//will be issued a SIGTERM, and if it again fails to respond within
//SUPERVISOR_PING_KILL_TIME it will be issued a SIGKILL. If a PONG comes in
//at any point, further abuse of the child module will stop.
#define SUPERVISOR_PING_INTERVAL SEC_TO_USEC(30)
#define SUPERVISOR_PING_WARN_TIME SEC_TO_USEC(60)
#define SUPERVISOR_PING_TERM_TIME SEC_TO_USEC(120)
#define SUPERVISOR_PING_KILL_TIME SEC_TO_USEC(180)
//How often to check system health parameters
#define SUPERVISOR_SYSTEM_STAT_INTERVAL (60)
#ifdef TARGET_DEVEL_DESKTOP
#define SUPERVISOR_WARN_LOW_MEM (4096) //Warn if free memory goes below this threshold
#define SUPERVISOR_WARN_LOAD_AVG (2.0f) //Warn if our 5 minute load average goes above this threshold
#define SUPERVISOR_WARN_NUM_PROC (256) //Warn if there are more than this many processes
#else
#define SUPERVISOR_WARN_LOW_MEM (4096) //Warn if free memory goes below this threshold
#define SUPERVISOR_WARN_LOAD_AVG (2.0f) //Warn if our 5 minute load average goes above this threshold
#define SUPERVISOR_WARN_NUM_PROC (100) //Warn if there are more than this many processes
#endif
//Which types of log entries should be sent to the server via the billing log?
//#define SUPERVISOR_LOG_DEBUG_TO_BILLDB
#define SUPERVISOR_LOG_WARNING_TO_BILLDB
#define SUPERVISOR_LOG_ERROR_TO_BILLDB
#endif