aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
AgeCommit message (Collapse)AuthorFiles
2020-02-28Implement here-document syntax in configuration file.Sergey Poznyakoff1
Here-document is supported for ip-list and trusted-ip statements. * doc/ping903.conf.5: Document the here-document syntax. * NEWS: Likewise. * examples/inspect: Mention that the created output is a valid configuration file. * src/config.c: Support for here-document. * src/defs.h: Mark printf-like functions as such. * src/ping903.h (CF_HEREDOC_OPCODE): New data type. (cf_callback_arg): Add heredoc member. (STMT_T_HEREDOC): New statement type. * src/remoteip.c (cf_trusted_ip_heredoc): New function. * src/ping903.c: Fix format strings and unused variables. * src/ping903q.c: Likewise. * src/pinger.c: Likewise.
2020-02-27Implement basic authSergey Poznyakoff1
* Makefile.am (SUBDIRS): Add lib * configure.ac: Build lib/Makefile * lib/Makefile.am: New file. * lib/apr.c: New file. * lib/basicauth.c: New file. * lib/basicauth.h: New file. * lib/md5.c: New file. * lib/md5.h: New file. * lib/sha1.c: New file. * lib/sha1.h: New file. * src/Makefile.am: Add lib to the include path * src/config.c: New statement "auth". * src/ping903.c: Implement basic auth. * src/ping903.h (cf_auth): New proto.
2020-02-26Configure httpd backlogSergey Poznyakoff1
* src/config.c: New statement "http-backlog-size" * src/ping903.c (ping903): Pass "http-backlog-size" to the httpd initialization routine. * src/ping903.h (httpd_backlog_size): New extern.
2020-02-24New API for adding/replacing multiple IP addresses.Sergey Poznyakoff1
* src/config.c: Update. * src/main.c (main): Call pinger_setup. * src/pinger.c: Major rewrite. * src/ping903.c: Major rewrite. Implement POST /config/ip-list. * src/ping903.h (pinger_setup) (pinger_host_add,pinger_host_delete_by_name) (pinger_host_add_name,pinger_hostlist_set): New protos. (hostping_add,hostping_delete_by_name) (hostping_add_name): Remove.
2020-02-23Save local additions in a local ip list file. Read it at startup.Sergey Poznyakoff1
* src/config.c (file_read_ip_list): New function. * src/defs.h (LOCAL_IP_LIST_FILE): New definition. * src/ping903.h (file_read_ip_list): New proto. * src/pinger.c (conf_hostping_count) (hostping_updated): New static variables. (hostping_add,hostping_delete): Raise the hostping_updated flag. (p903_init): Read in the local ip-list file, if it exists. Clear hostping_updated. (p903_scheduler): Save changes to the local ip-list file, if hostping_updated is set.
2020-02-23New API for adding and removing IP addresses on the fly.Sergey Poznyakoff1
* src/config.c (cf_ip_list): Support both parse and serialize calls. * src/ping903.c (/config/ip-list): New endpoint. PUT to add a host or IP to the ip-list, DELETE to remove existing one. * src/ping903.h (hostping_add_name) (hostping_add_name,get_all_hosts): New protos. * src/pinger.c: Protect each iteration over hostping list by a rwlock object. (hostping_delete,get_all_hosts) (hostping_delete_by_name) (hostping_add_name): New functions.
2020-02-22Reorganize host array and functionsSergey Poznyakoff1
2020-02-22Protect each hostaddr with a mutexSergey Poznyakoff1
2020-02-12Separate ping-interval and probe-intervalSergey Poznyakoff1
* configure.ac: Use AM_PROG_AR * src/config.c: rename "interval" to "ping-interval". New statement: "probe-interval". (readconfig): Signal error if ping_count probes don't fit into probe_interval. * src/ping903.conf: Update. * src/ping903.h (host_stat): Rename "tv" to "start_tv". New member: "stop_tv". * src/pinger.c (probe_interval): New global. (sendq_enqueue_unlocked): Remove. (sendq_enqueue): Set xmit_tv to the time when this host should be probed again. (sendq_dequeue): Sleep until the right ping time. (p903_sender): Don't lock sendq_mutex. This is done by sendq_dequeue. (host_stat): Save start_tv and stop_tv. (get_host_stat): Format stop-timestamp and recv-timestamp. * src/main.c: Use sysexits. * src/ping903q.c (print_host_status): Use stop-timestamp and recv-timestamp to calculate duration.
2020-02-12Implement simple query utilitySergey Poznyakoff1
* configure.ac: Test for ranlib * src/.gitignore: Update. * src/ping903q.c: New file. * src/Makefile.am: Build ping903q * src/defs.h: New file. * src/mem.h: New file. * src/json.h (json_2nrealloc): New proto. * src/config.c: New statement: "access-log-verbose" Change error codes to positive values. * src/main.c: Use DEFAULT_CONFIG_FILE instead of hardcoding the file name. * src/ping903.c: Log json object only if access-log-verbose has been requested. * src/ping903.conf: Document access-log-verbose * src/ping903.h (HOSTADDR): Rename tv to xmit_tv. New member: start_tv. * src/pinger.c: Keep the time when first packet has been sent in the start_tv member.
2020-02-11Improve logging and configuration.Sergey Poznyakoff1
2020-02-11Initial commitSergey Poznyakoff1

Return to:

Send suggestions and report system problems to the System administrator.